Skip to content

Commit

Permalink
fastp to cellranger
Browse files Browse the repository at this point in the history
  • Loading branch information
mapo9 committed May 7, 2024
1 parent 2f492b0 commit b092a25
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 3 deletions.
23 changes: 23 additions & 0 deletions modules/local/rename_fastq_cellranger.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Import generic module functions
process RENAME_FASTQ_CELLRANGER {
tag "$meta.id"
label 'process_low'

conda "conda-forge::python=3.8.0 conda-forge::biopython=1.74"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-adc9bb9edc31eb38b3c24786a83b7dfa530e2bea:47d6d7765d7537847ced7dac873190d164146022-0' :
'biocontainers/mulled-v2-adc9bb9edc31eb38b3c24786a83b7dfa530e2bea:47d6d7765d7537847ced7dac873190d164146022-0' }"

input:
tuple val(meta), path(R1), path(R2)
tuple val(meta_2), path(orig_r1), path(orig_r2)

output:
tuple val(meta), path('*R1_001.fastq.gz'), path('*R2_001.fastq.gz') , emit: reads

script:
"""
mv ${R1} fastp_${orig_r1}
mv ${R2} fastp_${orig_r2}
"""
}
29 changes: 28 additions & 1 deletion subworkflows/local/sc_raw_input.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ include { UNZIP_CELLRANGERDB } from '
include { RENAME_FILE as RENAME_FILE_TSV } from '../../modules/local/rename_file'
include { CHANGEO_CONVERTDB_FASTA as CHANGEO_CONVERTDB_FASTA_FROM_AIRR } from '../../modules/local/changeo/changeo_convertdb_fasta'
include { FASTQ_INPUT_CHECK } from '../../subworkflows/local/fastq_input_check'
include { FASTP } from '../../modules/nf-core/fastp/main'
include { RENAME_FASTQ_CELLRANGER } from '../../modules/local/rename_fastq_cellranger'



workflow SC_RAW_INPUT {
Expand Down Expand Up @@ -51,9 +54,30 @@ workflow SC_RAW_INPUT {
error "The single-cell 10X genomics library generation method requires you to provide a reference file."
}

// Fastp
save_merged = false
FASTP (
ch_reads,
[],
[],
save_merged
)
ch_versions = ch_versions.mix(FASTP.out.versions)

ch_rename_fastp = FASTP.out.reads.map{ meta,reads -> [meta, reads[0], reads[1]] }
ch_rename_original = ch_reads.map{ meta,reads -> [meta, reads[0], reads[1]] }

// rename fastq files to follow cellranger standards again
RENAME_FASTQ_CELLRANGER(
ch_rename_fastp,
ch_rename_original
)

ch_reads_fastp = RENAME_FASTQ_CELLRANGER.out.reads.map{ meta, read1, read2 -> [meta, [read1, read2]] }

// run cellranger vdj
CELLRANGER_VDJ (
ch_reads,
ch_reads_fastp,
ch_sc_reference.collect()
)
ch_versions = ch_versions.mix(CELLRANGER_VDJ.out.versions)
Expand Down Expand Up @@ -89,6 +113,9 @@ workflow SC_RAW_INPUT {

emit:
versions = ch_versions
// fastp
fastp_reads_json = FASTP.out.json.collect{ meta,json -> json }
fastp_reads_html = FASTP.out.html.collect{ meta,html -> html }
// complete cellranger output
outs = ch_cellranger_out
// cellranger output in airr format
Expand Down
4 changes: 2 additions & 2 deletions workflows/airrflow.nf
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ workflow AIRRFLOW {
ch_presto_assemblepairs_logs = Channel.empty()
ch_presto_collapseseq_logs = Channel.empty()
ch_presto_splitseq_logs = Channel.empty()
ch_fastp_html = Channel.empty()
ch_fastp_json = Channel.empty()
ch_fastp_html = SC_RAW_INPUT.out.fastp_reads_html
ch_fastp_json = SC_RAW_INPUT.out.fastp_reads_json
ch_fastqc_postassembly_mqc = Channel.empty()
} else {
// Perform sequence assembly if input type is fastq from bulk sequencing data
Expand Down

0 comments on commit b092a25

Please sign in to comment.