[ensembl-dev] Variation set: fetch_all_by_Variation() outputting hash values

Anja Thormann anja at ebi.ac.uk
Tue Jul 22 22:11:37 BST 2014


Hi Henry,
VariationSet is an object. You can get the set name by calling 
$variation_set->name() and you can get all Variations stored in a 
VariationSet by calling $variation_set->get_all_Variations(). But be 
careful here; sets can contain millions of variations. Better to use an 
Iterator.
You can find more in the documentation:
http://www.ensembl.org/info/docs/Doxygen/variation-api/classBio_1_1EnsEMBL_1_1Variation_1_1VariationSet.html#a3aa51f756aaa0b662108cb52bffda055
http://www.ensembl.org/info/docs/api/variation/variation_tutorial.html#variation_sets

So for your code:
     foreach my $tva(@{$tvas}) {
         my @vsets = 
@{$vs_adaptor->fetch_all_by_Variation($tva->variation_feature->variation)};
         foreach my $vs (@vsets) {
             my $set_name = $vs->name();
             ...
         }
         print
$tva->variation_feature->display_id,"\t",join(",", @vsets),"\n"; 
#variation sets
     }

Kind regards,
Anja


On 22/07/2014 21:40, Gong, Henry wrote:
> Hi EnsEMBL devs,
>
> I'm working on a script that essentially outputs much of the variation 
> page for a given transcript, with some tweaks and additions. Right now 
> I'm working with API version 75, and I'm running into issues with the 
> variation sets.
>
> Here's a script which reproduces the issue on my computer:
> #begin script
> use strict;
> use warnings;
> use Bio::EnsEMBL::Registry;
>
> my $registry = 'Bio::EnsEMBL::Registry';
>
> $registry->load_registry_from_db(
>     -host => 'ensembldb.ensembl.org',
>     -user => 'anonymous'
> );
>
> my $stable_id = "ENST00000392487"; #this is the stable_id of a human 
> transcript, as an example
> my $transcript_adaptor = $registry->get_adaptor('homo_sapiens', 
> 'core', 'transcript'); #get the adaptor to get the Transcript from the 
> database
> my $transcript = $transcript_adaptor->fetch_by_stable_id($stable_id); 
> #get the Transcript object
> my $tv_adaptor = $registry->get_adaptor('homo_sapiens', 'variation', 
> 'transcriptvariation'); #get the adaptor to get TranscriptVariation 
> objects
> my $vs_adaptor = $registry->get_adaptor('human', 'variation', 
> 'variationset'); # get variation set adaptor
> my $tvs = $tv_adaptor->fetch_all_by_Transcripts([$transcript]); #get 
> ALL effects of Variations in the Transcript
>
> foreach my $tv (@{$tvs}) {
>     my $tvas = $tv->get_all_alternate_TranscriptVariationAlleles(); 
> #These alleles will be the lines of the output.
>
>     foreach my $tva(@{$tvas}) {
>         my @vsets = 
> @{$vs_adaptor->fetch_all_by_Variation($tva->variation_feature->variation)};
>         print
> $tva->variation_feature->display_id,"\t",join(",", @vsets),"\n"; 
> #variation sets
>     }
> }
> #end script
>
> And here's a couple lines of the output:
> rs374450378 Bio::EnsEMBL::Variation::VariationSet=HASH(0x6022f7778)
> rs369428195 Bio::EnsEMBL::Variation::VariationSet=HASH(0x601f7e868)
> rs146522403 
> Bio::EnsEMBL::Variation::VariationSet=HASH(0x6022f7550),Bio::EnsEMBL::Variation::VariationSet=HASH(0x6022f7778),Bio::EnsEMBL::Variation::VariationSet=HASH(0x6022f75f8)
>
> So in other words, the problem seems to lie in the adaptor pm's 
> interpretation of the data from the function 
> $vsa->fetch_all_by_Variation(); the program seems to correctly output 
> some hash value(s) based on a variation as a key. That's a guess based 
> on the fact that the output depends on the variant.
>
> Would this be based on some issue with my syntax (which is based on 
> the API tutorial), or with the pm itself? I'm new to perl, so I'm not 
> really able to diagnose the pm.
>
> Thanks,
> Henry Gong
> Junior Specialist
> UCSF Dept of Neuro Surgery
>
>
> _______________________________________________
> Dev mailing list    Dev at ensembl.org
> Posting guidelines and subscribe/unsubscribe info: http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20140722/7531abd9/attachment.html>


More information about the Dev mailing list