Commit cf22986c authored by Audrey Gibert's avatar Audrey Gibert
Browse files

Adaptation des scripts pour PicardTools 2.14.1 SGE

parent 1ae31924
{*
Copyright (C) 2009 INRA
This program is free software: you can redistribute it and/or modify
This program is a free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
......
......@@ -152,7 +152,7 @@ class AlignmentStats (Analysis):
# Duplication stats
if self.search_dupl:
self.tmp_bam = self.get_outputs('{basename_woext}_noDupl.bam', self.bam_files)
self.add_shell_execution("java -Xmx4g -jar " + self.get_exec_path("MarkDuplicates") + " INPUT=$1 METRICS_FILE=$2 OUTPUT=$3" + self.duplication_options + " 2> $4",
self.add_shell_execution("/tools/java/jre1.8.0_45/bin/java -Xmx4g -jar " + self.get_exec_path("Picard") + " MarkDuplicates INPUT=$1 METRICS_FILE=$2 OUTPUT=$3" + self.duplication_options + " 2> $4",
cmd_format='{EXE} {IN} {OUT}', map=True,
inputs=self.bam_files, outputs=[self.duplication_files, self.tmp_bam, self.dupl_stderrs])
......
......@@ -20,7 +20,19 @@ from subprocess import Popen, PIPE
from ng6.analysis import Analysis
def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_file, samtools_path, collectinsertsizemetrics_path, options_dump_path, memory):
# def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_file, samtools_path, collectinsertsizemetrics_path, options_dump_path, memory):
# """
# @param bam_file : path for bam
# @param pairs_count_file : path to the produced file with the number of reads pairs in bam
# @param metrics_file : path to the metrics file produced by collectinsertsizemetrics
# @param hist_file : path to the histogram produced by collectinsertsizemetrics
# @param log_file : path to the log produced by collectinsertsizemetrics
# @param samtools_path : path to the software samtools
# @param collectinsertsizemetrics_path : path to the software collectinsertsizemetrics
# @param picard_path : path to the software picard.jar
# @param options : options for the software collectinsertsizemetrics
# """
def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_file, samtools_path, picard_path, options_dump_path, memory):
"""
@param bam_file : path for bam
@param pairs_count_file : path to the produced file with the number of reads pairs in bam
......@@ -28,7 +40,7 @@ def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_fil
@param hist_file : path to the histogram produced by collectinsertsizemetrics
@param log_file : path to the log produced by collectinsertsizemetrics
@param samtools_path : path to the software samtools
@param collectinsertsizemetrics_path : path to the software collectinsertsizemetrics
@param picard_path : path to the software picard.jar
@param options : options for the software collectinsertsizemetrics
"""
from subprocess import Popen, PIPE
......@@ -45,7 +57,7 @@ def inserts_metrics(bam_file, pairs_count_file, metrics_file, hist_file, log_fil
if properly_paired_nb > 0 :
# Process inserts sizes metrics
command = Popen( ["-c", "java "+xmx+" -jar " + collectinsertsizemetrics_path + " " +options + " HISTOGRAM_FILE=" + hist_file + " INPUT=" + bam_file + " OUTPUT=" + metrics_file + " 2> " + log_file], shell=True, stdout=PIPE, stderr=PIPE )
command = Popen( ["-c", "/tools/java/jre1.8.0_45/bin/java "+xmx+" -jar " + picard_path + " CollectInsertSizeMetrics " +options + " HISTOGRAM_FILE=" + hist_file + " INPUT=" + bam_file + " OUTPUT=" + metrics_file + " 2> " + log_file], shell=True, stdout=PIPE, stderr=PIPE )
stdout, stderr = command.communicate()
# Count nb pairs in bam file
command = Popen( ["-c", samtools_path + " view -F384 " + bam_file + " | wc -l"], shell=True, stdout=PIPE, stderr=PIPE) # First read in pair
......@@ -126,10 +138,14 @@ class InsertsSizes (Analysis):
self._create_and_archive(self.info_files, self.archive_name)
def get_version(self):
cmd = ["java", "-Xmx1g", "-jar", self.get_exec_path("CollectInsertSizeMetrics"),"--version"]
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
cmd = "/tools/java/jre1.8.0_45/bin/java -Xmx1g -jar {} CollectInsertSizeMetrics --version".format(self.get_exec_path("Picard"))
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
stdout, stderr = p.communicate()
return stderr.split()[0]
return(stderr.decode("utf-8").rsplit()[0])
# cmd = ["/tools/java/jre1.8.0_45/bin/java", "-Xmx1g", "-jar", self.get_exec_path("Picard")," CollectInsertSizeMetrics --version"]
# p = Popen(cmd, stdout=PIPE, stderr=PIPE)
# stdout, stderr = p.communicate()
# return stderr.split()[0]
def process(self):
options_dump_path = self.get_temporary_file(".dump")
......@@ -140,11 +156,11 @@ class InsertsSizes (Analysis):
for i in range(len(self.bam_files)):
self.add_python_execution(inserts_metrics,cmd_format="{EXE} {IN} {OUT} {ARG}",
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, self.memory])
arguments=[self.get_exec_path("samtools"), self.get_exec_path("Picard"), options_dump_path, self.memory])
def parse_pairs_count_file(self, input_file):
"""
@param input_file : the pairs count file path
@param input_file : the pairs count file path
@return : the number of properly paired
"""
count_file_fh = open(input_file, "r")
......
......@@ -12,7 +12,7 @@
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import os
......@@ -35,7 +35,7 @@ class STARIndex (Component):
def process(self):
xmx="-Xmx" + self.memory.lower()
# normalize fasta
self.add_shell_execution( "java " + xmx + " -jar " + self.get_exec_path("NormalizeFasta.jar") + " I=$1 O=$2 ",
self.add_shell_execution( "/tools/java/jre1.8.0_45/bin/java " + xmx + " -jar " + self.get_exec_path("Picard") + " NormalizeFasta I=$1 O=$2 ",
cmd_format="{EXE} {IN} {OUT}", map=False,
inputs = self.input_fasta, outputs = self.normalized_fasta_file)
......
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