Commit b698df3d authored by Penom Nom's avatar Penom Nom
Browse files

hotfix for test on ng6-test

parent d27b7108
......@@ -68,7 +68,7 @@ class SVDetection (NG6Workflow):
delly = self.add_component("Standardisation", [delly.output_file, "delly", "delly.bed", self.min_len, self.max_len, indiv_list])
pindel = self.add_component("Standardisation", [pindel.output_file, "pindel", "pindel.bed", self.min_len, self.max_len, indiv_list])
breakdancer = self.add_component("Standardisation", [breakdancer.output_file, "breakdancer", "breakdancer.bed", self.min_len, self.max_len, indiv_list, input_bam])
cnvnator = self.add_component("Standardisation", [input_f, "cnvnator", "cnvnator.bed", self.min_len, self.max_len, indiv_list])
cnvnator = self.add_component("Standardisation", [cnvnator.output_file, "cnvnator", "cnvnator.bed", self.min_len, self.max_len, indiv_list])
# #=====TEST PURPOSE=====
# input_f = ["/home/yguarr/DataTest/example_cnvnator_raw.txt","/home/yguarr/DataTest/example2_cnvnator_raw.txt","/home/yguarr/DataTest/example3_cnvnator_raw.txt"]
......
......@@ -23,6 +23,7 @@ import numpy
import itertools
import subprocess
import re
from types import NoneType
class Analyzebed (Analysis):
......@@ -41,11 +42,16 @@ class Analyzebed (Analysis):
cnvnator_help = subprocess.Popen(["cnvnator"], universal_newlines=True, stderr=subprocess.PIPE)
cnvnator_version = re.search("CNVnator v([0-9\.]+)", cnvnator_help.stderr.read())
delly_help = subprocess.Popen(["delly"], universal_newlines=True, stdout=subprocess.PIPE)
delly_version = re.search("Delly \(Version: ([0-9\.]+)\)", delly_help.stdout.read())
delly_version = re.search("\(Version: ([0-9\.]+)\)", delly_help.stdout.read())
breakdancer_help = subprocess.Popen(["breakdancer-max"], universal_newlines=True, stderr=subprocess.PIPE)
breakdancer_version = re.search("breakdancer-max version ([0-9\.]+)", breakdancer_help.stderr.read())
versions = "Pindel: {0} / CNVnator: {1} / Delly: {2} / Breakdancer: {3}".format(pindel_version.groups()[0],
cnvnator_version.groups()[0], delly_version.groups()[0], breakdancer_version.groups()[0])
v_list = [pindel_version,cnvnator_version, delly_version, breakdancer_version]
for v,i in enumerate(v_list):
if v is None:
v_list[i] = 'unknonw'
else:
v_list[i] = v.groups()[0]
versions = "Pindel: {0} / CNVnator: {1} / Delly: {2} / Breakdancer: {3}".format(*v_list)
return versions
def define_analysis(self):
......
......@@ -37,7 +37,8 @@ class Breakdancer (Component):
# command
breakdancer = ShellFunction(self.get_exec_path("breakdancer-max") \
+ " -r {0} -m {1} -q {2} ".format(self.min_sup, self.max_len, self.min_mapq) \
+ " $1 > $2",
+ " $1 > $2;"\
+ " if [ ! -e $2 ]; then echo no_read_groups_found > $2; fi",
cmd_format='{EXE} {IN} {OUT}')
# launch
breakdancer(cfg_file_path, self.output_file)
\ No newline at end of file
......@@ -46,4 +46,4 @@ class CnvNator (Component):
#Real cnvnator run starts
cnvnator = PythonFunction(cnvnator_func, cmd_format="{EXE} {OUT} {ARG} {IN}")
for i,o in zip(self.input_bam, self.output_file):
cnvnator(outputs=o, arguments=[self.bin_size], inputs=i)
\ No newline at end of file
cnvnator(outputs=o, arguments=[self.reference_genome, self.bin_size], inputs=i)
\ No newline at end of file
......@@ -62,21 +62,21 @@ class Standardisation (Component):
--tag $3 \
--min_length {0} --max_length {1}".format(self.min_len, self.max_len),
cmd_format='{EXE} {IN} {OUT} {ARG}')
for i in range(len(self.input_file)):
std(inputs=self.input_file[i], outputs=tmp_out[i], arguments=self.indiv_list[i])
if len(self.input_file) > 1:
unsorted_out = self.get_temporary_file(".bed")
#MERGE_SV
mrg = ShellFunction(self.get_exec_path("merge_sv.py") + \
" --output $1 \
--tag $2\
--p $3\
--li $4" \
+ " --names" + utils.get_argument_pattern(self.indiv_list, 5)[0] \
+ " --files" + utils.get_argument_pattern(tmp_out, len(tmp_out)+5)[0],
cmd_format='{EXE} {OUT} {ARG} {IN}')
mrg(outputs=unsorted_out, inputs=tmp_out, arguments=[self.mode, self.overlap_percent, self.li_range, self.indiv_list])
sort = ShellFunction(self.get_exec_path("sort") + " -k1,1n -k2,2n $1 > $2", cmd_format='{EXE} {IN} {OUT}')
sort(unsorted_out, self.output_file)
for i in range(len(self.input_file)):
std(inputs=self.input_file[i], outputs=tmp_out[i], arguments=self.indiv_list[i])
unsorted_out = self.get_temporary_file(".bed")
#MERGE_SV
mrg = ShellFunction(self.get_exec_path("merge_sv.py") + \
" --output $1 \
--tag $2\
--p $3\
--li $4" \
+ " --names" + utils.get_argument_pattern(self.indiv_list, 5)[0] \
+ " --files" + utils.get_argument_pattern(tmp_out, len(tmp_out)+5)[0],
cmd_format='{EXE} {OUT} {ARG} {IN}')
mrg(outputs=unsorted_out, inputs=tmp_out, arguments=[self.mode, self.overlap_percent, self.li_range, self.indiv_list])
sort = ShellFunction(self.get_exec_path("sort") + " -k1,1n -k2,2n $1 > $2", cmd_format='{EXE} {IN} {OUT}')
sort(unsorted_out, self.output_file)
else:
self.output_file=tmp_out
std(inputs=self.input_file, outputs=self.output_file, arguments=self.indiv_list)
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