annotate datatypes/Datatype.py @ 1:85195e0d4b71 draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
author yating-l
date Fri, 29 Sep 2017 13:32:23 -0400
parents
children fa990284327b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
1 #!/usr/bin/python
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
2 # -*- coding: utf8 -*-
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
3
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
4 """
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
5 Super Class of the managed datatype
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
6 """
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
7
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
8 import os
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
9 import tempfile
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
10 import collections
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
11 import util
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
12 import logging
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
13 import abc
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
14 from abc import ABCMeta
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
15 from TrackDb import TrackDb
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
16 from datatypes.validators.DataValidation import DataValidation
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
17
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
18
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
19 class Datatype(object):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
20 __metaclass__ = ABCMeta
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
21
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
22 twoBitFile = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
23 chromSizesFile = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
24 input_fasta_file = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
25 extra_files_path = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
26 tool_directory = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
27
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
28 mySpecieFolderPath = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
29 myTrackFolderPath = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
30
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
31
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
32 def __init__(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
33 not_init_message = "The {0} is not initialized." \
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
34 "Did you use pre_init static method first?"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
35 if Datatype.input_fasta_file is None:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
36 raise TypeError(not_init_message.format('reference genome'))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
37 if Datatype.extra_files_path is None:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
38 raise TypeError(not_init_message.format('track Hub path'))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
39 if Datatype.tool_directory is None:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
40 raise TypeError(not_init_message.format('tool directory'))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
41 self.inputFile = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
42 self.trackType = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
43 self.dataType = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
44 self.track = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
45 self.trackSettings = dict()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
46 self.extraSettings = collections.OrderedDict()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
47
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
48 @staticmethod
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
49 def pre_init(reference_genome, two_bit_path, chrom_sizes_file,
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
50 extra_files_path, tool_directory, specie_folder, tracks_folder):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
51 Datatype.extra_files_path = extra_files_path
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
52 Datatype.tool_directory = tool_directory
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
53
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
54 # TODO: All this should be in TrackHub and not in Datatype
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
55 Datatype.mySpecieFolderPath = specie_folder
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
56 Datatype.myTrackFolderPath = tracks_folder
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
57
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
58 Datatype.input_fasta_file = reference_genome
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
59
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
60 # 2bit file creation from input fasta
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
61 Datatype.twoBitFile = two_bit_path
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
62 Datatype.chromSizesFile = chrom_sizes_file
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
63
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
64 def generateCustomTrack(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
65 self.validateData()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
66 self.initSettings()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
67 #Create the track file
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
68 self.createTrack()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
69 # Create the TrackDb Object
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
70 self.createTrackDb()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
71 logging.debug("- %s %s created", self.dataType, self.trackName)
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
72
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
73
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
74 @abc.abstractmethod
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
75 def validateData(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
76 """validate the input data with DataValidation"""
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
77
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
78 def initSettings(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
79 #Initialize required fields: trackName, longLabel, shortLable
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
80 self.trackName = self.trackSettings["name"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
81 if self.trackSettings["long_label"]:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
82 self.longLabel = self.trackSettings["long_label"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
83 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
84 self.longLabel = self.trackName
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
85 if not "short_label" in self.trackSettings:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
86 self.shortLabel = ""
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
87 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
88 self.shortLabel = self.trackSettings["short_label"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
89 self.trackDataURL = os.path.join(self.myTrackFolderPath, self.trackName)
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
90
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
91
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
92 @abc.abstractmethod
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
93 def createTrack(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
94 """Create the final track file"""
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
95
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
96 def createTrackDb(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
97 self.track = TrackDb(self.trackName, self.longLabel, self.shortLabel, self.trackDataURL, self.trackType, self.extraSettings)
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
98
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
99
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
100
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
101
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
102
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
103
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
104
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
105 '''
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
106 def __init__(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
107 not_init_message = "The {0} is not initialized." \
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
108 "Did you use pre_init static method first?"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
109 if Datatype.input_fasta_file is None:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
110 raise TypeError(not_init_message.format('reference genome'))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
111 if Datatype.extra_files_path is None:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
112 raise TypeError(not_init_message.format('track Hub path'))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
113 if Datatype.tool_directory is None:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
114 raise TypeError(not_init_message.format('tool directory'))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
115 self.track = None
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
116 self.extra_settings = collections.OrderedDict()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
117
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
118
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
119 @staticmethod
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
120 def pre_init(reference_genome, two_bit_path, chrom_sizes_file,
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
121 extra_files_path, tool_directory, specie_folder, tracks_folder):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
122 Datatype.extra_files_path = extra_files_path
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
123 Datatype.tool_directory = tool_directory
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
124
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
125 # TODO: All this should be in TrackHub and not in Datatype
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
126 Datatype.mySpecieFolderPath = specie_folder
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
127 Datatype.myTrackFolderPath = tracks_folder
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
128
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
129 Datatype.input_fasta_file = reference_genome
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
130
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
131 # 2bit file creation from input fasta
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
132 Datatype.twoBitFile = two_bit_path
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
133 Datatype.chromSizesFile = chrom_sizes_file
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
134
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
135 @staticmethod
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
136 def get_largest_scaffold_name(self):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
137 # We can get the biggest scaffold here, with chromSizesFile
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
138 with open(Datatype.chromSizesFile.name, 'r') as chrom_sizes:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
139 # TODO: Check if exists
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
140 return chrom_sizes.readline().split()[0]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
141
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
142
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
143 def createTrack(self, trackName, longLabel, shortLabel, trackDataURL, trackType, extra_settings=None):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
144 self.track = TrackDb(trackName, longLabel, shortLabel, trackDataURL, trackType, extra_settings)
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
145
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
146 def initRequiredSettings(self, trackSettings, trackDataURL = None, trackType = None):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
147
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
148 #Initialize required fields: trackName, longLabel, shortLable
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
149
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
150 self.trackSettings = trackSettings
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
151 self.trackName = self.trackSettings["name"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
152 #self.priority = self.trackSettings["order_index"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
153 #self.track_color = self.trackSettings["track_color"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
154 # TODO: Think about how to avoid repetition of the group_name everywhere
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
155 #self.group_name = self.trackSettings["group_name"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
156 #self.database = self.trackSettings["database"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
157 if self.trackSettings["long_label"]:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
158 self.longLabel = self.trackSettings["long_label"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
159 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
160 self.longLabel = self.trackName
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
161 if not "short_label" in self.trackSettings:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
162 self.shortLabel = ""
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
163 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
164 self.shortLabel = self.trackSettings["short_label"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
165 self.trackDataURL = trackDataURL
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
166 self.trackType = trackType
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
167
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
168 def setExtLink(self, database, inputFile, seqType=None, useIframe=True, iframeHeight=None, iframeWidth=None):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
169 if "NCBI" in database:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
170 if not seqType:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
171 self.seqType = int(self.getSeqType(inputFile))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
172 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
173 self.seqType = seqType
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
174 if self.seqType < 0:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
175 print self.seqType
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
176 raise Exception("Sequence Type is not set for bigPsl. Stopping the application")
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
177 if self.seqType == 2:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
178 self.extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/protein/$$"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
179 elif self.seqType == 1:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
180 self.extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/nuccore/$$"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
181 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
182 raise Exception("Sequence Type {0} is not valid for bigPsl. Stopping the application".format(self.seqType))
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
183 elif "UniProt" in database:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
184 self.extra_settings["url"] = "http://www.uniprot.org/uniprot/$$"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
185 elif "FlyBase" in database:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
186 self.extra_settings["url"] = "http://flybase.org/reports/$$"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
187 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
188 self.extra_settings["url"] = "https://www.ncbi.nlm.nih.gov/gquery/?term=$$"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
189 self.extra_settings["urlLabel"] = database + " Details:"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
190 if useIframe:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
191 self.extra_settings["iframeUrl"] = self.extra_settings["url"]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
192 if not iframeHeight:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
193 iframeHeight = "600"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
194 if not iframeWidth:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
195 iframeWidth = "800"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
196 self.extra_settings["iframeOptions"] = "height= %s width= %s" % (iframeHeight, iframeWidth)
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
197
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
198 def getSeqType(self, inputFile):
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
199 with open(inputFile, "r") as bigpsl:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
200 sampleSeq = bigpsl.readline().split()
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
201 if len(sampleSeq) == 25:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
202 return sampleSeq[-1]
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
203 else:
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
204 return "-1"
85195e0d4b71 planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit b1ae7349f118a0fe7923d765020dfc684cf84116-dirty
yating-l
parents:
diff changeset
205 '''