Skip to content

Commit 1c2b3d7

Browse files
authored
Merge pull request #405 from JoseEspinosa/updates
Add read group tag to bowtie2 bams
2 parents 9fe5767 + bcb876b commit 1c2b3d7

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2828
- [[PR #392](https://github.com/nf-core/chipseq/pull/392)] - Adding line numbers to warnings/errors messages in `bin/check_samplesheet.py`.
2929
- [[#396](https://github.com/nf-core/chipseq/issues/396)] - Check that samplesheet samples IDs do only have alphanumeric characters, dots, dashes or underscores.
3030
- [[#378](https://github.com/nf-core/chipseq/issues/378)] - Switch from macs2 to macs3.
31+
- [[#347](https://github.com/nf-core/chipseq/issues/347)] - Add read group tag to bam files processed by bowtie2.
3132

3233
### Software dependencies
3334

conf/modules.config

+6-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,12 @@ if (params.aligner == 'bwa') {
225225
if (params.aligner == 'bowtie2') {
226226
process {
227227
withName: 'BOWTIE2_ALIGN' {
228-
ext.args = ''
228+
ext.args = {
229+
[
230+
meta.read_group ? "--rg-id ${meta.id} --rg SM:${meta.id - ~/_T\d+$/} --rg PL:ILLUMINA --rg LB:${meta.id} --rg PU:1" : '',
231+
params.seq_center ? "--rg CN:${params.seq_center}" : ''
232+
].join(' ').trim()
233+
}
229234
ext.prefix = { "${meta.id}.Lb" }
230235
publishDir = [
231236
[

subworkflows/local/input_check.nf

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def create_fastq_channel(LinkedHashMap row, String seq_center) {
2929
meta.antibody = row.antibody
3030
meta.control = row.control
3131

32-
def read_group = "\'@RG\\tID:${meta.id}\\tSM:${meta.id.split('_')[0..-2].join('_')}\\tPL:ILLUMINA\\tLB:${meta.id}\\tPU:1\'"
32+
def read_group = "\'@RG\\tID:${meta.id}\\tSM:${meta.id - ~/_T\d+$/}\\tPL:ILLUMINA\\tLB:${meta.id}\\tPU:1\'"
3333
if (seq_center) {
34-
read_group = "\'@RG\\tID:${meta.id}\\tSM:${meta.id.split('_')[0..-2].join('_')}\\tPL:ILLUMINA\\tLB:${meta.id}\\tPU:1\\tCN:${seq_center}\'"
34+
read_group = "\'@RG\\tID:${meta.id}\\tSM:${meta.id - ~/_T\d+$/}\\tPL:ILLUMINA\\tLB:${meta.id}\\tPU:1\\tCN:${seq_center}\'"
3535
}
3636
meta.read_group = read_group
3737

0 commit comments

Comments
 (0)