comparison bigPsl.py @ 20:40469b265ddb draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 3af31e043f5b82636015c18e013d2f22ce6c9077-dirty
author yating-l
date Fri, 20 Jan 2017 17:12:03 -0500
parents
children 884ee2a71680
comparison
equal deleted inserted replaced
19:0152500d9acd 20:40469b265ddb
1 #!/usr/bin/python
2
3 import os
4 import tempfile
5
6 from Datatype import Datatype
7 from Track import Track
8 from TrackDb import TrackDb
9 from util import subtools
10
11
12 class bigPsl( Datatype ):
13 def __init__(self, input_bigpsl_false_path, data_bigpsl):
14
15 super(bigPsl, self).__init__()
16
17 self.input_bigpsl_false_path = input_bigpsl_false_path
18 self.name_bigpsl = data_bigpsl["name"]
19 self.priority = data_bigpsl["order_index"]
20 self.track_color = data_bigpsl["track_color"]
21 # TODO: Think about how to avoid repetition of the group_name everywhere
22 self.group_name = data_bigpsl["group_name"]
23
24 #sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed")
25
26 # Sort processing
27 #subtools.sort(self.input_bigpsl_false_path, sortedBedFile.name)
28
29 # bedToBigBed processing
30 # TODO: Change the name of the bb, to tool + genome + .bb
31 trackName = "".join( ( self.name_bigpsl, '.bb' ) )
32 myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName)
33
34 auto_sql_option = os.path.join(self.tool_directory, 'bigPsl.as')
35
36 with open(myBigBedFilePath, 'w') as bigBedFile:
37 subtools.bedToBigBed(self.input_bigpsl_false_path,
38 self.chromSizesFile.name,
39 bigBedFile.name,
40 typeOption='bed12+12',
41 tab='True',
42 autoSql=auto_sql_option)
43
44 # Create the Track Object
45 self.createTrack(file_path=trackName,
46 track_name=trackName,
47 long_label=self.name_bigpsl, track_type='bigBed 12 +', visibility='dense',
48 priority=self.priority,
49 track_file=myBigBedFilePath,
50 track_color=self.track_color,
51 group_name=self.group_name)
52
53 # dataURL = "tracks/%s" % trackName
54 #
55 # trackDb = TrackDb(
56 # trackName=trackName,
57 # longLabel=self.name_bed_simple_repeats,
58 # shortLabel=self.getShortName( self.name_bed_simple_repeats ),
59 # trackDataURL=dataURL,
60 # trackType='bigBed 4 +',
61 # visibility='dense',
62 # priority=self.priority,
63 # )
64 #
65 # self.track = Track(
66 # trackFile=myBigBedFilePath,
67 # trackDb=trackDb,
68 # )
69
70 print("- bigPsl %s created" % self.name_bigpsl)
71 #print("- %s created in %s" % (trackName, myBigBedFilePath))