<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hi Johanne,<br>
    <br>
    Thanks for the detailed report. It looks as if you don't have the <font
      class="">JSON.pm module installed or in your path. Adding this
      will sort out the problem.<br>
      <br>
      Best wishes,<br>
      <br>
      Sarah<br>
    </font><br>
    <div class="moz-cite-prefix">On 15/01/2016 12:35, Johanne Håøy Horn
      wrote:<br>
    </div>
    <blockquote
      cite="mid:31F41F6D-DDBC-4D3D-BEE9-888B345C3189@ifi.uio.no"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <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
        moz-do-not-send="true"
        href="https://www.biostars.org/p/109785/#147784" class=""><a class="moz-txt-link-freetext" href="https://www.biostars.org/p/109785/#147784">https://www.biostars.org/p/109785/#147784</a></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 class="" face="Courier">use strict;</font></div>
        <div class=""><font class="" face="Courier">use warnings;</font></div>
        <div class=""><font class="" face="Courier">use
            Bio::EnsEMBL::Registry;</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">my $registry =
            'Bio::EnsEMBL::Registry';</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">$registry->load_registry_from_db(</font></div>
        <div class=""><font class="" face="Courier">  -host => '<a
              moz-do-not-send="true" href="http://ensembldb.ensembl.org"
              class="">ensembldb.ensembl.org</a>',</font></div>
        <div class=""><font class="" face="Courier">  -user =>
            'anonymous'</font></div>
        <div class=""><font class="" face="Courier">    );</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">my
            $variation_adaptor =
            $registry->get_adaptor('homo_sapiens', 'variation',
            'variation' );</font></div>
        <div class=""><font class="" face="Courier">$variation_adaptor->db->use_vcf(1);
            # To get 1000G phase 3 data also</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier"># For each rsID in
            the input file from calling python script:</font></div>
        <div class=""><font class="" face="Courier">while (<>) {</font></div>
        <div class=""><font class="" face="Courier">    # Find all SNPs
            in LD and print</font></div>
        <div class=""><font class="" face="Courier">    # $_ represents
            a line from stdin</font></div>
        <div class=""><font class="" face="Courier">    print $_;</font></div>
        <div class=""><font class="" face="Courier">    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 class="" face="Courier">    print
            $variation;</font></div>
      </div>
      <div class="">
        <div class=""><font class="" face="Courier">    if ($variation)
            {</font></div>
        <div class=""><font class="" face="Courier">        my @vfs = @{
            $variation->get_all_VariationFeatures };</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">        foreach my
            $vf (@vfs){</font></div>
        <div class=""><font class="" face="Courier">            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 class="" face="Courier">            my @pops
            = @{ $vf->get_all_LD_Populations };</font></div>
        <div class=""><font class="" face="Courier">            my @ldvs
            = @{ $ld->get_variations };</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">            foreach
            my $pop (@pops) {</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">                if
            ($pop->name =~ /1000GENOMES/) {</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">                   
            foreach my $ldv (@ldvs) {</font></div>
        <div class=""><font class="" face="Courier">                   
                if ($ldv->stable_id ne $_) {</font></div>
        <div class=""><font class="" face="Courier">                   
                    my @ldvfs = @{ $ldv->get_all_VariationFeatures };</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">                   
                    foreach my $ldvf (@ldvfs) {</font></div>
        <div class=""><font class="" face="Courier">                   
                        my @tvs = @{
            $ldvf->get_all_TranscriptVariations };</font></div>
        <div class=""><font class="" face="Courier">                   
                        my $r2 = $ld->get_r_square($vf, $ldvf, $pop);</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">                   
                        foreach my $tv (@tvs) {</font></div>
        <div class=""><font class="" face="Courier">                   
                            my $gene = $tv->transcript->get_Gene;</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">                   
                            if ($r2 > 0.8) {</font></div>
        <div class=""><font class="" face="Courier">                   
                                print $variation->stable_id, "\t",
            $ldv->stable_id, "\t", $gene->external_name, "\t",
            $r2, "\t", $pop->name, "\n";</font></div>
        <div class=""><font class="" face="Courier">                   
                            }</font></div>
        <div class=""><font class="" face="Courier">                   
                        }</font></div>
        <div class=""><font class="" face="Courier">                   
                    }</font></div>
        <div class=""><font class="" face="Courier">                   
                }</font></div>
        <div class=""><font class="" face="Courier">                   
            }</font></div>
        <div class=""><font class="" face="Courier">                }</font></div>
        <div class=""><font class="" face="Courier">            }</font></div>
        <div class=""><font class="" face="Courier">        }</font></div>
        <div class=""><font class="" face="Courier">    }</font></div>
        <div class=""><font class="" face="Courier">}</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 class="" face="Courier">--------------------
            WARNING ----------------------</font></div>
        <div class=""><font class="" face="Courier">MSG:
            'Bio::EnsEMBL::Variation::DBSQL::VCFCollectionAdaptor'
            cannot be found.</font></div>
        <div class=""><font class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">Compilation failed
            in require at (eval 260) line 3, <> line 1.</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">FILE:
            Bio/EnsEMBL/Registry.pm LINE: 1169</font></div>
        <div class=""><font class="" face="Courier">CALLED BY:
            EnsEMBL/DBSQL/DBAdaptor.pm  LINE: 988</font></div>
        <div class=""><font class="" face="Courier">Date (localtime)  
             = Fri Jan 15 11:32:21 2016</font></div>
        <div class=""><font class="" face="Courier">Ensembl API version
            = 83</font></div>
        <div class=""><font class="" face="Courier">---------------------------------------------------</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">--------------------
            WARNING ----------------------</font></div>
        <div class=""><font class="" face="Courier">MSG: Could not find
            VCFCollection adaptor in the registry for homo_sapiens
            variation</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">FILE:
            EnsEMBL/DBSQL/DBAdaptor.pm LINE: 991</font></div>
        <div class=""><font class="" face="Courier">CALLED BY:
            Variation/DBSQL/LDFeatureContainerAdaptor.pm  LINE: 451</font></div>
        <div class=""><font class="" face="Courier">Date (localtime)  
             = Fri Jan 15 11:32:21 2016</font></div>
        <div class=""><font class="" face="Courier">Ensembl API version
            = 83</font></div>
        <div class=""><font class="" face="Courier">---------------------------------------------------</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">--------------------
            EXCEPTION --------------------</font></div>
        <div class=""><font class="" face="Courier">MSG: Could not get
            adaptor VCFCollection for homo_sapiens variation</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">STACK
            Bio::EnsEMBL::DBSQL::DBAdaptor::AUTOLOAD
/usit/abel/u1/johannhh/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm:995</font></div>
        <div class=""><font class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">STACK toplevel
            ldCalculation.pl:28</font></div>
        <div class=""><font class="" face="Courier">Date (localtime)  
             = Fri Jan 15 11:32:21 2016</font></div>
        <div class=""><font class="" face="Courier">Ensembl API version
            = 83</font></div>
        <div class=""><font class="" face="Courier">—————————————————————————</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 moz-do-not-send="true"
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 moz-do-not-send="true"
          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 moz-do-not-send="true"
          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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 class="" face="Courier">--------------------
            WARNING ----------------------</font></div>
        <div class=""><font class="" face="Courier">MSG:
            'Bio::EnsEMBL::Variation::DBSQL::VCFCollectionAdaptor'
            cannot be found.</font></div>
        <div class=""><font class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">Compilation failed
            in require at (eval 261) line 3.</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">FILE:
            Bio/EnsEMBL/Registry.pm LINE: 1169</font></div>
        <div class=""><font class="" face="Courier">CALLED BY:
            EnsEMBL/DBSQL/DBAdaptor.pm  LINE: 988</font></div>
        <div class=""><font class="" face="Courier">Date (localtime)  
             = Fri Jan 15 13:11:11 2016</font></div>
        <div class=""><font class="" face="Courier">Ensembl API version
            = 83</font></div>
        <div class=""><font class="" face="Courier">---------------------------------------------------</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">--------------------
            WARNING ----------------------</font></div>
        <div class=""><font class="" face="Courier">MSG: Could not find
            VCFCollection adaptor in the registry for homo_sapiens
            variation</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">FILE:
            EnsEMBL/DBSQL/DBAdaptor.pm LINE: 991</font></div>
        <div class=""><font class="" face="Courier">CALLED BY:
            Variation/DBSQL/SampleGenotypeAdaptor.pm  LINE: 287</font></div>
        <div class=""><font class="" face="Courier">Date (localtime)  
             = Fri Jan 15 13:11:11 2016</font></div>
        <div class=""><font class="" face="Courier">Ensembl API version
            = 83</font></div>
        <div class=""><font class="" face="Courier">---------------------------------------------------</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">--------------------
            EXCEPTION --------------------</font></div>
        <div class=""><font class="" face="Courier">MSG: Could not get
            adaptor VCFCollection for homo_sapiens variation</font></div>
        <div class=""><font class="" face="Courier"><br class="">
          </font></div>
        <div class=""><font class="" face="Courier">STACK
            Bio::EnsEMBL::DBSQL::DBAdaptor::AUTOLOAD
/usit/abel/u1/johannhh/src/ensembl/modules/Bio/EnsEMBL/DBSQL/DBAdaptor.pm:995</font></div>
        <div class=""><font class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">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 class="" face="Courier">STACK toplevel
            ensembleapi.pl:17</font></div>
        <div class=""><font class="" face="Courier">Date (localtime)  
             = Fri Jan 15 13:11:11 2016</font></div>
        <div class=""><font class="" face="Courier">Ensembl API version
            = 83</font></div>
        <div class=""><font class="" face="Courier">—————————————————————————</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>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Dev mailing list    <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a>
Posting guidelines and subscribe/unsubscribe info: <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>