Skip to content

Commit

Permalink
nf-core-rnaseq: Add min_mapped_reads advanced option
Browse files Browse the repository at this point in the history
  • Loading branch information
pansapiens committed Dec 19, 2023
1 parent 1c87bd0 commit 9b5885a
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 6 deletions.
9 changes: 9 additions & 0 deletions laxy_backend/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,15 @@ def post(self, request: Request, version=None):
job.params, "params.user_genome.annotation_url", None
)

# TODO: nf-core /rnaseq specific - this should go into a pipeline specific validation hook in the
# nf-core-rnaseq app that gets called based on the pipeline being started
_min_mapped_reads = job.params.get("params").get(
"min_mapped_reads", None
)
if _min_mapped_reads is not None:
job.params['min_mapped_reads'] = int(_min_mapped_reads)
job.save()

if (
(
reference_genome_id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const initial_state: any = {
strandedness: 'auto',
debug_mode: false,
has_umi: false,
min_mapped_reads: 5,
save_reference_genome: true,
save_genome_index: false,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,27 @@
Use UMIs <em>(UMIs must be in the FASTQ header from bcl2fastq demultiplexing, not in the
sequence)</em></md-switch>

<md-switch v-model="save_reference_genome" id="save-reference-genome-toggle"
name="save-reference-genome-toggle" class="md-primary">Save reference genome</md-switch>

<md-switch v-model="save_genome_index" id="save-genome-index-toggle"
name="save-genome-index-toggle" class="md-primary">Save reference genome index</md-switch>
<md-layout>
<md-layout>
<md-input-container>
<label>Exclude samples with less this percentage of mapped reads
(<code>--min_mapped_reads</code>)</label>
<md-input type="number" min="0" max="100" v-model="min_mapped_reads"></md-input>
</md-input-container>
</md-layout>
<md-layout md-flex="5" md-vertical-align="center">
<md-button id="minMappedReadshelpButton" @click="openDialog('minMappedReadsHelpPopup')"
class="push-right md-icon-button md-raised md-dense">
<md-icon style="color: #bdbdbd;">help</md-icon>
</md-button>
</md-layout>
</md-layout>

<md-switch v-model="save_reference_genome" id="save-reference-genome-toggle"
name="save-reference-genome-toggle" class="md-primary">Save reference genome</md-switch>

<md-switch v-model="save_genome_index" id="save-genome-index-toggle" name="save-genome-index-toggle"
class="md-primary">Save reference genome index</md-switch>
</md-layout>

</md-layout>
Expand Down Expand Up @@ -92,6 +108,27 @@
nf-core/rnaseq does not support 'auto' strandedness. Please select another strandedness option, or another
pipeline version.
</banner-notice>
<banner-notice v-if="!isValid_min_mapped_reads" type="error" :show-close-button="false">Invalid value for minimum
mapped reads - should be an integer between 0 and 100.
</banner-notice>


<md-dialog md-open-from="#minMappedReadshelpButton" md-close-to="#minMappedReadshelpButton"
id="minMappedReadsHelpPopup" ref="minMappedReadsHelpPopup">
<md-dialog-title>Minimum mapped reads</md-dialog-title>

<md-dialog-content>
The nf-core/rnaseq <code>--min_mapped_reads</code> option.<br />
Samples with mapping rates less than this are excluded from the final counts matrix and most QC steps.<br />
Setting this to below 5% risks some downstream steps failing, since not all tools handle samples with very
low mapping rates gracefully.<br />
</md-dialog-content>

<md-dialog-actions>
<md-button class="md-primary" @click="closeDialog('minMappedReadsHelpPopup')">Close</md-button>
</md-dialog-actions>
</md-dialog>

</md-layout>

<md-snackbar md-position="bottom center" ref="snackbar" :md-duration="snackbar_duration">
Expand Down Expand Up @@ -239,6 +276,9 @@ export default class PipelineParams extends Vue {
@Sync("[email protected]_umi")
public has_umi: boolean;
@Sync("[email protected]_mapped_reads")
public min_mapped_reads: number;
@Sync("[email protected]_reference_genome")
public save_reference_genome: boolean;
Expand Down Expand Up @@ -340,13 +380,22 @@ export default class PipelineParams extends Vue {
return true;
}
get isValid_min_mapped_reads() {
if (this.min_mapped_reads >= 0 &&
this.min_mapped_reads <= 100) {
return true;
}
return false;
}
get isValid_params() {
let is_valid = false;
if (
this.isValid_reference_genome &&
this.isValid_samples_added &&
this.isValid_duplicate_samples &&
this.isValid_strandedness_option
this.isValid_strandedness_option &&
this.isValid_min_mapped_reads
) {
is_valid = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ function get_settings_from_pipeline_config() {
if [[ "${_has_umi}" == "true" ]]; then
export UMI_FLAGS=" --with_umi --skip_umi_extract --umitools_umi_separator : "
fi

local -i _min_mapped_reads=$(jq --raw-output '.params."nf-core-rnaseq".min_mapped_reads' "${PIPELINE_CONFIG}" || echo "5")
export MIN_MAPPED_READS_ARG=" --min_mapped_reads ${_min_mapped_reads} "
}

function generate_samplesheet() {
Expand Down Expand Up @@ -550,6 +553,7 @@ function run_nextflow() {
--outdir ${JOB_PATH}/output/results \
${GENOME_ARGS} \
${UMI_FLAGS} \
${MIN_MAPPED_READS_ARG} \
--aligner star_salmon \
--pseudo_aligner salmon \
--save_reference \
Expand All @@ -572,6 +576,7 @@ function run_nextflow() {
--outdir ${JOB_PATH}/output/results \
${GENOME_ARGS} \
${UMI_FLAGS} \
${MIN_MAPPED_READS_ARG} \
--aligner star_salmon \
--pseudo_aligner salmon \
--save_reference \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,9 @@ function get_settings_from_pipeline_config() {
if [[ "${_has_umi}" == "true" ]]; then
export UMI_FLAGS=" --with_umi --skip_umi_extract --umitools_umi_separator : "
fi

local -i _min_mapped_reads=$(jq --raw-output '.params."nf-core-rnaseq".min_mapped_reads' "${PIPELINE_CONFIG}" || echo "5")
export MIN_MAPPED_READS_ARG=" --min_mapped_reads ${_min_mapped_reads} "
}

function generate_samplesheet() {
Expand Down Expand Up @@ -545,6 +548,7 @@ function run_nextflow() {
--outdir ${JOB_PATH}/output/results \
${GENOME_ARGS} \
${UMI_FLAGS} \
${MIN_MAPPED_READS_ARG} \
--aligner star_salmon \
--pseudo_aligner salmon \
--save_reference \
Expand All @@ -567,6 +571,7 @@ function run_nextflow() {
--outdir ${JOB_PATH}/output/results \
${GENOME_ARGS} \
${UMI_FLAGS} \
${MIN_MAPPED_READS_ARG} \
--aligner star_salmon \
--pseudo_aligner salmon \
--save_reference \
Expand Down

0 comments on commit 9b5885a

Please sign in to comment.