def filter_by_sequence_pct(otus, nseqs, pct, phyl_level):
if phyl_level not in ['<STR_LIT:k>', '<STR_LIT:p>', '<STR_LIT:c>', '<STR_LIT:o>', '<STR_LIT:f>', '<STR_LIT:g>', '<STR_LIT:s>']:<EOL><INDENT>phyl_level = '<STR_LIT:s>'<EOL><DEDENT>seq_counts = defaultdict(int)<EOL>nseqs = float(nseqs)<EOL>for oid in otus:<EOL><INDENT>phyl = util.split_phylogeny(otus[oid][<NUM_LIT:0>], phyl_level)<EOL>seq_counts[phyl] += len(otus[oid][<NUM_LIT:1>])<EOL><DEDENT>seq_counts = {phyl: seq_counts[phyl]/nseqs for phyl in seq_counts}<EOL>above = {}<EOL>below = {}<EOL>for otuid in otus:<EOL><INDENT>phyl = util.split_phylogeny(otus[otuid][<NUM_LIT:0>], phyl_level)<EOL>if seq_counts[phyl] >= pct:<EOL><INDENT>above[otuid] = otus[otuid]<EOL><DEDENT>else:<EOL><INDENT>below[otuid] = ['<STR_LIT>', seq_counts[phyl],<EOL>otus[otuid][<NUM_LIT:0>], otus[otuid][<NUM_LIT:1>]]<EOL><DEDENT><DEDENT>return above, below<EOL>
Split the list of OTUs (and associated sequence ids) into two lists:
those occurring associated with more than some percentage of total sequences
and those less than the cutoff.

:type otus: dict
:param otus: {otuid: [taxonomy, [sequence IDs]]}
:type nseqs: int
:param nseqs: The total number of sequences in the data set
:type pct: float
:param pct: The cutoff percentage for inclusion in the filtered
             set of OTUs
:type phyl_level: str
:param phyl_level: The phylogenetic level (e.g. family, group, etc...) at
                   which to combine OTU counts for thresholding. One of
                   the following: ['k','p','c','o','f','g','s']

:rtype: tuple
:return: Two dicts: the OTU IDs and sequence IDs above and below the
          percentage threshold.