Mercurial > repos > artbio > rsem
annotate rsem.py @ 0:e5e836936d60 draft
planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
author | artbio |
---|---|
date | Sat, 31 Mar 2018 21:30:07 -0400 |
parents | |
children | 49795544dac7 |
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>') |
e5e836936d60
planemo upload for repository https://github.com/artbio/tools-artbio/tree/master/tools/rsem commit d84a0359354698a4b29df12ab581c2618bffcf80
artbio
parents:
diff
changeset
|
161 fh = file(dataset.file_name, 'w') |
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) |