Skip to content
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

Add nf-tests for deseq2_qc local module #1241

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
87 changes: 87 additions & 0 deletions modules/local/deseq2_qc/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
nextflow_process {

name "Test Process DESEQ2_QC"
script "../main.nf"
process "DESEQ2_QC"

test("parse count data correctly") {

when {
process {
"""
// Taken from example salmon merged data from -profile test
def fileContents = [
'gene_id gene_name RAP1_IAA_30M_REP1 RAP1_UNINDUCED_REP1 RAP1_UNINDUCED_REP2 WT_REP1 WT_REP2',
'Gfp_transgene_gene Gfp_transgene_gene 0 0 0 0 0',
'HRA1 HRA1 3.01943228500291 9.80701185810843 9.53274413980081 5.72894534769954 5.9648842559222',
'snR18 snR18 2.15518528497702 20.2706605484032 10.1398196728994 5.78313737408605 5.79976683844901',
'YAL001C TFC3 56.5487189493641 70.7846010387686 113.108816589334 60.5178622417112 30.2958040068545',
'YAL002W VPS8 36.3862437592078 32.3965311942571 80.536128672497 63.6031126291227 25.2702744059695',
'YAL003W EFB1 598.396699649099 887.339579289614 1856.66699260635 1049.93553354283 665.403243069765',
'YAL004W YAL004W 388.410667489585 383.296795393227 203.744142706403 202.691892385957 251.440658667147',
'YAL005C SSA1 5647.27979655766 5715.94369645599 12575.108029018 7775.42737695585 3903.66710060582',
'YAL007C ERP2 44.6930487868818 60.9301400694571 143.68466075721 56.9486461946981 41.7805866183878',
'YAL008W FUN14 13.1986081960994 18.7996646072737 26.552459043029 9.4087625308538 2.82245410144267',
'YAL009W SPO7 13.5217762310537 15.8719804576371 20.113413795 8.67724034815225 4.82436501953514',
'YAL010C MDM10 10.9410758413598 12.0839661783069 36.2679562039924 29.7986383847897 9.94377960724503',
'YAL011W SWC3 12.0055027348268 24.9403272396788 35.9299792122994 19.9834911886444 18.0057148106317',
'YAL012W CYS3 242.877787996136 236.466395413312 547.58060621785 378.571834233094 226.984289418222',
'YAL013W DEP1 7.90662508175251 18.3153373366285 35.6289306191157 20.7248252538103 10.8672258295774',
'YAL014C SYN8 15.4361922388434 21.2042068878003 44.5485583043788 26.9652946879967 16.3840947562552',
'YAL015C NTG1 12.841137836752 12.2213888342821 28.5292052419374 7.89073247427083 5.92421903162791',
]
def countFile = file("${workDir}/countFile.tsv")
countFile.withWriter{ out ->
fileContents.each {out.println it}
}

def pcaHeaderFile = file("${workDir}/deseq2_pca_header.txt")
def pcaHeaderContents = '''
#id: 'deseq2_pca'
#section_name: 'DESeq2 PCA plot'
#description: "PCA plot between samples in the experiment.
# These values are calculated using <a href='https://bioconductor.org/packages/release/bioc/html/DESeq2.html'>DESeq2</a>
# in the <a href='https://github.com/nf-core/rnaseq/blob/master/bin/deseq2_qc.r'><code>deseq2_qc.r</code></a> script."
#plot_type: 'scatter'
#anchor: 'deseq2_pca'
#pconfig:
# title: 'DESeq2: Principal component plot'
# xlab: PC1
# ylab: PC2
'''.stripIndent().trim()
pcaHeaderFile.write(pcaHeaderContents)

def clusteringHeaderFile = file("${workDir}/deseq2_clustering_header.txt")
def clusteringHeaderContents = '''
#id: 'deseq2_clustering'
#section_name: 'DESeq2 sample similarity'
#description: "is generated from clustering by Euclidean distances between
# <a href='https://bioconductor.org/packages/release/bioc/html/DESeq2.html' target='_blank'>DESeq2</a>
# rlog values for each sample
# in the <a href='https://github.com/nf-core/rnaseq/blob/master/bin/deseq2_qc.r'><code>deseq2_qc.r</code></a> script."
#plot_type: 'heatmap'
#anchor: 'deseq2_clustering'
#pconfig:
# title: 'DESeq2: Heatmap of the sample-to-sample distances'
# xlab: True
# reverseColors: True
'''.stripIndent().trim()
clusteringHeaderFile.write(clusteringHeaderContents)

input[0] = countFile
input[1] = pcaHeaderFile
input[2] = clusteringHeaderFile
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
81 changes: 81 additions & 0 deletions modules/local/deseq2_qc/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"parse count data correctly": {
"content": [
{
"0": [
"deseq2.plots.pdf:md5,066dd6e447a41b6a361b9c9776013b17"
],
"1": [
"deseq2.dds.RData:md5,c7c1872e7566321d0c3f7ca56c463088"
],
"2": [
"deseq2.pca.vals.txt:md5,4cda8e32ec39326c1350e77b4b607aad"
],
"3": [

],
"4": [
"deseq2.sample.dists.txt:md5,1616ce40eb58ee75640efed219c6bbec"
],
"5": [

],
"6": [
"R_sessionInfo.log:md5,fb0da0d7ad6994ed66a8e68348b19676"
],
"7": [
[
"RAP1_IAA_30M_REP1.txt:md5,ce4ff0b74aeedc3dc12a764c3504c9df",
"RAP1_UNINDUCED_REP1.txt:md5,51c9b23be5e82670aceb14f7e58dd867",
"RAP1_UNINDUCED_REP2.txt:md5,2c56106abcd9d31980f672b6e2862ee8",
"WT_REP1.txt:md5,5e3fe5f7e9b7f300be43649a8b496352",
"WT_REP2.txt:md5,2ce093f2c2e92c1bde1cd3da91ac884c",
"deseq2.size_factors.RData:md5,51c6643a0f8a9edabbff8df0165451f2"
]
],
"8": [
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
],
"dists_multiqc": [

],
"dists_txt": [
"deseq2.sample.dists.txt:md5,1616ce40eb58ee75640efed219c6bbec"
],
"log": [
"R_sessionInfo.log:md5,fb0da0d7ad6994ed66a8e68348b19676"
],
"pca_multiqc": [

],
"pca_txt": [
"deseq2.pca.vals.txt:md5,4cda8e32ec39326c1350e77b4b607aad"
],
"pdf": [
"deseq2.plots.pdf:md5,066dd6e447a41b6a361b9c9776013b17"
],
"rdata": [
"deseq2.dds.RData:md5,c7c1872e7566321d0c3f7ca56c463088"
],
"size_factors": [
[
"RAP1_IAA_30M_REP1.txt:md5,ce4ff0b74aeedc3dc12a764c3504c9df",
"RAP1_UNINDUCED_REP1.txt:md5,51c9b23be5e82670aceb14f7e58dd867",
"RAP1_UNINDUCED_REP2.txt:md5,2c56106abcd9d31980f672b6e2862ee8",
"WT_REP1.txt:md5,5e3fe5f7e9b7f300be43649a8b496352",
"WT_REP2.txt:md5,2ce093f2c2e92c1bde1cd3da91ac884c",
"deseq2.size_factors.RData:md5,51c6643a0f8a9edabbff8df0165451f2"
]
],
"versions": [
"versions.yml:md5,60f8e4f473397a4b5d1a3dc490c93ec5"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-03-07T11:47:31.43621"
}
}
Loading