Commit 6c59cd12 authored by Lukas Jelonek's avatar Lukas Jelonek
Browse files

Merge branch 'develop' into targetp

parents 6a22244c 8dbbeca4
......@@ -2,3 +2,4 @@ tools:
signalp: '/vol/biotools/bin/signalp'
ghostx: '/vol/biotools/bin/ghostx'
targetp: '/vol/software/bin/targetp'
tmhmm: '/vol/biotools/bin/tmhmm'
......@@ -15,6 +15,7 @@ In order to run PSOT on your machine you need:
* hmmscan
* signalp
* ghostx
* tmhmm
* the bioinformatic databases you want to use
......
# Module manifest for the tmhmm analysis
# The name of the module. Is needed for the list-analyses option, for custom
# configurations and custom profiles.
name: 'tmhmm'
# Short description of the analysis.
info: 'predict transmembrane helices in proteins'
# The configuration of the script for the analysis step.
analysis:
# script must take a --fasta parameter
script: 'run_tmhmm.py'
# specify additional default configuration here
parameters:
# The configuration of the script for the json conversion step.
converter:
# script must take a --result parameter, which is the result from the analysis step
script: 'convert_tmhmm.py'
# specify additional default configuration here
parameters:
......@@ -4,3 +4,4 @@ modules:
ghostx_swissprot:
signalp:
organism: 'euk'
tmhmm:
#!/usr/bin/python3
import sys
import json
import argparse
parser = argparse.ArgumentParser(description='Convert tmhmm results to json documents')
parser.add_argument('--result', '-r', required=True, help='The tmhmm result file')
parser.add_argument('--output', '-o', required=True, help='The converted results json file')
args = parser.parse_args()
def parse_topology(s, l):
elements = []
result = []
flag = False
num = ""
for c in s:
if c == 'i' or c == 'o' or c == '-':
if num != "":
elements.append(int(num))
num = ""
if c != '-':
elements.append(c)
else:
num += c
if num != "":
elements.append(int(num))
for i in range(len(elements)):
if flag:
flag = False
else:
if elements[i] == 'i' or elements[i] == 'o':
location = ""
if elements[i] == 'i':
location = "inside"
else:
location = "outside"
if i == 0:
if len(elements) == 1:
result.append({'start': 1, 'end': l , 'location': location})
else:
result.append({'start': 1, 'end': elements[i+1]-1 , 'location': location})
elif i+1 == len(elements):
result.append({'start': elements[i-1]+1, 'end':l , 'location': location})
else:
result.append({'start': elements[i-1]+1, 'end': elements[i+1]-1 , 'location': location})
else:
result.append({'start': elements[i], 'end': elements[i+1] , 'location': 'membrane'})
flag = True
return (result)
filename = args.result
documents = {}
with open(filename) as f:
for line in f:
line_dic = {}
elements = line.rstrip().split("\t")
for i in range(1, len(elements)):
key = elements[i][:elements[i].rfind('=')]
value = elements[i][elements[i].rfind('=')+1:]
if key == 'Topology':
line_dic['topology'] = parse_topology(value, int(elements[i-4][elements[i-4].rfind('=')+1:]))
elif key == 'PredHel':
line_dic[key] = int(value)
elif not key == 'len':
line_dic[key] = float(value)
documents[elements[0]] = {'computations': [{'tool': {'name': 'TMHMM', 'version': '2.0'}, 'results': line_dic}]}
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
import subprocess
tmhmm_tool = config.load_config()['tools'].get('tmhmm', 'tmhmm')
parser = argparse.ArgumentParser(description='Find transmembrane helices in amino acid sequences')
parser.add_argument('--fasta', '-f', required=True, help='A fasta file with aminoacid sequences')
parser.add_argument('--output', required=True, help='The output file')
args = parser.parse_args()
system("cat " + args.fasta + " | " + tmhmm_tool + " -short > " + 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