Skip to content

Commit

Permalink
addess commenets
Browse files Browse the repository at this point in the history
  • Loading branch information
an-altosian committed Feb 11, 2025
1 parent a8fb237 commit ef240e2
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 37 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Update documents related to `simpleaf`, `alevin`, `salmon`, and `alevin-fry` for consistency.
- Rename the default aligner from `alevin` to `simpleaf` for consistency.
- Update the `mtx_to_h5ad` template for `simpleaf` to start from the h5ad file generated by simpleaf.
- Upgrade alevinqc from 1.12.1 to 1.18.0 to match the latest output file structure of simpleaf.

## v3.0.0 - 2024-12-09

Expand Down
2 changes: 1 addition & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ if(params.aligner == "cellrangerarc") {
}
}

if (params.aligner == "simpleaf" || params.aligner == "alevin") {
if ( params.aligner == "simpleaf" ) {
process {
withName: 'SIMPLEAF_INDEX' {
publishDir = [
Expand Down
64 changes: 37 additions & 27 deletions subworkflows/local/simpleaf.nf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ include { ALEVINQC } from '../../modules/local/alevinqc'
include { SIMPLEAF_INDEX } from '../../modules/nf-core/simpleaf/index'
include { SIMPLEAF_QUANT } from '../../modules/nf-core/simpleaf/quant'

workflow SCRNASEQ_SIMPLEAF {
workflow SIMPLEAF {

take:
ch_genome_fasta // channel
Expand All @@ -21,38 +21,48 @@ workflow SCRNASEQ_SIMPLEAF {
ch_versions = Channel.empty()

/*
* Build simpleaf index
* Build simpleaf index if needed
* If simpleaf_index is provided, we skip this step
* If map_dir is provided, we skip this step
* Otherwise, we build the index
*/
if ( !simpleaf_index || !map_dir ) {
// define input channels for index building
// we can either use a genome fasta and gtf file pair or a transcript fasta file
if ( transcript_fasta ) {
ch_genome_fasta_gtf = [ [:],[],[] ] // meta, genome fasta, genome gtf
ch_transcript_fasta = [ [id: "${transcript_fasta.getName()}"], transcript_fasta ] // meta, transcript fasta
} else {
ch_genome_fasta_gtf = ch_genome_fasta.combine( ch_genome_gtf ).map{ fasta, gtf -> [[id: "${fasta.getName()}"], fasta, gtf] }
ch_transcript_fasta = [ [:], [] ] // meta, transcript fasta
}
if ( !simpleaf_index ) {
if ( !map_dir ) {
// We do not have a simpleaf index or a map dir, so we need to build the index

// define input channels for index building
// we can either use a genome fasta and gtf file pair or a transcript fasta file
if ( transcript_fasta ) {
ch_genome_fasta_gtf = [ [:],[],[] ] // meta, genome fasta, genome gtf
ch_transcript_fasta = [ [id: "${transcript_fasta.getName()}"], transcript_fasta ] // meta, transcript fasta
} else {
ch_genome_fasta_gtf = ch_genome_fasta.combine( ch_genome_gtf ).map{ fasta, gtf -> [[id: "${fasta.getName()}"], fasta, gtf] }
ch_transcript_fasta = [ [:], [] ] // meta, transcript fasta
}

SIMPLEAF_INDEX(
ch_genome_fasta_gtf,
ch_transcript_fasta,
[[:], []], // meta, probe CSV
[[:], []] // meta, feature CSV
)
// Channel of tuple(meta, index dir)
simpleaf_index = SIMPLEAF_INDEX.out.index.collect()
// Channel of t2g path or empty
t2g = SIMPLEAF_INDEX.out.t2g.collect().map { _meta, it -> it }
ch_versions = ch_versions.mix( SIMPLEAF_INDEX.out.versions )
SIMPLEAF_INDEX(
ch_genome_fasta_gtf,
ch_transcript_fasta,
[[:], []], // meta, probe CSV
[[:], []] // meta, feature CSV
)
// Channel of tuple(meta, index dir)
simpleaf_index = SIMPLEAF_INDEX.out.index.collect()
// Channel of version
ch_versions = ch_versions.mix( SIMPLEAF_INDEX.out.versions )

// ensure txp2gene is a Channel
if (!txp2gene) {
txp2gene = t2g
// ensure txp2gene is a Channel
if (!txp2gene) {
txp2gene = SIMPLEAF_INDEX.out.t2g.collect().map { _meta, it -> it }
} else {
txp2gene = Channel.of( txp2gene )
}
} else {
txp2gene = Channel.of( txp2gene )
// we have a map dir, so we do not need to build the index
simpleaf_index = Channel.of( [ [:], [] ] )
}
} else {
// we have a simpleaf index, we use it directly
// ensure simpleaf index and txp2gene are Channels
simpleaf_index = Channel.of( [ [ id: simpleaf_index.getName() ], simpleaf_index ] )
}
Expand Down
17 changes: 8 additions & 9 deletions workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include { methodsDescriptionText } from '../subworkfl
include { getGenomeAttribute } from '../subworkflows/local/utils_nfcore_scrnaseq_pipeline'
include { FASTQC_CHECK } from '../subworkflows/local/fastqc'
include { KALLISTO_BUSTOOLS } from '../subworkflows/local/kallisto_bustools'
include { SCRNASEQ_SIMPLEAF } from '../subworkflows/local/simpleaf'
include { SIMPLEAF } from '../subworkflows/local/simpleaf'
include { STARSOLO } from '../subworkflows/local/starsolo'
include { CELLRANGER_ALIGN } from "../subworkflows/local/align_cellranger"
include { CELLRANGER_MULTI_ALIGN } from "../subworkflows/local/align_cellrangermulti"
Expand Down Expand Up @@ -134,9 +134,9 @@ workflow SCRNASEQ {
}

// Run simpleaf pipeline
if (params.aligner == "simpleaf" || params.aligner == "alevin") {
if ( params.aligner == "simpleaf" ) {

SCRNASEQ_SIMPLEAF(
SIMPLEAF(
ch_genome_fasta,
ch_filter_gtf,
ch_transcript_fasta,
Expand All @@ -148,10 +148,10 @@ workflow SCRNASEQ {
ch_fastq,
[] // for existing map dir; not applicable
)
ch_versions = ch_versions.mix(SCRNASEQ_SIMPLEAF.out.ch_versions)
ch_multiqc_files = ch_multiqc_files.mix(SCRNASEQ_SIMPLEAF.out.quant.map{ meta, it -> it })
ch_versions = ch_versions.mix(SIMPLEAF.out.ch_versions)
ch_multiqc_files = ch_multiqc_files.mix(SIMPLEAF.out.quant.map{ meta, it -> it })
ch_mtx_matrices = ch_mtx_matrices.mix(
SCRNASEQ_SIMPLEAF.out.quant.map{
SIMPLEAF.out.quant.map{
meta, files -> [
meta +
[input_type: meta["filtered"] ? "filtered" : "raw" ],
Expand All @@ -160,7 +160,7 @@ workflow SCRNASEQ {
}
)

ch_txp2gene = SCRNASEQ_SIMPLEAF.out.txp2gene
ch_txp2gene = SIMPLEAF.out.txp2gene
}

// Run STARSolo pipeline
Expand Down Expand Up @@ -299,11 +299,10 @@ workflow SCRNASEQ {
H5AD_REMOVEBACKGROUND_BARCODES_CELLBENDER_ANNDATA (
ch_h5ads
.filter { meta, mtx_files -> meta.input_type == 'raw' }
.map { meta, mtx_files -> [ meta + [input_type: 'filtered'], mtx_files ]} // to avoid name collision
.map { meta, mtx_files -> [ meta + [input_type: 'cellbender_filter'], mtx_files ]} // to avoid name collision
)
ch_h5ads = ch_h5ads.mix(
H5AD_REMOVEBACKGROUND_BARCODES_CELLBENDER_ANNDATA.out.h5ad
.map{ meta, file -> [ meta + [input_type: 'cellbender_filter'], file ]}
)
}

Expand Down

0 comments on commit ef240e2

Please sign in to comment.