HLA typing - mapping of RNAseq fastqs - avoiding RazerS ressource dependencies
Closed this issue · 2 comments
PeterBailey commented
The following code below was modified in main.nf.
Simply removed the unzip process and replaced with modified yara mapper script.
The code was run as follows:
nextflow run ~/nf_scripts/hlaTypingMaster -profile docker --reads '*_R{1,2}.fastq.gz' --seqtype 'rna' --outdir $PWD/SCC_hlatyping --index data/indices/yara/hla _reference_rna
Received error:
Jul-30 14:01:33.586 [Task monitor] ERROR nextflow.processor.TaskProcessor - Error executing process > 'map_fastq_to_hla (5)'
Caused by:
Process `map_fastq_to_hla (5)` terminated with an error exit status (1)
Command executed:
yara_mapper -e 3 -t 16 /home/pbailey/nf_scripts/hlaTypingMaster/data/indices/yara/hla_reference_rna MET2_R1.fastq.gz MET2_R2.fastq.gz -o output.bam
samtools view -h -F 4 -f 0x40 -b1 output.bam > mapped_1.bam
samtools view -h -F 4 -f 0x80 -b1 output.bam > mapped_2.bam
Command exit status:
1
Command output:
(empty)
Command error:
Open failed on file /home/pbailey/nf_scripts/hlaTypingMaster/data/indices/yara/hla_reference_rna.txt.size: "No such file or directory"
yara_mapper: Error while opening reference file.
if( params.bam ) log.info "BAM file format detected. Initiate remapping to HLA alleles with yara mapper."
/*
* Preparation - Unpack files if packed.
*
* OptiType cannot handle *.gz archives as input files,
* So we have to unpack first, if this is the case.
*/
if ( !params.bam ) { // FASTQ files processing
process map_fastq_to_hla {
input:
set val(pattern), file(reads) from input_data
output:
set val(pattern), "mapped_{1,2}.bam" into raw_reads
script:
if (params.singleEnd)
"""
yara_mapper -e 3 -t ${params.max_cpus} -f bam ${workflow.projectDir}/${params.index} ${reads[0]} > output_1.bam
samtools view -h -F 4 -b1 output_1.bam > mapped_1.bam
"""
else
"""
yara_mapper -e 3 -t ${params.max_cpus} ${workflow.projectDir}/${params.index} ${reads[0]} ${reads[1]} -o output.bam
samtools view -h -F 4 -f 0x40 -b1 output.bam > mapped_1.bam
samtools view -h -F 4 -f 0x80 -b1 output.bam > mapped_2.bam
"""
}
} else { // BAM files processing
/*
* Preparation - Remapping of reads against HLA reference and filtering these
*
* In case the user provides BAM files, a remapping step
* is then done against the HLA reference sequence.
*/
process remap_to_hla {
input:
set val(pattern), file(bams) from input_data
output:
set val(pattern), "mapped_{1,2}.bam" into raw_reads
script:
if (params.singleEnd)
"""
samtools bam2fq $bams > output_1.fastq
yara_mapper -e 3 -t ${params.max_cpus} -f bam ${workflow.projectDir}/${params.index} output_1.fastq > output_1.bam
samtools view -h -F 4 -b1 output_1.bam > mapped_1.bam
"""
else
"""
samtools view -h -f 0x40 $bams > output_1.bam
samtools view -h -f 0x80 $bams > output_2.bam
samtools bam2fq output_1.bam > output_1.fastq
samtools bam2fq output_2.bam > output_2.fastq
yara_mapper -e 3 -t ${params.max_cpus} -f bam ${workflow.projectDir}/${params.index} output_1.fastq output_2.fastq > output.bam
samtools view -h -F 4 -f 0x40 -b1 output.bam > mapped_1.bam
samtools view -h -F 4 -f 0x80 -b1 output.bam > mapped_2.bam
"""
}
}
sven1103 commented
thanks @PeterBailey for reporting this. We will implement a pre-mapping step with yara in the next minor release of the HLA typing pipleline!