annotate repmatch_gff3.py @ 5:2365720de36d draft

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