# Get numbers of genes with homologs in other species
debug("Calculating homologs for chromosome ".$chr_name);
# the SQL below will calculate the number of homologous genes between
# human and all other species to use a "source" species other than
# human, modify m1.genome_db_id = 1 to whatever the compara
# genome_db_id is for the required species.
my$homolog_sql="select count( distinct m1.stable_id ) as num_genes, g.name from homology_member hm1, homology_member hm2, member m1, member m2, genome_db g where hm1.member_id = m1.member_id and m1.chr_name = '".$chr_name."' and m1.genome_db_id = 1 and hm2.member_id = m2.member_id and hm1.homology_id = hm2.homology_id and hm1.member_id != hm2.member_id and m2.genome_db_id=g.genome_db_id GROUP BY g.name";
my$sth=$compara_dbi->prepare($homolog_sql);
my($num_genes,$species);
$sth->execute();
$sth->bind_columns(\$num_genes,\$species);
report("Number of homologous genes between human and other species");
while(my@row=$sth->fetchrow_array()){
report($species."\t".$num_genes);
}
$sth->finish();
# ----------------------------------------
# How many genes are in a family (of proteins) that has one or more members in other species