Mercurial > repos > bgruening > repmatch_gff3
annotate repmatch_gff3.py @ 0:b26d50dd3226 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
| author | bgruening | 
|---|---|
| date | Wed, 23 Dec 2015 09:24:35 -0500 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 0 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 1 # repmatch.py | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 2 # | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 3 # Replicate matching - matches paired peaks from two or more replicates | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 4 # | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 5 # Input: one or more gff files (matched_peak output from cwpair2, each a list of paired peaks from a replicate | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 6 # | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 7 # Output: list of matched groups and list of unmatched peaks | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 8 # Files: statistics_table.tabular (file to replicate ID), matched_paired_peaks.tabular, detail.tabular, unmatched_peaks.tabular | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 9 | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 10 import argparse | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 11 import repmatch_gff3_util | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 12 | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 13 if __name__ == '__main__': | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 14 parser = argparse.ArgumentParser() | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 15 parser.add_argument('--input', dest='inputs', action='append', nargs=2, help="Input datasets") | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 16 parser.add_argument('--method', dest='method', default='closest', help='Method of finding match') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 17 parser.add_argument('--distance', dest='distance', type=int, default=50, help='Maximum distance between peaks in different replicates to allow merging') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 18 parser.add_argument('--step', dest='step', type=int, default=0, help='Step size of distance for each iteration') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 19 parser.add_argument('--replicates', dest='replicates', type=int, default=2, help='Minimum number of replicates that must be matched for merging to occur') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 20 parser.add_argument('--low_limit', dest='low_limit', type=int, default=-1000, help='Lower limit for c-w distance filter') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 21 parser.add_argument('--up_limit', dest='up_limit', type=int, default=1000, help='Upper limit for c-w distance filter') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 22 parser.add_argument('--output_files', dest='output_files', default='all', help='Restrict output dataset collections.') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 23 parser.add_argument('--output_matched_peaks', dest='output_matched_peaks', help='Matched groups in gff format') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 24 parser.add_argument('--output_unmatched_peaks', dest='output_unmatched_peaks', default=None, help='Unmatched paired peaks in tabular format') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 25 parser.add_argument('--output_detail', dest='output_detail', default=None, help='Details in tabular format') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 26 parser.add_argument('--output_statistics_table', dest='output_statistics_table', default=None, help='Keys in tabular format') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 27 parser.add_argument('--output_statistics_histogram', dest='output_statistics_histogram', default=None, help='Histogram') | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 28 | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 29 args = parser.parse_args() | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 30 | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 31 dataset_paths = [] | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 32 hids = [] | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 33 for (dataset_path, hid) in args.inputs: | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 34 dataset_paths.append(dataset_path) | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 35 hids.append(hid) | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 36 repmatch_gff3_util.process_files(dataset_paths, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 37 hids, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 38 args.method, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 39 args.distance, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 40 args.step, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 41 args.replicates, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 42 args.up_limit, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 43 args.low_limit, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 44 args.output_files, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 45 args.output_matched_peaks, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 46 args.output_unmatched_peaks, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 47 args.output_detail, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 48 args.output_statistics_table, | 
| 
b26d50dd3226
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
 bgruening parents: diff
changeset | 49 args.output_statistics_histogram) | 
