Skip to content

Commit

Permalink
implemented barcode size selection
Browse files Browse the repository at this point in the history
  • Loading branch information
Acribbs committed May 12, 2023
1 parent 52e4503 commit 2438190
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tallytrin/pipeline_10x.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def identify_bcumi(infile, outfile):
PYTHON_ROOT = os.path.join(os.path.dirname(__file__), "python/")

statement = '''python %(PYTHON_ROOT)s/10x_identify_barcode.py --outfile=%(outfile)s --infile=%(infile)s --whitelist=polyA_umi.dir/%(name)s.whitelist.txt
--cmimode=%(cmimode)s'''
--cmimode=%(cmimode)s --barcode=%(barcode)s'''

P.run(statement, job_options='-t 24:00:00')

Expand Down Expand Up @@ -266,7 +266,7 @@ def mapping(infile, outfile):

statement = '''minimap2 %(options)s %(cdna)s %(infile)s > %(outfile)s 2> %(outfile)s.log'''

P.run(statement, job_options='-t 24:00:00')
P.run(statement, job_options='-t 24:00:00', job_threads=4)


@transform(mapping,
Expand Down
6 changes: 5 additions & 1 deletion tallytrin/pipeline_10x/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ database:
# this is so that the accuracy of the data can be measured: True 1, False 0
cmi_mode: 1

job_options: -t 48:00:00
job_options: -t 48:00:00

# Specify the barcode length you would like for 10x,
# the default is 16 but for testing purposes this can be reduced
barcode: 16
7 changes: 5 additions & 2 deletions tallytrin/python/10x_identify_barcode.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import sys
import regex
import cgatcore.iotools as iotools
Expand Down Expand Up @@ -29,6 +30,8 @@
help='name for output fastq files')
parser.add_argument("--cmimode", default=None, type=str,
help='Run the script in cmi mode for accuracy evaluation')
parser.add_argument("--barcode", default='16', type=int,
help='Length of barcode required')

args = parser.parse_args()

Expand Down Expand Up @@ -76,14 +79,14 @@
else:
umi = record.sequence[end_b:end_b+12]
if len(umi) == 15 and args.cmimode == '1':
barcode = record.sequence[end_b+12:end_b+28]
barcode = record.sequence[end_b+12:end_b+28][:int(args.barcode)]
barcodes.append(barcode)
seq_new = record.sequence[:begin_b]
quality_new = record.quality[:begin_b]

outfile.write("@%s\n%s\n+\n%s\n" % (record.name + "_" + barcode + "_" + umi, seq_new, quality_new))
else:
barcode = record.sequence[end_b+12:end_b+28]
barcode = record.sequence[end_b+12:end_b+28][:int(args.barcode)]
barcodes.append(barcode)
seq_new = record.sequence[:begin_b]
quality_new = record.quality[:begin_b]
Expand Down
2 changes: 1 addition & 1 deletion tallytrin/python/correct_10xbarcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def closest_match(input_string, string_list):

seq = record.sequence
name = record.name.split("_")[0]
barcode = record.name.split("_")[1][2:12]
barcode = record.name.split("_")[1]
umi = record.name.split("_")[2]

if args.cmimode:
Expand Down

0 comments on commit 2438190

Please sign in to comment.