Mercurial > repos > rmarenco > hubarchivecreator
annotate util/Reader.py @ 32:6d1f2bb5c1d1 draft default tip
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 5a0c39ed61b4408ba65a759aede807df260d097d
author | yating-l |
---|---|
date | Sun, 26 Aug 2018 16:44:27 -0400 |
parents | e7c4be523cb7 |
children |
rev | line source |
---|---|
30
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
1 import os |
29
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
2 import json |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
3 import logging |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
4 import codecs |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
5 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
6 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
7 # Internal dependencies |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
8 from datatypes.binary.Bam import Bam |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
9 from datatypes.binary.BigWig import BigWig |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
10 from datatypes.binary.BigBed import BigBed |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
11 from datatypes.interval.Bed import Bed |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
12 from datatypes.interval.BedSimpleRepeats import BedSimpleRepeats |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
13 from datatypes.interval.BedSpliceJunctions import BedSpliceJunctions |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
14 from datatypes.interval.CytoBand import CytoBand |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
15 from datatypes.interval.BedBlatAlignments import BedBlatAlignments |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
16 from datatypes.interval.BedBlastAlignments import BedBlastAlignments |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
17 from datatypes.interval.Gff3 import Gff3 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
18 from datatypes.interval.Gtf import Gtf |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
19 from datatypes.interval.Psl import Psl |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
20 from datatypes.sequence.Fasta import Fasta |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
21 from util import santitizer |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
22 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
23 class Reader(object): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
24 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
25 DATATYPE_CLASS = [Bam, BigWig, BigBed, Bed, BedSimpleRepeats, BedSpliceJunctions, CytoBand, BedBlatAlignments, BedBlastAlignments, Gff3, Gtf, Psl, Fasta] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
26 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
27 def __init__(self, input_json_file): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
28 self.inputFile = input_json_file |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
29 self.args = self.loadJson() |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
30 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
31 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
32 def loadJson(self): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
33 try: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
34 data_file = codecs.open(self.inputFile, 'r', 'utf-8') |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
35 return json.load(data_file) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
36 except IOError: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
37 print "Cannot find JSON file\n" |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
38 exit(1) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
39 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
40 def getToolDir(self): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
41 try: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
42 return self.args["tool_directory"] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
43 except KeyError: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
44 print ("tool_directory is not defined in the input file!") |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
45 exit(1) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
46 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
47 def getExtFilesPath(self): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
48 try: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
49 return self.args["extra_files_path"] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
50 except KeyError: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
51 print ("extra_files_path is not defined in the input file!") |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
52 exit(1) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
53 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
54 def getUserEmail(self): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
55 try: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
56 return self.args["user_email"] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
57 except KeyError: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
58 print ("user_email is not defined in the input file!") |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
59 exit(1) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
60 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
61 def getDebugMode(self): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
62 try: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
63 return self.args["debug_mode"] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
64 except KeyError: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
65 print ("debug_mode is not defined in the input file!") |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
66 exit(1) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
67 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
68 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
69 def getRefGenome(self): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
70 array_inputs_reference_genome = self.args["fasta"] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
71 # TODO: Replace these with the object Fasta |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
72 input_fasta_file = array_inputs_reference_genome["false_path"] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
73 input_fasta_file_name = santitizer.sanitize_name_input(array_inputs_reference_genome["name"]) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
74 genome_name = santitizer.sanitize_name_input(self.args["genome_name"]) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
75 reference_genome = Fasta(input_fasta_file, |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
76 input_fasta_file_name, genome_name) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
77 return reference_genome |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
78 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
79 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
80 def getTracksData(self): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
81 self.logger = logging.getLogger(__name__) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
82 all_datatype_dictionary = dict() |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
83 for datatype in self.DATATYPE_CLASS: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
84 class_name = datatype.__name__ |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
85 array_inputs = self.args.get(str(class_name)) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
86 if array_inputs: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
87 self.logger.debug("Create %s objects\n", class_name) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
88 self.logger.debug("array_inputs: %s", array_inputs) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
89 all_datatype_dictionary.update(self.create_ordered_datatype_objects(datatype, array_inputs)) |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
90 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
91 return all_datatype_dictionary |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
92 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
93 def create_ordered_datatype_objects(self, ExtensionClass, array_inputs): |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
94 """ |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
95 Function which executes the creation all the necessary files / folders for a special Datatype, for TrackHub |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
96 and update the dictionary of datatype |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
97 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
98 :param ExtensionClass: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
99 :param array_inputs: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
100 :type ExtensionClass: Datatype |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
101 :type array_inputs: list[string] |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
102 """ |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
103 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
104 datatype_dictionary = {} |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
105 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
106 # TODO: Optimize this double loop |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
107 for input_data in array_inputs: |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
108 input_false_path = input_data["false_path"] |
30
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
109 # if the file is empty, skip the rest |
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
110 if os.path.isfile(input_false_path) and os.path.getsize(input_false_path) > 0: |
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
111 input_data["name"] = santitizer.sanitize_name_input(input_data["name"]) |
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
112 extensionObject = ExtensionClass(input_false_path, input_data) |
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
113 extensionObject.generateCustomTrack() |
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
114 datatype_dictionary.update({input_data["order_index"]: extensionObject}) |
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
115 else: |
e7c4be523cb7
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 2f1b3cc8c9cb463e460f7f79efe99ed472700ecf
yating-l
parents:
29
diff
changeset
|
116 self.logger.info("The input file: %s is empty, skip creating the track for this data", input_data["name"]) |
29
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
117 return datatype_dictionary |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
118 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
119 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
120 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
121 |
7e8a8b732db3
planemo upload for repository https://github.com/goeckslab/hub-archive-creator commit 1a81ebd0ddea950b84af3fc830e9267a4814b29f
yating-l
parents:
diff
changeset
|
122 |