[ensembl-dev] Get two variants frequencies

david martin vilanew at gmail.com
Wed Nov 9 15:01:36 GMT 2016


Hello,

I have two variants and would like to know how can i compute the 
frequency and genotype  of each of the alleles and then the frequency of 
both combined and individually.

The idea is to estimate in the 1000 genomes the frequency of each 
variation and their prevalence when combined in the same individual 
(with all allele possiblities)

For example if varA = 80%A / 20%T and varB =40%G and 60%C


What is the frequence for varA = 80% Aand varB=40%G in the population. 
Same for varA = 80%A and varB = 60%C


So far i have managed to get frequencies for each variation individually 
(the code below is en example for one variant).


The two variants are rs1333049 and rs7046863

I´m using API version 86

use strict;
use warnings;
use Bio::EnsEMBL::Registry;

my $registry = 'Bio::EnsEMBL::Registry';

$registry->load_registry_from_

db(
     -host => 'ensembldb.ensembl.org <http://ensembldb.ensembl.org/>',
     -user => 'anonymous'
     );

my $variation_adaptor = $registry->get_adaptor('human', 'variation', 
'variation');

# Retrieve 1000 genomes phase 3 data
$variation_adaptor->db->use_vcf(1);

my $variation = $variation_adaptor->fetch_by_name('rs1333049');

# get all the alleles
my @alleles = @{$variation->get_all_Alleles()};

foreach my $allele(@alleles) {
if($allele->population && $allele->population->name =~ /1000GENOMES.*YRI/){
         print
$variation->name, "\t",
$allele->allele, "\t",
(defined($allele->frequency) ? $allele->frequency : "-"), "\t",
$allele->population->name, "\n";
     }
}

my $genotypes = $variation->get_all_PopulationGenotypes();

foreach my $genotype (@{$genotypes}) {
if($genotype->population && $genotype->population->name =~ 
/1000GENOMES.*YRI/){
        print "Population ", $genotype->population->name, " has genotype 
", $genotype->genotype_string, " with the frequency ", 
$genotype->frequency, "\n";
     }
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20161109/9c2ac50a/attachment.html>


More information about the Dev mailing list