Commit 7bc05813 authored by yy1533's avatar yy1533
Browse files

💊 arguments too long error 7

parent efc58048
......@@ -83,6 +83,7 @@ def demultiplexing(read1_fpath, read2_fpath, dict_bc_id2seq,
is_gzip=True,
save_unknown_bc_fastq=False,
tagging_only=False,
tag_to='tagged.fastq',
do_bc_rev_complement=False,
do_tx_rev_complement=False,
verbose=False):
......@@ -112,7 +113,7 @@ def demultiplexing(read1_fpath, read2_fpath, dict_bc_id2seq,
'UNKNOWNBC_R2.fq')
if tagging_only:
out_fpath_tagged_fq = join_path(outdir, 'tagged.fastq')
out_fpath_tagged_fq = join_path(outdir, tag_to)
out_fh_tagged_fq = open(out_fpath_tagged_fq, 'w')
for bc_seq, v in bc_fhout.items():
......@@ -326,6 +327,11 @@ def main():
help=('Demultiplexed reads are merged to a file named'
' \"tagged.fastq\" under --out-dir.'))
parser.set_defaults(tagging_only=False)
parser.add_argument(
'--tag-to',
dest='tag_to', default='tagged.fastq',
help=('File base name to save the tagged fastq file. '
'Only used when tagging_only.'))
parser.add_argument('--verbose', dest='verbose', action='store_true')
parser.set_defaults(verbose=False)
......@@ -350,6 +356,7 @@ def main():
is_gzip=args.is_gzip,
save_unknown_bc_fastq=args.save_unknown_bc_fastq,
tagging_only=args.tagging_only,
tag_to=args.tag_to,
do_bc_rev_complement=False,
do_tx_rev_complement=False,
verbose=args.verbose)
......
__version__ = '0.5.3.1'
__version__ = '0.5.3.2'
......@@ -44,8 +44,8 @@ BOWTIE2_INDEX_PREFIX = config.get('BOWTIE2_INDEX_PREFIX', None)
BOWTIE2 = config.get('BOWTIE2', None) # '/local/apps/bowtie2/2.3.1/bowtie2'
STAR_INDEX_DIR = config.get('STAR_INDEX_DIR', None)
STAR = config.get('STAR', None)
KALLISTO = config.get('KALLISTO', None)
KALLISTO_INDEX = config.get('KALLISTO_INDEX', None)
# KALLISTO = config.get('KALLISTO', None)
# KALLISTO_INDEX = config.get('KALLISTO_INDEX', None)
ALIGNER_EXTRA_PARAMETERS = config.get('ALIGNER_EXTRA_PARAMETERS', '')
# Annotations
......@@ -347,11 +347,16 @@ rule tag_fastq:
for fq in input.fq:
fq_itemid = base_name(dir_name(fq))
dict_itemid_fq.setdefault(fq_itemid, []).append(fq)
for itemid, item_fq in dict_itemid_fq.items():
itemid_tag_fq = join_path(DIR_PROJ, SUBDIR_FASTQ,
itemid, 'TAGGED.bigfastq')
cmd = 'cat {} > {} '.format(' '.join(item_fq), itemid_tag_fq)
shell(cmd)
# cmd = 'cat {} > {} '.format(' '.join(item_fq), itemid_tag_fq)
if is_nonempty_file(itemid_tag_fq):
shell('rm {itemid_tag_fq}')
for fq in item_fq:
cmd = 'cat {} >> {}'.format(fq, itemid_tag_fq)
shell(cmd)
print_logger('Tagged FQ: {}'.format(itemid_tag_fq))
......@@ -426,36 +431,36 @@ if ALIGNER == 'star':
shell('mv {starsam} {output.sam} ')
shell('mv {starlog} {output.log} ')
if ALIGNER == 'kallisto':
rule align_kallisto_pseudobam:
input:
fq = join_path(DIR_PROJ, SUBDIR_FASTQ,
'{itemID}', 'TAGGED.bigfastq'),
output:
sam = join_path(DIR_PROJ, SUBDIR_ALIGN_ITEM,
'{itemID}', ALIGNER + '.bigsam'),
params:
threads = num_threads,
kallisto_outdir_tmp = join_path(DIR_PROJ, SUBDIR_ALIGN_ITEM,
'{itemID}', '.kallisto', ''),
aligner_extra_parameters = ALIGNER_EXTRA_PARAMETERS,
# shadow: "shallow"
log:
join_path(DIR_PROJ, SUBDIR_LOG, '{itemID}',
'Align-Kallisto.log')
run:
cmd = '{KALLISTO} '
cmd += '--index {KALLISTO_INDEX} '
cmd += '--output-dir {params.kallisto_outdir_tmp} '
cmd += '--seed 42 --single --pseudobam '
cmd += '--fragment-length {CUT_LENGTH} '
cmd += '--sd 2 '
cmd += '--threads {params.threads} '
cmd += '{params.aligner_extra_parameters} '
cmd += '{input.fq} '
cmd += '>{output.sam} '
cmd += '2>{log} '
shell(cmd)
# if ALIGNER == 'kallisto':
# rule align_kallisto_pseudobam:
# input:
# fq = join_path(DIR_PROJ, SUBDIR_FASTQ,
# '{itemID}', 'TAGGED.bigfastq'),
# output:
# sam = join_path(DIR_PROJ, SUBDIR_ALIGN_ITEM,
# '{itemID}', ALIGNER + '.bigsam'),
# params:
# threads = num_threads,
# kallisto_outdir_tmp = join_path(DIR_PROJ, SUBDIR_ALIGN_ITEM,
# '{itemID}', '.kallisto', ''),
# aligner_extra_parameters = ALIGNER_EXTRA_PARAMETERS,
# # shadow: "shallow"
# log:
# join_path(DIR_PROJ, SUBDIR_LOG, '{itemID}',
# 'Align-Kallisto.log')
# run:
# cmd = '{KALLISTO} '
# cmd += '--index {KALLISTO_INDEX} '
# cmd += '--output-dir {params.kallisto_outdir_tmp} '
# cmd += '--seed 42 --single --pseudobam '
# cmd += '--fragment-length {CUT_LENGTH} '
# cmd += '--sd 2 '
# cmd += '--threads {params.threads} '
# cmd += '{params.aligner_extra_parameters} '
# cmd += '{input.fq} '
# cmd += '>{output.sam} '
# cmd += '2>{log} '
# shell(cmd)
# Pipeline Step 2b: Combo-demultiplex the SAM file
......
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