Commit f67b0373 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Merge branch 'targetp' into 'develop'


See merge request SOaAS/psot!1
parents 8dbbeca4 6c59cd12
......@@ -18,6 +18,7 @@ Supported bioinformatic tools:
* blastp
* signalp
* ghostx
* targetp
Install nextflow:
signalp: '/vol/biotools/bin/signalp'
ghostx: '/vol/biotools/bin/ghostx'
targetp: '/vol/software/bin/targetp'
tmhmm: '/vol/biotools/bin/tmhmm'
# Module manifest for the targetp analysis
# The name of the module. Is needed for the list-analyses option, for custom
# configurations and custom profiles
name: 'targetp'
# Short description of the analysis
info: 'predict subcellular peptide location'
# The configuration of the script for the analysis step.
# script must take a --fasta parameter
script: ''
# specify additional default configuration here
# The configuration of the script for the json conversion step.
# script must take a --result parameter, which is the result from the analysis step
script: ''
# specify additional default configuration here
......@@ -5,3 +5,5 @@ modules:
organism_group: 'non-plant'
......@@ -6,3 +6,5 @@ modules:
organism_group: 'non-plant'
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('--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
documents = {}
with open(filename) as f:
tool = None
field_index = {"Name": None, "cTP": None, "mTP": None, "SP": None, "Loc": None}
is_datasection = False
for line in f:
if line.startswith("---------"):
is_datasection = not is_datasection
elif is_datasection:
split = line.split()
if not split[0] in documents:
documents[split[0]] = {"id": split[0], "computations": [{'tool': tool, 'results':[{}]}]}
results = documents[split[0]]['computations'][0]["results"][0]
for field in field_index:
if field_index[field] is not None:
if field in ["cTP", "mTP", "SP"]:
results[field.lower()] = float(split[field_index[field]])
elif field == "Loc":
results[field.lower()] = loc_dict[split[field_index[field]]]
results[field.lower()] = split[field_index[field]]
if line.startswith('Name '):
split = line.split()
for field in field_index:
field_index[field] = split.index(field)
except ValueError:
print('TargetP Converter: No column "' + field + '" found in table!')
elif line.startswith('### targetp '):
split = line.split()
tool = {'name': 'TargetP',
'version': split[2].replace("v", ""),
'organism_group': 'plant'}
elif ' NON-PLANT ' in line:
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
targetp_tool = config.load_config()['tools'].get('targetp', 'targetp')
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')
args = parser.parse_args()
system(targetp_tool + " " + org_flags[args.organism_group] + " " + args.fasta + " > " + args.output)
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