Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Mar 13, 2024
2 parents ec19912 + ae5b28b commit fc47a34
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 84 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## v2.6.0dev - [date]

- [[#91](https://github.com/nf-core/scrnaseq/issues/91)] - Change from pytests to nf-test
- Change from pytests to nf-test ([#291](https://github.com/nf-core/scrnaseq/pull/291))
- Update template to v2.13.1 ([#309](https://github.com/nf-core/scrnaseq/pull/309))
- Update to kallisto|bustools v0.28.2 ([#294](https://github.com/nf-core/scrnaseq/pull/294))

## v2.5.1

Expand Down
34 changes: 0 additions & 34 deletions modules/local/gene_map.nf

This file was deleted.

10 changes: 5 additions & 5 deletions modules/local/mtx_to_h5ad.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ process MTX_TO_H5AD {
if (params.aligner == 'kallisto') {
mtx_matrix = "*count/counts_unfiltered/*.mtx"
barcodes_tsv = "*count/counts_unfiltered/*.barcodes.txt"
features_tsv = "*count/counts_unfiltered/*.genes.txt"
features_tsv = "*count/counts_unfiltered/*.genes.names.txt"
} else if (params.aligner == 'alevin') {
mtx_matrix = "*_alevin_results/af_quant/alevin/quants_mat.mtx"
barcodes_tsv = "*_alevin_results/af_quant/alevin/quants_mat_rows.txt"
Expand All @@ -54,13 +54,13 @@ process MTX_TO_H5AD {
else if (params.aligner == 'kallisto' && params.kb_workflow != 'standard')
"""
# convert file types
for input_type in spliced unspliced ; do
for input_type in nascent ambiguous mature ; do
mtx_to_h5ad.py \\
--aligner ${params.aligner} \\
--sample ${meta.id} \\
--input *count/counts_unfiltered/\${input_type}.mtx \\
--barcode *count/counts_unfiltered/\${input_type}.barcodes.txt \\
--feature *count/counts_unfiltered/\${input_type}.genes.txt \\
--input *count/counts_unfiltered/cells_x_genes.\${input_type}.mtx \\
--barcode $barcodes_tsv \\
--feature $features_tsv \\
--txp2gene ${txp2gene} \\
--star_index ${star_index} \\
--out ${meta.id}/${meta.id}_\${input_type}_matrix.h5ad ;
Expand Down
10 changes: 5 additions & 5 deletions modules/local/mtx_to_seurat.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ process MTX_TO_SEURAT {
} else if (params.aligner == "kallisto") {
matrix = "*count/counts_unfiltered/*.mtx"
barcodes = "*count/counts_unfiltered/*.barcodes.txt"
features = "*count/counts_unfiltered/*.genes.txt"
features = "*count/counts_unfiltered/*.genes.names.txt"
} else if (params.aligner == "alevin") {
matrix = "*_alevin_results/af_quant/alevin/quants_mat.mtx"
barcodes = "*_alevin_results/af_quant/alevin/quants_mat_rows.txt"
Expand All @@ -43,11 +43,11 @@ process MTX_TO_SEURAT {
if (params.aligner == 'kallisto' && params.kb_workflow != 'standard')
"""
# convert file types
for input_type in spliced unspliced ; do
for input_type in nascent ambiguous mature ; do
mtx_to_seurat.R \\
*count/counts_unfiltered/\${input_type}.mtx \\
*count/counts_unfiltered/\${input_type}.barcodes.txt \\
*count/counts_unfiltered/\${input_type}.genes.txt \\
*count/counts_unfiltered/cells_x_genes.\${input_type}.mtx \\
$barcodes \\
$features \\
${meta.id}/${meta.id}_\${input_type}_matrix.rds \\
${aligner}
done
Expand Down
7 changes: 4 additions & 3 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,18 @@ params {
// reference files
genome = null
transcript_fasta = null
txp2gene = null

// salmon alevin parameters (simpleaf)
simpleaf_rlen = 91
barcode_whitelist = null
txp2gene = null
salmon_index = null

// kallist bustools parameters
kallisto_gene_map = null
// kallisto bustools parameters
kallisto_index = null
kb_workflow = "standard"
kb_t1c = null
kb_t2c = null

// STARsolo parameters
star_index = null
Expand Down
29 changes: 19 additions & 10 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -214,26 +214,35 @@
"type": "object",
"description": "Params related to Kallisto/BUS tool",
"default": "",
"fa_icon": "fas fa-fish",
"fa_icon": "fas fa-rainbow",
"properties": {
"kallisto_gene_map": {
"type": "string",
"description": "Specify a Kallisto gene mapping file here. If you don't, this will be automatically created in the Kallisto workflow when specifying a valid `--gtf` file.",
"fa_icon": "fas fa-fish"
},
"kallisto_index": {
"type": "string",
"description": "Specify a path to the precomputed Kallisto index.",
"fa_icon": "fas fa-fish",
"fa_icon": "fas fa-rainbow",
"format": "file-path",
"exists": true
},
"kb_t1c": {
"type": "string",
"description": "Specify a path to the cDNA transcripts-to-capture.",
"fa_icon": "fas fa-rainbow",
"format": "file-path",
"exists": true
},
"kb_t2c": {
"type": "string",
"description": "Specify a path to the intron transcripts-to-capture.",
"fa_icon": "fas fa-rainbow",
"format": "file-path",
"exists": true
},
"kb_workflow": {
"type": "string",
"default": "standard",
"description": "Type of workflow. Use `lamanno` for RNA velocity based on La Manno et al. 2018 logic. Use `nucleus` for RNA velocity on single-nucleus RNA-seq reads. Use `kite` for feature barcoding. Use `kite: 10xFB` for 10x Genomics Feature Barcoding technology. (default: standard)",
"fa_icon": "fas fa-fish",
"enum": ["standard", "lamanno", "nucleus", "kite", "kite: 10xFB"]
"description": "Type of workflow. Use `nac` for an index type that can quantify nascent and mature RNA. Use `lamanno` for RNA velocity based on La Manno et al. 2018 logic. (default: standard)",
"fa_icon": "fas fa-rainbow",
"enum": ["standard", "lamanno", "nac"]
}
}
},
Expand Down
27 changes: 8 additions & 19 deletions subworkflows/local/kallisto_bustools.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* -- IMPORT LOCAL MODULES/SUBWORKFLOWS -- */
include { GENE_MAP } from '../../modules/local/gene_map'
include {KALLISTOBUSTOOLS_COUNT } from '../../modules/nf-core/kallistobustools/count/main'

/* -- IMPORT NF-CORE MODULES/SUBWORKFLOWS -- */
Expand All @@ -14,33 +13,22 @@ workflow KALLISTO_BUSTOOLS {
gtf
kallisto_index
txp2gene
t1c
t2c
protocol
kb_workflow
ch_fastq

main:
ch_versions = Channel.empty()

assert kallisto_index || (genome_fasta && gtf):
assert (txp2gene && kallisto_index) || (genome_fasta && gtf):
"Must provide a genome fasta file ('--fasta') and a gtf file ('--gtf') if no index is given!"

assert txp2gene || gtf:
"Must provide either a GTF file ('--gtf') or kallisto gene map ('--kallisto_gene_map') to align with kallisto bustools!"

/*
* Generate Kallisto Gene Map if not supplied and index is given
* If no index is given, the gene map will be generated in the 'kb ref' step
*/
if (!txp2gene && kallisto_index) {
GENE_MAP( gtf )
txp2gene = GENE_MAP.out.gene_map
ch_versions = ch_versions.mix(GENE_MAP.out.versions)
}

/*
* Generate kallisto index
* Generate kallisto index and t2g if not already present
*/
if (!kallisto_index) {
if (!(txp2gene && kallisto_index)) {
KALLISTOBUSTOOLS_REF( genome_fasta, gtf, kb_workflow )
txp2gene = KALLISTOBUSTOOLS_REF.out.t2g.collect()
kallisto_index = KALLISTOBUSTOOLS_REF.out.index.collect()
Expand All @@ -58,15 +46,16 @@ workflow KALLISTO_BUSTOOLS {
txp2gene,
t1c,
t2c,
protocol
protocol,
kb_workflow
)

ch_versions = ch_versions.mix(KALLISTOBUSTOOLS_COUNT.out.versions)

emit:
ch_versions
counts = KALLISTOBUSTOOLS_COUNT.out.count
txp2gene = txp2gene.collect()
txp2gene


}
21 changes: 21 additions & 0 deletions tests/.nf-test.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Feb-27 21:54:09.971 [main] INFO com.askimed.nf.test.App - nf-test 0.8.4
Feb-27 21:54:09.988 [main] INFO com.askimed.nf.test.App - Arguments: [test, tests/main_pipeline_kallisto.test, --update-snapshot]
Feb-27 21:54:10.670 [main] INFO com.askimed.nf.test.App - Nextflow Version: 23.10.1
Feb-27 21:54:10.674 [main] WARN com.askimed.nf.test.commands.RunTestsCommand - No nf-test config file found.
Feb-27 21:54:10.674 [main] INFO com.askimed.nf.test.commands.RunTestsCommand - Detected 1 test files.
Feb-27 21:54:10.676 [main] ERROR com.askimed.nf.test.commands.RunTestsCommand - Running tests failed.
java.lang.Exception: Test file '/home/ec2-user/scrnaseq/tests/tests/main_pipeline_kallisto.test' not found.
at com.askimed.nf.test.core.TestExecutionEngine.parse(TestExecutionEngine.java:116)
at com.askimed.nf.test.core.TestExecutionEngine.execute(TestExecutionEngine.java:159)
at com.askimed.nf.test.commands.RunTestsCommand.execute(RunTestsCommand.java:184)
at com.askimed.nf.test.commands.AbstractCommand.call(AbstractCommand.java:43)
at com.askimed.nf.test.commands.AbstractCommand.call(AbstractCommand.java:18)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at com.askimed.nf.test.App.run(App.java:44)
at com.askimed.nf.test.App.main(App.java:51)
14 changes: 7 additions & 7 deletions tests/main_pipeline_kallisto.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
"name": "workflow",
"success": true
},
"cells_x_genes.barcodes.txt:md5,18be561873e435d4587f6b3f95a0e301",
"cells_x_genes.barcodes.txt:md5,72d78bb1c1ee7cb174520b30f695aa48",
"cells_x_genes.genes.txt:md5,acd9d00120f52031974b2add3e7521b6",
"cells_x_genes.mtx:md5,37d2cd8c712f9c70463e87485bf6cd36",
"cells_x_genes.barcodes.txt:md5,488437e1f5477243697efb93366e5676",
"cells_x_genes.mtx:md5,894d60da192e3788de11fa8fc1fa711d",
"cells_x_genes.barcodes.txt:md5,a8cf7ea4b2d075296a94bf066a64b7a4",
"cells_x_genes.genes.txt:md5,acd9d00120f52031974b2add3e7521b6",
"cells_x_genes.mtx:md5,af90e05b404490f6cb133ab7f62949f8",
"Sample_X_matrix.rds:md5,f0e43f69403f4b2e7704065421592ad0",
"Sample_Y_matrix.rds:md5,61809156e64dbdaf254cbc1c3456588e"
"cells_x_genes.mtx:md5,abd83de117204d0a77df3c92d00cc025",
"Sample_X_matrix.rds:md5,0938f4189b7a7fd1030abfcee798741c",
"Sample_Y_matrix.rds:md5,93c12abe283ab37c5f37e5cd3cb25302"
],
"timestamp": "2024-01-23T12:19:47.921508953"
"timestamp": "2024-02-27T12:19:47.921508953"
}
}
8 changes: 8 additions & 0 deletions workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ workflow SCRNASEQ {
ch_barcode_whitelist = []
}

//kallisto params
ch_kallisto_index = params.kallisto_index ? file(params.kallisto_index) : []
kb_workflow = params.kb_workflow
kb_t1c = params.kb_t1c ? file(params.kb_t1c) : []
kb_t2c = params.kb_t2c ? file(params.kb_t2c) : []

// samplesheet - this is passed to the MTX conversion functions to add metadata to the
// AnnData objects.
ch_input = file(params.input)
Expand Down Expand Up @@ -83,6 +89,8 @@ workflow SCRNASEQ {
ch_filter_gtf,
ch_kallisto_index,
ch_txp2gene,
kb_t1c,
kb_t2c,
protocol_config['protocol'],
kb_workflow,
ch_fastq
Expand Down

0 comments on commit fc47a34

Please sign in to comment.