Commit 4acbe9eb authored by Mikaël Salson's avatar Mikaël Salson

Merge branch 'feature-s/3911-fusion-de-reads-avec-flash' into 'dev'

Resolve "Fusion de reads avec Flash"

Closes #3911

See merge request !469
parents 67392167 a6592c5e
Pipeline #115178 passed with stage
in 9 seconds
......@@ -873,6 +873,7 @@ def run_pre_process(pre_process_id, sequence_file_id, clean_before=True, clean_a
cmd = cmd.replace( "&file2&", defs.DIR_SEQUENCES + sequence_file.data_file2)
cmd = cmd.replace( "&result&", output_file)
cmd = cmd.replace("&pear&", defs.DIR_PEAR)
cmd = cmd.replace("&flash2&", defs.DIR_FLASH2)
# Example of template to add some preprocess shortcut
# cmd = cmd.replace("&preprocess_template&", defs.DIR_preprocess_template)
# Where &preprocess_template& is the shortcut to change and
......@@ -47,6 +47,7 @@ DIR_FUSE = '../../tools'
DIR_MIXCR = '../../'
DIR_IGREC = '../../'
DIR_PEAR = '../../'
DIR_FLASH2 = '../../'
DIR_CLONEDB = '../../../clonedb'
### Directory that store the germlines used by Vidjil
from os import listdir, path, makedirs
from os.path import isfile, join
import sys
import shutil
import gzip
import subprocess
import argparse
import shlex
import os
parser = argparse.ArgumentParser(description='Use FLASH2 read merger to make a new fastq file and keep unmerged reads')
parser.add_argument("flash2_dir", help="path to flash2 executable")
parser.add_argument("file_R1", help="forward read file")
parser.add_argument("file_R2", help="reverse read file")
parser.add_argument("output_file", help="output file")
parser.add_argument("-r1", "--keep_r1", help="keep unmerged forward reads", action="store_true")
parser.add_argument("-r2", "--keep_r2", help="keep unmerged reverse reads", action="store_true")
parser.add_argument("-f", "--flash2-options", help="additional options passed to FLASH2", default="")
parser.add_argument("-k", "--keep", help="keep temporary files (may take lots of disk space in the end)", action = 'store_true')
args = parser.parse_args()
f_r1 = args.file_R1
f_r2 = args.file_R2
f_out = args.output_file
paths = os.path.split(f_out)
path_head = paths[0]
path_file = paths[1]
print( "args: %s" % args)
print( "###" )
print( "f_r1: %s" % f_r1)
print( "f_r2: %s" % f_r2)
print( "f_out: %s" % f_out)
print( "path_head: %s" % path_head)
print( "path_file: %s" % path_file)
exit_code =['%s/flash2' % args.flash2_dir,
f_r1, f_r2,
"-d", path_head,
"-o", path_file,
"-t", "1",
# + shlex.split(args.flash2_options)
if exit_code > 0:
raise EnvironmentError("Flash2 failed")
try :
with, 'w') as outFile:
with open(f_out+'.extendedFrags.fastq', 'rb') as f1:
shutil.copyfileobj(f1, outFile)
if (args.keep_r1):
with open(f_out+'.notCombined_1.fastq', 'rb') as f2:
shutil.copyfileobj(f2, outFile)
if (args.keep_r2):
with open(f_out+'.notCombined_2.fastq', 'rb') as f3:
shutil.copyfileobj(f3, outFile)
if not args.keep:
## Remove the histogram provide by Flash2
except IOError :
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