Skip to content

Commit 75e580c

Browse files
authored
add sample option to cmo_split_reads (#42)
* add 1.96 version to picard calls * add set -o pipefail to bwa call per jaeyoung bug ticket, update version * remove ref seq from default args, default_args probably needs another refactor * fix dis test * inital commit of ppflag_fixer * inital commit of ppflag_fixer * add ppflag-fixer to deploy list, increment _version * add optional sample rename during splitting * add some comments
1 parent fa10a7c commit 75e580c

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

bin/cmo_split_reads

+7-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import argparse, os, sys, signal, subprocess, math, gzip, io
44
import cmo
55
import multiprocessing
66

7-
def chunk(fastq, lines_per_chunk, num_pieces):
7+
def chunk(fastq, sample, lines_per_chunk, num_pieces):
88
logger = cmo.util.get_logger()
99
output_prefix = os.path.basename(fastq).split(".", 1)[0] + "."
10+
if(sample != None):
11+
exploded = output_prefix.split(".")
12+
exploded[0]=sample
13+
output_prefix = ".".join(exploded)
1014
while lines_per_chunk % 4 != 0:
1115
lines_per_chunk +=1
1216
fh = io.BufferedReader(gzip.open(fastq, "rb"))
@@ -40,6 +44,7 @@ if __name__ =='__main__':
4044
parser = argparse.ArgumentParser(description="split files into chunks based on filesize")
4145
parser.add_argument('-f1', "--fastq1", action='store', help="filename to split", required=True)
4246
parser.add_argument('-f2', "--fastq2", action='store', help="filename2 to split")
47+
parser.add_argument('-s', "--sample", action='store', help="sample ID")
4348
args = parser.parse_args()
4449
fastqs = [args.fastq1]
4550
if args.fastq2:
@@ -53,7 +58,7 @@ if __name__ =='__main__':
5358
logger.info("%s lines per chunk" % str(lines_per_chunk))
5459
pool=multiprocessing.Pool(processes=2)
5560
for fastq in fastqs:
56-
result = pool.apply_async(chunk, args=(fastq, lines_per_chunk, num_pieces, ))
61+
result = pool.apply_async(chunk, args=(fastq, args.sample, lines_per_chunk, num_pieces, ))
5762
pool.close()
5863
pool.join()
5964

cmo/_version.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
# This file is originally generated from Git information by running 'setup.py
33
# version'. Distribution tarballs contain a pre-generated copy of this file.
44

5-
__version__ = '1.5.0'
5+
6+
__version__ = '1.5.1'

cmo/picard.py

+2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ def picard_cmd(self, command, default_args_override={}, command_specific_args={}
3737
cmd = [self.java_cmd, self.java_args, "-jar", os.path.join(self.picard_jar, command+".jar")]
3838
else:
3939
cmd = [self.java_cmd, self.java_args, "-jar", self.picard_jar, command]
40+
#overwrite default args with whatever was passed in
4041
for arg, value in default_args_override.items():
4142
if arg in self.default_args:
4243
self.default_args[arg] = value
44+
#add combination of pass-ins and defaults to command
4345
for arg, value in self.default_args.items():
4446
if arg in default_args_override:
4547
value = default_args_override[arg]

0 commit comments

Comments
 (0)