Handling Multimapped Reads with --keep_multi_map A...
# chipseq
w
Handling Multimapped Reads with --keep_multi_map Across Different Aligners I am currently utilizing the nf-core/chipseq pipeline (v2.0.0) for ChIP-seq analysis with an interest in transposable elements. I have enabled the --keep_multi_map option and am using various aligners (STAR, BWA, and Bowtie2). I am trying to understand the specific behavior of each aligner when this option is active: 1. STAR: How are multimapped reads handled when --keep_multi_map is true? Specifically, does STAR select the best alignment or report a random alignment in the event of ties? 2. BWA/Bowtie2: Could you detail how these aligners manage multimapped reads under the same condition? I have experience using STAR outside of the nf-core pipeline with specific parameters tailored for RNA-seq, which influence how multimapped reads are treated. --outFilterMultimapNmax 5000: This parameter sets the maximum number of multiple alignments allowed for a read. If a read maps in more than 5000 locations, it's considered too many and won't be included. --outMultimapperOrder Random: When there are multiple alignments for a read that are considered equally good, this parameter instructs STAR to randomly select one of these alignments to output. --winAnchorMultimapNmax 5000: This parameter is similar to --outFilterMultimapNmax but applies specifically to the number of maximum multiple alignments that are tried to be anchored within a window of the sequence. @Jose Espinosa-Carrasco
j
None of this tools arguments are set in the pipeline as the aligners are by default not set to multimap. You will need to create a
custom.config
and provide the desired tools arguments to the pipeline as you desire as explained here The
--keep_multi_map
parameter only controls that multimap reads are not filtered by samtools, see here
w
@Jose Espinosa-Carrasco Thanks for clarifying the settings for multimapped reads. I have set up a custom configuration to ensure STAR handles the reads as required.Here is my Execution Command: nextflow run nf-core/chipseq \ -r 2.0.0 \ --input path/samplesheet.csv \ --outdir path \ --genome GRCm38 \ --read_length 100 \ --aligner star \ --keep_multi_map true \ -profile singularity \ -c path/star_custom.config # Specify the path to your custom config Here is my star_custom.config // Custom configuration for STAR aligner in the nf-core/chipseq pipeline process { withName: 'STAR_ALIGN' { // Apply custom STAR aligner parameters ext.args = '--outFilterMultimapNmax 5000 --outMultimapperOrder Random' } } Does this setup look correct to you? And is this correct way pipeline will accept my custom configuration?
j
Hi, it is nice to format the code for making it more readable, as shown below, markdownhelp
s
Using some code formatting helps with readability and finding the issue. Here are some tips about how to format code snippets nicely in Slack: http://tiny.cc/mdcodeblocks http://tiny.cc/slacksnippets
j
Regarding what your post, keep in mind that your current custom config will overwrite the arguments passed to
STAR
and not append them to the current ones, see here, including
--outReadsUnmapped Fastx
So you will also need to provide all of the arguments you need in your custom config, e.g.:
Copy code
process {
  withName: 'STAR_ALIGN' {
    // Apply custom STAR aligner parameters
    ext.args = '--outFilterMultimapNmax 5000 --outMultimapperOrder Random --outReadsUnmapped Fastx moreArgumentsHere'
  }
}
w
#Default pipeline
@Jose Espinosa-Carrasco I ran both default pipeline and custom.config pipeline (with all arguments as you suggested ). They mapping statistics are same (~) for both. See attachments. It seems custom config is not overwriting the arguments of STAR? Or did I miss anything?
Untitled
Nextflow.nfcore_Custom Config.all.Parameters.results_summary.out,Nextflow.nfcore_star_results_unique_results_summary.out
j
If you go to the work directory of he process you would be able to check the actual command nextflow had run by inspecting
.command.sh
, this way you will be able to check whether the arguments have been overwritten, if you don’t know how to do it share your
.nextflow.log
here and I can try to help you, from what I see it seems to me that the arguments should be correctly overwritten
w
@Jose Espinosa-Carrasco Do you mean the contents of the .command.sh like this. I dont see all my custom .contig parameters here. Or am I looking into wrong file
ontents of the .command.sh
j
Yes, something 🐠 is going on, I think it should have worked this way, but it doesn’t seem to… I have been testing locally and using the whole name selector should work:
Copy code
process {
    withName: 'NFCORE_CHIPSEQ:CHIPSEQ:ALIGN_STAR:STAR_ALIGN {
    // Custom STAR aligner parameters, including defaults and handling for multimapped reads
    ext.args = '--runMode alignReads --alignIntronMax 1 --alignEndsType EndToEnd --outSAMtype BAM Unsorted --readFilesCommand zcat --runRNGseed 0 --outSAMattributes NH HI AS NM MD --outFilterMultimapNmax 5000 --outMultimapperOrder Random --outReadsUnmapped Fastx'
    }
}
w
@Jose Espinosa-Carrasco i used more explicit path in the withName directive:'NFCORE_CHIPSEQCHIPSEQALIGN_STAR:STAR_ALIGN' in custom.contig ( file attached)
Untitled
star_custom.4_config.config
I think the parameters are overriding. Am i correct?
j
yes, I think so
w
@Jose Espinosa-Carrasco Thanks for your help
😊 1
Untitled
@Jose Espinosa-Carrasco I have used that custom pipeline which we discussed in both unique and multimapping modes. However, I observed only a slight increase in multi-mapped reads, which has left me uncertain about the effectiveness of this approach for TE detection. What is your take on it? Any suggestions for improvement?
Untitled