annotate rsem.py @ 9:e00a79cf5f8c draft default tip

"planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit fdb6ccd340e366ef386d69ff344036a83e479b2f"
author artbio
date Tue, 03 Mar 2020 07:28:39 -0500
parents 49795544dac7
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
1 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
2 RSEM datatypes
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
3 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
4 import logging
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
5 import os
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
6 import os.path
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
7
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
8 from galaxy.datatypes.images import Html
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
9 from galaxy.datatypes.metadata import MetadataElement
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
10 from galaxy.datatypes.sniff import get_headers
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
11 from galaxy.datatypes.tabular import Tabular
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
12
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
13
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
14 log = logging.getLogger(__name__)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
15
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
16
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
17 class RsemIsoformsResults(Tabular):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
18 file_ext = "rsem.isoforms.results"
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
19 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
20 required columns:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
21 transcript_id gene_id length effective_length expected_count TPM
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
22 FPKM IsoPct
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
23 optional columns:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
24 pme_expected_count pme_TPM pme_FPKM IsoPct_from_pme_TPM TPM_ci_lower_bound
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
25 TPM_ci_upper_bound FPKM_ci_lower_bound FPKM_ci_upper_bound
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
26 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
27
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
28 def __init__(self, **kwd):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
29 Tabular.__init__(self, **kwd)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
30 """Initialize RsemResults datatype"""
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
31 self.comment_lines = 1
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
32
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
33 def sniff(self, filename):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
34 headers = get_headers(filename, '\n', count=1)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
35 return (len(headers) > 0 and len(headers[0]) >= 8 and
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
36 headers[0][0] == "transcript_id" and
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
37 headers[0][1] == "gene_id" and headers[0][6] == "FPKM")
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
38
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
39 def set_meta(self, dataset, **kwd):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
40 Tabular.set_meta(self, dataset, skip=None, **kwd)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
41
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
42
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
43 class RsemGenesResults(Tabular):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
44 file_ext = "rsem.genes.results"
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
45 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
46 required columns:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
47 gene_id transcript_id(s) length effective_length expected_count TPM FPKM
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
48 optional columns:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
49 pme_expected_count pme_TPM pme_FPKM TPM_ci_lower_bound TPM_ci_upper_bound
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
50 FPKM_ci_lower_bound FPKM_ci_upper_bound
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
51 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
52
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
53 def __init__(self, **kwd):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
54 Tabular.__init__(self, **kwd)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
55 """Initialize RsemResults datatype"""
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
56 self.comment_lines = 1
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
57
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
58 def sniff(self, filename):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
59 headers = get_headers(filename, '\n', count=1)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
60 return (len(headers) > 0 and len(headers[0]) >= 7 and
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
61 headers[0][0] == "gene_id" and
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
62 headers[0][1].startswith("transcript_id") and
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
63 headers[0][6] == "FPKM")
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
64
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
65 def set_meta(self, dataset, **kwd):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
66 Tabular.set_meta(self, dataset, skip=None, **kwd)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
67
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
68
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
69 class RsemReference(Html):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
70 """Class describing an RSEM reference"""
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
71 MetadataElement(name='reference_name', default='rsem_ref',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
72 desc='RSEM Reference Name', readonly=True, visible=True,
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
73 set_in_upload=True, no_value='rsem_ref')
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
74 file_ext = 'rsem_ref'
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
75 allow_datatype_change = False
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
76 composite_type = 'auto_primary_file'
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
77
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
78 def __init__(self, **kwd):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
79 Html.__init__(self, **kwd)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
80 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
81 Expecting files:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
82 extra_files_path/<reference_name>.grp
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
83 extra_files_path/<reference_name>.ti
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
84 extra_files_path/<reference_name>.seq
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
85 extra_files_path/<reference_name>.transcripts.fa
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
86 Optionally includes files:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
87 extra_files_path/<reference_name>.chrlist
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
88 extra_files_path/<reference_name>.idx.fa
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
89 extra_files_path/<reference_name>.1.ebwt
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
90 extra_files_path/<reference_name>.2.ebwt
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
91 extra_files_path/<reference_name>.3.ebwt
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
92 extra_files_path/<reference_name>.4.ebwt
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
93 extra_files_path/<reference_name>.rev.1.ebwt
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
94 extra_files_path/<reference_name>.rev.2.ebwt
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
95 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
96 self.add_composite_file('%s.grp', description='Group File',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
97 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
98 is_binary=False)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
99 self.add_composite_file('%s.ti', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
100 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
101 is_binary=False)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
102 self.add_composite_file('%s.seq', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
103 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
104 is_binary=False)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
105 self.add_composite_file('%s.transcripts.fa', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
106 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
107 is_binary=False)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
108 self.add_composite_file('%s.chrlist', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
109 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
110 is_binary=False, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
111 self.add_composite_file('%s.idx.fa', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
112 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
113 is_binary=False, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
114 self.add_composite_file('%s.1.ebwt', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
115 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
116 is_binary=True, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
117 self.add_composite_file('%s.2.ebwt', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
118 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
119 is_binary=True, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
120 self.add_composite_file('%s.3.ebwt', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
121 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
122 is_binary=True, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
123 self.add_composite_file('%s.4.ebwt', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
124 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
125 is_binary=True, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
126 self.add_composite_file('%s.rev.1.ebwt', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
127 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
128 is_binary=True, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
129 self.add_composite_file('%s.rev.2.ebwt', description='',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
130 substitute_name_with_metadata='reference_name',
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
131 is_binary=True, optional=True)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
132
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
133 def generate_primary_file(self, dataset=None):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
134 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
135 This is called only at upload to write the file
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
136 cannot rename the datasets here - they come with
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
137 the default unfortunately
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
138 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
139
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
140 def regenerate_primary_file(self, dataset):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
141 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
142 cannot do this until we are setting metadata
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
143 """
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
144 link_to_exts = ['.grp', '.ti', '.seq', '.fa', '.chrlist', '.log']
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
145 ref_name = dataset.metadata.reference_name
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
146 efp = dataset.extra_files_path
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
147 flist = os.listdir(efp)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
148 rval = ['<html><head><title>%s</title></head><body><p/>RSEM \
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
149 Reference %s files:<p/><ul>' % (dataset.name, ref_name)]
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
150 rvalb = []
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
151 for i, fname in enumerate(flist):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
152 sfname = os.path.split(fname)[-1]
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
153 f, e = os.path.splitext(fname)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
154 if e in link_to_exts:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
155 rval.append('<li><a href="%s">%s</a></li>' % (sfname, sfname))
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
156 else:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
157 rvalb.append('<li>%s</li>' % (sfname))
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
158 if len(rvalb) > 0:
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
159 rval += rvalb
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
160 rval.append('</ul></body></html>')
9
e00a79cf5f8c "planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit fdb6ccd340e366ef386d69ff344036a83e479b2f"
artbio
parents: 1
diff changeset
161 fh = open(dataset.file_name, 'w')
0
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
162 fh.write("\n".join(rval))
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
163 fh.write('\n')
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
164 fh.close()
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
165
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
166 def set_meta(self, dataset, **kwd):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
167 Html.set_meta(self, dataset, **kwd)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
168 efp = dataset.extra_files_path
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
169 flist = os.listdir(efp)
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
170 for i, fname in enumerate(flist):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
171 if fname.endswith('.grp'):
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
172 dataset.metadata.reference_name = fname[:-4]
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
173 break
e5e836936d60 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff changeset
174 self.regenerate_primary_file(dataset)
1
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
175
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
176
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
177 class RsemBt2Reference(Html):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
178 """Class describing an RSEM reference"""
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
179 MetadataElement(name='reference_name', default='rsem_bt2_ref',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
180 desc='RSEM Bowtie2 Reference Name', readonly=True,
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
181 visible=True, set_in_upload=True, no_value='rsem_bt2_ref')
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
182 file_ext = 'rsem_bt2_ref'
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
183 allow_datatype_change = False
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
184 composite_type = 'auto_primary_file'
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
185
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
186 def __init__(self, **kwd):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
187 Html.__init__(self, **kwd)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
188 """
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
189 Expecting files:
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
190 extra_files_path/<reference_name>.grp
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
191 extra_files_path/<reference_name>.ti
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
192 extra_files_path/<reference_name>.seq
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
193 extra_files_path/<reference_name>.transcripts.fa
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
194 Optionally includes files:
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
195 extra_files_path/<reference_name>.chrlist
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
196 extra_files_path/<reference_name>.idx.fa
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
197 extra_files_path/<reference_name>.n2g.idx.fa
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
198 extra_files_path/<reference_name>.1.bt2
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
199 extra_files_path/<reference_name>.2.bt2
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
200 extra_files_path/<reference_name>.3.bt2
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
201 extra_files_path/<reference_name>.4.bt2
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
202 extra_files_path/<reference_name>.rev.1.bt2
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
203 extra_files_path/<reference_name>.rev.2.bt2
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
204 """
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
205 self.add_composite_file('%s.grp', description='Group File',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
206 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
207 is_binary=False)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
208 self.add_composite_file('%s.ti', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
209 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
210 is_binary=False)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
211 self.add_composite_file('%s.seq', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
212 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
213 is_binary=False)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
214 self.add_composite_file('%s.transcripts.fa', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
215 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
216 is_binary=False)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
217 self.add_composite_file('%s.chrlist', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
218 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
219 is_binary=False, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
220 self.add_composite_file('%s.idx.fa', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
221 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
222 is_binary=False, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
223 self.add_composite_file('%s.n2g.idx.fa', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
224 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
225 is_binary=False, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
226 self.add_composite_file('%s.1.bt2', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
227 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
228 is_binary=True, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
229 self.add_composite_file('%s.2.bt2', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
230 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
231 is_binary=True, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
232 self.add_composite_file('%s.3.bt2', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
233 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
234 is_binary=True, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
235 self.add_composite_file('%s.4.bt2', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
236 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
237 is_binary=True, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
238 self.add_composite_file('%s.rev.1.bt2', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
239 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
240 is_binary=True, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
241 self.add_composite_file('%s.rev.2.bt2', description='',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
242 substitute_name_with_metadata='reference_name',
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
243 is_binary=True, optional=True)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
244
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
245 def generate_primary_file(self, dataset=None):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
246 """
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
247 This is called only at upload to write the file
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
248 cannot rename the datasets here - they come with
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
249 the default unfortunately
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
250 """
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
251
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
252 def regenerate_primary_file(self, dataset):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
253 """
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
254 cannot do this until we are setting metadata
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
255 """
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
256 link_to_exts = ['.grp', '.ti', '.seq', '.fa', '.chrlist', '.log']
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
257 ref_name = dataset.metadata.reference_name
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
258 efp = dataset.extra_files_path
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
259 flist = os.listdir(efp)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
260 rval = ['<html><head><title>%s</title></head><body><p/>RSEM \
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
261 Reference %s files:<p/><ul>' % (dataset.name, ref_name)]
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
262 rvalb = []
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
263 for i, fname in enumerate(flist):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
264 sfname = os.path.split(fname)[-1]
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
265 f, e = os.path.splitext(fname)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
266 if e in link_to_exts:
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
267 rval.append('<li><a href="%s">%s</a></li>' % (sfname, sfname))
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
268 else:
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
269 rvalb.append('<li>%s</li>' % (sfname))
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
270 if len(rvalb) > 0:
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
271 rval += rvalb
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
272 rval.append('</ul></body></html>')
9
e00a79cf5f8c "planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit fdb6ccd340e366ef386d69ff344036a83e479b2f"
artbio
parents: 1
diff changeset
273 fh = open(dataset.file_name, 'w')
1
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
274 fh.write("\n".join(rval))
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
275 fh.write('\n')
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
276 fh.close()
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
277
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
278 def set_meta(self, dataset, **kwd):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
279 Html.set_meta(self, dataset, **kwd)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
280 efp = dataset.extra_files_path
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
281 flist = os.listdir(efp)
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
282 for i, fname in enumerate(flist):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
283 if fname.endswith('.grp'):
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
284 dataset.metadata.reference_name = fname[:-4]
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
285 break
49795544dac7 planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit 62e8088d5f73cbb9b2f93e23a74636c77a06b492
artbio
parents: 0
diff changeset
286 self.regenerate_primary_file(dataset)