<div dir="ltr">On a related note Will<div><br></div><div>I have a plugin that I want to run for every output annotation line. It basicaly adds the genotype fields form the VCF into as extra fields ... </div><div>It works fine for the large majority of cases but in some, the $vf->{base_variation_feature_overlap}->{base_variation_feature}->{_line} seems to be undefined (I've highlighted the line in question with commments)<br>

</div><div><br></div><div>since I require this line to extract the fields I am interested in, can you tell me what I might be doing wrong.</div>
<div><br></div><div>Here is the code of the plugin:</div><div><br></div><div><br></div><div>###########################################</div><div><div>=head1 LICENSE</div><div><br></div><div>    Selected_VCF_fields_output</div>


<div>    Copyright (C) 2013  Duarte Molha</div><div><br></div><div>    This program is free software: you can redistribute it and/or modify</div><div>    it under the terms of the GNU General Public License as published by</div>


<div>    the Free Software Foundation, either version 3 of the License, or</div><div>    (at your option) any later version.</div><div><br></div><div>    This program is distributed in the hope that it will be useful,</div>


<div>    but WITHOUT ANY WARRANTY; without even the implied warranty of</div><div>    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</div><div>    GNU General Public License for more details.</div><div><br>


</div><div>    You should have received a copy of the GNU General Public License</div><div>    along with this program.  If not, see <<a href="http://www.gnu.org/licenses/" target="_blank">http://www.gnu.org/licenses/</a>>.</div>

<div>
<br></div><div>=head1 CONTACT</div><div><br></div><div> Questions may also be sent to <<a href="mailto:duartemolha@gmail.com" target="_blank">duartemolha@gmail.com</a>>.</div><div><br></div><div>=cut</div><div><br>

</div><div>=head1 NAME</div>
<div><br></div><div>Selected_VCF_fields_output</div><div><br></div><div>=head1 SYNOPSIS</div><div><br></div><div>    mv Selected_VCF_fields_output.pm ~/.vep/Plugins</div><div>    perl <a href="http://variant_effect_predictor.pl" target="_blank">variant_effect_predictor.pl</a> -i variations.vcf --plugin Selected_VCF_fields_output</div>


<div> </div><div> </div><div>=head1 DESCRIPTION</div><div><br></div><div> This plugin retrieves the quality score fields and the genotype fields from the input VFC and outputs them in the output tab delimited annotation file</div>


<div><br></div><div>=cut</div><div><br></div><div>package Selected_VCF_fields_output;</div><div><br></div><div>use base qw(Bio::EnsEMBL::Variation::Utils::BaseVepPlugin);</div><div><br></div><div>use strict;</div><div>use warnings;</div>


<div><br></div><div>sub version {</div><div>    return '71';</div><div>}</div><div><br></div><div>sub new {</div><div>    my $class = shift;</div><div>    my $self = $class->SUPER::new(@_);</div><div>    return $self;</div>


<div>}</div><div><br></div><div><br></div><div>sub get_header_info {</div><div>    return {</div><div><span style="white-space:pre-wrap">         </span>"quality_score" => "Quality score from VCF input Field",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_AD" <span style="white-space:pre-wrap">                       </span>=> "Allelic depths for the ref and alt alleles in the order listed",</div><div><span style="white-space:pre-wrap">                </span>"GT_PARAMS_DP" <span style="white-space:pre-wrap">                       </span>=> "Read Depth (only filtered reads used for calling)",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_GQ" <span style="white-space:pre-wrap">                       </span>=> "Genotype Quality",</div><div><span style="white-space:pre-wrap">              </span>"GT_PARAMS_GT" <span style="white-space:pre-wrap">                       </span>=> "Genotype",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_PL" <span style="white-space:pre-wrap">                       </span>=> "Normalized, Phred-scaled likelihoods for AA,AB,BB genotypes where A=ref and B=alt; not applicable if site is not biallelic",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_SDP"<span style="white-space:pre-wrap">                       </span>=> "Raw Read Depth as reported by SAMtools",</div><div><span style="white-space:pre-wrap">                </span>"GT_PARAMS_RD"<span style="white-space:pre-wrap">                        </span>=> "Depth of reference-supporting bases (reads1)",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_FREQ"<span style="white-space:pre-wrap">              </span>=> "Variant allele frequency",</div><div><span style="white-space:pre-wrap">              </span>"GT_PARAMS_PVAL"<span style="white-space:pre-wrap">              </span>=> "P-value from Fisher's Exact Test",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_RBQ"<span style="white-space:pre-wrap">                       </span>=> "Average quality of reference-supporting bases (qual1)",</div><div><span style="white-space:pre-wrap">         </span>"GT_PARAMS_ABQ"<span style="white-space:pre-wrap">                       </span>=> "Average quality of variant-supporting bases (qual2)",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_RDF"<span style="white-space:pre-wrap">                       </span>=> "Depth of reference-supporting bases on forward strand (reads1plus)",</div><div>
<span style="white-space:pre-wrap">             </span>"GT_PARAMS_RDR"<span style="white-space:pre-wrap">                       </span>=> "Depth of reference-supporting bases on reverse strand (reads1minus)",</div><div><span style="white-space:pre-wrap">           </span>"GT_PARAMS_ADF"<span style="white-space:pre-wrap">                       </span>=> "Depth of variant-supporting bases on forward strand (reads2plus)",</div>


<div><span style="white-space:pre-wrap">          </span>"GT_PARAMS_ADR"<span style="white-space:pre-wrap">                       </span>=> "Depth of variant-supporting bases on reverse strand (reads2minus)",</div><div>
    };</div><div>}</div><div><br></div><div>sub feature_types {</div><div>    return ['Feature', 'Intergenic'];</div><div>}</div><div><br></div><div><br></div><div>sub run {</div><div>    my $self = shift;</div>


<div>    my $vf = shift;</div><div>    my $line_hash = shift;</div><div>    </div><div>    my $config = $self->{config};</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if(defined($config->{individual}) && $config->{format} eq 'vcf') {</div>


<div><span style="white-space:pre-wrap">          </span>my $ind_cols = $config->{ind_cols};</div><div>                ############################################################################################################################</div>


<div><span style="white-space:pre-wrap">          </span>my $line = $vf->{base_variation_feature_overlap}->{base_variation_feature}->{_line};                        <b> # in this line sometimes the {_line} field is undef. Why???</b></div>


<div><div>                ############################################################################################################################</div></div><div><span style="white-space:pre-wrap">                </span>my $individual = $vf->{base_variation_feature_overlap}->{base_variation_feature}->{individual};<br>


</div><div><span style="white-space:pre-wrap">              </span>my @split_line = split /[\s\t]+/, $line;</div><div><span style="white-space:pre-wrap">         </span>my @gt_format  = split /:/, $split_line[8];</div><div><span style="white-space:pre-wrap">              </span>foreach my $p (@gt_format){</div>


<div><span style="white-space:pre-wrap">                  </span>$p = "GT_PARAMS_".$p ;</div><div><span style="white-space:pre-wrap">         </span>}</div><div><span style="white-space:pre-wrap">                </span>my @gt_data    = split /:/, $split_line[$ind_cols->{$individual}];</div>


<div><span style="white-space:pre-wrap">          </span>my $results = {map { shift @gt_format => $_ } @gt_data};</div><div><span style="white-space:pre-wrap">              </span>$results->{"quality_score"} = $split_line[5];</div>


<div><span style="white-space:pre-wrap">          </span>return $results;</div><div><span style="white-space:pre-wrap"> </span>}else{</div><div><span style="white-space:pre-wrap">           </span>return {};</div><div><span style="white-space:pre-wrap">       </span>}</div>


<div><br></div><div>}</div><div><br></div><div>1;</div></div><div>###########################################################</div><div><br></div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><font style="background-color:rgb(255,255,255)" color="#999999">=========================<br>

     Duarte Miguel Paulo Molha      <br></font><div><font style="background-color:rgb(255,255,255)" color="#999999">         <a href="http://about.me/duarte" target="_blank">http://about.me/duarte</a>         <br>=========================</font></div>

</div>
<br><br><div class="gmail_quote">On Thu, Aug 1, 2013 at 9:49 AM, Duarte Molha <span dir="ltr"><<a href="mailto:duartemolha@gmail.com" target="_blank">duartemolha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">Thanks Will<div><br></div><div>I should have checked that before asking :S</div><div><br></div><div>I'll redownload and check if the error is gone ... thanks</div><span class="HOEnZb"><font color="#888888"><div>

<br></div><div>Duarte</div><div><br>
</div></font></span></div><div class="gmail_extra"><div class="im"><br clear="all"><div><font style color="#999999">=========================<br>     Duarte Miguel Paulo Molha      <br></font><div><font style color="#999999">         <a href="http://about.me/duarte" target="_blank">http://about.me/duarte</a>         <br>


=========================</font></div></div>
<br><br></div><div><div class="h5"><div class="gmail_quote">On Thu, Aug 1, 2013 at 9:46 AM, Will McLaren <span dir="ltr"><<a href="mailto:wm2@ebi.ac.uk" target="_blank">wm2@ebi.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div dir="ltr">Hi Duarte,<div><br></div><div>I think this is a bug I've already found and fixed - can you update your ensembl-variation API and try again?</div><div><br></div><div>Here's the fix for reference:</div>



<div><br></div><div><a href="http://cvs.sanger.ac.uk/cgi-bin/viewvc.cgi/ensembl-variation/modules/Bio/EnsEMBL/Variation/Utils/VEP.pm?root=ensembl&r1=1.101.2.4&r2=1.101.2.5" target="_blank">http://cvs.sanger.ac.uk/cgi-bin/viewvc.cgi/ensembl-variation/modules/Bio/EnsEMBL/Variation/Utils/VEP.pm?root=ensembl&r1=1.101.2.4&r2=1.101.2.5</a><br>



</div><div><br></div><div>Will</div></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On 1 August 2013 09:33, Duarte Molha <span dir="ltr"><<a href="mailto:duartemolha@gmail.com" target="_blank">duartemolha@gmail.com</a>></span> wrote:<br>



</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">I believe the main problem is that this Variation feature, for some reason does not have a splice attached to it<font color="#000000" face="Courier New, Courier, monospace"><span style="font-size:12.222222328186035px;line-height:15.989583969116211px"> : </span></font><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">'slice' => undef</span><div>





<span style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px">so the method to extract the slice and expand </span></div>





<div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></span></div><div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">471:                my $slice = $self->feature_Slice->expand(</font></div>





<div><font face="arial, sans-serif">472:                    MAX_DISTANCE_FROM_TRANSCRIPT,</font></div><div><font face="arial, sans-serif">473:                    MAX_DISTANCE_FROM_TRANSCRIPT</font></div><div><font face="arial, sans-serif">474:                );</font></div>





<div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">Fails.</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">





<br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">Anyone knows what might be causing this?</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br></div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">





Best regards</div><span><font color="#888888"><div style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br>Duarte</div><div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
<br></div><div><span style="font-family:arial,sans-serif;font-size:13.333333969116211px"><br>

</span></div></font></span></div><div class="gmail_extra"><div><br clear="all"><div><font color="#999999">=========================<br>     Duarte Miguel Paulo Molha      <br></font><div><font color="#999999">         <a href="http://about.me/duarte" target="_blank">http://about.me/duarte</a>         <br>





=========================</font></div></div>
<br><br></div><div><div><div class="gmail_quote">On Wed, Jul 31, 2013 at 5:05 PM, Duarte Molha <span dir="ltr"><<a href="mailto:duartemolha@gmail.com" target="_blank">duartemolha@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">In an effort to understand better what might be causing this ... here is a dumb of one such object causing the error message:<div><br></div><div>the VCF line:</div><div>#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT  sample-01  sample-02  sample-03 sample-04 sample-05 sample-06<br>






</div><div>1<span style="white-space:pre-wrap">     </span>I777437<span style="white-space:pre-wrap"> </span>I.<span style="white-space:pre-wrap">      </span>IA<span style="white-space:pre-wrap">      </span>IC<span style="white-space:pre-wrap">      </span>I667.93<span style="white-space:pre-wrap"> </span>IPASS<span style="white-space:pre-wrap">   </span>IAC=1;AF=0.083;AN=12;BaseQRankSum=6.089;DP=487;Dels=0.00;FS=1.662;HRun=0;HaplotypeScore=0.9613;MQ=44.32;MQ0=49;MQRankSum=-1.435;QD=8.35;ReadPosRankSum=-1.520;SB=-247.14;set=variant2<span style="white-space:pre-wrap">   </span>IGT:AD:DP:GQ:PL<span style="white-space:pre-wrap"> </span>I0/0:60,0:60:99:0,138,1819<span style="white-space:pre-wrap">      </span>I0/0:82,0:82:99:0,205,2614<span style="white-space:pre-wrap">      </span>I0/1:52,28:80:99:706,0,1290<span style="white-space:pre-wrap">     </span>I0/0:100,0:100:99:0,253,3074<span style="white-space:pre-wrap">    </span>I0/0:83,0:83:99:0,178,2360<span style="white-space:pre-wrap">      </span>I0/0:82,0:82:99:0,166,2135<br>






</div><div><br></div><div>at line 471 of /Bio/EnsEMBL/Variation/VariationFeature.pm</div><div><br></div><div>my object $self contains:</div><div><br><div><div>0  Bio::EnsEMBL::Variation::VariationFeature=HASH(0x57802b0)</div>






<div>   '_line' => "1\cI777437\cI.\cIA\cIC\cI667.93\cIPASS\cIAC=1;AF=0.083;AN=12;BaseQRankSum=6.089;DP=487;Dels=0.00;FS=1.662;HRun=0;HaplotypeScore=0.9613;MQ=44.32;MQ0=49;MQRankSum=-1.435;QD=8.35;ReadPosRankSum=-1.520;SB=-247.14;set=variant2\cIGT:AD:DP:GQ:PL\cI0/0:60,0:60:99:0,138,1819\cI0/0:82,0:82:99:0,205,2614\cI0/1:52,28:80:99:706,0,1290\cI0/0:100,0:100:99:0,253,3074\cI0/0:83,0:83:99:0,178,2360\cI0/0:82,0:82:99:0,166,2135"</div>






<div>   'adaptor' => Bio::EnsEMBL::Variation::DBSQL::VariationFeatureAdaptor=HASH(0x4b06030)</div><div>      '_is_multispecies' => ''</div><div>      'db' => Bio::EnsEMBL::Variation::DBSQL::DBAdaptor=HASH(0x52b4f08)</div>






<div>         '_dbc' => Bio::EnsEMBL::DBSQL::DBConnection=HASH(0x52b50d0)</div><div>            '_dbname' => 'homo_sapiens_variation_72_37'</div><div>            '_driver' => 'mysql'</div>






<div>            '_host' => '<a href="http://ensembldb.ensembl.org" target="_blank">ensembldb.ensembl.org</a>'</div><div>            '_port' => 5306</div><div>            '_query_count' => 4</div>






<div>            '_timeout' => 0</div><div>            '_username' => 'anonymous'</div><div>            'connected32406' => 1</div><div>            'db_handle32406' => DBI::db=HASH(0x51e5ee8)</div>






<div>                 empty hash</div><div>            'reconnect_when_lost' => 1</div><div>         '_group' => 'variation'</div><div>         '_is_multispecies' => ''</div>






<div>         '_no_cache' => 1</div><div>         '_species' => 'homo_sapiens'</div><div>         '_species_id' => 1</div><div>      'dbc' => Bio::EnsEMBL::DBSQL::DBConnection=HASH(0x52b50d0)</div>






<div>         -> REUSED_ADDRESS</div><div>      'species_id' => 1</div><div>   'allele_string' => 'A'</div><div>   'chr' => 1</div><div>   'end' => 777437</div><div>





   'existing' => ARRAY(0x10861900)</div>
<div>        empty array</div><div>   'genotype' => ARRAY(0x577ff80)</div><div>      0  'A'</div><div>      1  'A'</div><div>   'individual' => 'sample-01'</div><div>   'map_weight' => 1</div>






<div>   'non_variant' => 1</div><div>   'phased' => 1</div><div>   'slice' => undef</div><div>   'start' => 777437</div><div>   'strand' => 1</div><div>   'variation_name' => '1_777437_A'</div>






</div><div><br></div><div><br></div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div><font color="#999999">=========================<br>     Duarte Miguel Paulo Molha      <br>
</font><div><font color="#999999">         <a href="http://about.me/duarte" target="_blank">http://about.me/duarte</a>         <br>=========================</font></div></div><div><div>
<br><br><div class="gmail_quote">On 31 July 2013 13:52, Duarte Molha <span dir="ltr"><<a href="mailto:duartemolha@gmail.com" target="_blank">duartemolha@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">






<div dir="ltr"><p>Hi Devs</p>

<p> I have been trying to run a VCF file by the variant
annotation script and I've been getting a warning message that I have never
before encountered..</p><p></p>

<p> I was wondering if someone could let me know if it is
something I am doing wrong…</p><p></p>

<p> The message is :</p><p></p>

<p> <b>Can't call method "expand" on an undefined value
at <sic>/Bio/EnsEMBL/Variation/VariationFeature.pm line 471</b></p><p><b></b></p>

<p><b> </b></p>

<p>Here are the configuration options I am using:</p>

<p> </p>

<p>Configuration options:</p>

<p> ###</p><p></p>

<p>allow_non_variant    1</p>

<p>cache                1</p>

<p>canonical            1</p>

<p>ccds                 1</p>

<p>check_alleles        1</p>

<p>check_existing       1</p>

<p>config              
vep_human.ini</p>

<p>core_type           
core</p>

<p>custom              
./vep_additional_annotations/Somatic_variation_phenotypes.bed.gz,Somatic,bed,exact
./vep_additional_annotations/dbsnp135_ensembl_variation_phenotype.bed.gz,dbsnp135,bed,exact</p>

<p>db_version          
72</p>

<p>dir                 
/ReferenceData/vep_cache</p>

<p>dir_cache           
/ReferenceData/vep_cache</p>

<p>dir_plugins         
./Plugins</p>

<p>domains              1</p>

<p>force_overwrite      1</p>

<p>fork                 5</p>

<p>gmaf                 1</p>

<p>hgnc                 1</p>

<p>host                
<a href="http://ensembldb.ensembl.org" target="_blank">ensembldb.ensembl.org</a></p>

<p>individual           all</p>

<p>input_file           All_BOTH_SNPINDELfilter_PASSED.vcf</p>

<p>maf_1kg              1</p>

<p>numbers              1</p>

<p>output_file          All_BOTH_SNPINDELfilter_PASSED.ann</p>

<p>plugin              
OGT_NHBLI_MAF,/ReferenceData/NHLBI_EVS/NHLBI_OGT.gz        OGT_selected_VCF_fields_output  Blosum62        Carol  
OGT_Condel,b    OGT_Grantham    TSSDistance     Downstream</p>

<p>polyphen             b</p>

<p>port                
5306</p>

<p>protein              1</p>

<p>regulatory           1</p>

<p>sift                 b</p>

<p>species             
homo_sapiens</p>

<p>stats               
HASH(0x4370ad8)</p>

<p>terms               
SO</p>

<p>verbose              1</p>

<p> </p>

<p>I would be very grateful for your help.</p><span><font color="#888888">

<p> Duarte Molha</p>
</font></span></div>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div></div></div>
<br></div></div>_______________________________________________<br>
Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div>