Commit 80058c9a authored by Penom Nom's avatar Penom Nom
Browse files

fix parameter string ...

parent 3e42c4d6
......@@ -15,14 +15,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os,re
import os,re,pickle
from subprocess import Popen, PIPE
from ng6.analysis import Analysis
from weaver.function import PythonFunction
def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_file, samtools_path, collectinsertsizemetrics_path, options):
def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_file, samtools_path, collectinsertsizemetrics_path, options_dump_path):
"""
@param bam_file : path for bam
@param pairs_count_file : path to the produced file with the number of reads pairs in bam
......@@ -34,6 +34,11 @@ def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_fil
@param options : options for the software collectinsertsizemetrics
"""
from subprocess import Popen, PIPE
import pickle
options_dump = open(options_dump_path, "rb")
options = pickle.load(options_dump)
options_dump.close()
# Count nb properly paired in bam file
command = Popen( ["-c", samtools_path + " view -f67 " + bam_file + "| wc -l"], shell=True, stdout=PIPE, stderr=PIPE)
......@@ -127,9 +132,14 @@ class InsertsSizes (Analysis):
return stderr.split()[0]
def process(self):
options_dump_path = self.get_temporary_file(".dump")
options_dump = open(options_dump_path, "wb")
pickle.dump(self.options, options_dump)
options_dump.close()
for i in range(len(self.bam_files)):
insertsSizes = PythonFunction(inserts_metrics, cmd_format="{EXE} {IN} {OUT} {ARG}")
insertsSizes(inputs=self.bam_files[i], outputs=[self.pairs_count_files[i], self.info_files[i], self.hist_files[i], self.log_files[i]], arguments=[self.get_exec_path("samtools"), self.get_exec_path("CollectInsertSizeMetrics"), '"'+self.options+'"'])
insertsSizes(inputs=self.bam_files[i], outputs=[self.pairs_count_files[i], self.info_files[i], self.hist_files[i], self.log_files[i]], arguments=[self.get_exec_path("samtools"), self.get_exec_path("CollectInsertSizeMetrics"), options_dump_path])
def parse_pairs_count_file(self, input_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