-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
17 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,25 @@ | ||
import subprocess | ||
import pandas as pd | ||
import numpy as np | ||
import pytest | ||
import os | ||
|
||
# Define the command to run as a list | ||
command = ["nextflow","run","main.nf","-c","test/test.config","-profile","ci"] | ||
|
||
# Run the command and capture the output | ||
result = subprocess.run(command, capture_output=True, text=True) | ||
# Run command to generate results first | ||
@pytest.fixture(scope="module", autouse=True) | ||
def generate_results(command): | ||
result = subprocess.run(command, capture_output=True, text=True) | ||
return result | ||
|
||
# Check if the command was successful | ||
if result.returncode == 0: | ||
# Print the standard output from the command | ||
print("Command output:\n", result.stdout) | ||
else: | ||
# Print the error if the command failed | ||
print("Command failed with error:\n", result.stderr) | ||
def test_run_completed(generate_results): | ||
assert generate_results.returncode == 0 | ||
|
||
def test_ld_block_output(generate_results): | ||
ld_blocks = pd.read_csv("results/ld_blocks/snps_with_LD_blocks.csv") | ||
assert len(ld_blocks.RSID)==3, "Expected 3 SNPs in output LD blocks file." | ||
assert ld_blocks.columns == ['RSID','CHR','POS','LDblock_lower','LDblock_upper','LDblock_length','lower_bound','upper_bound'], "Column names do not match expected names in LD blocks file." | ||
|
||
def test_screeplot_exists(generate_results): | ||
assert os.path.exists("results/pca/ScreePlot.pdf"), "Expected output ScreePlot from pipeline run." |