Mercurial > repos > yating-l > jbrowsearchivecreator
comparison util/Reader.py @ 39:4a69515eed63 draft
planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 91271a6c0d39c923f0d460b2979247baa297286b-dirty
| author | yating-l |
|---|---|
| date | Fri, 13 Apr 2018 18:21:35 -0400 |
| parents | 07cc5384dd61 |
| children | b1553f2a4942 |
comparison
equal
deleted
inserted
replaced
| 38:d17f629f5486 | 39:4a69515eed63 |
|---|---|
| 1 import os | |
| 1 import json | 2 import json |
| 3 import shutil | |
| 2 import logging | 4 import logging |
| 3 import codecs | 5 import codecs |
| 4 | 6 |
| 5 | 7 |
| 6 # Internal dependencies | 8 # Internal dependencies |
| 65 except KeyError: | 67 except KeyError: |
| 66 print ("debug_mode is not defined in the input file!") | 68 print ("debug_mode is not defined in the input file!") |
| 67 exit(1) | 69 exit(1) |
| 68 | 70 |
| 69 def getTrackType(self): | 71 def getTrackType(self): |
| 70 track_type = self.args.get("track_type") | 72 try: |
| 71 return track_type | 73 return self.args.get("feature_tracks_type") |
| 74 except KeyError: | |
| 75 print ("feature tracks type is not defined in the input file!") | |
| 76 exit(1) | |
| 72 | 77 |
| 73 def getGenomeName(self): | 78 def getGenomeName(self): |
| 74 genome_name = santitizer.sanitize_name_input(self.args["genome_name"]) | 79 genome_name = santitizer.sanitize_name_input(self.args["genome_name"]) |
| 75 return genome_name | 80 return genome_name |
| 76 | 81 |
| 77 def getRefGenome(self): | 82 def getRefGenome(self): |
| 78 array_inputs_reference_genome = self.args["fasta"] | 83 array_inputs_reference_genome = self.args["fasta"] |
| 79 # TODO: Replace these with the object Fasta | |
| 80 input_fasta_file = array_inputs_reference_genome["false_path"] | 84 input_fasta_file = array_inputs_reference_genome["false_path"] |
| 81 input_fasta_file_name = santitizer.sanitize_name_input(array_inputs_reference_genome["name"]) | 85 input_fasta_file_name = santitizer.sanitize_name_input(array_inputs_reference_genome["name"]) |
| 82 #genome_name = santitizer.sanitize_name_input(self.args["genome_name"]) | 86 # Add "fasta" extension because Apollo needs it to create annotation |
| 87 refseq_file = os.path.join(os.path.dirname(input_fasta_file), input_fasta_file_name + ".fasta") | |
| 88 shutil.copyfile(input_fasta_file, refseq_file) | |
| 83 genome_name = self.getGenomeName() | 89 genome_name = self.getGenomeName() |
| 84 reference_genome = Fasta(input_fasta_file, | 90 reference_genome = Fasta(refseq_file, |
| 85 input_fasta_file_name, genome_name) | 91 input_fasta_file_name, genome_name) |
| 86 return reference_genome | 92 return reference_genome |
| 87 | 93 |
| 88 def getTracksData(self): | 94 def getTracksData(self): |
| 89 self.logger = logging.getLogger(__name__) | 95 self.logger = logging.getLogger(__name__) |
