Mercurial > repos > rmarenco > hubarchivecreator
comparison Gtf.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 |
---|---|
23 | 23 |
24 #print "Creating TrackHub GTF from (falsePath: %s; name: %s)" % ( self.input_gtf_false_path, self.name_gtf) | 24 #print "Creating TrackHub GTF from (falsePath: %s; name: %s)" % ( self.input_gtf_false_path, self.name_gtf) |
25 | 25 |
26 # TODO: See if we need these temporary files as part of the generated files | 26 # TODO: See if we need these temporary files as part of the generated files |
27 genePredFile = tempfile.NamedTemporaryFile(bufsize=0, suffix=".genePred") | 27 genePredFile = tempfile.NamedTemporaryFile(bufsize=0, suffix=".genePred") |
28 unsortedBedFile = tempfile.NamedTemporaryFile(bufsize=0, suffix=".unsortedBed") | 28 unsorted_bigGenePred_file = tempfile.NamedTemporaryFile(bufsize=0, suffix=".unsorted.bigGenePred") |
29 sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed") | 29 sorted_bigGenePred_file = tempfile.NamedTemporaryFile(suffix=".sortedBed.bigGenePred") |
30 | 30 |
31 # GtfToGenePred | 31 # GtfToGenePred |
32 subtools.gtfToGenePred(self.input_gtf_false_path, genePredFile.name) | 32 subtools.gtfToGenePred(self.input_gtf_false_path, genePredFile.name) |
33 | 33 |
34 # TODO: From there, refactor because common use with Gff3.py | 34 # TODO: From there, refactor because common use with Gff3.py |
35 # genePredToBed processing | 35 # genePredToBigGenePred processing |
36 subtools.genePredToBed(genePredFile.name, unsortedBedFile.name) | 36 subtools.genePredToBigGenePred(genePredFile.name, unsorted_bigGenePred_file.name) |
37 | 37 |
38 # Sort processing | 38 # Sort processing |
39 subtools.sort(unsortedBedFile.name, sortedBedFile.name) | 39 subtools.sort(unsorted_bigGenePred_file.name, sorted_bigGenePred_file.name) |
40 | 40 |
41 # bedToBigBed processing | 41 # bedToBigBed processing |
42 # TODO: Change the name of the bb, to tool + genome + possible adding if multiple + .bb | |
43 trackName = "".join( ( self.name_gtf, ".bb") ) | 42 trackName = "".join( ( self.name_gtf, ".bb") ) |
43 | |
44 auto_sql_option = os.path.join(self.tool_directory, 'bigGenePred.as') | |
45 | |
44 myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName) | 46 myBigBedFilePath = os.path.join(self.myTrackFolderPath, trackName) |
47 | |
45 with open(myBigBedFilePath, 'w') as bigBedFile: | 48 with open(myBigBedFilePath, 'w') as bigBedFile: |
46 subtools.bedToBigBed(sortedBedFile.name, self.chromSizesFile.name, bigBedFile.name) | 49 subtools.bedToBigBed(sorted_bigGenePred_file.name, |
50 self.chromSizesFile.name, | |
51 bigBedFile.name, | |
52 autoSql=auto_sql_option, | |
53 typeOption='bed12+8', | |
54 tab=True) | |
55 | |
47 | 56 |
48 # Create the Track Object | 57 # Create the Track Object |
49 self.createTrack(file_path=trackName, | 58 self.createTrack(file_path=trackName, |
50 track_name=trackName, | 59 track_name=trackName, |
51 long_label=self.name_gtf, track_type='bigBed 12 +', visibility='dense', priority=self.priority, | 60 long_label=self.name_gtf, track_type='bigGenePred', |
61 visibility='dense', priority=self.priority, | |
52 track_file=myBigBedFilePath) | 62 track_file=myBigBedFilePath) |
53 # | |
54 # dataURL = "tracks/%s" % trackName | |
55 # | |
56 # trackDb = TrackDb( | |
57 # trackName=trackName, | |
58 # longLabel=self.name_gtf, | |
59 # shortLabel=self.getShortName( self.name_gtf ), | |
60 # trackDataURL=dataURL, | |
61 # trackType='bigBed 12 +', | |
62 # visibility='dense', | |
63 # priority=self.priority, | |
64 # ) | |
65 # self.track = Track( | |
66 # trackFile=myBigBedFilePath, | |
67 # trackDb=trackDb, | |
68 # ) | |
69 | 63 |
70 print("- Gtf %s created" % self.name_gtf) | 64 print("- Gtf %s created" % self.name_gtf) |
71 #print("- %s created in %s" % (trackName, myBigBedFilePath)) |