Mercurial > repos > yating-l > jbrowsearchivecreator
annotate util/Reader.py @ 40:b1553f2a4942 draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
| author | yating-l |
|---|---|
| date | Fri, 20 Apr 2018 12:29:32 -0400 |
| parents | 4a69515eed63 |
| children | 061da5d3a219 |
| rev | line source |
|---|---|
|
39
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
1 import os |
|
25
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
2 import json |
|
39
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
3 import shutil |
|
25
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
4 import logging |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
5 import codecs |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
6 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
7 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
8 # Internal dependencies |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
9 from datatypes.binary.Bam import Bam |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
10 from datatypes.binary.BigWig import BigWig |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
11 from datatypes.interval.Bed import Bed |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
12 from datatypes.interval.BedSimpleRepeats import BedSimpleRepeats |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
13 from datatypes.interval.BedSpliceJunctions import BedSpliceJunctions |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
14 from datatypes.interval.BlastXml import BlastXml |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
15 from datatypes.interval.Gff3 import Gff3 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
16 from datatypes.interval.Gtf import Gtf |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
17 from datatypes.interval.BigPsl import BigPsl |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
18 from datatypes.interval.BedBlatAlignments import BedBlatAlignments |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
19 from datatypes.interval.BedBlastAlignments import BedBlastAlignments |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
20 from datatypes.interval.Psl import Psl |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
21 from datatypes.sequence.Fasta import Fasta |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
22 from util import santitizer |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
23 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
24 class Reader(object): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
25 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
26 DATATYPE_CLASS = [Bam, BigWig, Bed, BedSimpleRepeats, |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
27 BedSpliceJunctions, BigPsl, BedBlatAlignments, BedBlastAlignments, |
|
33
07cc5384dd61
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 74a020b6b0a2fa7ff5670d7f154de838dee51dfd
yating-l
parents:
32
diff
changeset
|
28 BlastXml, Gff3, Gtf, Psl, Fasta] |
|
25
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
29 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
30 def __init__(self, input_json_file): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
31 self.inputFile = input_json_file |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
32 self.args = self.loadJson() |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
33 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
34 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
35 def loadJson(self): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
36 try: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
37 data_file = codecs.open(self.inputFile, 'r', 'utf-8') |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
38 return json.load(data_file) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
39 except IOError: |
|
40
b1553f2a4942
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
yating-l
parents:
39
diff
changeset
|
40 print ("Cannot find JSON file\n") |
|
25
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
41 exit(1) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
42 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
43 def getToolDir(self): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
44 try: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
45 return self.args["tool_directory"] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
46 except KeyError: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
47 print ("tool_directory is not defined in the input file!") |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
48 exit(1) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
49 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
50 def getExtFilesPath(self): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
51 try: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
52 return self.args["extra_files_path"] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
53 except KeyError: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
54 print ("extra_files_path is not defined in the input file!") |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
55 exit(1) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
56 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
57 def getUserEmail(self): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
58 try: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
59 return self.args["user_email"] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
60 except KeyError: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
61 print ("user_email is not defined in the input file!") |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
62 exit(1) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
63 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
64 def getDebugMode(self): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
65 try: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
66 return self.args["debug_mode"] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
67 except KeyError: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
68 print ("debug_mode is not defined in the input file!") |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
69 exit(1) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
70 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
71 def getTrackType(self): |
|
39
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
72 try: |
|
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
73 return self.args.get("feature_tracks_type") |
|
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
74 except KeyError: |
|
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
75 print ("feature tracks type is not defined in the input file!") |
|
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
76 exit(1) |
|
25
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
77 |
|
32
7b955a58d8f2
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 18da3c5b92673ba5030c24c981c6ca7ebe0bf097-dirty
yating-l
parents:
31
diff
changeset
|
78 def getGenomeName(self): |
|
7b955a58d8f2
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 18da3c5b92673ba5030c24c981c6ca7ebe0bf097-dirty
yating-l
parents:
31
diff
changeset
|
79 genome_name = santitizer.sanitize_name_input(self.args["genome_name"]) |
|
7b955a58d8f2
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 18da3c5b92673ba5030c24c981c6ca7ebe0bf097-dirty
yating-l
parents:
31
diff
changeset
|
80 return genome_name |
|
25
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
81 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
82 def getRefGenome(self): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
83 array_inputs_reference_genome = self.args["fasta"] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
84 input_fasta_file = array_inputs_reference_genome["false_path"] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
85 input_fasta_file_name = santitizer.sanitize_name_input(array_inputs_reference_genome["name"]) |
|
39
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
86 # Add "fasta" extension because Apollo needs it to create annotation |
|
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
87 refseq_file = os.path.join(os.path.dirname(input_fasta_file), input_fasta_file_name + ".fasta") |
|
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
88 shutil.copyfile(input_fasta_file, refseq_file) |
|
32
7b955a58d8f2
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 18da3c5b92673ba5030c24c981c6ca7ebe0bf097-dirty
yating-l
parents:
31
diff
changeset
|
89 genome_name = self.getGenomeName() |
|
39
4a69515eed63
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
yating-l
parents:
33
diff
changeset
|
90 reference_genome = Fasta(refseq_file, |
|
25
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
91 input_fasta_file_name, genome_name) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
92 return reference_genome |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
93 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
94 def getTracksData(self): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
95 self.logger = logging.getLogger(__name__) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
96 all_datatype_dictionary = dict() |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
97 for datatype in self.DATATYPE_CLASS: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
98 class_name = datatype.__name__ |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
99 array_inputs = self.args.get(str(class_name)) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
100 if array_inputs: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
101 self.logger.debug("Creating %s objects\n", class_name) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
102 self.logger.debug("array_inputs: %s", array_inputs) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
103 all_datatype_dictionary.update(self.create_ordered_datatype_objects(datatype, array_inputs)) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
104 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
105 return all_datatype_dictionary |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
106 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
107 def create_ordered_datatype_objects(self, ExtensionClass, array_inputs): |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
108 """ |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
109 Function which executes the creation all the necessary files / folders for a special Datatype, for TrackHub |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
110 and update the dictionary of datatype |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
111 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
112 :param ExtensionClass: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
113 :param array_inputs: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
114 :type ExtensionClass: Datatype |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
115 :type array_inputs: list[string] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
116 """ |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
117 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
118 datatype_dictionary = {} |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
119 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
120 # TODO: Optimize this double loop |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
121 for input_data in array_inputs: |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
122 input_false_path = input_data["false_path"] |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
123 input_data["name"] = santitizer.sanitize_name_input(input_data["name"]) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
124 extensionObject = ExtensionClass(input_false_path, input_data) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
125 extensionObject.generateCustomTrack() |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
126 datatype_dictionary.update({input_data["order_index"]: extensionObject}) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
127 self.logger.debug("%s object: %s has been created", ExtensionClass, input_data["name"]) |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
128 return datatype_dictionary |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
129 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
130 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
131 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
132 |
|
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
yating-l
parents:
diff
changeset
|
133 |
