Commit 8d43922d authored by Marc Duez's avatar Marc Duez

fastaToJson.py : used to build germline.js with sequence files and germline.data file

-renamed in buildBrowsergermline.py
parent 0f7e296f
...@@ -4,21 +4,22 @@ import sys ...@@ -4,21 +4,22 @@ import sys
import time import time
if len(sys.argv) < 2: if len(sys.argv) < 3:
print "Usage: %s <FASTA input file> [JSON output file]" % sys.argv[0] print "Usage: %s <FASTA input file> [JSON/DATA germline file] [JSON output file]" % sys.argv[0]
sys.exit() sys.exit()
input_name = sys.argv[1] input_name = sys.argv[1]
output_name = "" output_name = ""
if len(sys.argv) >= 3: if len(sys.argv) >= 4:
output_name = sys.argv[-1] output_name = sys.argv[-1]
data_file = sys.argv[-2]
table = {} table = {}
identifiant = "" identifiant = ""
sequence = "" sequence = ""
for i in range(1, len(sys.argv)-1) : for i in range(1, len(sys.argv)-2) :
fasta = open(sys.argv[i], "r") fasta = open(sys.argv[i], "r")
system = sys.argv[i].split('/')[-1].split('.')[0] system = sys.argv[i].split('/')[-1].split('.')[0]
...@@ -54,4 +55,8 @@ for i in range(1, len(sys.argv)-1) : ...@@ -54,4 +55,8 @@ for i in range(1, len(sys.argv)-1) :
if output_name != "": if output_name != "":
with open(output_name, "w") as file : with open(output_name, "w") as file :
file.write("germline = ") file.write("germline = ")
json.dump(table, file, indent=2, sort_keys=True) json.dump(table, file, indent=2, sort_keys=True)
\ No newline at end of file
data = open(data_file, "r")
file.write( "\n\n" )
file.write( data.read() )
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment