From 01195fc4d2434732b113c774514e94a5e8a3855b Mon Sep 17 00:00:00 2001 From: Amine Ghozlane Date: Mon, 2 Sep 2024 19:46:38 +0200 Subject: [PATCH] Fix strain and variantcalling testing --- meteor/tests/test_strain.py | 4 ---- meteor/tests/test_variantcalling.py | 16 ++++------------ 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/meteor/tests/test_strain.py b/meteor/tests/test_strain.py index 1bcece4..11411f1 100644 --- a/meteor/tests/test_strain.py +++ b/meteor/tests/test_strain.py @@ -49,11 +49,7 @@ def test_filter_coverage( strain_builder.meteor.ref_dir / "database" / "mock.bed", strain_builder.meteor.ref_dir / "fasta" / "mock.fasta.gz", ) - filtered_cov.to_csv("/pasteur/zeus/projets/p01/BioIT/amine/filtered.tsv", sep="\t") expected_output = pd.read_table(datadir / "expected_output" / "filtered_cov.tsv") - expected_output.to_csv( - "/pasteur/zeus/projets/p01/BioIT/amine/expected.tsv", sep="\t" - ) assert filtered_cov.reset_index(drop=True).equals(expected_output) diff --git a/meteor/tests/test_variantcalling.py b/meteor/tests/test_variantcalling.py index 1b7d75b..05dc3d4 100644 --- a/meteor/tests/test_variantcalling.py +++ b/meteor/tests/test_variantcalling.py @@ -18,9 +18,6 @@ import json from pysam import AlignmentFile, FastaFile import pandas as pd -import shutil - -# from subprocess import run from pandas.testing import assert_frame_equal from hashlib import md5 @@ -32,6 +29,7 @@ def fixture_vc_builder(datadir: Path, tmp_path: Path) -> VariantCalling: meteor.ref_name = "test" meteor.threads = 1 meteor.tmp_dir = tmp_path + meteor.DEFAULT_GAP_CHAR = "?" ref_json_file = datadir / "eva71" / "eva71_reference.json" ref_json = {} with ref_json_file.open("rt", encoding="UTF-8") as ref: @@ -103,7 +101,8 @@ def test_create_consensus( ) -> None: vc_builder.matrix_file = datadir / "eva71_bench" / "eva71_bench.tsv.xz" reference_file = datadir / "eva71" / "fasta" / "eva71.fasta.gz" - consensus_file = tmp_path / "consensus.fasta.xz" + # consensus_file = tmp_path / "consensus.fasta.xz" + consensus_file = Path("/pasteur/appa/homes/aghozlan/consensus2.fasta.xz") bed_file = datadir / "eva71" / "database" / "eva71.bed" vcf_file = datadir / "eva71_bench" / "eva71_bench.vcf.gz" low_cov_sites = pd.read_table( @@ -119,15 +118,8 @@ def test_create_consensus( bed_file, ) assert consensus_file.exists() - - # print(consensus_file) with consensus_file.open("rb") as consensus: - if md5(consensus.read()).hexdigest() == "916fe0018af1eebc59592a75c770570b": - output_path = "/pasteur/appa/homes/aghozlan/consensus1.fasta.xz" - else: - output_path = "/pasteur/appa/homes/aghozlan/consensus2.fasta.xz" - with open(output_path, "wb") as output: - shutil.copyfileobj(consensus, output) + assert md5(consensus.read()).hexdigest() == "916fe0018af1eebc59592a75c770570b" def test_execute(vc_builder: VariantCalling) -> None: