Skip to content

Commit d5d247b

Browse files
author
Kai Hu
committed
minor
1 parent d4712a1 commit d5d247b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

conf/test_chromap.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params {
1818
// filter_sample = 'PBMC_10K_V, PBMC_10K_N'
1919

2020
// filter out undesired clusters:
21-
//filter_seurat_harmony = 'C2, C10'
21+
// filter_seurat_harmony = 'C1, C6'
2222

2323
modules {
2424
// specify a list of marker genes:

modules/local/tag_bam.nf

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ process TAG_BAM {
2525
script:
2626

2727
"""
28+
# Note: mawk v1.3.4 is 10x faster than mawk v1.3.3
2829
# v1: use more memory
29-
# samtools view -h $bam | awk 'BEGIN{FS=OFS="\t"} NR == FNR { if (\$3 != "undetermined") {tag_dict[\$1] = \$3}; next} { if (/^@/) {print} else if (\$1 in tag_dict) {print \$0, "CB:Z:" tag_dict[\$1]}}' $tagfile - | samtools view -b -h - -o ${chunk_name}.tag.bam
30+
# samtools view -h $bam | mawk 'BEGIN{FS=OFS="\t"} NR == FNR { if (\$3 != "undetermined") {tag_dict[\$1] = \$3}; next} { if (/^@/) {print} else if (\$1 in tag_dict) {print \$0, "CB:Z:" tag_dict[\$1]}}' $tagfile - | samtools view -b -h - -o ${chunk_name}.tag.bam
3031
3132
# v2: use less memory but assuming that all qnames in the BAM files are in the tagfile, which is not true since tagfile only contains valid barcodes.
32-
# samtools view -h $bam | awk 'BEGIN{FS=OFS="\t"} NR == FNR { if (\$2 != \$3) { if (\$3 == "undetermined") { tag_dict[\$1] = 0 } else { tag_dict[\$1] = \$3 } }; next} { if (/^@/) {print} else { split(\$1, q_name, ":"); print \$0, "CB:Z:" q_name[1]}}' $tagfile - | samtools view -h -b - -o ${chunk_name}.tag.bam
33+
# samtools view -h $bam | mawk 'BEGIN{FS=OFS="\t"} NR == FNR { if (\$2 != \$3) { if (\$3 == "undetermined") { tag_dict[\$1] = 0 } else { tag_dict[\$1] = \$3 } }; next} { if (/^@/) {print} else { split(\$1, q_name, ":"); print \$0, "CB:Z:" q_name[1]}}' $tagfile - | samtools view -h -b - -o ${chunk_name}.tag.bam
3334
3435
# v3: use less memory and without assumption in v2, as fast as v1
35-
samtools view -h $bam | awk 'BEGIN{FS=OFS="\t"} NR == FNR { if (\$3 != "undetermined") { if (\$2 == \$3) { tag_dict[\$1] = 1 } else { tag_dict[\$1] = \$3 } }; next} { if (/^@/) {print} else if (\$1 in tag_dict) { if (tag_dict[\$1] != 1) { print \$0, "CB:Z:" tag_dict[\$1] } else { split(\$1, q_name, ":"); print \$0, "CB:Z:" q_name[1] } } }' $tagfile - | samtools view -h -b - -o ${chunk_name}.tag.bam
36+
samtools view -h $bam | mawk 'BEGIN{FS=OFS="\t"} NR == FNR { if (\$3 != "undetermined") { if (\$2 == \$3) { tag_dict[\$1] = 1 } else { tag_dict[\$1] = \$3 } }; next} { if (/^@/) {print} else if (\$1 in tag_dict) { if (tag_dict[\$1] != 1) { print \$0, "CB:Z:" tag_dict[\$1] } else { split(\$1, q_name, ":"); print \$0, "CB:Z:" q_name[1] } } }' $tagfile - | samtools view -h -b - -o ${chunk_name}.tag.bam
3637
3738
"""
3839
}

0 commit comments

Comments
 (0)