Mercurial > repos > yating-l > jbrowsearchivecreator
annotate datatypes/Datatype.py @ 9:7cb67cbbd8e5 draft
planemo upload for repository https://github.com/goeckslab/jbrowse-archive-creator.git commit 753ca09582fe0148e538103f2c211f7caa182966
author | yating-l |
---|---|
date | Tue, 01 May 2018 23:01:06 -0400 |
parents | 5d5fdcb798da |
children | 43a700afd457 |
rev | line source |
---|---|
6
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
1 #!/usr/bin/python |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
2 # -*- coding: utf8 -*- |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
3 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
4 """ |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
5 Super Class of the managed datatype |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
6 """ |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
7 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
8 import os |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
9 import tempfile |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
10 import collections |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
11 from util import subtools |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
12 import logging |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
13 import abc |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
14 from abc import ABCMeta |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
15 from tracks.HTMLFeatures import HTMLFeatures |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
16 from tracks.CanvasFeatures import CanvasFeatures |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
17 from tracks.BamFeatures import BamFeatures |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
18 from tracks.BigwigFeatures import BigwigFeatures |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
19 from datatypes.validators.DataValidation import DataValidation |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
20 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
21 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
22 class Datatype(object): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
23 __metaclass__ = ABCMeta |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
24 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
25 chromSizesFile = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
26 input_fasta_file = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
27 extra_files_path = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
28 tool_directory = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
29 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
30 mySpecieFolderPath = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
31 myTrackFolderPath = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
32 myBinaryFolderPath = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
33 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
34 trackType = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
35 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
36 def __init__(self): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
37 not_init_message = "The {0} is not initialized." \ |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
38 "Did you use pre_init static method first?" |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
39 if Datatype.input_fasta_file is None: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
40 raise TypeError(not_init_message.format('reference genome')) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
41 if Datatype.extra_files_path is None: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
42 raise TypeError(not_init_message.format('track Hub path')) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
43 if Datatype.tool_directory is None: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
44 raise TypeError(not_init_message.format('tool directory')) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
45 self.inputFile = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
46 self.trackType = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
47 self.dataType = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
48 self.trackFileType = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
49 self.track = None |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
50 self.trackSettings = dict() |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
51 self.extraSettings = collections.OrderedDict() |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
52 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
53 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
54 @staticmethod |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
55 def pre_init(reference_genome, chrom_sizes_file, |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
56 extra_files_path, tool_directory, specie_folder, tracks_folder, binary_folder, track_type): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
57 Datatype.extra_files_path = extra_files_path |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
58 Datatype.tool_directory = tool_directory |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
59 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
60 # TODO: All this should be in TrackHub and not in Datatype |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
61 Datatype.mySpecieFolderPath = specie_folder |
7
5d5fdcb798da
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
6
diff
changeset
|
62 Datatype.myTrackFolderPath = tracks_folder # temporary raw data files |
6
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
63 Datatype.myBinaryFolderPath = binary_folder |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
64 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
65 Datatype.input_fasta_file = reference_genome |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
66 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
67 # 2bit file creation from input fasta |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
68 #Datatype.twoBitFile = two_bit_path |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
69 Datatype.chromSizesFile = chrom_sizes_file |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
70 Datatype.trackType = track_type |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
71 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
72 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
73 def generateCustomTrack(self): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
74 self.validateData() |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
75 self.initSettings() |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
76 #Create the track file |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
77 self.createTrack() |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
78 # Create the TrackDb Object |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
79 self.createTrackDb() |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
80 logging.debug("- %s %s created", self.dataType, self.trackName) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
81 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
82 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
83 @abc.abstractmethod |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
84 def validateData(self): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
85 """validate the input data with DataValidation""" |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
86 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
87 def initSettings(self): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
88 #Initialize required fields: trackName, longLabel, shortLable |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
89 self.trackName = self.trackSettings["name"] |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
90 self.trackDataURL = os.path.join(self.myTrackFolderPath, self.trackName) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
91 if self.trackSettings["long_label"]: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
92 self.trackLabel = self.trackSettings["long_label"] |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
93 else: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
94 self.trackLabel = self.trackName |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
95 if "trackType" in self.trackSettings and self.trackSettings["trackType"]: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
96 self.trackType = self.trackSettings["trackType"] |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
97 if self.trackSettings["group_name"]: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
98 self.extraSettings["category"] = self.trackSettings["group_name"] |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
99 if "track_color" in self.trackSettings and self.trackSettings["track_color"]: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
100 self.extraSettings["color"] = self.trackSettings["track_color"] |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
101 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
102 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
103 @abc.abstractmethod |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
104 def createTrack(self): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
105 """Create the final track file""" |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
106 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
107 def createTrackDb(self): |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
108 if self.trackType == 'HTMLFeatures': |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
109 self.track = HTMLFeatures(self.trackName, self.trackLabel, self.trackDataURL, self.trackType, self.dataType, self.extraSettings) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
110 elif self.trackType == "CanvasFeatures": |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
111 self.track = CanvasFeatures(self.trackName, self.trackLabel, self.trackDataURL, self.trackType, self.dataType, self.extraSettings) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
112 elif self.trackType == "bam": |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
113 self.track = BamFeatures(self.trackName, self.trackLabel, self.trackDataURL, self.trackType, self.dataType, self.extraSettings) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
114 elif self.trackType == "bigwig": |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
115 self.track = BigwigFeatures(self.trackName, self.trackLabel, self.trackDataURL, self.trackType, self.dataType, self.extraSettings) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
116 else: |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
117 logging.error("Cannot createTrackDb, because trackType is not defined or invalid! trackType = %s", self.trackType) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
118 self.track.createTrackDb() |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
119 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
120 #self.track = TrackDb(self.trackName, self.trackLabel, self.trackDataURL, self.trackType, self.dataType, self.extraSettings) |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
121 |
237707a6b74d
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit a500f7ab2119cc5faaf80393bd87428389d06880-dirty
yating-l
parents:
diff
changeset
|
122 |