10000 SL-93 refactor rmarts input checks · Pull Request #10 · nf-core/rnasplice · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

SL-93 refactor rmarts input checks #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
2 commits merged into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ params {

// Input data yeast rnaseq

input = 'https://raw.githubusercontent.com/zifornd/test-datasets/main/samplesheet/rnasplice/samplesheet.csv'
// input = 'https://raw.githubusercontent.com/zifornd/test-datasets/main/samplesheet/rnasplice/samplesheet.csv'

// Input data human single chr 22

Expand All @@ -31,13 +31,17 @@ params {

// input = 'https://raw.githubusercontent.com/zifornd/test-datasets/main/samplesheet/rnasplice/samplesheet_rmats.csv'

// Input data human chr X from hisat2 stringtie

input = 'https://raw.githubusercontent.com/zifornd/test-datasets/main/samplesheet/rnasplice/samplesheet_test.csv'

// Genome references yeast

fasta = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/genome.fasta'
gtf = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/genes.gtf.gz'
gff = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/genes.gff.gz'
transcript_fasta = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/transcriptome.fasta'
salmon_index = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/salmon.tar.gz'
// fasta = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/genome.fasta'
// gtf = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/genes.gtf.gz'
// gff = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/genes.gff.gz'
// transcript_fasta = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/transcriptome.fasta'
// salmon_index = 'https://github.com/nf-core/test-datasets/raw/rnaseq/reference/salmon.tar.gz'

// Genome references human chr 22

Expand All @@ -46,15 +50,11 @@ params {
// transcript_fasta = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/transcriptome.fasta'
// salmon_index = 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/homo_sapiens/genome/index/salmon'

// Genome references human full from igenomes
// Genome references human chr X from hisat2 stringtie

// fasta = 's3://ngi-igenomes/igenomes/Homo_sapiens/Ensembl/GRCh37/Sequence/WholeGenomeFasta/genome.fa'
// gtf = 's3://ngi-igenomes/igenomes/Homo_sapiens/Ensembl/GRCh37/Annotation/Genes/genes.gtf'
// star_index = 's3://ngi-igenomes/igenomes/Homo_sapiens/Ensembl/GRCh37/Sequence/STARIndex/'
// star_index_local = '../test-datasets-rnasplice/aws/references/Homo_sapiens/Ensembl/GRCh37/Sequence/STARIndex'
// transcript_fasta = '~/Documents/test-datasets-rnasplice/rsem/genome.transcripts.fa'
// salmon_index = '~/Documents/test-datasets-rnasplice/salmon.tar.gz'
fasta = 'https://raw.githubusercontent.com/zifornd/test-datasets/main/testdata/Pertea_2016/rnasplice/X.fa'
gtf = 'https://raw.githubusercontent.com/zifornd/test-datasets/main/testdata/Pertea_2016/rnasplice/genes_chrX.gtf'

pseudo_aligner = null
pseudo_aligner = null

}
48 changes: 48 additions & 0 deletions lib/WorkflowRnasplice.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -396,4 +396,52 @@ class WorkflowRnasplice {
"==================================================================================="
}

//
// Exit pipeline if rMATS requested with mixed single and paired end samples
//
private static void rmatsReadError(reads, log) {
reads
.map { meta, fastq -> meta.single_end }
.unique()
.collect()
.map {
if (it.size() > 1) {
log.error "Please check input samplesheet -> Cannot run rMats with mixed single and paired end samples."
System.exit(1)
}
}
}

//
// Exit pipeline if rMATS requested with mixed stranded samples
//
private static void rmatsStrandednessError(reads, log) {
reads
.map { meta, fastq -> meta.strandedness }
.unique()
.collect()
.map {
if (it.size() > 1) {
log.error "Please check input samplesheet -> Cannot run rMats with mixed stranded samples."
System.exit(1)
}
}
}

//
// Exit pipeline if rMATS requested with more than 2 conditions
//
private static void rmatsConditionError(reads, log) {
reads
.map { meta, fastq -> meta.condition }
.unique()
.collect()
.map {
if (it.size() > 2) {
log.error "Please check input samplesheet -> Cannot run rMats with more than 2 conditions."
System.exit(1)
}
}
}

}
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,4 @@ def check_max(obj, type) {
return obj
}
}
}
}
44 changes: 4 additions & 40 deletions workflows/rnasplice.nf
C3B4
Original file line number Diff line number Diff line change
Expand Up @@ -157,50 +157,14 @@ workflow RNASPLICE {
// Take software versions from input check (.first() not required)
ch_versions = ch_versions.mix(INPUT_CHECK.out.versions)

// Check rMATS input specifically
if (params.rmats) {

INPUT_CHECK
.out
.reads
.map { meta, fastq -> meta.single_end }
.unique()
.collect()
.map {
if(it.size() > 1) {
exit 1, "ERROR: Please check input samplesheet -> Cannot run rMats with mixed single and paired end samples"
} else {
return it
}
}

INPUT_CHECK
.out
.reads
.map { meta, fastq -> meta.strandedness }
.unique()
.collect()
.map {
if(it.size() > 1) {
exit 1, "ERROR: Please check input samplesheet -> Cannot run rMats with mixed stranded samples"
} else {
return it
}
}
WorkflowRnasplice.rmatsReadError(INPUT_CHECK.out.reads, log)

INPUT_CHECK
.out
.reads
.map { meta, fastq -> meta.condition }
.unique()
.collect()
.map {
if(it.size() > 2) {
exit 1, "ERROR: Please check input samplesheet -> Cannot run rMats with more than 2 conditions"
} else {
return it
}
}
WorkflowRnasplice.rmatsStrandednessError(INPUT_CHECK.out.reads, log)

WorkflowRnasplice.rmatsConditionError(INPUT_CHECK.out.reads, log)

}

Expand Down
0