<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Matthieu, <div><br></div><div>sorry to bother you again. I did some reading of former emails and modified your script a little. But, it seems my modification is very limited that now I can only print out the paralogous genes pairwise, however, can not print them as a group. </div><div><br></div><div>could you please have a look the script I modified? It will be great if you can give some hints that how to do this job between two genomes. </div><div><br></div><div>Thanks a lot! </div><div><br></div><div>Shaohua </div><div><br></div><div><div>use Bio::EnsEMBL::Registry;</div><div>use Bio::SimpleAlign;</div><div>use Bio::AlignIO;</div><div>my $reg="Bio::EnsEMBL::Registry";</div><div>$reg->load_registry_from_db(</div><div>    -host=>"<a href="http://ensembldb.ensembl.org">ensembldb.ensembl.org</a>",</div><div>    -user => "anonymous");</div><div><br></div><div><br></div><div>my $mlss_adaptor = $reg->get_adaptor('Multi', 'compara', 'MethodLinkSpeciesSet');</div><div>my $mlss = $mlss_adaptor->fetch_by_method_link_type_registry_aliases("ENSEMBL_PARALOGUES", ["human"]);</div><div>my $homology_adaptor = $reg->get_adaptor("Multi", "compara", "Homology");</div><div>my $all_paralogues = $homology_adaptor->fetch_all_by_MethodLinkSpeciesSet_orthology_type($mlss, "within_species_paralog");</div><div><br></div><div><br></div><div>my $count;</div><div><br></div><div>while (my $homol = shift @{$all_paralogues}) {</div><div><span class="Apple-tab-span" style="white-space:pre">     </span>$count++;<span class="Apple-tab-span" style="white-space:pre">   </span></div><div><span class="Apple-tab-span" style="white-space:pre">     </span>print "group id $count\n";</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre">     </span>foreach my $member_attribute (@{$homol->get_all_Member_Attribute}) {</div><div><span class="Apple-tab-span" style="white-space:pre">      </span>my ($member, $attribute) = @{$member_attribute};</div><div><span class="Apple-tab-span" style="white-space:pre">     </span>print $member->stable_id;}</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>print "\n";</div><div><span class="Apple-tab-span" style="white-space:pre">                                        </span>     }</div><div><br></div><div><div>On Apr 17, 2012, at 3:17 PM, Matthieu Muffato wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dear Shaohua<br><br>The most efficient way is probably to use the fetch_all_by_MethodLinkSpeciesSet_orthology_type() method from the HomologyAdaptor<br><br>You first have to create a MethodLinkSpeciesSet object<br>my $mlss_adaptor = $reg->get_adaptor("Multi", "compara", "MethodLinkSpeciesSet");<br>my $mlss = $mlss_adaptor->fetch_by_method_link_type_registry_aliases("ENSEMBL_PARALOGUES", ["human"]);<br>This object describes which kind of data you want, and on which species<br><br>Then, you can retrieve the homologies:<br>my $homology_adaptor = $reg->get_adaptor("Multi", "compara", "Homology");<br>my $all_paralogues = $homology_adaptor->fetch_all_by_MethodLinkSpeciesSet_orthology_type($mlss, "within_species_paralog");<br><br>This method can be extended to orthologues and to pairs of species. It is the fastest when it comes to fetch big sets of homologues<br><br>Hope this helps,<br>Matthieu<br><br>On 17/04/12 10:45, shaohua fan wrote:<br><blockquote type="cite">Dear all,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">As a newbie of Ensembl compara API, I want to ask whether there is a way to fetch all the within species paralogous genes of one specified genome by using the compara API? I have searched the former emails and Ensembl website and only found the solution for the single gene in the tutorial of compara API.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks a lot!<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">shaohua<br></blockquote></div></blockquote></div><br><div apple-content-edited="true">
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">-----------------------------------------------------------------------------------</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Shaohua Fan, Ph.D student.</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Professor Axel Meyer's Lab</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Department of Biology (Fach M617)</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">University of Konstanz</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Universitaetsstrasse 10</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">D-78457 Konstanz</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; ">Germany</span><span class="Apple-style-span" style="font-family: Arial; font-size: 13px; "><br></span></div></div>
</div>
<br></div></body></html>