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