def create_clusters(f_orthomcl,f_hmmout,f_fasta,f_species,f_family): ''' Loads an orthomcl output file, to create clusters. In addition proteins are added from the corresponding hmmout file, species information is added from speciesMapping(Andreas) and fasta sequences for each protein are loaded. Function returns an interable with cluster objects''' orthomcl, hmmout, fasta, = Orthomcl(), Hmmout(), Fasta() species, family = SpeciesMapping(), Family() fasta.load(f_fasta) hmmout.load(f_hmmout) orthomcl.load(f_orthomcl) species.load(f_species) family.load(f_family) for protein in hmmout: protein.add_sequence(fasta) protein.add_species(species) protein.add_family(family) for cluster in orthomcl: cluster.add_proteins(hmmout) cluster.counts = copy.deepcopy(species.all()) cluster.add_counts() cluster.add_cluster_to_members() cluster.add_family() return orthomcl
def species_list(f_species): species = SpeciesMapping() species.load(f_species) return list(species.all())