RAPPEL : Opération de maintenance > ForgeMIA indisponible le 20 Janvier entre 7h et 12h

Commit 6ab4ff55 authored by Maxime Manno's avatar Maxime Manno 🍜
Browse files

Resolve conflict #112

parent 07725731
......@@ -33,16 +33,14 @@ class Demultiplex_ONT (Analysis):
def define_parameters(self, fastq_files, barcode_file, archivename="DemultiplexONT_archive.tar"):
self.add_input_file_list( "fastq_files", "fastq_files", default=fastq_files, required=True, file_format = 'fastq')
self.add_parameter("barcode_file", "Name of the barcode file", default=barcode_file, required=True , file_format = 'str')
self.add_parameter("barcode_file", "Name of the barcode file", default=barcode_file, required=False , file_format = 'str')
self.add_parameter("archive_name", "Name of the archive", default=archivename, type='str')
self.add_parameter( "run_name", "The name of the run (from total fastq file)", pattern='{basename_woext}', items=self.fastq_files, file_format = "fastq")
def define_analysis(self):
self.name = "DemultiplexONT"
self.description = "Demultiplexes the total fastq of a barcoded ONT run and produces stats"
self.software = "Qcat"
#if self.discard_middle == "discard_middle":
# self.options = "--discard_middle"
self.description = "Produces stats about demultiplex files from Qcat"
self.software = "Seqkit"
def __parse_stat_file (self, stat_file):
logging.getLogger("jflow").debug("Begin DemultiplexONT.__parse_stat_file! file =",stat_file)
......@@ -51,6 +49,26 @@ class Demultiplex_ONT (Analysis):
@param stat_file : the stdout porechop
@return : {"read_trim_start" : read_trim_start, ...}
"""
#File parsing : recording into a list
list_stats= []
with open(stat_file, "r") as f_stat :
for line in f_stat.readlines():
list_stat.append(line.split())
# Registering file's header into a list
header = list_stats.pop(0)
# Creating a dictionnary on this model
# dico_stats[SampleName][parameterName] = Value
dico_stats = {}
for sample_number in range(len(list_stats)):
print("Le numero de sample est : "+str(sample_number))
dico_stats[list_stats[sample_number][0]] = {}
for parameter_idx in range(1, len(header)):
print(" Le numero de parametre est : " + str(parameter_idx))
print(" Dans : dico [list_stats[spl_nb][0]] [header[param_idx]]")
print(" on va mettre: list_stats[spl_nb][param_idx]")
dico_stats[list_stats[sample_number][0]][header[parameter_idx]] = list_stats[sample_number][parameter_idx]
return dico_stats
def post_process(self):
......@@ -96,7 +114,7 @@ class Demultiplex_ONT (Analysis):
logging.getLogger("jflow").debug("End DemultiplexONT.post_process! ")
def get_version(self):
shell_script = "module load system/Python-3.6.3;" + self.get_exec_path("qcat") + " --version"
shell_script = self.get_exec_path("seqkit") + " --version"
logging.getLogger("jflow").debug("DemultiplexONT.get_version ! shell_script " + str(shell_script))
cmd = ["sh","-c",shell_script]
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
......@@ -109,7 +127,7 @@ class Demultiplex_ONT (Analysis):
# Create cmd
self.add_shell_execution(self.get_exec_path("qcat") +" " + self.options + "-f $1 -b " + str(self.outpath) + " -k " + str(self.kit) + " > ${" + str() + "}",
self.add_shell_execution(self.get_exec_path("seqkit") +" " + self.options + " > ${" + str() + "}",
cmd_format='{EXE} {IN} {OUT}' ,
map=False,
inputs = self.fastq_files)
......
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