<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-tab-span" style="white-space:pre">     </span><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-style-span" style="white-space: normal; ">Hi James, </span><div style="white-space: normal; "><br></div><div style="white-space: normal; ">the first script from the powerpoint works for me w/o problems or modifications. I've tried schema 62 and schema 64 API's. </div><div style="white-space: normal; "><br></div><div style="white-space: normal; "><br></div><div style="white-space: normal; ">The second one ( 'from the list' ) had some minor problems. It works like this : </div><div style="white-space: normal; "><br></div><div style="white-space: normal; "><font class="Apple-style-span" face="Courier">my $member = $member_adaptor->fetch_by_source_stable_id('ENSEMBLGENE','ENSG00000004059');</font></div><div style="white-space: normal; "><font class="Apple-style-span" face="Courier"><br></font></div><div style="white-space: normal; "><font class="Apple-style-span" face="Courier">or </font></div><div style="white-space: normal; "><font class="Apple-style-span" face="Courier"><br></font></div><div style="white-space: normal; "><font class="Apple-style-span" face="Courier"><div style="font-family: Helvetica; "><font class="Apple-style-span" face="Courier">my $member = $member_adaptor->fetch_by_source_stable_id(undef,'ENSG00000004059');</font></div><div><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier"><br></font></font></div><div><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier">I did not try the zfish protein. </font></font></div><div><font class="Apple-style-span" face="Helvetica"><font class="Apple-style-span" face="Courier"><br></font></font></div><div>Hth, </div><div>   Jan </div></font></div><div style="white-space: normal; "><div><br></div><div><div>On Nov 11, 2011, at 9:50 AM, James Blackshaw wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hi,<br>I've been trying to put together some scripts for finding the 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 value at<br><a href="http://sandbox3.pl/">sandbox3.pl</a> line 15."<br><br>I've used one script taken from a presentation by Stephen 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=>"<a href="http://ensembldb.ensembl.org/">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>my $member =<br>$member_adaptor->fetch_by_source_stable_id('ENSEMBLPEP','ENSDARP00000103634');<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 (@{$homology->get_all_Member_Attribute}) {<br><br> # for each Member, you get information on the Member specifically 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 href="mailto:Dev@ensembl.org">Dev@ensembl.org</a><br>List admin (including subscribe/unsubscribe): <a href="http://lists.ensembl.org/mailman/listinfo/dev">http://lists.ensembl.org/mailman/listinfo/dev</a><br>Ensembl Blog: <a href="http://www.ensembl.info/">http://www.ensembl.info/</a><br></div></blockquote></div><div><br></div></div></span></div></body></html>