Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit 097cd375 authored by marc's avatar marc
Browse files

tools/pear.py: add small script for pear pre_process

parent db8d19cb
from os import listdir, path, makedirs
from os.path import isfile, join
import sys
import shutil
import gzip
import subprocess
import argparse
parser = argparse.ArgumentParser(description='Use pear read merger to make a new fastq file and keep unmerged reads')
parser.add_argument("file_R1", help="reverse read file")
parser.add_argument("file_R2", help="forward read file")
parser.add_argument("output_file", help="output file")
parser.add_argument("-r1", "--keep_r1", help="keep unmerged reverse reads", action="store_true")
parser.add_argument("-r2", "--keep_r2", help="keep unmerged forward reads", action="store_true")
args = parser.parse_args()
f_r1 = args.file_R1
f_r2 = args.file_R2
f_out = args.output_file
subprocess.call(["pear",
"-f", f_r1,
"-r", f_r2,
"-o", f_out,
"-n", "100",
"-m", "490",
"-j", "3"])
with gzip.open(f_out, 'w') as outFile:
with open(f_out+'.assembled.fastq', 'rb') as f1:
shutil.copyfileobj(f1, outFile)
if (args.keep_r1):
with open(f_out+'.unassembled.reverse.fastq', 'rb') as f2:
shutil.copyfileobj(f2, outFile)
if (args.keep_r2):
with open(f_out+'.unassembled.forward.fastq', 'rb') as f3:
shutil.copyfileobj(f3, outFile)
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