Commit 7b15f5e7 authored by hmueller's avatar hmueller
Browse files

Pass directory instead of file between targetp run and convert processes.

parent 6ddf8881
#!/usr/bin/python3
import sys
import json
import argparse
parser = argparse.ArgumentParser(description = 'Convert targetp results to json documents')
parser.add_argument('--result', '-r', required = True, help = 'The targetp result file')
parser.add_argument('--result', '-r', required = True, help = 'The targetp results directory')
parser.add_argument('--output', '-o', required = True, help = 'The converted results json file')
args = parser.parse_args()
loc_dict = {"C": "chloroplast", "M": "mitochondrion", "S": "secretory pathway", "_": "other", "*": "undetermined"}
filename = args.result
filename = args.result + '/results.txt'
documents = {}
with open(filename) as f:
tool = None
field_index = {"Name": None, "cTP": None, "mTP": None, "SP": None, "Loc": None}
......@@ -50,5 +52,6 @@ with open(filename) as f:
tool['organism_group'] = 'non-plant'
output_filename = args.output
with open(output_filename, 'w') as o:
json.dump(documents, o)
#!/usr/bin/env python3
import env
import argparse
from psot import config
from os import system
from os import system,makedirs
targetp_tool = config.load_config()['tools'].get('targetp', 'targetp')
......@@ -11,7 +12,10 @@ org_flags = {'plant': '-P', 'non-plant': '-N'}
parser = argparse.ArgumentParser(description = 'Determine subcellular locations of eukaryotic amino acid sequences')
parser.add_argument('--fasta', '-f', required = True, help = 'A fasta file with amino acid sequences')
parser.add_argument('--organism_group', choices = org_flags.keys(), required = True, help = 'Define wether to use plant/non-plant networks')
parser.add_argument('--output', required = True, help = 'The output file')
parser.add_argument('--output', required = True, help = 'The results directory. Will contain results.txt and enum_headers.tsv.')
args = parser.parse_args()
system(targetp_tool + " " + org_flags[args.organism_group] + " " + args.fasta + " > " + args.output)
makedirs(args.output, exist_ok=True)
results_file = args.output + '/results.txt'
system(targetp_tool + " " + org_flags[args.organism_group] + " " + args.fasta + " > " + results_file)
Supports Markdown
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