<div class="gmail_quote"><p>Hi Javier</p>
<p>Correct me if I am wrong but won't the paralog query give you the three sets of genes in hsap? I would like to, for instance, get hsap1 without getting hsap2, hsap2', or hsap3. </p>
<p>I wrote the following script to recursively get all homologies of all types except paralog that I think should get and print out all of the members of the gene family. </p><p>$stable = shift;</p><p></p><p>my %these_species;</p>
<p>foreach (9606, 10090){</p><p> $these_species{$_} = 1;</p><p>}</p><p>my %relationships;</p><p>foreach ("ortholog_one2one", "ortholog_one2many", "ortholog_many2one", </p><p> "ortholog_many2many", "possible_ortholog", "apparent_ortholog_one2one"){</p>
<p> $relationships{$_} = 1;</p><p>}</p><p><br></p><p>my $homology_adaptor = $reg->get_adaptor("Compara", "compara", "Homology");</p><p>my $member_adaptor = $reg->get_adaptor('Multi', 'compara', 'Member');</p>
<p>my %these_genes;</p><p>my %query_used;</p><p>single_gene($stable, \%relationships, \%these_species, $member_adaptor, $homology_adaptor, \%query_used);</p><p></p><p>while ( my ($key, $value) = each(%these_genes) ) {</p>
<p> print "$key => $value\n";</p><p> }</p><p><br></p><p></p><p>sub single_gene</p><p>{</p><p> #($stable, %relationships, %these_species, $member_adaptor, $homology_adaptor)</p>
<p> my $this_stable = @_[0];</p><p> if ($query_used{$this_stable}){</p><p> return;</p><p> }</p><p> $query_used{$this_stable} = 1;</p><p><br></p><p> my $member = $member_adaptor->fetch_by_source_stable_id("ENSEMBLGENE", $this_stable);</p>
<p> if (defined $member){</p><p> my $all_homologies = $homology_adaptor->fetch_by_Member($member);</p><p> foreach my $homology (@{$all_homologies}) {</p><p> if ($relationships{$homology->description}){</p>
<p> foreach my $attr (@{$homology->get_all_Member_Attribute}) {</p><p> my ($member, $attribute) = @{$attr};</p><p> if ($these_species{$member->taxon_id}){</p>
<p> my $new_stable = $member->stable_id;</p><p> $these_genes{$new_stable} = 1;</p><p> single_gene($new_stable, \%relationships, \%these_species, </p>
<p> $member_adaptor, $homology_adaptor, \%query_used);</p><p><br></p><p> }</p><p> }</p><p> }</p>
<p> }</p><p> }</p><p> return;</p><div><div><p>}</p><div><br></div><p></p>
<div class="gmail_quote">On Feb 13, 2012 6:48 AM, "Javier Herrero" <<a href="mailto:jherrero@ebi.ac.uk" target="_blank">jherrero@ebi.ac.uk</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">
Hi Jason<br>
<br>
You can use the HomologyAdaptor (<a href="http://www.ensembl.org/info/docs/Doxygen/compara-api/classBio_1_1EnsEMBL_1_1Compara_1_1DBSQL_1_1HomologyAdaptor.html" target="_blank">http://www.ensembl.org/info/docs/Doxygen/compara-api/classBio_1_1EnsEMBL_1_1Compara_1_1DBSQL_1_1HomologyAdaptor.html</a>)
to get these relationships. You can try either the
fetch_all_by_Member_paired_species or the
fetch_all_by_Member_paired_species methods. For instance,<br>
<br>
$homology_adaptor->fetch_all_by_Member_paired_species($hsap1_member,
"mus_musculus", "ENSEMBL_ORTHOLOGUES");<br>
<br>
will return [$mmus1_member], and<br>
<br>
$homology_adaptor->fetch_all_by_Member_paired_species($hsap2_member,
"mus_musculus", "ENSEMBL_ORTHOLOGUES");<br>
<br>
will return [$mmus2_member, $mmus2'_member]. If you want to get the
intra-species paralogues as well, you can add:<br>
<br>
$homology_adaptor->fetch_all_by_Member_paired_species($hsap2_member,
"homo_sapiens", "ENSEMBL_PARALOGUES");<br>
<br>
I hope this helps<br>
<br>
Javier<br>
<br>
On 12/02/12 01:24, Jason Merkin wrote:
<blockquote type="cite">Hello. I am trying to identify duplications that have
occured within a group of species. I have gone through the
tutorial and the mailing list archives and couldn't find anything
on it. I will use the example on the webpage that explains the
homology definitions (<a href="http://ensembl.genomics.org.cn:8058/info/docs/compara/homology_method.html" target="_blank">http://ensembl.genomics.org.cn:8058/info/docs/compara/homology_method.html</a>)
to illustrate what I am trying to do. Using just human and mouse,
as on the diagram, I would like to query with Hsap1 and get the
set of (Hsap1, Mmus1); query with Hsap2 and get (Hsap2, Hsap2',
Mmus2, Mmus2'); and query with Hsap3 and get (Hsap3, Mmus3,
Mmus3'). Is there a way to specify the homology type and, more
importantly, restrict the species to be considered for definining
the homology? <br clear="all">
<br>
Thanks for any help,<br>
Jason Merkin<br>
<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
Dev mailing list <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a>
List admin (including subscribe/unsubscribe): <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a>
</pre>
</blockquote>
<br>
<pre cols="72">--
Javier Herrero, PhD
Ensembl Coordinator and Ensembl Compara Project Leader
European Bioinformatics Institute (EMBL-EBI)
Wellcome Trust Genome Campus, Hinxton
Cambridge - CB10 1SD - UK</pre>
</div>
<br>_______________________________________________<br>
Dev mailing list <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
List admin (including subscribe/unsubscribe): <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
<br></blockquote></div>
</div></div></div><br>