annotate BigWig.py @ 0:f493979f1408 draft default tip

planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
author yating-l
date Wed, 21 Dec 2016 12:13:04 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
1 #!/usr/bin/python
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
2
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
3 import os
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
4 import shutil
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
5
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
6 # Internal dependencies
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
7 from Datatype import Datatype
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
8 from Track import Track
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
9 from TrackDb import TrackDb
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
10
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
11
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
12 class BigWig( Datatype ):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
13 def __init__(self, input_bigwig_path, data_bigwig):
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
14 super(BigWig, self).__init__()
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
15
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
16 self.track = None
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
17
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
18 self.input_bigwig_path = input_bigwig_path
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
19 self.name_bigwig = data_bigwig["name"]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
20 self.priority = data_bigwig["order_index"]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
21 self.track_color = data_bigwig["track_color"]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
22 # TODO: Think about how to avoid repetition of the group_name everywhere
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
23 self.group_name = data_bigwig["group_name"]
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
24
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
25 #print "Creating TrackHub BigWig from (falsePath: %s; name: %s)" % ( self.input_bigwig_path, self.name_bigwig )
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
26
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
27 trackName = "".join( ( self.name_bigwig, ".bigwig" ) )
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
28
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
29 myBigWigFilePath = os.path.join(self.myTrackFolderPath, trackName)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
30 shutil.copy(self.input_bigwig_path, myBigWigFilePath)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
31
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
32 # Create the Track Object
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
33 self.createTrack(file_path=trackName,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
34 track_name=trackName,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
35 long_label=self.name_bigwig,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
36 track_type='bigWig', visibility='full',
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
37 priority=self.priority,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
38 track_file=myBigWigFilePath,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
39 track_color=self.track_color,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
40 group_name=self.group_name)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
41
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
42 # dataURL = "tracks/%s" % trackName
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
43 #
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
44 # # Return the BigBed track
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
45 #
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
46 # trackDb = TrackDb(
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
47 # trackName=trackName,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
48 # longLabel=self.name_bigwig,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
49 # shortLabel=self.getShortName( self.name_bigwig ),
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
50 # trackDataURL=dataURL,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
51 # trackType='bigWig',
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
52 # visibility='full',
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
53 # priority=self.priority,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
54 # )
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
55 #
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
56 # self.track = Track(
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
57 # trackFile=myBigWigFilePath,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
58 # trackDb=trackDb,
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
59 # )
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
60
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
61 print("- BigWig %s created" % self.name_bigwig)
f493979f1408 planemo upload for repository https://github.com/Yating-L/hubarchivecreator-test commit 48b59e91e2dcc2e97735ee35d587960cbfbce932-dirty
yating-l
parents:
diff changeset
62 #print("- %s created in %s" % (trackName, myBigWigFilePath))