Skip to content

Commit 72e1b25

Browse files
author
Pablo Riesgo-Ferreiro
authoredMar 25, 2024
Merge pull request #2 from TRON-Bioinformatics/picard2bedtools
replace picard by bedtools for the bam2fastq
2 parents 8a52bb9 + 1206a2d commit 72e1b25

File tree

3 files changed

+52
-3
lines changed

3 files changed

+52
-3
lines changed
 

‎CHANGELOG.md

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
12+
### Changed
13+
14+
### Removed
15+
16+
17+
## [0.3.0] - 2024-03-25
18+
19+
### Changed
20+
21+
- Replaced GATKs SamToFastq by bedtools bamtofastq to avoid issue with unmated reads
22+
23+
24+
## [0.2.0] - 2024-03-25
25+
26+
### Added
27+
28+
- Add support for BAM files as input files. It extracts the reads aligned to the MHC region in the canonical
29+
chromosome 6 + all reads from chromosome 6 alt contigs + unmapped reads and converts into FASTQs
30+
31+
32+
## [0.1.0] - 2022-11-02
33+
34+
- First release!
35+
36+
37+
[unreleased]: https://github.com/tron-bioinformatics/tronflow-hla-hd/compare/v0.3.0...HEAD
38+
[0.3.0]: https://github.com/tron-bioinformatics/tronflow-hla-hd/compare/v0.2.0...v0.3.0
39+
[0.2.0]: https://github.com/tron-bioinformatics/tronflow-hla-hd/compare/v0.1.0...v0.2.0
40+
[0.1.0]: https://github.com/tron-bioinformatics/tronflow-hla-hd/releases/tag/v0.1.0

‎modules/00_bam2fastq.nf

+11-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ process BAM2FASTQ {
55
publishDir "${params.output}/${name}", mode: "copy", pattern: "*.txt"
66
module params.bowtie2_module
77

8-
conda (params.enable_conda ? "bioconda::samtools=1.18 bioconda::gatk4=4.2.5.0" : null)
8+
conda (params.enable_conda ? "bioconda::samtools=1.18 bioconda::bedtools=2.31.1" : null)
99

1010
input:
1111
tuple val(name), val(bam)
@@ -31,12 +31,21 @@ process BAM2FASTQ {
3131
3232
#Merge bam files
3333
samtools merge -o ${name}.merge.bam ${name}.unmap.bam ${name}.mhc.bam
34+
rm -f ${name}.unmap.bam
35+
rm -f ${name}.mhc.bam
36+
37+
# sort BAM by read name
38+
samtools sort -n ${name}.merge.bam -o ${name}.merge.sorted.bam
39+
rm -f ${name}.merge.bam
3440
3541
#Create fastq
36-
gatk SamToFastq --VALIDATION_STRINGENCY SILENT -I ${name}.merge.bam -F ${name}.hlatmp.1.fastq -F2 ${name}.hlatmp.2.fastq
42+
bedtools bamtofastq -i ${name}.merge.sorted.bam -fq ${name}.hlatmp.1.fastq -fq2 ${name}.hlatmp.2.fastq
3743
3844
#Change fastq ID
3945
cat ${name}.hlatmp.1.fastq |awk '{if(NR%4 == 1){O=\$0;gsub("/1"," 1",O);print O}else{print \$0}}' | gzip > ${name}.hla.1.fastq.gz
4046
cat ${name}.hlatmp.2.fastq |awk '{if(NR%4 == 1){O=\$0;gsub("/2"," 2",O);print O}else{print \$0}}' | gzip > ${name}.hla.2.fastq.gz
47+
48+
rm -f ${name}.hlatmp.1.fastq
49+
rm -f ${name}.hlatmp.2.fastq
4150
"""
4251
}

‎nextflow.config

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ env {
3939
// Capture exit codes from upstream processes when piping
4040
process.shell = ['/bin/bash', '-euo', 'pipefail']
4141

42-
VERSION = '0.2.0'
42+
VERSION = '0.3.0'
4343

4444
manifest {
4545
name = 'TRON-Bioinformatics/tronflow-hlahd'

0 commit comments

Comments
 (0)