diff util/Reader.py @ 7:5d5fdcb798da draft

planemo upload for repository https://github.com/Yating-L/jbrowse-archive-creator.git commit 12fb52d5b285935b2353d93a5aa291838df7893e
author yating-l
date Fri, 20 Apr 2018 13:51:23 -0400
parents 237707a6b74d
children 43a700afd457
line wrap: on
line diff
--- a/util/Reader.py	Thu Feb 15 17:05:05 2018 -0500
+++ b/util/Reader.py	Fri Apr 20 13:51:23 2018 -0400
@@ -1,4 +1,6 @@
+import os
 import json
+import shutil
 import logging
 import codecs
 
@@ -35,7 +37,7 @@
             data_file = codecs.open(self.inputFile, 'r', 'utf-8')   
             return json.load(data_file) 
         except IOError:
-            print "Cannot find JSON file\n"
+            print ("Cannot find JSON file\n")
             exit(1)
 
     def getToolDir(self):
@@ -67,8 +69,11 @@
             exit(1)
 
     def getTrackType(self):
-        track_type = self.args.get("track_type")
-        return track_type
+        try:
+            return self.args.get("feature_tracks_type")
+        except KeyError:
+            print ("feature tracks type is not defined in the input file!")
+            exit(1)
     
     def getGenomeName(self):
         genome_name = santitizer.sanitize_name_input(self.args["genome_name"])
@@ -76,12 +81,13 @@
         
     def getRefGenome(self):
         array_inputs_reference_genome = self.args["fasta"]
-        # TODO: Replace these with the object Fasta
         input_fasta_file = array_inputs_reference_genome["false_path"]
         input_fasta_file_name = santitizer.sanitize_name_input(array_inputs_reference_genome["name"])
-        #genome_name = santitizer.sanitize_name_input(self.args["genome_name"])
+        # Add "fasta" extension because Apollo needs it to create annotation
+        refseq_file = os.path.join(os.path.dirname(input_fasta_file), input_fasta_file_name + ".fasta")
+        shutil.copyfile(input_fasta_file, refseq_file)
         genome_name = self.getGenomeName()
-        reference_genome = Fasta(input_fasta_file,
+        reference_genome = Fasta(refseq_file,
                              input_fasta_file_name, genome_name)
         return reference_genome