Skip to content

Commit

Permalink
Add test for hash-missing
Browse files Browse the repository at this point in the history
  • Loading branch information
kylacochrane committed Jun 17, 2024
1 parent 95c0f5c commit 0b2ba27
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/data/called/expected_results_missing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
id address level_1
sample1 1 1
sample2 1 1
sample3 2 2
sampleQ 1 1
4 changes: 4 additions & 0 deletions tests/data/clusters/expected_clusters_missing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id address level_1
sample1 1 1
sample2 1 1
sample3 2 2
5 changes: 5 additions & 0 deletions tests/data/distances/expected_dists_missing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
query_id ref_id dist
sampleQ sampleQ 0
sampleQ sample1 1
sampleQ sample2 1
sampleQ sample3 2
17 changes: 17 additions & 0 deletions tests/data/irida/missing_iridanext.output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"files": {
"global": [

],
"samples": {

}
},
"metadata": {
"samples": {
"sampleQ": {
"address": "1"
}
}
}
}
5 changes: 5 additions & 0 deletions tests/data/profiles/expected-profile_missing1.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sample_id l1 l2 l3
sampleQ 1 2 1
sample1 1 1 1
sample2 - 1 1
sample3 - 1 2
2 changes: 2 additions & 0 deletions tests/data/profiles/expected-profile_missing2.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sample_id l1 l2 l3
sampleQ 1 2 1
7 changes: 7 additions & 0 deletions tests/data/reports/sample2_missing.mlst.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sample2": {
"l1": "-",
"l2": "1",
"l3": "1"
}
}
7 changes: 7 additions & 0 deletions tests/data/reports/sample3_missing.mlst.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sample3": {
"l1": "-",
"l2": "1",
"l3": "2"
}
}
6 changes: 6 additions & 0 deletions tests/data/samplesheets/samplesheet-hash_missing.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
sample,mlst_alleles,address
sampleQ,https://raw.githubusercontent.com/phac-nml/gasnomenclature/dev/tests/data/reports/sampleQ.mlst.json,
sample1,https://raw.githubusercontent.com/phac-nml/gasnomenclature/dev/tests/data/reports/sample1.mlst.json,1
sample2,https://raw.githubusercontent.com/phac-nml/gasnomenclature/add_tests/tests/data/reports/sample2_missing.mlst.json,1
sample3,https://raw.githubusercontent.com/phac-nml/gasnomenclature/add_tests/tests/data/reports/sample3_missing.mlst.json,2

61 changes: 61 additions & 0 deletions tests/pipelines/main_missing_alleles.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
nextflow_pipeline {

name "Integration Tests for parameters dealing with missing or removed alleles"
script "main.nf"

test("Full pipeline hashes and missing data") {
tag "pipeline_hashes_missing"

when {
params {
input = "$baseDir/tests/data/samplesheets/samplesheet-hash_missing.csv"
outdir = "results"

gm_thresholds = "1"
}
}

then {
assert workflow.success
assert path("$launchDir/results").exists()

// Check merged profiles
def actual_profile_ref = path("$launchDir/results/locidex/merge/reference/merged_ref/merged_profiles_ref.tsv")
def expected_profile_tsv = path("$baseDir/tests/data/profiles/expected-profile_missing1.tsv")
assert actual_profile_ref.text == expected_profile_tsv.text

// Check query profiles
def actual_profile_query = path("$launchDir/results/locidex/merge/query/merged_value/merged_profiles_value.tsv")
def expected_profile_query_tsv = path("$baseDir/tests/data/profiles/expected-profile_missing2.tsv")
assert actual_profile_query.text == expected_profile_query_tsv.text

// Check computed pairwise distances
def actual_distances = path("$launchDir/results/distances/results.text")
def expected_distances = path("$baseDir/tests/data/distances/expected_dists_missing.txt")
assert actual_distances.text == expected_distances.text

// Verify cluster file
def actual_cluster = path("$launchDir/results/cluster/reference_clusters.txt")
def expected_cluster = path("$baseDir/tests/data/clusters/expected_clusters_missing.txt")
assert actual_cluster.text == expected_cluster.text

// Check called clusters
def actual_calls = path("$launchDir/results/call/Called/results.text")
def expected_calls = path("$baseDir/tests/data/called/expected_results_missing.txt")
assert actual_calls.text == expected_calls.text

// Check IRIDA Next JSON output
assert path("$launchDir/results/iridanext.output.json").json == path("$baseDir/tests/data/irida/missing_iridanext.output.json").json

def iridanext_json = path("$launchDir/results/iridanext.output.json").json
def iridanext_samples = iridanext_json.files.samples
def iridanext_metadata = iridanext_json.metadata.samples

assert iridanext_metadata.size() == 1 && iridanext_metadata.containsKey("sampleQ")
assert iridanext_metadata.sampleQ."address" == "1"
}
}


}

0 comments on commit 0b2ba27

Please sign in to comment.