<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello Nathalie,<div><br><div><div>If you iterate over a list of VariationFeatures for a given Slice you can get Gene information using</div><div>the get_nearest_Gene or get_overlapping_Genes methods on a VariationFeature. Please note that both methods return listrefs of Gene objects.</div><div>We need to update the documentation for get_nearest_Gene.</div><div><br></div><div>my @genes = @{$vfh->get_nearest_Gene()};</div><div>foreach my $gene (@genes) {</div><div>    print 'Nearest gene: ', $gene->external_name, "\t", $gene->stable_id, "\n";</div><div>}</div><div><br></div><div>my @overlapping_genes = @{$vfh->get_overlapping_Genes()};</div><div>foreach my $gene (@overlapping_genes) {</div><div>    print 'Overlapping gene: ', $gene->external_name, "\t", $gene->stable_id, "\n";</div><div>}</div><div><br></div><div>If you made a decision on which Gene you choose you can get all Transcripts for that gene by using</div><div>the method get_all_Transcripts() on a Gene object. You should be aware that a Gene can have more than</div><div>one transcript.</div><div><br></div><div>my $transcripts = $gene->get_all_Transcripts();</div><div>foreach my $transcript (@{$transcripts}) {</div><div>    print $transcript->stable_id, "\n";</div><div>}</div><div><br></div><div>The method get_all_TranscriptVariations on a VariationFeature object returns TranscriptVariation objects.</div><div>A TranscriptVariation relates a VariationFeature and a Transcript which either overlaps the VariationFeature</div><div>or is in close proximity to a VariationFeature. You can retrieve the transcript stable id from a TranscriptVariation</div><div>as well:</div><div>my $transcript_variations = $vfh->get_all_TranscriptVariations;</div><div>foreach my $tv (@{$transcript_variations }) {</div><div>    my $id = $tv->transcript->stable_id();</div><div>}</div><div>A TranscriptVariation has many more attributes and methods which are documented here:</div><div><a href="http://www.ensembl.org/info/docs/Doxygen/variation-api/classBio_1_1EnsEMBL_1_1Variation_1_1TranscriptVariation.html">http://www.ensembl.org/info/docs/Doxygen/variation-api/classBio_1_1EnsEMBL_1_1Variation_1_1TranscriptVariation.html</a></div><div><br></div><div>Regards,</div><div>Anja</div><div><br></div><div><div>On 20 May 2013, at 14:25, Nathalie Conte wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>HI, </div><div> I would require some guidance please-</div><div> I would like from a slice object containing several variation features, to retrieve all variation object and additional information (overlapping gene or ), and print them in a OUT file like this, </div><div>name of variation:rs12114605<span class="Apple-tab-span" style="white-space: pre; ">       </span>alles:C/T<span class="Apple-tab-span" style="white-space: pre; ">        </span>start:55749184<span class="Apple-tab-span" style="white-space: pre; ">   </span>end:55749184<span class="Apple-tab-span" style="white-space: pre; ">     </span>consequence:INTRONIC<span class="Apple-tab-span" style="white-space: pre; ">             </span>transcript_name:ENST00000521465<span class="Apple-tab-span" style="white-space: pre; ">  </span>gene_name:ENSG00000254608<span class="Apple-tab-span" style="white-space: pre; ">        </span>gene_extname:RP11-56A10.1</div><div><br></div><div>Starting from the variation and associated annotation and retrieving  overlapping gene or neighbouring information- I had a look in the variation feature object and it seems from the variation we can retrieve gene content and neighbouring genes with 2 methods below, although I didn't managed to use them from my variation feature-</div><table class="memberdecls" style="font-family: 'Lucida Grande', Verdana, Geneva, Arial, sans-serif; font-size: 12px; color: rgb(0, 0, 0); -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; background-color: rgb(255, 255, 255); "><tbody><tr style="vertical-align: top; "><td class="memItemLeft" align="right" valign="top" style="font-size: 1em; text-align: left; border-top-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-color: rgb(196, 207, 229); color: rgb(51, 51, 51); background-color: rgb(249, 250, 252); margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px; padding-top: 1px; padding-right: 0px; padding-bottom: 0px; padding-left: 8px; white-space: nowrap; ">public <a class="elRef" doxygen="ensembl.tag:../core-api//" href="http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1Gene.html" style="color: rgb(70, 101, 162); text-decoration: none; ">Bio::EnsEMBL::Gene</a> </td><td class="memItemRight" valign="bottom" style="font-size: 1em; text-align: left; border-top-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-color: rgb(196, 207, 229); color: rgb(51, 51, 51); background-color: rgb(249, 250, 252); margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px; padding-top: 1px; padding-right: 0px; padding-bottom: 0px; padding-left: 8px; width: 750px; "><a class="elRef" doxygen="ensembl.tag:../core-api//" href="http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1Feature.html#a8a7c8af129910c4daa088b87171b86a6" style="color: rgb(70, 101, 162); text-decoration: none; ">get_nearest_Gene</a> ()</td></tr><tr style="vertical-align: top; "><td class="memItemLeft" align="right" valign="top" style="font-size: 1em; text-align: left; border-top-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-color: rgb(196, 207, 229); color: rgb(51, 51, 51); background-color: rgb(249, 250, 252); margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px; padding-top: 1px; padding-right: 0px; padding-bottom: 0px; padding-left: 8px; white-space: nowrap; ">public List </td><td class="memItemRight" valign="bottom" style="font-size: 1em; text-align: left; border-top-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; border-top-color: rgb(196, 207, 229); color: rgb(51, 51, 51); background-color: rgb(249, 250, 252); margin-top: 4px; margin-right: 4px; margin-bottom: 4px; margin-left: 4px; padding-top: 1px; padding-right: 0px; padding-bottom: 0px; padding-left: 8px; width: 750px; "><a class="elRef" doxygen="ensembl.tag:../core-api//" href="http://www.ensembl.org/info/docs/Doxygen/core-api/classBio_1_1EnsEMBL_1_1Feature.html#ad2bee4aa5ed7b624a47d92456eb8e978" style="color: rgb(70, 101, 162); text-decoration: none; ">get_overlapping_Genes</a> ()</td></tr></tbody></table><div><br></div><div>So I chose to get all the transcripts corresponding to my variation using get_all_TranscriptVariations method (see below), but ovisouly I am missing neighbour gene info. Is this the best way to interrogate the genetic (or neighbouring gene?) content of the variation?</div><div>thanks</div><div>Nathalie</div><div><br></div><div><br></div><div>#variation</div><div>my $human_slice_adaptor = Bio::EnsEMBL::Registry->get_adaptor('Human', 'Core', 'Slice');</div><div>my $human_query_slice = $human_slice_adaptor->fetch_by_region('chromosome',$genomic_align->dnafrag->name,$genomic_align->dnafrag_start,$genomic_align->dnafrag_end);</div><div><br></div><div>###  get all variations in human slice</div><div>my $vfh_adaptor = Bio::EnsEMBL::Registry->get_adaptor('homo_sapiens', 'variation', 'variationfeature'); #get adaptor to VariationFeature object</div><div><div>my $gene_adaptor = Bio::EnsEMBL::Registry->get_adaptor('human', 'core', 'gene');</div></div><div><br></div><div>my $vfsh = $vfh_adaptor->fetch_all_by_Slice($human_query_slice); #return ALL variations defined in $slice</div><div><br></div><div>foreach my $vfh (@{$vfsh}){ </div><div><span class="Apple-tab-span" style="white-space: pre; ">   </span>print   OUT join "\t", $vfh->variation_name, $vfh->allele_string,  $vfh->seq_region_start,$vfh->seq_region_end,$vfh->most_severe_OverlapConsequence->display_term, "\t";<span class="Apple-tab-span" style="white-space: pre; "> </span>;#this is where i need to check the variation gene content</div><div>#get transcripts corresponding to the variation features. </div><div><span class="Apple-tab-span" style="white-space: pre; ">  </span>my $transcripts=$vfh->get_all_TranscriptVariations;<span class="Apple-tab-span" style="white-space: pre; ">   </span></div><div><span class="Apple-tab-span" style="white-space: pre; ">          </span>foreach my $transcript (@{$transcripts}) {</div><div>if (!@{$transcripts}){print 'no_gene',"\t";}</div><div><span class="Apple-tab-span" style="white-space: pre; ">           </span>print OUT 'transcript',"\t",my $id=$transcript->transcript_stable_id,"\t";</div><div><span class="Apple-tab-span" style="white-space: pre; ">         </span>my $gene = $gene_adaptor->fetch_by_transcript_stable_id($id);</div><div>     <span class="Apple-tab-span" style="white-space: pre; ">              </span>print OUT $gene->stable_id, "\t",$gene->external_name,"\n";</div><div><span class="Apple-tab-span" style="white-space: pre; ">             </span><span class="Apple-converted-space"> </span>     <span class="Apple-tab-span" style="white-space: pre; ">              </span>#print OUT $gene->stable_id if (defined $gene->external_name),"\t",$gene->external_name,"\n";</div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span>}</div></blockquote></div><br></div></div></body></html>