comparison cytoBand.py @ 24:fcc1021bd496 draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 93e2e2fb59f99677425104a80c17f665fa7b2b4a-dirty
author yating-l
date Wed, 31 May 2017 11:35:16 -0400
parents
children df42241d3731
comparison
equal deleted inserted replaced
23:2677f1899aa8 24:fcc1021bd496
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 cytoBand( Datatype ):
13 def __init__(self, input_bed_cytoBand_false_path, data_bed_cytoBand):
14
15 super(cytoBand, self).__init__()
16
17 self.input_bed_cytoBand_false_path = input_bed_cytoBand_false_path
18 self.name_bed_cytoBand = data_bed_cytoBand["name"]
19 self.priority = data_bed_cytoBand["order_index"]
20 self.track_color = data_bed_cytoBand["track_color"]
21 # TODO: Think about how to avoid repetition of the group_name everywhere
22 self.group_name = data_bed_cytoBand["group_name"]
23 if data_bed_cytoBand["long_label"]:
24 self.long_label = data_bed_cytoBand["long_label"]
25 else:
26 self.long_label = self.name_bed_cytoBand
27 sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed")
28
29 # Sort processing
30 subtools.sort(self.input_bed_cytoBand_false_path, sortedBedFile.name)
31
32 # bedToBigBed processing
33 # TODO: Change the name of the bb, to tool + genome + .bb
34 trackName = "".join( ( self.name_bed_cytoBand, '.bb' ) )
35 myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName)
36
37 auto_sql_option = os.path.join(self.tool_directory, 'cytoBandIdeo.as')
38
39 with open(myBigBedFilePath, 'w') as bigBedFile:
40 subtools.bedToBigBed(sortedBedFile.name,
41 self.chromSizesFile.name,
42 bigBedFile.name,
43 typeOption='bed4',
44 autoSql=auto_sql_option)
45
46 # Create the Track Object
47 self.createTrack(file_path=trackName,
48 track_name='cytoBandIdeo',
49 long_label=self.long_label,
50 track_type='bigBed',
51 visibility='dense',
52 priority=self.priority,
53 track_file=myBigBedFilePath,
54 track_color=self.track_color,
55 group_name=self.group_name)
56
57 # dataURL = "tracks/%s" % trackName
58 #
59 # trackDb = TrackDb(
60 # trackName=trackName,
61 # longLabel=self.name_bed_simple_repeats,
62 # shortLabel=self.getShortName( self.name_bed_simple_repeats ),
63 # trackDataURL=dataURL,
64 # trackType='bigBed 4 +',
65 # visibility='dense',
66 # priority=self.priority,
67 # )
68 #
69 # self.track = Track(
70 # trackFile=myBigBedFilePath,
71 # trackDb=trackDb,
72 # )
73
74 print("- Bed splice junctions %s created" % self.name_bed_cytoBand)
75 #print("- %s created in %s" % (trackName, myBigBedFilePath))