Skip to content
Snippets Groups Projects
Commit 74657bda authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Update build pop to enable stdout/err redirecting

parent 6427b4bd
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ from pysam import tabix_compress, tabix_index
from variants_simulator import VariantsSimulator
from exceptions import InputException
import multiprocessing
import subprocess
def parse_args():
"""
......@@ -269,24 +270,23 @@ def generate_samples_fastq(haploid, nb_inds, output_dir, coverage, read_len, ins
print("GENERATE RANDOM READS FOR EACH INDIVIDUAL FROM GENOME...\n")
# Generate reads for all individuals:
if not haploid:
cmd = str("{4}pirs/pirs simulate -z -x {3} -d -B {4}pirs/Profiles/Base-Calling_Profiles/humNew.PE100.matrix.gz "
"-I {4}pirs/Profiles/InDel_Profiles/phixv2.InDel.matrix -l {5} -m {6} -v {7} "
"-G {4}pirs/Profiles/GC-depth_Profiles/humNew.gcdep_100.dat -o {0} -t {8} {1} {2}")
else:
cmd = str("{4}pirs/pirs simulate -z -x {3} -B {4}pirs/Profiles/Base-Calling_Profiles/humNew.PE100.matrix.gz "
"-I {4}pirs/Profiles/InDel_Profiles/phixv2.InDel.matrix -l {5} -m {6} -v {7} "
"-G {4}pirs/Profiles/GC-depth_Profiles/humNew.gcdep_100.dat -o {0} -t {8} {1}")
cmd = [prg_path + "/pirs/pirs", "simulate", "-z", "-x", str(coverage), "-d", "-B",
prg_path + "/pirs/Profiles/Base-Calling_Profiles/humNew.PE100.matrix.gz", "-I",
prg_path + "/pirs/Profiles/InDel_Profiles/phixv2.InDel.matrix", "-l", str(read_len), "-m",
str(insert_len_mean), "-v", str(insert_len_sd),
"-G", prg_path + "/pirs/Profiles/GC-depth_Profiles/humNew.gcdep_100.dat", "-t", str(threads), "-o"]
if haploid:
cmd.remove("-d")
for i in range(1, nb_inds+1):
prefix = os.path.join(output_dir, "INDIV_" + str(i))
cmd_full = cmd + [prefix]
chr0 = prefix + "_chr_0.fasta"
chr1 = prefix + "_chr_1.fasta"
if not haploid:
os.system(cmd.format(prefix, chr0, chr1, coverage, prg_path + os.path.sep, read_len,
insert_len_mean, insert_len_sd, threads))
chr1 = prefix + "_chr_1.fasta"
cmd_full += [chr0, chr1]
else:
os.system(cmd.format(prefix, chr0, "", coverage, prg_path + os.path.sep, read_len,
insert_len_mean, insert_len_sd, threads))
cmd_full.append(chr0)
subprocess.call(cmd_full, stdout=sys.stdout, stderr=sys.stderr)
def confirm(deletions: dict, variants: dict):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment