Mercurial > repos > earlhaminst > ete
diff ete_gene_cnv.py @ 13:ed74587a13c8 draft
planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/ete commit 23b3c7c09a7d391b576e3b19f8b34dd63d636bdc
author | earlhaminst |
---|---|
date | Thu, 01 Sep 2022 16:11:32 +0000 |
parents | 16e925bf567e |
children |
line wrap: on
line diff
--- a/ete_gene_cnv.py Tue Jun 07 08:58:05 2022 +0000 +++ b/ete_gene_cnv.py Thu Sep 01 16:11:32 2022 +0000 @@ -45,10 +45,10 @@ leaves_parts = [_.split("_") for _ in leaves] for i, leaf_parts in enumerate(leaves_parts): - if len(leaf_parts) != 2: + if len(leaf_parts) < 2: raise Exception("Leaf node '%s' is not in gene_species format" % leaves[i]) - leaves_species = [_[1] for _ in leaves_parts] + leaves_species = [_[-1] for _ in leaves_parts] species_counter = collections.Counter(leaves_species) # Assign to ref_species the first element of species_list which @@ -61,8 +61,8 @@ # Find the gene of the (first) leaf node for the ref_species for leaf_parts in leaves_parts: - if leaf_parts[1] == ref_species: - species_counter['gene'] = leaf_parts[0] + if leaf_parts[-1] == ref_species: + species_counter['gene'] = "_".join(leaf_parts[:-1]) break table.append(species_counter)