Mercurial > repos > greg > repmatch_gff3
comparison repmatch_gff3.py @ 0:d33030c8e2cc draft
Uploaded
| author | greg |
|---|---|
| date | Tue, 17 Nov 2015 14:26:08 -0500 |
| parents | |
| children | 6df81aade62c |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d33030c8e2cc |
|---|---|
| 1 # repmatch.py | |
| 2 # | |
| 3 # Replicate matching - matches paired peaks from two or more replicates | |
| 4 # | |
| 5 # Input: one or more gff files (simple output from cwpair2, each a list of paired peaks from a replicate | |
| 6 # | |
| 7 # Output: list of matched groups and list of unmatched orphans | |
| 8 # Files: key.tabular (file to replicate IDsummary.tabular, detail.tabular, orphans.tabular | |
| 9 | |
| 10 import argparse | |
| 11 import repmatch_gff3_util | |
| 12 | |
| 13 if __name__ == '__main__': | |
| 14 parser = argparse.ArgumentParser() | |
| 15 parser.add_argument('--input', dest='inputs', action='append', nargs=2, help="Input datasets") | |
| 16 parser.add_argument('--method', dest='method', default='closest', help='Method of finding match') | |
| 17 parser.add_argument('--distance', dest='distance', type=int, default=50, help='Maximum distance between peaks in different replicates to allow merging') | |
| 18 parser.add_argument('--step', dest='step', type=int, default=0, help='Step size of distance for each iteration') | |
| 19 parser.add_argument('--replicates', dest='replicates', type=int, default=2, help='Minimum number of replicates that must be matched for merging to occur') | |
| 20 parser.add_argument('--low_limit', dest='low_limit', type=int, default=-1000, help='Lower limit for c-w distance filter') | |
| 21 parser.add_argument('--up_limit', dest='up_limit', type=int, default=1000, help='Upper limit for c-w distance filter') | |
| 22 parser.add_argument('--output_files', dest='output_files', default='simple', help='Restrict output dataset collections.') | |
| 23 parser.add_argument('--plot_format', dest='plot_format', default=None, help='Output format for graph') | |
| 24 parser.add_argument('--output_summary', dest='output_summary', help='Matched groups in gff format') | |
| 25 parser.add_argument('--output_orphan', dest='output_orphan', default=None, help='Orphans in tabular format') | |
| 26 parser.add_argument('--output_detail', dest='output_detail', default=None, help='Details in tabular format') | |
| 27 parser.add_argument('--output_key', dest='output_key', default=None, help='Keys in tabular format') | |
| 28 parser.add_argument('--output_histogram', dest='output_histogram', default=None, help='Histogram in plot_format') | |
| 29 | |
| 30 args = parser.parse_args() | |
| 31 | |
| 32 dataset_paths = [] | |
| 33 hids = [] | |
| 34 for (dataset_path, hid) in args.inputs: | |
| 35 dataset_paths.append(dataset_path) | |
| 36 hids.append(hid) | |
| 37 repmatch_gff3_util.process_files(dataset_paths, | |
| 38 hids, | |
| 39 args.method, | |
| 40 args.distance, | |
| 41 args.step, | |
| 42 args.replicates, | |
| 43 args.up_limit, | |
| 44 args.low_limit, | |
| 45 args.output_files, | |
| 46 args.plot_format, | |
| 47 args.output_summary, | |
| 48 args.output_orphan, | |
| 49 args.output_detail, | |
| 50 args.output_key, | |
| 51 args.output_histogram) |
