Using the Ensembl Perl API:
#!/usr/local/bin/perl
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
my $reg = 'Bio::EnsEMBL::Registry';
$reg->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous'
);
# get a variation adaptor
my $va = $reg->get_adaptor("human", "variation", "variation");
# fetch the variation by name
my $v = $va->fetch_by_name('rs123');
# get all the alleles
my @alleles = @{$v->get_all_Alleles()};
foreach my $allele(@alleles) {
if($allele->population && $allele->population->name =~ /1000GENOMES.*YRI/){
print
$v->name, "\t",
$allele->allele, "\t",
(defined($allele->frequency) ? $allele->frequency : "-"), "\t",
$allele->population->name, "\n";
}
}
Or starting out from the position of a variant instead of the rs number:
#!/usr/local/bin/perl
use strict;
use warnings;
use Bio::EnsEMBL::Registry;
my $reg = 'Bio::EnsEMBL::Registry';
$reg->load_registry_from_db(
-host => 'ensembldb.ensembl.org',
-user => 'anonymous'
);
my $sa = $reg->get_adaptor("human", "core", "slice");
my $vfa = $reg->get_adaptor("human", "variation", "variationfeature");
my $chromosome = '7';
my $position = 24966446;
my $slice = $sa->fetch_by_region('chromosome', $chromosome, $position, $position);
my @vfs = @{$vfa->fetch_all_by_Slice($slice)};
foreach my $vf(@vfs){
my @alleles = @{$vf->variation->get_all_Alleles()};
foreach my $allele(@alleles) {
if($allele->population && $allele->population->name =~ /1000GENOMES.*YRI/){
print
$vf->seq_region_name, "\t",
$vf->seq_region_start, "\t",
$vf->seq_region_end, "\t",
$vf->variation->name, "\t",
$allele->allele, "\t",
(defined($allele->frequency) ? $allele->frequency : "-"), "\t",
$allele->population->name, "\n";
}
}
}
Ensembl questions can also be posted to the Ensembl Helpdesk or the Ensembl developers mailing list.
just to check do you mean ncbi36/hg18 or GRCh37/hg19