comparison hubArchiveCreator.py @ 16:3233451a3bd6 draft

planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit fc73ec22a0db3ab09c4ac13dc58f0b54ae37845c
author rmarenco
date Sun, 25 Sep 2016 11:25:38 -0400
parents 25809f699cb3
children c02720d1afee
comparison
equal deleted inserted replaced
15:2a45cd656e8e 16:3233451a3bd6
22 from BigWig import BigWig 22 from BigWig import BigWig
23 from util.Fasta import Fasta 23 from util.Fasta import Fasta
24 from util.Filters import TraceBackFormatter 24 from util.Filters import TraceBackFormatter
25 from Gff3 import Gff3 25 from Gff3 import Gff3
26 from Gtf import Gtf 26 from Gtf import Gtf
27 from Psl import Psl
27 from TrackHub import TrackHub 28 from TrackHub import TrackHub
28 29
29 # TODO: Verify each subprocessed dependency is accessible [gff3ToGenePred, genePredToBed, twoBitInfo, faToTwoBit, bedToBigBed, sort 30 # TODO: Verify each subprocessed dependency is accessible [gff3ToGenePred, genePredToBed, twoBitInfo, faToTwoBit, bedToBigBed, sort
30 31
31 32
51 # BigWig Management 52 # BigWig Management
52 parser.add_argument('--bigwig', action='append', help='BigWig format') 53 parser.add_argument('--bigwig', action='append', help='BigWig format')
53 54
54 # Bam Management 55 # Bam Management
55 parser.add_argument('--bam', action='append', help='Bam format') 56 parser.add_argument('--bam', action='append', help='Bam format')
57
58 # Psl Management
59 parser.add_argument('--psl', action='append', help='Psl format')
56 60
57 # TODO: Check if the running directory can have issues if we run the tool outside 61 # TODO: Check if the running directory can have issues if we run the tool outside
58 parser.add_argument('-d', '--directory', 62 parser.add_argument('-d', '--directory',
59 help='Running tool directory, where to find the templates. Default is running directory') 63 help='Running tool directory, where to find the templates. Default is running directory')
60 parser.add_argument('-u', '--ucsc_tools_path', 64 parser.add_argument('-u', '--ucsc_tools_path',
104 108
105 # TODO: Use a class to have a better management of the structure of these inputs 109 # TODO: Use a class to have a better management of the structure of these inputs
106 # These inputs are populated in the Galaxy Wrapper xml and are in this format: 110 # These inputs are populated in the Galaxy Wrapper xml and are in this format:
107 # ARRAY[DICT{FILE_PATH: DICT{NAME: NAME_VALUE, EXTRA_DATA: EXTRA_DATA_VALUE}}] 111 # ARRAY[DICT{FILE_PATH: DICT{NAME: NAME_VALUE, EXTRA_DATA: EXTRA_DATA_VALUE}}]
108 # EXTRA_DATA could be anything, for example the index of a BAM => {"index", FILE_PATH} 112 # EXTRA_DATA could be anything, for example the index of a BAM => {"index", FILE_PATH}
113 array_inputs_bam = args.bam
114 array_inputs_bed_generic = args.bed
115 array_inputs_bed_simple_repeats = args.bedSimpleRepeats
116 array_inputs_bigwig = args.bigwig
109 array_inputs_gff3 = args.gff3 117 array_inputs_gff3 = args.gff3
110 array_inputs_bed_simple_repeats = args.bedSimpleRepeats
111 array_inputs_bed_generic = args.bed
112 array_inputs_gtf = args.gtf 118 array_inputs_gtf = args.gtf
113 array_inputs_bam = args.bam 119 array_inputs_psl = args.psl
114 array_inputs_bigwig = args.bigwig
115 120
116 outputFile = args.output 121 outputFile = args.output
117 122
118 json_inputs_data = args.data_json 123 json_inputs_data = args.data_json
119 124
127 # Create the Track Hub folder 132 # Create the Track Hub folder
128 trackHub = TrackHub(reference_genome, user_email, outputFile, extra_files_path, toolDirectory) 133 trackHub = TrackHub(reference_genome, user_email, outputFile, extra_files_path, toolDirectory)
129 134
130 all_datatype_dictionary = {} 135 all_datatype_dictionary = {}
131 136
132 for (inputs, datatype_class) in [(array_inputs_gff3, Gff3), 137 for (inputs, datatype_class) in [
133 (array_inputs_bed_simple_repeats, BedSimpleRepeats), 138 (array_inputs_bam, Bam),
134 (array_inputs_bed_generic, Bed), 139 (array_inputs_bed_generic, Bed),
135 (array_inputs_gtf, Gtf), 140 (array_inputs_bigwig, BigWig),
136 (array_inputs_bam, Bam), 141 (array_inputs_bed_simple_repeats, BedSimpleRepeats),
137 (array_inputs_bigwig, BigWig)]: 142 (array_inputs_gff3, Gff3),
143 (array_inputs_gtf, Gtf),
144 (array_inputs_psl, Psl)]:
138 if inputs: 145 if inputs:
139 all_datatype_dictionary.update(create_ordered_datatype_objects(datatype_class, inputs, inputs_data)) 146 all_datatype_dictionary.update(create_ordered_datatype_objects(datatype_class, inputs, inputs_data))
140 147
141 # Create Ordered Dictionary to add the tracks in the tool form order 148 # Create Ordered Dictionary to add the tracks in the tool form order
142 all_datatype_ordered_dictionary = collections.OrderedDict(all_datatype_dictionary) 149 all_datatype_ordered_dictionary = collections.OrderedDict(all_datatype_dictionary)
185 192
186 # TODO: Optimize this double loop 193 # TODO: Optimize this double loop
187 for input_false_path in array_inputs: 194 for input_false_path in array_inputs:
188 for key, data_value in inputs_data.items(): 195 for key, data_value in inputs_data.items():
189 if key == input_false_path: 196 if key == input_false_path:
197 logging.debug("input_false_path: " + input_false_path)
198 logging.debug("data_value: " + str(data_value))
190 extensionObject = ExtensionClass(input_false_path, data_value) 199 extensionObject = ExtensionClass(input_false_path, data_value)
191 datatype_dictionary.update({data_value["order_index"]: extensionObject}) 200 datatype_dictionary.update({data_value["order_index"]: extensionObject})
192 return datatype_dictionary 201 return datatype_dictionary
193 202
194 def configure_logger(extra_files_path=None, debug=False): 203 def configure_logger(extra_files_path=None, debug=False):