<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Dear Ensembl dev team,</div>
<div class=""><br class="">
</div>
<div class="">I wish to use your perl API (version 83) to create a program that does the following: Have as input a list of SNPs by rsID, fetch 1000G phase 3 LD SNPs and provide list of the ones with r^2 > 0.8 as output.</div>
<div class=""><br class="">
</div>
I tried following the example posted by Emily here: <a href="https://www.biostars.org/p/109785/#147784" class="">https://www.biostars.org/p/109785/#147784</a>
<div class=""><br class="">
</div>
<div class="">I seem to want the same functionality and have the same problems as the user in the correspondence, but while they appear to have found a solution, I still have two issues right now:</div>
<div class="">1) I provide an input file to the script, where each line is rs###. I am able to print out this id using $_ as rs###\n, but when using $variation_adaptor->fetch_by_name($_); I do not get a $variation object, just undefined. Therefore, in the code
 below, I have used a test rsID so far. Do you have any suggestions on why the rsID from my input file gives undefined variations?</div>
<div class="">2) When running the following perl code, I get the error pasted below:</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><font face="Courier" class="">use strict;</font></div>
<div class=""><font face="Courier" class="">use warnings;</font></div>
<div class=""><font face="Courier" class="">use Bio::EnsEMBL::Registry;</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">my $registry = 'Bio::EnsEMBL::Registry';</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">$registry->load_registry_from_db(</font></div>
<div class=""><font face="Courier" class="">  -host => '<a href="http://ensembldb.ensembl.org" class="">ensembldb.ensembl.org</a>',</font></div>
<div class=""><font face="Courier" class="">  -user => 'anonymous'</font></div>
<div class=""><font face="Courier" class="">    );</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">my $variation_adaptor = $registry->get_adaptor('homo_sapiens', 'variation', 'variation' );</font></div>
<div class=""><font face="Courier" class="">$variation_adaptor->db->use_vcf(1); # To get 1000G phase 3 data also</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class=""># For each rsID in the input file from calling python script:</font></div>
<div class=""><font face="Courier" class="">while (<>) {</font></div>
<div class=""><font face="Courier" class="">    # Find all SNPs in LD and print</font></div>
<div class=""><font face="Courier" class="">    # $_ represents a line from stdin</font></div>
<div class=""><font face="Courier" class="">    print $_;</font></div>
<div class=""><font face="Courier" class="">    my $variation = $variation_adaptor->fetch_by_name('rs1333049'); <span class="Apple-tab-span" style="white-space: pre;">
</span># Test data</font></div>
<div class=""><font face="Courier" class="">    print $variation;</font></div>
</div>
<div class="">
<div class=""><font face="Courier" class="">    if ($variation) {</font></div>
<div class=""><font face="Courier" class="">        my @vfs = @{ $variation->get_all_VariationFeatures };</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">        foreach my $vf (@vfs){</font></div>
<div class=""><font face="Courier" class="">            my $ld = $vf->get_all_LD_values; <span class="Apple-tab-span" style="white-space: pre;">
</span># error seems to occur here</font></div>
<div class=""><font face="Courier" class="">            my @pops = @{ $vf->get_all_LD_Populations };</font></div>
<div class=""><font face="Courier" class="">            my @ldvs = @{ $ld->get_variations };</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">            foreach my $pop (@pops) {</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">                if ($pop->name =~ /1000GENOMES/) {</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">                    foreach my $ldv (@ldvs) {</font></div>
<div class=""><font face="Courier" class="">                        if ($ldv->stable_id ne $_) {</font></div>
<div class=""><font face="Courier" class="">                            my @ldvfs = @{ $ldv->get_all_VariationFeatures };</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">                            foreach my $ldvf (@ldvfs) {</font></div>
<div class=""><font face="Courier" class="">                                my @tvs = @{ $ldvf->get_all_TranscriptVariations };</font></div>
<div class=""><font face="Courier" class="">                                my $r2 = $ld->get_r_square($vf, $ldvf, $pop);</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">                                foreach my $tv (@tvs) {</font></div>
<div class=""><font face="Courier" class="">                                    my $gene = $tv->transcript->get_Gene;</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">                                    if ($r2 > 0.8) {</font></div>
<div class=""><font face="Courier" class="">                                        print $variation->stable_id, "\t", $ldv->stable_id, "\t", $gene->external_name, "\t", $r2, "\t", $pop->name, "\n";</font></div>
<div class=""><font face="Courier" class="">                                    }</font></div>
<div class=""><font face="Courier" class="">                                }</font></div>
<div class=""><font face="Courier" class="">                            }</font></div>
<div class=""><font face="Courier" class="">                        }</font></div>
<div class=""><font face="Courier" class="">                    }</font></div>
<div class=""><font face="Courier" class="">                }</font></div>
<div class=""><font face="Courier" class="">            }</font></div>
<div class=""><font face="Courier" class="">        }</font></div>
<div class=""><font face="Courier" class="">    }</font></div>
<div class=""><font face="Courier" class="">}</font></div>
</div>
<div class=""><br class="">
</div>
<div class=""><b class="">Error from terminal:</b></div>
<div class=""><b class=""><br class="">
</b></div>
<div class="">
<div class=""><font face="Courier" class="">-------------------- WARNING ----------------------</font></div>
<div class=""><font face="Courier" class="">MSG: 'Bio::EnsEMBL::Variation::DBSQL::VCFCollectionAdaptor' cannot be found.</font></div>
<div class=""><font face="Courier" class="">Exception Can't locate JSON.pm in @INC (@INC contains: /software/lib/perl5/x86_64-linux-thread-multi /software/lib/perl5 /software/lib/perl5/5.10.1/x86_64-linux-thread-multi /software/lib/perl5/5.10.1 /usit/invitro/data/common_software/share/perl5/5.10.1
 /hpc/lib/perl5 /cluster/lib/perl5 /usit/abel/u1/johannhh/src/BioPerl-1.6.1 /usit/abel/u1/johannhh/src/ensembl/modules /usit/abel/u1/johannhh/src/ensembl-compara/modules /usit/abel/u1/johannhh/src/ensembl-variation/modules /usit/abel/u1/johannhh/src/ensembl-funcgen/modules
 /usit/abel/u1/johannhh/src/lib64/perl5 /usit/abel/u1/johannhh/src/ensembl-io/modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/VCFCollectionAdaptor.pm
 line 91, <> line 1.</font></div>
<div class=""><font face="Courier" class="">BEGIN failed--compilation aborted at /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/VCFCollectionAdaptor.pm line 91, <> line 1.</font></div>
<div class=""><font face="Courier" class="">Compilation failed in require at (eval 260) line 3, <> line 1.</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">FILE: Bio/EnsEMBL/Registry.pm LINE: 1169</font></div>
<div class=""><font face="Courier" class="">CALLED BY: EnsEMBL/DBSQL/DBAdaptor.pm  LINE: 988</font></div>
<div class=""><font face="Courier" class="">Date (localtime)    = Fri Jan 15 11:32:21 2016</font></div>
<div class=""><font face="Courier" class="">Ensembl API version = 83</font></div>
<div class=""><font face="Courier" class="">---------------------------------------------------</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">-------------------- WARNING ----------------------</font></div>
<div class=""><font face="Courier" class="">MSG: Could not find VCFCollection adaptor in the registry for homo_sapiens variation</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">FILE: EnsEMBL/DBSQL/DBAdaptor.pm LINE: 991</font></div>
<div class=""><font face="Courier" class="">CALLED BY: Variation/DBSQL/LDFeatureContainerAdaptor.pm  LINE: 451</font></div>
<div class=""><font face="Courier" class="">Date (localtime)    = Fri Jan 15 11:32:21 2016</font></div>
<div class=""><font face="Courier" class="">Ensembl API version = 83</font></div>
<div class=""><font face="Courier" class="">---------------------------------------------------</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">-------------------- EXCEPTION --------------------</font></div>
<div class=""><font face="Courier" class="">MSG: Could not get adaptor VCFCollection for homo_sapiens variation</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::DBSQL::DBAdaptor::AUTOLOAD /usit/abel/u1/johannhh/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm:995</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::DBSQL::LDFeatureContainerAdaptor::_fetch_by_Slice_VCF /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/LDFeatureContainerAdaptor.pm:451</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::DBSQL::LDFeatureContainerAdaptor::fetch_by_Slice /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/LDFeatureContainerAdaptor.pm:165</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::DBSQL::LDFeatureContainerAdaptor::fetch_by_VariationFeature /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/LDFeatureContainerAdaptor.pm:246</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::VariationFeature::get_all_LD_values /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/VariationFeature.pm:1388</font></div>
<div class=""><font face="Courier" class="">STACK toplevel ldCalculation.pl:28</font></div>
<div class=""><font face="Courier" class="">Date (localtime)    = Fri Jan 15 11:32:21 2016</font></div>
<div class=""><font face="Courier" class="">Ensembl API version = 83</font></div>
<div class=""><font face="Courier" class="">—————————————————————————</font></div>
</div>
<div class=""><br class="">
</div>
<div class="">When searching around, it seemed as though the error is somewhat connected to vcftools. However, I have followed the installation steps as described on the ensembl web page, and would expect the installation to have been successful.</div>
<div class="">For the installation, I have followed the guide here: <a href="http://www.ensembl.info/blog/2015/06/18/1000-genomes-phase-3-frequencies-genotypes-and-ld-data/" class="">http://www.ensembl.info/blog/2015/06/18/1000-genomes-phase-3-frequencies-genotypes-and-ld-data/</a></div>
<div class="">Here: <a href="http://www.ensembl.org/info/docs/api/api_installation.html" class="">http://www.ensembl.org/info/docs/api/api_installation.html</a></div>
<div class="">And here: <a href="http://www.ensembl.org/info/docs/api/api_git.html" class="">http://www.ensembl.org/info/docs/api/api_git.html</a></div>
<div class="">(they overlap some, and my perl5-installation was put in ~/src/lib64/perl5 not in the path described in the guides) I believe I have set the correct values of PERL5LIB and PATH.</div>
<div class=""><br class="">
</div>
<div class="">I am able to run the code under «LD-calculation» here: <a href="http://www.ensembl.org/info/docs/api/variation/variation_tutorial.html" class="">http://www.ensembl.org/info/docs/api/variation/variation_tutorial.html</a></div>
<div class="">But when I try to run the «Using in the API script» from this page: <a href="http://www.ensembl.info/blog/2015/06/18/1000-genomes-phase-3-frequencies-genotypes-and-ld-data/" class="">http://www.ensembl.info/blog/2015/06/18/1000-genomes-phase-3-frequencies-genotypes-and-ld-data/</a> I
 get what seems to be a similar error:</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><font face="Courier" class="">-------------------- WARNING ----------------------</font></div>
<div class=""><font face="Courier" class="">MSG: 'Bio::EnsEMBL::Variation::DBSQL::VCFCollectionAdaptor' cannot be found.</font></div>
<div class=""><font face="Courier" class="">Exception Can't locate JSON.pm in @INC (@INC contains: /software/lib/perl5/x86_64-linux-thread-multi /software/lib/perl5 /software/lib/perl5/5.10.1/x86_64-linux-thread-multi /software/lib/perl5/5.10.1 /usit/invitro/data/common_software/share/perl5/5.10.1
 /hpc/lib/perl5 /cluster/lib/perl5 /usit/abel/u1/johannhh/src/BioPerl-1.6.1 /usit/abel/u1/johannhh/src/ensembl/modules /usit/abel/u1/johannhh/src/ensembl-compara/modules /usit/abel/u1/johannhh/src/ensembl-variation/modules /usit/abel/u1/johannhh/src/ensembl-funcgen/modules
 /usit/abel/u1/johannhh/src/lib64/perl5 /usit/abel/u1/johannhh/src/ensembl-io/modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/VCFCollectionAdaptor.pm
 line 91.</font></div>
<div class=""><font face="Courier" class="">BEGIN failed--compilation aborted at /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/VCFCollectionAdaptor.pm line 91.</font></div>
<div class=""><font face="Courier" class="">Compilation failed in require at (eval 261) line 3.</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">FILE: Bio/EnsEMBL/Registry.pm LINE: 1169</font></div>
<div class=""><font face="Courier" class="">CALLED BY: EnsEMBL/DBSQL/DBAdaptor.pm  LINE: 988</font></div>
<div class=""><font face="Courier" class="">Date (localtime)    = Fri Jan 15 13:11:11 2016</font></div>
<div class=""><font face="Courier" class="">Ensembl API version = 83</font></div>
<div class=""><font face="Courier" class="">---------------------------------------------------</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">-------------------- WARNING ----------------------</font></div>
<div class=""><font face="Courier" class="">MSG: Could not find VCFCollection adaptor in the registry for homo_sapiens variation</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">FILE: EnsEMBL/DBSQL/DBAdaptor.pm LINE: 991</font></div>
<div class=""><font face="Courier" class="">CALLED BY: Variation/DBSQL/SampleGenotypeAdaptor.pm  LINE: 287</font></div>
<div class=""><font face="Courier" class="">Date (localtime)    = Fri Jan 15 13:11:11 2016</font></div>
<div class=""><font face="Courier" class="">Ensembl API version = 83</font></div>
<div class=""><font face="Courier" class="">---------------------------------------------------</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">-------------------- EXCEPTION --------------------</font></div>
<div class=""><font face="Courier" class="">MSG: Could not get adaptor VCFCollection for homo_sapiens variation</font></div>
<div class=""><font face="Courier" class=""><br class="">
</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::DBSQL::DBAdaptor::AUTOLOAD /usit/abel/u1/johannhh/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm:995</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::DBSQL::SampleGenotypeAdaptor::fetch_all_by_Variation /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/SampleGenotypeAdaptor.pm:287</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::Variation::get_all_SampleGenotypes /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/Variation.pm:987</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::DBSQL::AlleleAdaptor::_fetch_all_by_Variation_from_Genotypes /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/AlleleAdaptor.pm:307</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::DBSQL::AlleleAdaptor::fetch_all_by_Variation /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/DBSQL/AlleleAdaptor.pm:273</font></div>
<div class=""><font face="Courier" class="">STACK Bio::EnsEMBL::Variation::Variation::get_all_Alleles /usit/abel/u1/johannhh/src/ensembl-variation/modules/Bio/EnsEMBL/Variation/Variation.pm:861</font></div>
<div class=""><font face="Courier" class="">STACK toplevel ensembleapi.pl:17</font></div>
<div class=""><font face="Courier" class="">Date (localtime)    = Fri Jan 15 13:11:11 2016</font></div>
<div class=""><font face="Courier" class="">Ensembl API version = 83</font></div>
<div class=""><font face="Courier" class="">—————————————————————————</font></div>
</div>
<div class=""><br class="">
</div>
<div class="">Could you please assist me in discovering the reason of these errors? </div>
<div class=""><br class="">
</div>
<div class="">As a side note: I am very new to perl and the ensembl api. My apologies if this question has been answered previously.</div>
<div class="">Also, if you have a database of ldSNPs available (as opposed to calculating them on the fly as above), I would appreciate if you notified me. The correspondence I found on this topic in different forums so far suggested otherwise, but some of
 it was quite old and perhaps outdated.</div>
<div class=""><br class="">
</div>
<div class="">Best,</div>
<div class="">Johanne H. Horn</div>
</body>
</html>