INNER CODE UNIT · Python

count_motifs

BortonWrightonLabs/DRAM · bin/combine_annotations.py:84

def count_motifs(gene_faa, motif="(C..CH)", genes_faa_dict=None):
    if genes_faa_dict is None:
        genes_faa_dict = dict()
    for seq in read_sequence(gene_faa, format="fasta"):
        if seq.metadata["id"] not in genes_faa_dict:
            genes_faa_dict[seq.metadata["id"]] = {}

        genes_faa_dict[seq.metadata["id"]]["heme_regulatory_motif_count"] = len(
            list(seq.find_with_regex(motif))
        )
    return genes_faa_dict


def set_gene_data(gene_faa, genes_faa_dict=None):
    if genes_faa_dict is None:
        genes_faa_dict = dict()
    for seq in read_sequence(gene_faa, format="fasta"):
        if seq.metadata["id"] not in genes_faa_dict:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…