Mercurial > repos > rmarenco > hubarchivecreator
comparison Gff3.py @ 13:25809f699cb3 draft
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 65ab931ef2b05a5acf06cbde3a746c94a0a0a4cb
author | rmarenco |
---|---|
date | Thu, 11 Aug 2016 19:02:29 -0400 |
parents | d05236b15f81 |
children | 3233451a3bd6 |
comparison
equal
deleted
inserted
replaced
12:747475757cb0 | 13:25809f699cb3 |
---|---|
19 self.input_Gff3_false_path = input_Gff3_false_path | 19 self.input_Gff3_false_path = input_Gff3_false_path |
20 self.name_gff3 = data_gff3["name"] | 20 self.name_gff3 = data_gff3["name"] |
21 self.priority = data_gff3["order_index"] | 21 self.priority = data_gff3["order_index"] |
22 | 22 |
23 # TODO: See if we need these temporary files as part of the generated files | 23 # TODO: See if we need these temporary files as part of the generated files |
24 genePredFile = tempfile.NamedTemporaryFile(bufsize=0, suffix=".genePred") | 24 unsorted_genePred_file = tempfile.NamedTemporaryFile(bufsize=0, suffix=".genePred") |
25 unsortedBedFile = tempfile.NamedTemporaryFile(bufsize=0, suffix=".unsortedBed") | 25 unsorted_bigGenePred_file = tempfile.NamedTemporaryFile(bufsize=0, suffix=".unsorted.bigGenePred") |
26 sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed") | 26 sorted_biGenePred_file = tempfile.NamedTemporaryFile(suffix=".sorted.bigGenePred") |
27 | |
28 # TODO: Refactor into another Class to manage the twoBitInfo and ChromSizes (same process as in Gtf.py) | |
29 | 27 |
30 # gff3ToGenePred processing | 28 # gff3ToGenePred processing |
31 subtools.gff3ToGenePred(self.input_Gff3_false_path, genePredFile.name) | 29 subtools.gff3ToGenePred(self.input_Gff3_false_path, unsorted_genePred_file.name) |
32 | 30 |
33 # TODO: From there, refactor because common use with Gtf.py | 31 # genePredToBigGenePred |
34 # genePredToBed processing | 32 subtools.genePredToBigGenePred(unsorted_genePred_file.name, unsorted_bigGenePred_file.name) |
35 subtools.genePredToBed(genePredFile.name, unsortedBedFile.name) | |
36 | 33 |
37 # Sort processing | 34 # Sort processing |
38 subtools.sort(unsortedBedFile.name, sortedBedFile.name) | 35 subtools.sort(unsorted_bigGenePred_file.name, sorted_biGenePred_file.name) |
39 | 36 |
40 # TODO: Check if no errors | 37 # TODO: Check if no errors |
41 | 38 |
42 # bedToBigBed processing | 39 # bedToBigBed processing |
43 # TODO: Change the name of the bb, to tool + genome + possible adding if multiple + .bb | |
44 trackName = "".join( (self.name_gff3, ".bb" ) ) | 40 trackName = "".join( (self.name_gff3, ".bb" ) ) |
41 | |
42 auto_sql_option = os.path.join(self.tool_directory, 'bigGenePred.as') | |
43 | |
45 myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName) | 44 myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName) |
45 | |
46 with open(myBigBedFilePath, 'w') as bigBedFile: | 46 with open(myBigBedFilePath, 'w') as bigBedFile: |
47 subtools.bedToBigBed(sortedBedFile.name, self.chromSizesFile.name, bigBedFile.name) | 47 subtools.bedToBigBed(sorted_biGenePred_file.name, |
48 self.chromSizesFile.name, | |
49 bigBedFile.name, | |
50 autoSql=auto_sql_option, | |
51 typeOption='bed12+8', | |
52 tab=True) | |
48 | 53 |
49 # Create the Track Object | 54 # Create the Track Object |
50 self.createTrack(file_path=trackName, | 55 self.createTrack(file_path=trackName, |
51 track_name=trackName, | 56 track_name=trackName, |
52 long_label=self.name_gff3, track_type='bigBed 12 +', visibility='dense', priority=self.priority, | 57 long_label=self.name_gff3, |
58 track_type='bigGenePred', visibility='dense', | |
59 priority=self.priority, | |
53 track_file=myBigBedFilePath) | 60 track_file=myBigBedFilePath) |
54 | 61 |
55 # dataURL = "tracks/%s" % trackName | |
56 # | |
57 # trackDb = TrackDb( | |
58 # trackName=trackName, | |
59 # longLabel=self.name_gff3, | |
60 # shortLabel=self.getShortName( self.name_gff3 ), | |
61 # trackDataURL=dataURL, | |
62 # trackType='bigBed 12 +', | |
63 # visibility='dense', | |
64 # priority=self.priority, | |
65 # ) | |
66 # | |
67 # self.track = Track( | |
68 # trackFile=myBigBedFilePath, | |
69 # trackDb=trackDb, | |
70 # ) | |
71 | |
72 print("- Gff3 %s created" % self.name_gff3) | 62 print("- Gff3 %s created" % self.name_gff3) |
73 #print("- %s created in %s" % (trackName, myBigBedFilePath)) |