def detect_complexity(bam_in, genome, out):
if not genome:<EOL><INDENT>logger.info("<STR_LIT>")<EOL>return None<EOL><DEDENT>out_file = op.join(out, op.basename(bam_in) + "<STR_LIT>")<EOL>if file_exists(out_file):<EOL><INDENT>return None<EOL><DEDENT>fai = genome + "<STR_LIT>"<EOL>cov = pybedtools.BedTool(bam_in).genome_coverage(g=fai, max=<NUM_LIT:1>)<EOL>cov.saveas(out_file)<EOL>total = <NUM_LIT:0><EOL>for region in cov:<EOL><INDENT>if region[<NUM_LIT:0>] == "<STR_LIT>" and int(region[<NUM_LIT:1>]) != <NUM_LIT:0>:<EOL><INDENT>total += float(region[<NUM_LIT:4>])<EOL><DEDENT><DEDENT>logger.info("<STR_LIT>" % total)<EOL>
genome coverage of small RNA