Mercurial > repos > iuc > repmatch_gff3
annotate repmatch_gff3.py @ 3:f7608d0363bf draft
Uploaded
author | iuc |
---|---|
date | Fri, 13 Jan 2017 10:52:02 -0500 |
parents | a072f0f30ea3 |
children | 6acaa2c93f47 |
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 |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
11 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
|
12 |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
13 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
|
14 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
|
15 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
|
16 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
|
17 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
|
18 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
|
19 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
|
20 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
|
21 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
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
29 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
|
30 |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
31 dataset_paths = [] |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
32 hids = [] |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
33 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
|
34 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
|
35 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
|
36 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
|
37 hids, |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
38 args.method, |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
39 args.distance, |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
40 args.step, |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
41 args.replicates, |
a072f0f30ea3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/repmatch_gff3 commit 0e04a4c237677c1f5be1950babcf8591097996a9
iuc
parents:
diff
changeset
|
42 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 args.output_statistics_histogram) |