Mercurial > repos > yating-l > jbrowsearchivecreator
annotate util/Reader.py @ 31:127037c49bc8 draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
| author | yating-l | 
|---|---|
| date | Mon, 16 Oct 2017 18:03:58 -0400 | 
| parents | 31a41ce128cc | 
| children | 7b955a58d8f2 | 
| rev | line source | 
|---|---|
| 25 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 1 import json | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 2 import logging | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 3 import codecs | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 4 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 5 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 6 # Internal dependencies | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 7 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 | 8 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 | 9 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 | 10 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 | 11 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 | 12 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 | 13 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 | 14 from datatypes.interval.Gff3_mrna import Gff3_mrna | 
| 
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_transcript import Gff3_transcript | 
| 
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.GtfStringTie import GtfStringTie | 
| 
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.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 | 19 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 | 20 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 | 21 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 | 22 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 | 23 from apollo.ApolloUser import ApolloUser | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 24 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 | 25 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 26 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 | 27 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 28 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 | 29 BedSpliceJunctions, BigPsl, BedBlatAlignments, BedBlastAlignments, | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 30 BlastXml, Gff3, Gff3_mrna, Gff3_transcript, Gff3_mrna, Gtf, GtfStringTie, Psl, Fasta] | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 31 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 32 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 | 33 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 | 34 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 | 35 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 36 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 37 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 | 38 try: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 39 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 | 40 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 | 41 except IOError: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 42 print "Cannot find JSON file\n" | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 43 exit(1) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 44 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 45 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 | 46 try: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 47 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 | 48 except KeyError: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 49 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 | 50 exit(1) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 51 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 52 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 | 53 try: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 54 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 | 55 except KeyError: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 56 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 | 57 exit(1) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 58 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 59 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 | 60 try: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 61 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 | 62 except KeyError: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 63 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 | 64 exit(1) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 65 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 66 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 | 67 try: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 68 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 | 69 except KeyError: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 70 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 | 71 exit(1) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 72 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 73 def getTrackType(self): | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 74 track_type = self.args.get("track_type") | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 75 return track_type | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 76 | 
| 31 
127037c49bc8
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: 
25diff
changeset | 77 def getApolloPath(self): | 
| 
127037c49bc8
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: 
25diff
changeset | 78 apollo_path = self.args.get("apollo_path") | 
| 
127037c49bc8
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: 
25diff
changeset | 79 return apollo_path | 
| 
127037c49bc8
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: 
25diff
changeset | 80 | 
| 25 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 81 def getApolloHost(self): | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 82 apollo_host = self.args.get("apollo_host") | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 83 return apollo_host | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 84 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 85 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 86 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 | 87 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 | 88 # TODO: Replace these with the object Fasta | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 89 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 | 90 input_fasta_file_name = santitizer.sanitize_name_input(array_inputs_reference_genome["name"]) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 91 genome_name = santitizer.sanitize_name_input(self.args["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 reference_genome = Fasta(input_fasta_file, | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 93 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 | 94 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 | 95 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 96 def getApolloUser(self): | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 97 user_info = self.args.get("apollo_user") | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 98 if not user_info: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 99 firstname = "demo" | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 100 lastname = "user" | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 101 password = "gonramp" | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 102 user_email = self.getUserEmail() | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 103 else: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 104 firstname = user_info['firstname'] | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 105 lastname = user_info['lastname'] | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 106 user_email = user_info['user_email'] | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 107 password = user_info['password'] | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 108 apollo_user = ApolloUser(user_email, firstname, lastname, password) | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 109 return apollo_user | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 110 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 111 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 | 112 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 | 113 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 | 114 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 | 115 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 | 116 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 | 117 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 | 118 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 | 119 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 | 120 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 | 121 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 122 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 | 123 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 124 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 | 125 """ | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 126 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 | 127 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 | 128 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 129 :param ExtensionClass: | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 130 :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 | 131 :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 | 132 :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 | 133 """ | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 134 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 135 datatype_dictionary = {} | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 136 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 137 # 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 | 138 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 | 139 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 | 140 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 | 141 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 | 142 extensionObject.generateCustomTrack() | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 143 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 | 144 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 | 145 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 | 146 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 147 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 148 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 149 | 
| 
31a41ce128cc
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 691e5366893905d30943a3cb8cdfb6341f0f5362-dirty
 yating-l parents: diff
changeset | 150 | 
