Mercurial > repos > devteam > cufflinks
annotate cufflinks_wrapper.py @ 11:e04dbae2abe0 draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
author | devteam |
---|---|
date | Sun, 19 Feb 2017 12:12:28 -0500 |
parents | 83bec71c5c9f |
children |
rev | line source |
---|---|
0 | 1 #!/usr/bin/env python |
2 | |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
3 import optparse |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
4 import os |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
5 import shutil |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
6 import subprocess |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
7 import sys |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
8 import tempfile |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
9 |
11
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
10 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
11 def parse_gff_attributes( attr_str ): |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
12 """ |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
13 Parses a GFF/GTF attribute string and returns a dictionary of name-value |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
14 pairs. The general format for a GFF3 attributes string is |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
15 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
16 name1=value1;name2=value2 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
17 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
18 The general format for a GTF attribute string is |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
19 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
20 name1 "value1" ; name2 "value2" |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
21 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
22 The general format for a GFF attribute string is a single string that |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
23 denotes the interval's group; in this case, method returns a dictionary |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
24 with a single key-value pair, and key name is 'group' |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
25 """ |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
26 attributes_list = attr_str.split(";") |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
27 attributes = {} |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
28 for name_value_pair in attributes_list: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
29 # Try splitting by '=' (GFF3) first because spaces are allowed in GFF3 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
30 # attribute; next, try double quotes for GTF. |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
31 pair = name_value_pair.strip().split("=") |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
32 if len( pair ) == 1: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
33 pair = name_value_pair.strip().split("\"") |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
34 if len( pair ) == 1: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
35 # Could not split for some reason -- raise exception? |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
36 continue |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
37 if pair == '': |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
38 continue |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
39 name = pair[0].strip() |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
40 if name == '': |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
41 continue |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
42 # Need to strip double quote from values |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
43 value = pair[1].strip(" \"") |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
44 attributes[ name ] = value |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
45 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
46 if len( attributes ) == 0: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
47 # Could not split attributes string, so entire string must be |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
48 # 'group' attribute. This is the case for strictly GFF files. |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
49 attributes['group'] = attr_str |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
50 return attributes |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
51 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
52 |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
53 def gff_attributes_to_str( attrs, gff_format ): |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
54 """ |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
55 Convert GFF attributes to string. Supported formats are GFF3, GTF. |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
56 """ |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
57 if gff_format == 'GTF': |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
58 format_string = '%s "%s"' |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
59 # Convert group (GFF) and ID, parent (GFF3) attributes to transcript_id, gene_id |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
60 id_attr = None |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
61 if 'group' in attrs: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
62 id_attr = 'group' |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
63 elif 'ID' in attrs: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
64 id_attr = 'ID' |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
65 elif 'Parent' in attrs: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
66 id_attr = 'Parent' |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
67 if id_attr: |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
68 attrs['transcript_id'] = attrs['gene_id'] = attrs[id_attr] |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
69 elif gff_format == 'GFF3': |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
70 format_string = '%s=%s' |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
71 attrs_strs = [] |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
72 for name, value in attrs.items(): |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
73 attrs_strs.append( format_string % ( name, value ) ) |
e04dbae2abe0
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5
devteam
parents:
10
diff
changeset
|
74 return " ; ".join( attrs_strs ) |
0 | 75 |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
76 |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
77 def stop_err(msg): |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
78 sys.exit("%s\n" % msg) |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
79 |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
80 |
0 | 81 def __main__(): |
82 parser = optparse.OptionParser() | |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
83 parser.add_option('-1', '--input', dest='input', help=' file of RNA-Seq read alignments in the SAM format. SAM is a standard short read alignment, that allows aligners to attach custom tags to individual alignments, and Cufflinks requires that the alignments you supply have some of these tags. Please see Input formats for more details.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
84 parser.add_option('-I', '--max-intron-length', dest='max_intron_len', help='The minimum intron length. Cufflinks will not report transcripts with introns longer than this, and will ignore SAM alignments with REF_SKIP CIGAR operations longer than this. The default is 300,000.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
85 parser.add_option('-F', '--min-isoform-fraction', dest='min_isoform_fraction', help='After calculating isoform abundance for a gene, Cufflinks filters out transcripts that it believes are very low abundance, because isoforms expressed at extremely low levels often cannot reliably be assembled, and may even be artifacts of incompletely spliced precursors of processed transcripts. This parameter is also used to filter out introns that have far fewer spliced alignments supporting them. The default is 0.05, or 5% of the most abundant isoform (the major isoform) of the gene.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
86 parser.add_option('-j', '--pre-mrna-fraction', dest='pre_mrna_fraction', help='Some RNA-Seq protocols produce a significant amount of reads that originate from incompletely spliced transcripts, and these reads can confound the assembly of fully spliced mRNAs. Cufflinks uses this parameter to filter out alignments that lie within the intronic intervals implied by the spliced alignments. The minimum depth of coverage in the intronic region covered by the alignment is divided by the number of spliced reads, and if the result is lower than this parameter value, the intronic alignments are ignored. The default is 5%.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
87 parser.add_option('-p', '--num-threads', dest='num_threads', help='Use this many threads to align reads. The default is 1.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
88 parser.add_option('-G', '--GTF', dest='GTF', help='Tells Cufflinks to use the supplied reference annotation to estimate isoform expression. It will not assemble novel transcripts, and the program will ignore alignments not structurally compatible with any reference transcript.') |
8 | 89 parser.add_option("--compatible-hits-norm", dest='compatible_hits_norm', action="store_true", help='Count hits compatible with reference RNAs only') |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
90 parser.add_option('-g', '--GTF-guide', dest='GTFguide', help='use reference transcript annotation to guide assembly') |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
91 parser.add_option("--3-overhang-tolerance", dest='three_overhang_tolerance', help='The number of bp allowed to overhang the 3prime end of a reference transcript when determining if an assembled transcript should be merged with it (ie, the assembled transcript is not novel). The default is 600 bp.') |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
92 parser.add_option("--intron-overhang-tolerance", dest='intron_overhang_tolerance', help='The number of bp allowed to enter the intron of a reference transcript when determining if an assembled transcript should be merged with it (ie, the assembled transcript is not novel). The default is 50 bp.') |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
93 parser.add_option("--no-faux-reads", dest='no_faux_reads', help='This option disables tiling of the reference transcripts with faux reads. Use this if you only want to use sequencing reads in assembly but do not want to output assembled transcripts that lay within reference transcripts. All reference transcripts in the input annotation will also be included in the output.') |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
94 parser.add_option('-u', '--multi-read-correct', dest='multi_read_correct', action="store_true", help='Tells Cufflinks to do an initial estimation procedure to more accurately weight reads mapping to multiple locations in the genome') |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
95 |
0 | 96 # Normalization options. |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
97 parser.add_option("--no-effective-length-correction", dest="no_effective_length_correction", action="store_true") |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
98 parser.add_option("--no-length-correction", dest="no_length_correction", action="store_true") |
0 | 99 |
100 # Wrapper / Galaxy options. | |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
101 parser.add_option('-A', '--assembled-isoforms-output', dest='assembled_isoforms_output_file', help='Assembled isoforms output file; formate is GTF.') |
0 | 102 |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
103 # Advanced Options: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
104 parser.add_option("--library-type", dest="library_type", help=' library prep used for input reads, default fr-unstranded') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
105 parser.add_option('-M', '--mask-file', dest='mask_file', help='Tells Cufflinks to ignore all reads that could have come from transcripts in this GTF file. \ |
7 | 106 We recommend including any annotated rRNA, mitochondrial transcripts other abundant transcripts \ |
107 you wish to ignore in your analysis in this file. Due to variable efficiency of mRNA enrichment \ | |
108 methods and rRNA depletion kits, masking these transcripts often improves the overall robustness \ | |
109 of transcript abundance estimates.') | |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
110 parser.add_option('-m', '--inner-mean-dist', dest='inner_mean_dist', help='This is the expected (mean) inner distance between mate pairs. \ |
7 | 111 For, example, for paired end runs with fragments selected at 300bp, \ |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
112 where each end is 50bp, you should set -r to be 200. The default is 45bp.') # cufflinks: --frag-len-mean |
7 | 113 |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
114 parser.add_option('-s', '--inner-dist-std-dev', dest='inner_dist_std_dev', help='The standard deviation for the distribution on inner distances between mate pairs. The default is 20bp.') # cufflinks: --frag-len-std-dev |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
115 parser.add_option('--max-mle-iterations', dest='max_mle_iterations', help='Sets the number of iterations allowed during maximum likelihood estimation of abundances. Default: 5000') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
116 parser.add_option('--junc-alpha', dest='junc_alpha', help='Alpha value for the binomial test used during false positive spliced alignment filtration. Default: 0.001') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
117 parser.add_option('--small-anchor-fraction', dest='small_anchor_fraction', help='Spliced reads with less than this percent of their length on each side of\ |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
118 the junction are considered suspicious and are candidates for filtering prior to assembly. Default: 0.09.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
119 parser.add_option('--overhang-tolerance', dest='overhang_tolerance', help='The number of bp allowed to enter the intron of a transcript when determining if a \ |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
120 read or another transcript is mappable to/compatible with it. The default is 8 bp based on the default bowtie/TopHat parameters.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
121 parser.add_option('--max-bundle-length', dest='max_bundle_length', help='Maximum genomic length of a given bundle" help="Default: 3,500,000bp') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
122 parser.add_option('--max-bundle-frags', dest='max_bundle_frags', help='Sets the maximum number of fragments a locus may have before being skipped. Skipped loci are listed in skipped.gtf. Default: 1,000,000') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
123 parser.add_option('--min-intron-length', dest='min_intron_length', help='Minimal allowed intron size. Default: 50') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
124 parser.add_option('--trim-3-avgcov-thresh', dest='trim_three_avgcov_thresh', help='Minimum average coverage required to attempt 3prime trimming. Default: 10') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
125 parser.add_option('--trim-3-dropoff-frac', dest='trim_three_dropoff_frac', help='The fraction of average coverage below which to trim the 3prime end of an assembled transcript. Default: 0.1') |
7 | 126 |
0 | 127 # Bias correction options. |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
128 parser.add_option('-b', dest='do_bias_correction', action="store_true", help='Providing Cufflinks with a multifasta file via this option instructs it to run our new bias detection and correction algorithm which can significantly improve accuracy of transcript abundance estimates.') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
129 parser.add_option('', '--index', dest='index', help='The path of the reference genome') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
130 parser.add_option('', '--ref_file', dest='ref_file', help='The reference dataset from the history') |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
131 |
7 | 132 # Global model (for trackster). |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
133 parser.add_option('', '--global_model', dest='global_model_file', help='Global model used for computing on local data') |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
134 |
0 | 135 (options, args) = parser.parse_args() |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
136 |
0 | 137 # If doing bias correction, set/link to sequence file. |
138 if options.do_bias_correction: | |
2
da11bfc10e81
Update to the new data table specification.
Dave Bouvier <dave@bx.psu.edu>
parents:
0
diff
changeset
|
139 if options.ref_file: |
0 | 140 # Sequence data from history. |
141 # Create symbolic link to ref_file so that index will be created in working directory. | |
142 seq_path = "ref.fa" | |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
143 os.symlink(options.ref_file, seq_path) |
0 | 144 else: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
145 if not os.path.exists(options.index): |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
146 stop_err('Reference genome %s not present, request it by reporting this error.' % options.index) |
2
da11bfc10e81
Update to the new data table specification.
Dave Bouvier <dave@bx.psu.edu>
parents:
0
diff
changeset
|
147 seq_path = options.index |
da11bfc10e81
Update to the new data table specification.
Dave Bouvier <dave@bx.psu.edu>
parents:
0
diff
changeset
|
148 |
0 | 149 # Build command. |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
150 |
0 | 151 # Base; always use quiet mode to avoid problems with storing log output. |
152 cmd = "cufflinks -q --no-update-check" | |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
153 |
0 | 154 # Add options. |
155 if options.max_intron_len: | |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
156 cmd += (" -I %i" % int(options.max_intron_len)) |
0 | 157 if options.min_isoform_fraction: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
158 cmd += (" -F %f" % float(options.min_isoform_fraction)) |
0 | 159 if options.pre_mrna_fraction: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
160 cmd += (" -j %f" % float(options.pre_mrna_fraction)) |
0 | 161 if options.num_threads: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
162 cmd += (" -p %i" % int(options.num_threads)) |
0 | 163 if options.GTF: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
164 cmd += (" -G %s" % options.GTF) |
7 | 165 if options.compatible_hits_norm: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
166 cmd += (" --compatible-hits-norm") |
0 | 167 if options.GTFguide: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
168 cmd += (" -g %s" % options.GTFguide) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
169 cmd += (" --3-overhang-tolerance %i" % int(options.three_overhang_tolerance)) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
170 cmd += (" --intron-overhang-tolerance %i" % int(options.intron_overhang_tolerance)) |
7 | 171 if options.no_faux_reads: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
172 cmd += (" --no-faux-reads") |
0 | 173 if options.multi_read_correct: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
174 cmd += (" -u") |
7 | 175 |
176 if options.library_type and options.library_type != 'auto': | |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
177 cmd += (" --library-type %s" % options.library_type) |
7 | 178 if options.mask_file: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
179 cmd += (" --mask-file %s" % options.mask_file) |
7 | 180 if options.inner_mean_dist: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
181 cmd += (" -m %i" % int(options.inner_mean_dist)) |
7 | 182 if options.inner_dist_std_dev: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
183 cmd += (" -s %i" % int(options.inner_dist_std_dev)) |
0 | 184 if options.max_mle_iterations: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
185 cmd += (" --max-mle-iterations %i" % int(options.max_mle_iterations)) |
7 | 186 if options.junc_alpha: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
187 cmd += (" --junc-alpha %f" % float(options.junc_alpha)) |
7 | 188 if options.small_anchor_fraction: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
189 cmd += (" --small-anchor-fraction %f" % float(options.small_anchor_fraction)) |
7 | 190 if options.overhang_tolerance: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
191 cmd += (" --overhang-tolerance %i" % int(options.overhang_tolerance)) |
7 | 192 if options.max_bundle_length: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
193 cmd += (" --max-bundle-length %i" % int(options.max_bundle_length)) |
7 | 194 if options.max_bundle_frags: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
195 cmd += (" --max-bundle-frags %i" % int(options.max_bundle_frags)) |
7 | 196 if options.min_intron_length: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
197 cmd += (" --min-intron-length %i" % int(options.min_intron_length)) |
7 | 198 if options.trim_three_avgcov_thresh: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
199 cmd += (" --trim-3-avgcov-thresh %i" % int(options.trim_three_avgcov_thresh)) |
7 | 200 if options.trim_three_dropoff_frac: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
201 cmd += (" --trim-3-dropoff-frac %f" % float(options.trim_three_dropoff_frac)) |
7 | 202 |
0 | 203 if options.do_bias_correction: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
204 cmd += (" -b %s" % seq_path) |
0 | 205 if options.no_effective_length_correction: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
206 cmd += (" --no-effective-length-correction") |
7 | 207 if options.no_length_correction: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
208 cmd += (" --no-length-correction") |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
209 |
0 | 210 # Add input files. |
211 cmd += " " + options.input | |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
212 |
0 | 213 # Run command and handle output. |
214 try: | |
215 # Run command. | |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
216 with tempfile.NamedTemporaryFile(dir=".") as tmp_stderr: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
217 returncode = subprocess.call(args=cmd, stderr=tmp_stderr, shell=True) |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
218 |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
219 # Error checking. |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
220 if returncode != 0: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
221 # Get stderr, allowing for case where it's very large. |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
222 buffsize = 1048576 |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
223 stderr = '' |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
224 with open(tmp_stderr.name) as tmp_stderr2: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
225 try: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
226 while True: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
227 stderr += tmp_stderr2.read(buffsize) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
228 if not stderr or len(stderr) % buffsize != 0: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
229 break |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
230 except OverflowError: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
231 pass |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
232 raise Exception(stderr) |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
233 |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
234 # Read standard error to get total map/upper quartile mass. |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
235 total_map_mass = -1 |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
236 with open(tmp_stderr.name, 'r') as tmp_stderr2: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
237 for line in tmp_stderr2: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
238 if line.lower().find("map mass") >= 0 or line.lower().find("upper quartile") >= 0: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
239 total_map_mass = float(line.split(":")[1].strip()) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
240 break |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
241 |
0 | 242 # If there's a global model provided, use model's total map mass |
243 # to adjust FPKM + confidence intervals. | |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
244 if options.global_model_file: |
0 | 245 # Global model is simply total map mass from original run. |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
246 with open(options.global_model_file, 'r') as global_model_file: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
247 global_model_total_map_mass = float(global_model_file.readline()) |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
248 |
0 | 249 # Ratio of global model's total map mass to original run's map mass is |
250 # factor used to adjust FPKM. | |
251 fpkm_map_mass_ratio = total_map_mass / global_model_total_map_mass | |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
252 |
0 | 253 # Update FPKM values in transcripts.gtf file. |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
254 with open("transcripts.gtf", 'r') as transcripts_file: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
255 with tempfile.NamedTemporaryFile(dir=".", delete=False) as new_transcripts_file: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
256 for line in transcripts_file: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
257 fields = line.split('\t') |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
258 attrs = parse_gff_attributes(fields[8]) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
259 attrs["FPKM"] = str(float(attrs["FPKM"]) * fpkm_map_mass_ratio) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
260 attrs["conf_lo"] = str(float(attrs["conf_lo"]) * fpkm_map_mass_ratio) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
261 attrs["conf_hi"] = str(float(attrs["conf_hi"]) * fpkm_map_mass_ratio) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
262 fields[8] = gff_attributes_to_str(attrs, "GTF") |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
263 new_transcripts_file.write("%s\n" % '\t'.join(fields)) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
264 shutil.move(new_transcripts_file.name, "transcripts.gtf") |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
265 |
0 | 266 # TODO: update expression files as well. |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
267 |
0 | 268 # Set outputs. Transcript and gene expression handled by wrapper directives. |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
269 shutil.move("transcripts.gtf", options.assembled_isoforms_output_file) |
0 | 270 if total_map_mass > -1: |
10
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
271 with open("global_model.txt", 'w') as f: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
272 f.write("%f\n" % total_map_mass) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
273 except Exception as e: |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
274 stop_err('Error running cufflinks: %s' % e) |
83bec71c5c9f
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit eb18f691975ef9539b5ebd4f118343c8ad967a1f
devteam
parents:
9
diff
changeset
|
275 |
0 | 276 |
9
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
277 if __name__ == "__main__": |
a1ea9af8d5f4
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit a1517c9d22029095120643bbe2c8fa53754dd2b7
devteam
parents:
8
diff
changeset
|
278 __main__() |