[ensembl-dev] Variation Features from Slice
Will McLaren
wm2 at ebi.ac.uk
Wed May 1 15:08:00 BST 2013
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';
$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> 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
> Posting guidelines and subscribe/unsubscribe info:
> http://lists.ensembl.org/**mailman/listinfo/dev<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/20130501/cdeb2375/attachment.html>
More information about the Dev
mailing list