Mercurial > repos > devteam > cuffcompare
annotate cuffcompare_wrapper.py @ 8:1322b73ffe44 draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
author | devteam |
---|---|
date | Tue, 07 Feb 2017 18:38:41 -0500 |
parents | 8e534225baa9 |
children | e66b9b5b8580 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/env python |
2 | |
3 # Supports Cuffcompare versions v1.3.0 and newer. | |
4 | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
5 import optparse |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
6 import os |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
7 import shutil |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
8 import subprocess |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
9 import sys |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
10 import tempfile |
0 | 11 |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
12 |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
13 def stop_err(msg): |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
14 sys.stderr.write('%s\n' % msg) |
0 | 15 sys.exit() |
16 | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
17 |
0 | 18 def __main__(): |
19 parser = optparse.OptionParser() | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
20 parser.add_option('-r', dest='ref_annotation', help='An optional "reference" annotation GTF. Each sample is matched against this file, and sample isoforms are tagged as overlapping, matching, or novel where appropriate. See the refmap and tmap output file descriptions below.') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
21 parser.add_option('-R', action="store_true", dest='ignore_nonoverlap_reference', help='If -r was specified, this option causes cuffcompare to ignore reference transcripts that are not overlapped by any transcript in one of cuff1.gtf,...,cuffN.gtf. Useful for ignoring annotated transcripts that are not present in your RNA-Seq samples and thus adjusting the "sensitivity" calculation in the accuracy report written in the transcripts accuracy file') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
22 parser.add_option('-Q', action="store_true", dest='ignore_nonoverlap_transfrag', help='If -r was specified, this option causes cuffcompare to consider only the input transcripts that overlap any of the reference transcripts (Sp correction); Warning: this will discard all "novel" loci!)') |
6 | 23 |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
24 parser.add_option('-s', dest='use_seq_data', action="store_true", help='Causes cuffcompare to look into for fasta files with the underlying genomic sequences (one file per contig) against which your reads were aligned for some optional classification functions. For example, Cufflinks transcripts consisting mostly of lower-case bases are classified as repeats. Note that <seq_dir> must contain one fasta file per reference chromosome, and each file must be named after the chromosome, and have a .fa or .fasta extension.') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
25 |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
26 parser.add_option('-M', action="store_true", dest='discard_single_exon_all', help='discard (ignore) single-exon transfrags and reference transcript') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
27 parser.add_option('-N', action="store_true", dest='discard_single_exon_ref', help='discard (ignore) single-exon reference transcripts') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
28 parser.add_option('-e', dest='max_dist_exon', help='Max. Distance for assessing exon accuracy" help="max. distance (range) allowed from free ends of terminal exons of reference transcripts when assessing exon accuracy. Default: 100') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
29 parser.add_option('-d', dest='max_dist_group', help='Max.Distance for transcript grouping" help="max. distance (range) for grouping transcript start sites. Default: 100') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
30 parser.add_option('-F', action="store_true", dest='discard_redundant_intron_transfrags', help='Discard intron-redundant transfrags if they share the 5-prime end (if they differ only at the 3-prime end)') |
6 | 31 |
0 | 32 # Wrapper / Galaxy options. |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
33 parser.add_option('', '--index', dest='index', help='The path of the reference genome') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
34 parser.add_option('', '--ref_file', dest='ref_file', help='The reference dataset from the history') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
35 |
0 | 36 # Outputs. |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
37 parser.add_option('', '--combined-transcripts', dest='combined_transcripts') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
38 |
0 | 39 (options, args) = parser.parse_args() |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
40 |
0 | 41 # output version # of tool |
42 try: | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
43 with tempfile.NamedTemporaryFile() as tmp_stdout: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
44 returncode = subprocess.call(args='cuffcompare 2>&1', stdout=tmp_stdout, shell=True) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
45 stdout = None |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
46 with open(tmp_stdout.name) as tmp_stdout2: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
47 for line in tmp_stdout2: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
48 if line.lower().find('cuffcompare v') >= 0: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
49 stdout = line.strip() |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
50 break |
0 | 51 if stdout: |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
52 sys.stdout.write('%s\n' % stdout) |
0 | 53 else: |
54 raise Exception | |
55 except: | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
56 sys.stdout.write('Could not determine Cuffcompare version\n') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
57 |
0 | 58 # Set/link to sequence file. |
59 if options.use_seq_data: | |
2
8b22e9adae34
Update to the new data table specification.
Dave Bouvier <dave@bx.psu.edu>
parents:
0
diff
changeset
|
60 if options.ref_file: |
0 | 61 # Sequence data from history. |
62 # Create symbolic link to ref_file so that index will be created in working directory. | |
63 seq_path = "ref.fa" | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
64 os.symlink(options.ref_file, seq_path) |
0 | 65 else: |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
66 if not os.path.exists(options.index): |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
67 stop_err('Reference genome %s not present, request it by reporting this error.' % options.index) |
2
8b22e9adae34
Update to the new data table specification.
Dave Bouvier <dave@bx.psu.edu>
parents:
0
diff
changeset
|
68 seq_path = options.index |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
69 |
0 | 70 # Build command. |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
71 |
0 | 72 # Base. |
73 cmd = "cuffcompare -o cc_output " | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
74 |
0 | 75 # Add options. |
76 if options.ref_annotation: | |
77 cmd += " -r %s " % options.ref_annotation | |
6 | 78 if options.ignore_nonoverlap_reference: |
0 | 79 cmd += " -R " |
6 | 80 if options.ignore_nonoverlap_transfrag: |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
81 cmd += " -Q " |
0 | 82 if options.use_seq_data: |
83 cmd += " -s %s " % seq_path | |
6 | 84 if options.discard_single_exon_all: |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
85 cmd += " -M " |
6 | 86 if options.discard_single_exon_ref: |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
87 cmd += " -N " |
6 | 88 if options.max_dist_exon: |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
89 cmd += " -e %i " % int(options.max_dist_exon) |
6 | 90 if options.max_dist_group: |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
91 cmd += " -d %i " % int(options.max_dist_group) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
92 if options.discard_redundant_intron_transfrags: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
93 cmd += " -F " |
0 | 94 # Add input files. |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
95 |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
96 # Need to symlink inputs so that output files are written to the current directory. |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
97 for i, arg in enumerate(args): |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
98 input_file_name = "./input%i" % (i + 1) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
99 os.symlink(arg, input_file_name) |
0 | 100 cmd += "%s " % input_file_name |
101 | |
102 # Run command. | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
103 try: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
104 with tempfile.NamedTemporaryFile(dir=".") as tmp_stderr: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
105 returncode = subprocess.call(args=cmd, stderr=tmp_stderr, shell=True) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
106 |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
107 # Error checking. |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
108 if returncode != 0: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
109 # Get stderr, allowing for case where it's very large. |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
110 buffsize = 1048576 |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
111 stderr = '' |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
112 with open(tmp_stderr.name) as tmp_stderr2: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
113 try: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
114 while True: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
115 stderr += tmp_stderr2.read(buffsize) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
116 if not stderr or len(stderr) % buffsize != 0: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
117 break |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
118 except OverflowError: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
119 pass |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
120 raise Exception(stderr) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
121 |
0 | 122 # Copy outputs. |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
123 shutil.move("cc_output.combined.gtf", options.combined_transcripts) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
124 |
0 | 125 # check that there are results in the output file |
126 cc_output_fname = "cc_output.stats" | |
8
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
127 if len(open(cc_output_fname).read().strip()) == 0: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
128 raise Exception('The main output file is empty, there may be an error with your input file or settings.') |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
129 except Exception as e: |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
130 stop_err('Error running cuffcompare: %s' % e) |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
131 |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
132 |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
133 if __name__ == "__main__": |
1322b73ffe44
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cuffcompare commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
6
diff
changeset
|
134 __main__() |