[ensembl-dev] Failed SNPs

Laurent Gil lgil at ebi.ac.uk
Mon Oct 8 12:32:37 BST 2018


Dear Duarte,

Most of the "failed" variants don't have mapping data, therefore they 
don't get variation_feature entries.

Here is a suggestion of code, using the method "is_failed" from the 
Variation object:

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');
$variation_adaptor->db->include_failed_variations(1);

foreach my $id (@rsids){
     if ($id =~ /^rs/i){
         my $variation = $variation_adaptor->fetch_by_name($id);
         if ($variation){
             if ($variation->is_failed) {
                 $progress->message("FAILED: $id - 
".$variation->failed_description()."\n");
             } else {
                 foreach my $vf 
(@{$variation->get_all_VariationFeatures()}){
                     ...
                 }
             }
         } else {
             $progress->message("FAILED: $id - No variation found in DB\n");
         }
     }
}

Best regards,

Laurent
Ensembl Variation

On 08/10/2018 11:01, Duarte Molha wrote:
> Dear Developers
>
> I created a script to query the database and retrieve details of some 
> SNPs ( taking as input the RS id of those SNPS)
>
> I wanted to change it so that I could also obtain information for 
> Failed SNPS.
>
> the script is really simple the gist being :
>
> 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' );
>
> foreach my $id (@rsids){
> chomp $id;
> if ($id =~ /^rs/i){
> my $variation = $variation_adaptor->fetch_by_name($id);
> if ($variation){
> foreach my $vf (@{$vf_adaptor->fetch_all_by_Variation($variation)}){
> my $varClass= $vf->class_SO_term();
> my $start = $vf->seq_region_start()-1;
> my $end = $vf->seq_region_end();
> if($varClass eq "insertion"){
> $end++;
> }
> my $allele_string = $vf->allele_string;
>
> if ($vf->strand eq "-1"){
> my $strand ="-";
> my $allele_string = $vf->allele_string;
> $allele_string =~ tr/ATGCatgc/TACGtacg/;
> print "chr".$vf->seq_region_name, $start, $end, 
> $vf->variation_name().";".$varClass.";".$allele_string,"0", $strand."\n";
> }else{
> my $strand ="+";
> print "chr".$vf->seq_region_name, $start, $end, 
> $vf->variation_name().";".$varClass.";".$allele_string,"0", $strand."\n";
> }
> }
> }else{
> $progress->message("FAILED: $id\n");
> }
> }
> }
>
> I looked at the documentation and you indicate I should use  something 
> like:
>
> $vf_adaptor->db->include_failed_variations(1);
>
> But for a failed variation
>
> this part of the code:
> my $variation = $variation_adaptor->fetch_by_name($id);
>
>
> would return undef therefore I would not reach the vf adaptor in my code
>
> I also tried
>
> $variation_adaptor->db->include_failed_variations(1);
> But this does not seem to work as well.
> What I am missing?
>
> Thanks
>
> Duarte
>
>
>
>
>
> _______________________________________________
> 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/20181008/77c80cbb/attachment.html>


More information about the Dev mailing list