Mercurial > repos > rmarenco > hubarchivecreator
comparison Bed.py @ 10:acc233161f50 draft
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1b1063f90004764bcf504f4340738eca5c4b1f9d
author | rmarenco |
---|---|
date | Thu, 21 Jul 2016 05:58:51 -0400 |
parents | fb5e60d4d18a |
children | d05236b15f81 |
comparison
equal
deleted
inserted
replaced
9:4f9847539a28 | 10:acc233161f50 |
---|---|
9 from TrackDb import TrackDb | 9 from TrackDb import TrackDb |
10 from util import subtools | 10 from util import subtools |
11 | 11 |
12 | 12 |
13 class Bed( Datatype ): | 13 class Bed( Datatype ): |
14 def __init__( self, inputBedGeneric, data_bed_generic, | 14 def __init__( self, inputBedGeneric, data_bed_generic): |
15 inputFastaFile, extra_files_path, tool_directory ): | 15 super(Bed, self).__init__() |
16 super(Bed, self).__init__( | |
17 inputFastaFile, extra_files_path, tool_directory | |
18 ) | |
19 | 16 |
20 self.track = None | 17 self.track = None |
21 | 18 |
22 self.inputBedGeneric = inputBedGeneric | 19 self.inputBedGeneric = inputBedGeneric |
23 | 20 |
24 self.sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed") | 21 self.sortedBedFile = tempfile.NamedTemporaryFile(suffix=".sortedBed") |
25 self.chromSizesFile = tempfile.NamedTemporaryFile(bufsize=0, suffix=".chrom.sizes") | |
26 self.twoBitInfoFile = tempfile.NamedTemporaryFile(bufsize=0) | |
27 | 22 |
28 self.data_bed_generic = data_bed_generic | 23 self.data_bed_generic = data_bed_generic |
29 self.name_bed_generic = self.data_bed_generic["name"] | 24 self.name_bed_generic = self.data_bed_generic["name"] |
30 self.priority = self.data_bed_generic["order_index"] | 25 self.priority = self.data_bed_generic["order_index"] |
31 | 26 |
32 # Sort processing | 27 # Sort processing |
33 subtools.sort(self.inputBedGeneric, self.sortedBedFile.name) | 28 subtools.sort(self.inputBedGeneric, self.sortedBedFile.name) |
34 | |
35 # Generate the chrom.sizes | |
36 # TODO: Isolate in a function | |
37 # We first get the twoBit Infos | |
38 subtools.twoBitInfo(self.twoBitFile.name, self.twoBitInfoFile.name) | |
39 | |
40 # Then we get the output to inject into the sort | |
41 # TODO: Check if no errors | |
42 subtools.sortChromSizes(self.twoBitInfoFile.name, self.chromSizesFile.name) | |
43 | 29 |
44 # bedToBigBed processing | 30 # bedToBigBed processing |
45 # TODO: Change the name of the bb, to tool + genome + possible adding if multiple + .bb | 31 # TODO: Change the name of the bb, to tool + genome + possible adding if multiple + .bb |
46 trackName = "".join( ( self.name_bed_generic, ".bb") ) | 32 trackName = "".join( ( self.name_bed_generic, ".bb") ) |
47 | 33 |