[ensembl-dev] Problem with populations

Eduardo Andrés León eduardo.andres at csic.es
Sun Apr 23 12:25:24 BST 2017



Dear all,
I’m using an old script to obtain snp frequencies in different populations/subpolulations. I think it was made one year ago and obviously it is not working anymore. The think is that i made a few changes but I’m not able to update it correctly

I hope any of you could help me.

As an example, what I want is to obtain the frequency for the All population, EUR population and IBS sub-population (all from 1000 genomes):
http://www.ensembl.org/Homo_sapiens/Variation/Population?db=core;r=6:43769593-43770593;v=rs1570360;vdb=variation;vf=1121901 <http://www.ensembl.org/Homo_sapiens/Variation/Population?db=core;r=6:43769593-43770593;v=rs1570360;vdb=variation;vf=1121901>


My code was:

my $variation = $variation_adaptor->fetch_by_name($snp);
if($variation){
foreach my $vf (@{$variation_adaptor_feature->fetch_all_by_Variation($variation)}) {
if($vf->seq_region_name !~ /^HG/){
print MAP $vf->seq_region_name() ." $snp 0 " .$vf->seq_region_start(),"\n";
print POB "$snp\t" . $vf->display_consequence;
foreach my $allele (@{$vf->get_all_Alleles}){
next unless (defined $allele->population);
my $allele_string   = $allele->allele;
my $frequency       = $allele->frequency || 'NA';
my $population_name = $allele->population->name;

 if($population_name eq "1000GENOMES:phase_1_IBS"){
 
print POB "\t$allele_string\t$frequency";
 }elsif($population_name eq "1000GENOMES:EUR"){
 
print POB "\t$allele_string\t$frequency";
 }elsif($population_name eq "1000GENOMES:phase_1_ALL"){
 
print POB "\t$allele_string\t$frequency”;


.....

So from the snp, I obtained the alleles and from the allele object I obtain most of the information using the population_name

Now I have tried a couple of things without success

Example1:

my $pa = $registry->get_adaptor("human","variation","population");
my $pop  = $allele->population;

foreach my $super_pop (@{$pa->fetch_all_by_sub_Population($pop)}) {
    print $pop->name(), " is a super population of ", $super_pop->name(), "\n";
  }

# fetch all sub populations of a population
  foreach my $sub_pop (@{$pa->fetch_all_by_super_Population($pop)}) {
    print $sub_pop->name(), " is a sub population of ", $pop->name(), "\n";
}

Example 2:

my $pop  = $allele->population;
my $sub_pops = $pop->get_all_sub_Populations();

        foreach my $sp (@$sub_pops) {
            print 
                  'name: ', $sp->name(),
                  'desc: ', $sp->description(),
                  'size: ', $sp->size(),"\n";
  }

Any help ?



--------------------------------------------------------------------------------------------------------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20170423/6d21e11d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Signature.jpg
Type: image/jpeg
Size: 37429 bytes
Desc: not available
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20170423/6d21e11d/attachment.jpg>


More information about the Dev mailing list