<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi James<br>
    <br>
    Sorry, I thought BioMart would have solved your problem. I guess it
    would be easier it we stick to just one script rather than the two
    you mentioned in an earlier email. I think I would opt for the first
    one (slides) as the other ones seems a little outdated (from the
    list).<br>
    <br>
    So, the script from the slides works out of the box (copy &
    paste from your email) for me, using e64 API.<br>
    <br>
    It also works if I substitute the gene stable ID by
    ENSDARG00000090113. However, if I use a non-existent gene stable ID
    or anything different from the gene stable ID, I get the error you
    reported in another email:<br>
    <i>Can't call method "dbID" on an undefined value at
      ~/ensembl-compara/modules/Bio/EnsEMBL/Compara/DBSQL/HomologyAdaptor.pm
      line 37.</i><br>
    <br>
    Please, use that script and check that it works (with the original
    gene identifier). Then change the identifier to get the data for
    your gene of interest and check that it still works.<br>
    <br>
    If you get a failure with the original script, there is something
    wrong with your setup (API installation, access to the database,
    etc). If you get a failure using a different gene identifier, then
    you are using a invalid gene identifier.<br>
    <br>
    I hope this helps<br>
    <br>
    Javier<br>
    <br>
    On 16/11/11 18:13, James Blackshaw wrote:
    <blockquote cite="mid:4EC3FD61.10607@mrc-mbu.cam.ac.uk" type="cite">Hello,
      <br>
      <br>
      Just a bit of a bump on this as I can't get the script to work and
      I've checked that I am using version 64 of Homologene. I could
      really do with a decent way to get homologs for a given species
      out of Ensembl for a list of genes. Sadly Biomart isn't much use
      as I cant get homologs from yeast or mouse to plants, they're on
      separate filters. Does anyone on this list have a similar script
      they might be willing to send me to see if I can get it to return
      anything?
      <br>
      <br>
      Regards,
      <br>
      James
      <br>
      <blockquote type="cite">
        <blockquote type="cite">
          <blockquote type="cite">Hi,
            <br>
            this still doesn't work, I get the error:
            <br>
            "Can't call method "fetch_by_source_stable_id" on an
            undefined value at
            homology_workshop_getAllHomologuesForGene.pl line 28."
            <br>
            <br>
            I get the following error off the script for comparing all
            homologs between two species. A pity, as that is otherwise
            perfect for what I want.
            <br>
            "Can't call method "get_HomologyAdaptor" on an undefined
            value at homology_getAllHomologuesBetween2Species.pl line
            24."
            <br>
            <br>
            Is there anywhere I'd be able to check the version number of
            the API I have?
            <br>
            <br>
            Regards,
            <br>
            -James
            <br>
            <br>
            On 14/11/2011 12:02, Matthieu Muffato wrote:
            <br>
            <blockquote type="cite">Hi James
              <br>
              <br>
              I just hope there is no misunderstanding with the line
              numbers. Your script seems to work well, at least here,
              replacing the
              $homology_adaptor->fetch_all_by_Member($member) line by
$homology_adaptor->fetch_all_by_Member($member->gene_member)
              <br>
              <br>
              I can have the "dbID" error message when applying both
              changes. They are actually not compatible. Either you
              specify the gene ID in the first place, and stick with
              $homology_adaptor->fetch_all_by_Member($member), or you
              keep the protein ID, and you add the "->gene_member"
              <br>
              <br>
              There is a script in the scripts/examples directory of the
              ensembl-compara repository, named
              homology_workshop_getAllHomologuesForGene.pl, that does
              the job if you know the gene name.
              <br>
              <br>
              Regards,
              <br>
              Matthieu
              <br>
              <br>
              On 14/11/11 11:41, James Blackshaw wrote:
              <br>
              <blockquote type="cite">Hi Matthieu,
                <br>
                Changing Line 16 doesn't help, I get the same error
                reported.
                <br>
                Changing line 25 gives me a new error though.
                <br>
                Can't call method "dbID" on an undefined value at
                <br>
                /usr/mbu/software/ensembl/ensembl-compara/modules/Bio/EnsEMBL/Compara/DBSQL/HomologyAdaptor.pm
                <br>
                line 37.
                <br>
                <br>
                What I'm trying to do is get the homologs for a list of
                proteins or
                <br>
                associated genes, either works. I'm surprised there's
                not already a
                <br>
                script about for it, but can't find on on the mailing
                list.
                <br>
                <br>
                -James
                <br>
                <br>
                <br>
                On 14/11/2011 11:25, Matthieu Muffato wrote:
                <br>
                <blockquote type="cite">Hi James
                  <br>
                  <br>
                  In Comparam the homologies are stored at the gene
                  level. Because your
                  <br>
                  Member object represents a peptide, the homology list
                  that you
                  <br>
                  retrieve is empty.
                  <br>
                  <br>
                  You can either change the line 25 to
                  <br>
                  my $homologies =
                  <br>
$homology_adaptor->fetch_all_by_Member($member->gene_member);
                  <br>
                  <br>
                  or change the line 16 to
                  <br>
                  my $member =
                  $member_adaptor->fetch_by_source_stable_id("ENSEMBLGENE",
                  <br>
                  ****) with an Ensembl gene ID if you know it
                  <br>
                  <br>
                  to have all the homologies of your favourite gene
                  <br>
                  <br>
                  Hope this helps,
                  <br>
                  Matthieu
                  <br>
                  <br>
                  On 14/11/11 11:15, James Blackshaw wrote:
                  <br>
                  <blockquote type="cite">Hi,
                    <br>
                    I am using the code from the API installation page
                    and that page talks
                    <br>
                    about version 64.
                    <br>
<a class="moz-txt-link-freetext" href="http://www.ensembl.org/info/docs/api/api_installation.html">http://www.ensembl.org/info/docs/api/api_installation.html</a>
                    <br>
                    <br>
                    This is my output under verbose, looks like it is
                    connecting.
                    <br>
                    Odd number of elements in hash assignment at
                    <br>
                    /usr/mbu/software/ensembl/ensembl/modules/Bio/EnsEMBL/Utils/Argument.pm
                    <br>
                    line 148.
                    <br>
                    Transcript:ENSDART00000112153
                    Gene:ENSDARG00000090113 Chr:19
                    <br>
                    Start:33519855 End:33522332
                    <br>
                    Can't call method "get_all_Member_Attribute" on an
                    undefined value at
                    <br>
                    sandbox3.pl line 47.
                    <br>
                    <br>
                    Regards,
                    <br>
                    James
                    <br>
                    <br>
                    <br>
                    On 11/11/2011 20:20, Javier Herrero wrote:
                    <br>
                    <blockquote type="cite">Hi James
                      <br>
                      <br>
                      This error is typical when you fail to connect to
                      the database.
                      <br>
                      <br>
                      I suspect you are using the HEAD code instead of
                      the branch 64. The
                      <br>
                      head code is already configured for connecting to
                      the forthcoming
                      <br>
                      database. Please switch your code to the 64 branch
                      and try again:
                      <br>
                      <br>
                      cvs up -r branch-ensembl-64
                      <br>
                      <br>
                      Regards
                      <br>
                      <br>
                      Javier
                      <br>
                      <br>
                      On 11/11/11 19:29, Jan Vogel wrote:
                      <br>
                      <blockquote type="cite">Hi James,
                        <br>
                        <br>
                        the first script from the powerpoint works for
                        me w/o problems or
                        <br>
                        modifications. I've tried schema 62 and schema
                        64 API's.
                        <br>
                        <br>
                        <br>
                        The second one ( 'from the list' ) had some
                        minor problems. It works
                        <br>
                        like this :
                        <br>
                        <br>
                        my $member =
                        <br>
                        $member_adaptor->fetch_by_source_stable_id('ENSEMBLGENE','ENSG00000004059');
                        <br>
                        <br>
                        <br>
                        <br>
                        or
                        <br>
                        <br>
                        my $member =
                        <br>
                        $member_adaptor->fetch_by_source_stable_id(undef,'ENSG00000004059');
                        <br>
                        <br>
                        I did not try the zfish protein.
                        <br>
                        <br>
                        Hth,
                        <br>
                        Jan
                        <br>
                        <br>
                        On Nov 11, 2011, at 9:50 AM, James Blackshaw
                        wrote:
                        <br>
                        <br>
                        <blockquote type="cite">Hi,
                          <br>
                          I've been trying to put together some scripts
                          for finding the
                          <br>
                          homolgies
                          <br>
                          for some lists of genes I'm interested in, but
                          I keep getting errors
                          <br>
                          with the "fetch" methods.
                          <br>
                          <br>
                          "Can't call method "fetch_by_source_stable_id"
                          on an undefined
                          <br>
                          value at
                          <br>
                          sandbox3.pl<a class="moz-txt-link-rfc2396E" href="http://sandbox3.pl/"><http://sandbox3.pl/></a>  line
                          15."
                          <br>
                          <br>
                          I've used one script taken from a presentation
                          by Stephen
                          <br>
                          Fitzgerald at
                          <br>
                          Edinburgh, and another from this maining list.
                          I'm including both.
                          <br>
                          <br>
                           From the powerpoint:
                          <br>
                          use strict;
                          <br>
                          use Bio::EnsEMBL::Registry;
                          <br>
                          my $reg = "Bio::EnsEMBL::Registry";
                          <br>
                          <br>
                          $reg->load_registry_from_db(
                          <br>
-host=>"ensembldb.ensembl.org<a class="moz-txt-link-rfc2396E" href="http://ensembldb.ensembl.org/"><http://ensembldb.ensembl.org/></a>",
                          <br>
                          -user =>  "anonymous");
                          <br>
                          <br>
                          <br>
                          my $ma = $reg->get_adaptor(
                          <br>
                          "Multi", "compara", "Member");
                          <br>
                          my $member =
                          $ma->fetch_by_source_stable_id(
                          <br>
                          "ENSEMBLGENE", "ENSG00000000971");
                          <br>
                          <br>
                          my $homology_adaptor = $reg->get_adaptor(
                          <br>
                          "Multi", "compara", "Homology");
                          <br>
                          <br>
                          my $homologies = $homology_adaptor->
                          <br>
                          fetch_all_by_Member($member);
                          <br>
                          <br>
                          foreach my $this_homology (@$homologies) {
                          <br>
                          print $this_homology->description, "\n";
                          <br>
                          my $member_attributes = $this_homology->
                          <br>
                          get_all_Member_Attribute();
                          <br>
                          foreach my $this_mem_attr
                          (@$member_attributes) {
                          <br>
                          my ($this_member, $this_attribute) =
                          <br>
                          @$this_mem_attr;
                          <br>
                          print $this_member->genome_db->name, "
                          ",
                          <br>
                          $this_member->source_name, " ",
                          <br>
                          $this_member->stable_id, "\n";
                          <br>
                          }
                          <br>
                          print "\n";
                          <br>
                          }
                          <br>
                          <br>
                          ==========================================
                          <br>
                          <br>
                           From the list:
                          <br>
                          use Bio::EnsEMBL::Registry;
                          <br>
Bio::EnsEMBL::Registry->load_registry_from_db(
                          <br>
                          -host =>  'ensembldb.ensembl.org',
                          <br>
                          -user =>  'anonymous',
                          <br>
                          -port =>  5306);
                          <br>
                          my $member_adaptor =
                          Bio::EnsEMBL::Registry->get_adaptor(
                          <br>
                          'Multi','compara','Member');
                          <br>
                          <br>
                          # fetch a Member
                          <br>
                          # get the MemberAdaptor
                          <br>
                          my $member_adaptor =
                          <br>
Bio::EnsEMBL::Registry->get_adaptor('Multi','compara','Member');
                          <br>
                          <br>
                          # fetch a Memmy $member =
                          <br>
                          $member_adaptor->fetch_by_source_stable_id('ENSEMBLPROTEIN','ENSG00000004059');
                          <br>
                          <br>
                          my $member =
                          <br>
                          $member_adaptor->fetch_by_source_stable_id('ENSEMBLPEP','ENSDARP00000103634');
                          <br>
                          <br>
                          # print out some information about the Member
                          <br>
                          print $member->description, "\n";
                          <br>
                          <br>
                          <br>
                          <br>
                          my $homology_adaptor =
                          Bio::EnsEMBL::Registry->get_adaptor('Multi',
                          <br>
                          'compara', 'Homology');
                          <br>
                          my $homologies =
                          $homology_adaptor->fetch_all_by_Member($member);
                          <br>
                          <br>
                          # That will return a reference to an array
                          with all
                          <br>
                          homologies(orthologues in
                          <br>
                          # other species and paralogues in the same
                          one)
                          <br>
                          # Then for each homology, you can get all the
                          Members implicated
                          <br>
                          <br>
                          foreach my $homology (@{$homologies}) {
                          <br>
                          # You will find different kind of description
                          <br>
                          # UBRH, MBRH, RHS, YoungParalogues
                          <br>
                          # see
                          ensembl-compara/docs/docs/schema_doc.html for
                          more details
                          <br>
                          <br>
                          print $homology->description," ",
                          $homology->subtype,"\n";
                          <br>
                          # And if they are defined dN and dS related
                          values
                          <br>
                          print " dn ", $homology->dn,"\n";
                          <br>
                          print " ds ", $homology->ds,"\n";
                          <br>
                          print " dnds_ratio ",
                          $homology->dnds_ratio,"\n";
                          <br>
                          }
                          <br>
                          <br>
                          my $homology = $homologies->[0];
                          <br>
                          # take one of the homologies and lookinto it
                          <br>
                          <br>
                          foreach my $member_attribute
                          <br>
                          (@{$homology->get_all_Member_Attribute}) {
                          <br>
                          <br>
                          # for each Member, you get information on the
                          Member specifically
                          <br>
                          and in
                          <br>
                          # relation to the homology relation via
                          Attribute object
                          <br>
                          <br>
                          my ($member, $attribute) =
                          @{$member_attribute};
                          <br>
                          print (join " ", map { $member->$_ }
                          qw(stable_id taxon_id))."\n";
                          <br>
                          print (join " ", map { $attribute->$_ }
                          qw(perc_id
                          <br>
                          perc_posperc_cov))."\n";
                          <br>
                          <br>
                          }
                          <br>
====================================================
                          <br>
                          <br>
                          <br>
                          <br>
                          James Blackshaw
                          <br>
                          PhD Student
                          <br>
                          MRC Mitochondrial Biology Unit
                          <br>
                          <br>
                          <br>
_______________________________________________
                          <br>
                          Dev mailing list
                          <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a><a class="moz-txt-link-rfc2396E" href="mailto:Dev@ensembl.org"><mailto:Dev@ensembl.org></a>
                          <br>
                          List admin (including subscribe/unsubscribe):
                          <br>
                          <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
                          <br>
                          Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
                          <br>
                        </blockquote>
                        <br>
                        <br>
                        _______________________________________________
                        <br>
                        Dev mailing
                        <a class="moz-txt-link-abbreviated" href="mailto:listDev@ensembl.org">listDev@ensembl.org</a><a class="moz-txt-link-rfc2396E" href="mailto:Dev@ensembl.org"><mailto:Dev@ensembl.org></a>
                        <br>
                        List admin (including
                        <br>
                        subscribe/unsubscribe):<a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
                        <br>
                        Ensembl Blog:<a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
                        <br>
                      </blockquote>
                      -- <br>
                      Javier Herrero, PhD
                      <br>
                      Ensembl Compara Project Leader
                      <br>
                      European Bioinformatics Institute (EMBL-EBI)
                      <br>
                      Wellcome Trust Genome Campus, Hinxton
                      <br>
                      Cambridge - CB10 1SD - UK
                      <br>
                      <br>
                      <br>
                      _______________________________________________
                      <br>
                      Dev mailing
                      <a class="moz-txt-link-abbreviated" href="mailto:listDev@ensembl.org">listDev@ensembl.org</a><a class="moz-txt-link-rfc2396E" href="mailto:Dev@ensembl.org"><mailto:Dev@ensembl.org></a>
                      <br>
                      List admin (including
                      <br>
                      subscribe/unsubscribe):<a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
                      <br>
                      Ensembl Blog:<a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
                      <br>
                    </blockquote>
                    <br>
                    <br>
                    _______________________________________________
                    <br>
                    Dev mailing list <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a>
                    <br>
                    List admin (including subscribe/unsubscribe):
                    <br>
                    <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
                    <br>
                    Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
                    <br>
                  </blockquote>
                  <br>
                </blockquote>
              </blockquote>
              <br>
            </blockquote>
            <br>
            _______________________________________________
            <br>
            Dev mailing list    <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a>
            <br>
            List admin (including subscribe/unsubscribe):
            <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
            <br>
            Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
            <br>
          </blockquote>
          ---
          <br>
          Andrew Yates                   Ensembl Core Software Project
          Leader
          <br>
          EMBL-EBI                       Tel: +44-(0)1223-492538
          <br>
          Wellcome Trust Genome Campus   Fax: +44-(0)1223-494468
          <br>
          Cambridge CB10 1SD, UK         <a class="moz-txt-link-freetext" href="http://www.ensembl.org/">http://www.ensembl.org/</a>
          <br>
          <br>
        </blockquote>
        <br>
      </blockquote>
      <br>
      <br>
      _______________________________________________
      <br>
      Dev mailing list    <a class="moz-txt-link-abbreviated" href="mailto:Dev@ensembl.org">Dev@ensembl.org</a>
      <br>
      List admin (including subscribe/unsubscribe):
      <a class="moz-txt-link-freetext" href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a>
      <br>
      Ensembl Blog: <a class="moz-txt-link-freetext" href="http://www.ensembl.info/">http://www.ensembl.info/</a>
      <br>
      <br>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Javier Herrero, PhD
Ensembl Compara Project Leader
European Bioinformatics Institute (EMBL-EBI)
Wellcome Trust Genome Campus, Hinxton
Cambridge - CB10 1SD - UK</pre>
  </body>
</html>