Commit efc58048 authored by yy1533's avatar yy1533
Browse files

💪 enable demultiplexing run as tagging mode

parent 5ce3bcaa
......@@ -82,6 +82,7 @@ def demultiplexing(read1_fpath, read2_fpath, dict_bc_id2seq,
bc_qual_min=10,
is_gzip=True,
save_unknown_bc_fastq=False,
tagging_only=False,
do_bc_rev_complement=False,
do_tx_rev_complement=False,
verbose=False):
......@@ -110,8 +111,18 @@ def demultiplexing(read1_fpath, read2_fpath, dict_bc_id2seq,
bc_fhout['UNKNOWNBC_R2'] = join_path(outdir, 'UNKNOWN',
'UNKNOWNBC_R2.fq')
if tagging_only:
out_fpath_tagged_fq = join_path(outdir, 'tagged.fastq')
out_fh_tagged_fq = open(out_fpath_tagged_fq, 'w')
for bc_seq, v in bc_fhout.items():
bc_fhout[bc_seq] = open(v, 'w')
if bc_seq.startswith('UNKNOWN'):
bc_fhout[bc_seq] = open(v, 'w')
continue
if tagging_only:
bc_fhout[bc_seq] = out_fh_tagged_fq
else:
bc_fhout[bc_seq] = open(v, 'w')
i = 0
while(True):
......@@ -310,6 +321,11 @@ def main():
parser.add_argument('--save-unknown-bc-fastq',
dest='save_unknown_bc_fastq', action='store_true')
parser.set_defaults(save_unknown_bc_fastq=False)
parser.add_argument('--tagging-only',
dest='tagging_only', action='store_true',
help=('Demultiplexed reads are merged to a file named'
' \"tagged.fastq\" under --out-dir.'))
parser.set_defaults(tagging_only=False)
parser.add_argument('--verbose', dest='verbose', action='store_true')
parser.set_defaults(verbose=False)
......@@ -333,6 +349,7 @@ def main():
bc_qual_min=args.min_bc_quality,
is_gzip=args.is_gzip,
save_unknown_bc_fastq=args.save_unknown_bc_fastq,
tagging_only=args.tagging_only,
do_bc_rev_complement=False,
do_tx_rev_complement=False,
verbose=args.verbose)
......
......@@ -95,7 +95,7 @@ def rmfile(fpath):
def base_name(fpath, ext=None):
bs = os.path.basename(fpath)
if not (ext is None or ext == ""):
bs.replace(ext, '')
bs = bs.replace(ext, '')
bs = os.path.splitext(bs)[0]
return(bs)
......
__version__ = '0.5.3'
__version__ = '0.5.3.1'
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