<html><head></head><body><p>Dear Chris</p>
<p>First at all, it seems your script is correct. See http://www.ensembl.org/Homo_sapiens/Gene/Family?g=ENSG00000127054;r=1:1246965-1260071 for the list of families on the web.</p>
<p>We expect some genes to be part of several families. This is because we cluster the proteins, not the genes themselves. In the case of this gene, there are many different alternative transcripts that have been annotated. The richness of annotation comes from Havana, the group at the Sanger doing the manual annotation of the genome. In this case, a few of the transcripts appear as singletons simply because the resulting protein is not similar enough to any the other proteins used in this analysis. The set of proteins we use include all the Ensembl proteins plus all the metazoan proteins in UniProt.</p>
<p>If you wish to remove the singleton's, you can test the number of protein members in the family. Here is an untested snippet that would do this:</p>
<p>my $num = grep {$_->source_name eq "ENSEMBLPEP"} @{$family->get_all_Members}</p>
<p>I hope this helps</p>
<p>Javier</p>

<p>Sent from my Kindle Fire</p>
<br><br><div style='font-size:10.0pt;font-family:"Tahoma","sans-serif";padding:3.0pt 0in 0in 0in'>
<hr style='border:none;border-top:solid #B5C4DF 1.0pt'>
<b>From:</b> Christopher Kelly <cpjkelly@gmail.com><br>
<b>Sent:</b> Tue Jun 12 01:36:57 GMT+01:00 2012<br>
<b>To:</b> Ensembl developers list <dev@ensembl.org><br>
<b>Subject:</b> [ensembl-dev] Ensembl Compara Member Objects Associated With        Multiple Single-Member Family Stable IDs<br>
</div>
<br>
<pre style="white-space: pre-wrap; word-wrap:break-word; font-family: sans-serif">Hello all, <br /><br />I have written a script to fetch all members in the ensembl compara 67 database using the member_adaptor->fetch_all_by_source_genome_db_id() method. <br /><br />Next the script fetches all families associated with each member that was fetched in the previous step, using family_adaptor->fetch_all_by_Member().<br /><br />When invoked, the script is passed the genome ids of each species to fetch family/member data for, and uses ENSEMBLGENE as the source for member_adaptor->fetch_all_by_source_genome_db_id. <br /><br />The script outputs list files for each scaffold, with the stable id of each fetched member placed in its respective scaffold file. In addition, the script outputs a file (families file) containing the stable ids of each family next to the members associated with each family, with singleton members simply placed beside their own stable_id. <br /><br />Th
 e
problem with this script (and where I hope someone can provide guidance) is that, for some genes, the families file list several families. For such genes, the first family listed usually contains members other than that gene, but the subsequent listings are family stable ids that link to families containing only that gene. For example, the following is an excerpt from the families file generated from an the homo_sapiens genome_db:<br /><br /><br />ENSG00000160087   ENSFM00580000910228<br />ENSG00000162572  ENSFM00250000001147<br />ENSG00000131584  ENSFM00250000000926<br />ENSG00000131584  ENSFM00550000746913<br />ENSG00000131584  ENSFM00550000756970<br />ENSG00000169972  ENSFM00250000006052<br />ENSG00000127054  ENSFM00280000058718<br />ENSG00000127054  ENSFM00610000969020<br />ENSG00000127054  ENSFM00610000969699<br />ENSG00000127054  ENSFM00610000969700<br />ENSG00000127054  ENSFM00610000969886<br />ENSG00000127054  ENSFM00610000973240<br />ENSG00000127054  ENSFM00610000973241<br
/>ENSG00000127054    ENSFM00560000783793<br />ENSG00000127054  ENSFM00610000973242<br />ENSG00000127054  ENSFM00610000969761<br />ENSG00000127054  ENSFM00610000973243<br /><br />Notice that the gene ENSG00000127054 is associated with multiple unique families. When entered into the ensembl genome browser, the first family entry for this gene returns a family with multiple orthologous members (which is expected). However, the subsequent family entries for this same gene, when entered into the ensembl genome browser, all return a family whose only member is ENSG00000127054. In fact, as far as I can tell, each of these family entries is identical, aside from stable id. <br /><br />Would anyone be able to provide me with insight regarding:<br /><br />a) The reason for multiple entries for singleton families(I am assuming that the problem is not due to different assemblies since I am searching only ensembl compare release 67).<br /><br />and/or <br /><br />b) How I can filter out these
singleton families reliably using the API.<br /><br />Thanks in advance,<br /><br />Chris Kelly<br /><br /><br />Here is my script, trimmed of pieces irrelevant to this question:<br /><br /><br /><br /><br /><br /><br />#!/usr/bin/perl<br /><br />use strict;<br />use warnings;<br />use Bio::EnsEMBL::Registry;<br />use Getopt::Long; # for GetOptions used for command line args<br />use Scalar::Util qw(openhandle); # for openhandle()<br /><br />my @genome_db_id_list = ();<br />my $output_file = "families.table"; #output file<br /><br />#Get command line arguments<br />GetOptions("id=s" => \@genome_db_id_list, "output=s" => \$output_file,);<br /><br />unless (@genome_db_id_list){<br />    die "No genome_db_id specified. Exiting...";<br />}<br />my $registry='Bio::EnsEMBL::Registry';<br /><br />print "\n\nLoading registry...";<br /><br />$registry->load_registry_from_db(<br />    -host => '<a href="http://ensembldb.ensembl.org">ensembldb.ensembl.org</a>',<br />    -use
 r =>
'anonymous',<br />    -port => '5306'); # add -verbose => '1' for more verbose output<br /><br />print "Done";<br /><br />#get member adaptor<br />my $member_adaptor = $registry->get_adaptor('Multi', 'compara', 'Member');<br /><br />my $family_adaptor = $registry->get_adaptor('Multi', 'compara', 'Family');<br /><br />my @member_list;<br /><br />#outside for-loop to iterate body of program for each genome_id specified on the command line<br />foreach my $species_genome_db_id (@genome_db_id_list){<br /><br />    #Fetch all members of given species (specified by genome_db_id) from given source.<br />    #Source options are: 'ENSEMBLGENE', 'ENSEMBLPEP', 'Uniprot/SPTREMBL', <br />    #'Uniprot/SWISSPROT', 'ENSEMBLTRANS', 'EXTERNALCDS'.<br />    #Each species has a unique genome_db_id in the current ensembl compara db version.<br />    sub get_members_list {<br />        <br />        my($source, $genome_db_id, @members) = @_;<br />    <br />        #fetch members list 
 -
returns listref of members<br />        my $new_members_ref = $member_adaptor->fetch_all_by_source_genome_db_id("$source", "$genome_db_id");<br />    <br />        #dereference members list ref<br />        my @new_members = @$new_members_ref;<br />    <br />        #join new_members list to the list of members<br />        push(@members, @new_members);<br />        @members;<br />    }   <br />    <br />    <br />    #Get members from all sources for the given genome_db_id (denoting a specific species)<br />    @member_list = get_members_list('ENSEMBLGENE', $species_genome_db_id, @member_list);<br />    <br />    #open the output file for overwriting<br />    open (OUTPUT, ">$output_file") or die "Could not open: $!";<br />    <br />    #initialise @families_list as an empty list<br />    my @families_list=();<br />    <br />    #Fetch all families that each member belongs to, as well as<br />    #create .lst files for each chromosome , and print member stable ids<br /
 >    #
and strand orientation to .lst files<br />    foreach my $single_member (@member_list) {<br />        <br />        #get member chr strand and name of for use by subsequent commands<br />        my $chr_name = $single_member->chr_name();<br />        my $chr_strand;<br />        <br />        if ($single_member->chr_strand() == -1){<br />                <br />                $chr_strand = '-';<br />        }<br />        elsif ($single_member->chr_strand() == 1) {<br />        <br />            $chr_strand = '+';<br />        }<br />        <br />        else{<br />        <br />            $chr_strand = ''; <br />        }<br />        <br />        #get stable id for member<br />        my $mem_stab_id = $single_member->stable_id();<br />        <br />        #construct .lst file names of the format<id>_<chr>.txt<br />        my $lst_file_name = "$species_genome_db_id"."_"."$chr_name".".lst";<br />       <br />        open(my $fh,
">>$lst_file_name");<br />        <br />        print $fh ("$mem_stab_id"."$chr_strand"."\n");<br />        close($fh);<br />        <br />        my $new_families_list_ref = $family_adaptor->fetch_all_by_Member($single_member);<br />        my @new_families_list = @$new_families_list_ref;<br />        <br />        if (@new_families_list){<br />            <br />            #print member stable id next to each corresponding family stable id<br />            foreach my $single_family (@new_families_list){<br />               my $fam_stab_id = $single_family->stable_id();<br />              print OUTPUT "$mem_stab_id\t$fam_stab_id\n";<br />            }<br />        }<br />        else{<br />            print OUTPUT "$mem_stab_id\t$mem_stab_id\n";    <br />        }<br />    <br />        $count++;<br />    <br />    }<br />} <br /><br /><br /><br /><br /><hr /><br />Dev mailing list    Dev@ensembl.org<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 /></pre></body></html>