[ensembl-dev] Variation Features from Slice
Stuart Meacham
sm766 at cam.ac.uk
Wed May 1 15:15:45 BST 2013
Hi Will,
Thanks very much for the quick reply! And you're right, a sort of buglet
. . . my loop was nested within one getting the gene_name
foreach my $go (@{$gene_adaptor->fetch_all_by_Slice($slice) }){
[PREVIOUS SNP CODE]
}
However for some reason this wasn't retrieving a gene object thus the
code was never invoked.
Cheers
Stuart
On 01/05/13 15:08, Will McLaren wrote:
> Hi Stuart,
>
> This works OK for me, both using this release's API (71) and the
> previous (70).
>
> Here's my script:
>
> use strict;
> use warnings;
>
> use Bio::EnsEMBL::Registry;
> my ($host, $port, $user, $pass, $species);
>
> $host = 'ensembldb.ensembl.org <http://ensembldb.ensembl.org>';
> $port = 5306;
> $user = 'anonymous';
> $pass = '';
>
>
> my $reg = 'Bio::EnsEMBL::Registry';
>
> $reg->load_registry_from_db(
> -host => $host,
> -user => $user,
> -pass => $pass,
> -port => $port,
> );
>
> my $sa = $reg->get_adaptor('homo_sapiens','core','slice');
> my $vfa =
> $reg->get_adaptor('homo_sapiens','variation','variationfeature');
>
> my $chr = '9';
> my $pos = '136131022';
> my $slice = $sa->fetch_by_region('chromosome',$chr,$pos,$pos); #create
> a slice of 1 base length
> foreach my $vf (@{$vfa->fetch_all_by_Slice($slice)}){ #get all
> variations at that position
> my $snp = $vf->variation_name();
> my $as = $vf->allele_string;
> my $maf = $vf->minor_allele_frequency();
> my $ma = $vf->minor_allele();
> my $cons = $vf->display_consequence();
> my $vc = $vf->var_class();
> print "$chr\t$pos\t$snp\t$as\t$cons\t$vc\n";
> }
>
> And the output:
>
> 9 136131022 rs8176751 C/T downstream_gene_variant SNP
>
> Perhaps you have a buglet somewhere in your script?
>
> Regards
>
> Will McLaren
> Ensembl Variation
>
>
> On 1 May 2013 14:50, Stuart Meacham <sm766 at cam.ac.uk
> <mailto:sm766 at cam.ac.uk>> wrote:
>
> Hi,
>
> If I have the data chr:pos for a SNP can I expect to retrieve the
> Variation Feature(s) at that location via a Slice with something like:
>
> my $chr = '9';
> my $pos = '136131022'
> my $slice = $sa->fetch_by_region('chromosome',$chr,$pos,$pos);
> #create a slice of 1 base length
> foreach my $vf (@{$vfa->fetch_all_by_Slice($slice)}){ #get all
> variations at that position
> my $snp = $vf->variation_name();
> my $as = $vf->allele_string;
> my $maf = $vf->minor_allele_frequency();
> my $ma = $vf->minor_allele();
> my $cons = $vf->display_consequence();
> my $vc = $vf->var_class();
> print OUTPUT "$chr\t$pos\t$snp\t$as\t$cons\t$vc\t$gene\n";
> }
> }
>
> The reason I ask is because 9:136131022 doesn't seem to return
> rs8176751 although I have had success with other locations.
>
> Thanks
>
> Stuart
>
>
>
>
> _______________________________________________
> Dev mailing list Dev at ensembl.org <mailto:Dev at ensembl.org>
> Posting guidelines and subscribe/unsubscribe info:
> http://lists.ensembl.org/mailman/listinfo/dev
> Ensembl Blog: http://www.ensembl.info/
>
>
>
>
> _______________________________________________
> 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/
More information about the Dev
mailing list