[ensembl-dev] Get two variants frequencies

Sarah Hunt seh at ebi.ac.uk
Thu Nov 10 08:48:05 GMT 2016


Hi David,

You could extract the genotypes for each variant using the API call:

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

foreach  my  $genotype  (@{$genotypes})  {
   print  "Sample ",  $genotype->sample->name,  " has genotype ",  $genotype->genotype_string,  "\n";
}

then calculate number of times of AA + GC etc occur within the same 
sample. The 1000 genomes genotypes are phased, but these variants are 
too far appart for that to be relevant.

Best wishes,

Sarah

On 09/11/2016 15:01, david martin wrote:
>
> 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";
>     }
> }
>
>
>
> _______________________________________________
> 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/

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


More information about the Dev mailing list