Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Thank you both for the help and for your time. I'm stuck with this problem and do not know how to fix it. I made this change that you propose tfrayner but still gives an error:
-------------------- EXCEPTION -------------------- MSG: [Bio::EnsEMBL::Compara::Member=HASH(0x9adfe40)] must be a Bio::En +sEMBL::Compara::MethodLinkSpeciesSet object STACK Bio::EnsEMBL::Compara::DBSQL::HomologyAdaptor::fetch_all_by_Meth +odLinkSpeciesSet_orthology_type_subtype /home/david/src/ensembl-compa +ra/modules/Bio/EnsEMBL/Compara/DBSQL/ STACK toplevel ---------------------------------------------------

I started with perl and Ensembl recently and I do not quite understand yet. The documentation is here:

So there should show only the orthologous of Mammalia which are one-to-one.This another code works and returns all species homologues, but I only want mammalian orthologues.
use strict; use warnings; use Bio::EnsEMBL::Registry; ## Load the registry automatically my $reg = "Bio::EnsEMBL::Registry"; $reg->load_registry_from_url('mysql://anonymous@ensembldb.ensembl. +org'); ## Get the human gene adaptor my $human_gene_adaptor = $reg->get_adaptor("Homo sapiens", "core", "Gene"); ## Get the compara member adaptor my $member_adaptor = $reg->get_adaptor("Compara", "compara", "Member"); ## Get the compara homology adaptor my $homology_adaptor = $reg->get_adaptor("Compara", "compara", "Homology"); my @BreastCANgenes = ('ABCA3','ABCB10','ABCB8','ACADM'); open ("archivo", ">homologos.txt"); my $gen; foreach $gen (@BreastCANgenes) { ## Get all existing gene object my $ctdp1_genes = $human_gene_adaptor->fetch_all_by_external_name( +$gen); ## For each of these genes... foreach my $ctdp1_gene (@$ctdp1_genes) { ## Get the compara member my $member = $member_adaptor->fetch_by_source_stable_id( "ENSEMBLGENE", $ctdp1_gene->stable_id); ## Get all the homologues my $all_homologies = $homology_adaptor->fetch_all_by_Member($mem +ber); ## For each homology foreach my $this_homology (@$all_homologies) { ## print the description (type of homology) and the ## subtype (taxonomy level of the event: duplic. or speciation +) print $this_homology->description, " [", $this_homology->subty +pe, "]\n"; print archivo $this_homology->description, " [", $this_homolog +y->subtype, "]\n"; ## print the members in this homology my $members = $this_homology->get_all_Members(); foreach my $this_member (@$members) { print archivo $this_member->source_name, " ", $this_member->stable_id, " (", $this_member->genome_db->name, ")\n" } print "\n"; } } } close ("archivo");

In reply to Re^2: Problems with ensembl perl script by bioinfo
in thread Problems with ensembl perl script by bioinfo

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others musing on the Monastery: (10)
    As of 2017-12-18 16:00 GMT
    Find Nodes?
      Voting Booth?
      What programming language do you hate the most?

      Results (492 votes). Check out past polls.