def cluster(args):
args = _check_args(args)<EOL>read_stats_file = op.join(args.dir_out, "<STR_LIT>")<EOL>if file_exists(read_stats_file):<EOL><INDENT>os.remove(read_stats_file)<EOL><DEDENT>bam_file, seq_obj = _clean_alignment(args)<EOL>logger.info("<STR_LIT>")<EOL>seqL, y, l = parse_ma_file(seq_obj, args.ffile)<EOL>logger.info("<STR_LIT>" % sum(y.values()))<EOL>logger.info("<STR_LIT>" % l)<EOL>dt = pd.DataFrame({'<STR_LIT>': y.keys(), '<STR_LIT>': y.values()})<EOL>dt['<STR_LIT>'] = '<STR_LIT>'<EOL>dt.to_csv(read_stats_file, sep="<STR_LIT:\t>", index=False, header=False, mode='<STR_LIT:a>')<EOL>if len(seqL.keys()) < <NUM_LIT:10>:<EOL><INDENT>logger.error("<STR_LIT>")<EOL>raise ValueError("<STR_LIT>")<EOL><DEDENT>logger.info("<STR_LIT>")<EOL>y, l = _total_counts(seqL.keys(), seqL)<EOL>logger.info("<STR_LIT>" % sum(y.values()))<EOL>logger.info("<STR_LIT>" % l)<EOL>dt = pd.DataFrame({'<STR_LIT>': y.keys(), '<STR_LIT>': y.values()})<EOL>dt['<STR_LIT>'] = '<STR_LIT>'<EOL>dt.to_csv(read_stats_file, sep="<STR_LIT:\t>", index=False, header=False, mode='<STR_LIT:a>')<EOL>clusL = _create_clusters(seqL, bam_file, args)<EOL>y, l = _total_counts(clusL.seq.keys(), clusL.seq, aligned=True)<EOL>logger.info("<STR_LIT>" % sum(y.values()))<EOL>logger.info("<STR_LIT>" % l)<EOL>dt = pd.DataFrame({'<STR_LIT>': y.keys(), '<STR_LIT>': y.values()})<EOL>dt['<STR_LIT>'] = '<STR_LIT>'<EOL>dt.to_csv(read_stats_file, sep="<STR_LIT:\t>", index=False, header=False, mode='<STR_LIT:a>')<EOL>logger.info("<STR_LIT>")<EOL>clusLred = _cleaning(clusL, args.dir_out)<EOL>y, l = _total_counts(clusLred.clus, seqL)<EOL>logger.info("<STR_LIT>" % sum(y.values()))<EOL>logger.info("<STR_LIT>" % l)<EOL>dt = pd.DataFrame({'<STR_LIT>': y.keys(), '<STR_LIT>': y.values()})<EOL>dt['<STR_LIT>'] = '<STR_LIT>'<EOL>dt.to_csv(read_stats_file, sep="<STR_LIT:\t>", index=False, header=False, mode='<STR_LIT:a>')<EOL>logger.info("<STR_LIT>" % (len(clusLred.clus.keys())))<EOL>if args.show:<EOL><INDENT>logger.info("<STR_LIT>")<EOL>clusLred = show_seq(clusLred, args.index)<EOL><DEDENT>clusLred = peak_calling(clusLred)<EOL>clusLred = _annotate(args, clusLred)<EOL>logger.info("<STR_LIT>")<EOL>json_file = _create_json(clusLred, args)<EOL>logger.info("<STR_LIT>" % args.dir_out)<EOL>if args.db:<EOL><INDENT>name = args.db + "<STR_LIT>"<EOL>logger.info("<STR_LIT>" + name)<EOL>data = load_data(json_file)<EOL>out_dir = op.join(args.dir_out, "<STR_LIT>")<EOL>make_database(data, name, out_dir)<EOL><DEDENT>logger.info("<STR_LIT>")<EOL>
Creating clusters