Repository: taxprofiler/taxpasta

Issue:
[BUG] Metaphlan4 run error in Microba datasets
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Problem description

I try to run this command in other to get the taxpasta file
```
taxpasta standardize -p metaphlan -o <wkdir>/Microba_session1-nomerge/metaphlan/metaphlan4-db/ani100_cLOW_stTrue_r5_pe_null_metaphlan4-db.metaphlan_profile.txt.taxpasta.tsv --add-lineage                     --taxonomy /home/ktest/pipeline_env/database/NCBI_taxdump-230711/taxdump/   <wkdir>/Microba_session1-nomerge/metaphlan/metaphlan4-db/ani100_cLOW_stTrue_r5_pe_null_metaphlan4-db.metaphlan_profile.txt
```
It present the error:
![image](https://github.com/taxprofiler/taxpasta/assets/52932655/fad34eac-5a51-4366-87d3-15cb3313d75f)


### Code sample

Code run:

```python
```

Traceback:

```text
```


### Environment

<details>
### Package Information

| Package  | Version |
|:---------|--------:|
| taxpasta |   0.6.1 |

### Dependency Information

|           Package            |   Version   |
|:-----------------------------|------------:|
| bash-kernel                  | **missing** |
| biom-format                  |      2.1.15 |
| depinfo~                     | **missing** |
| jupyter                      | **missing** |
| mkdocs-awesome-pages-plugin~ | **missing** |
| mkdocs-exclude~              | **missing** |
| mkdocs-material~             | **missing** |
| mkdocstrings[python]~        | **missing** |
| numpy~                       | **missing** |
| odfpy                        | **missing** |
| openpyxl                     | **missing** |
| pandas~                      | **missing** |
| pandera~                     | **missing** |
| pre-commit                   | **missing** |
| pyarrow                      |      14.0.2 |
| rich                         |      13.7.0 |
| tabulate~                    | **missing** |
| taxopy~                      | **missing** |
| tox~                         | **missing** |
| typer~                       | **missing** |

### Build Tools Information

|  Package   | Version |
|:-----------|--------:|
| pip        |  23.3.2 |
| setuptools |  69.0.3 |
| wheel      |  0.42.0 |

### Platform Information

|         |                          |
|:--------|-------------------------:|
| Linux   | 5.15.0-91-generic-x86_64 |
| CPython |                   3.12.1 |

</details>


### Anything else?

Error dataframe;
![image](https://github.com/taxprofiler/taxpasta/assets/52932655/b3c16eeb-b4f6-4508-8d92-3b79511e034d)



Discussion:
codecov-commenter: ## [Codecov](https://app.codecov.io/gh/taxprofiler/taxpasta/pull/147?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 89.40%. Comparing base [(`b34a5a4`)](https://app.codecov.io/gh/taxprofiler/taxpasta/commit/b34a5a4d88fbc53cede33269e527234d521ca6bf?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) to head [(`437e6cd`)](https://app.codecov.io/gh/taxprofiler/taxpasta/pull/147?dropdown=coverage&src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).

> :exclamation: Current head 437e6cd differs from pull request most recent head 598ff0f. Consider uploading reports for the commit 598ff0f to get more accurate results


:exclamation: Your organization needs to install the [Codecov GitHub app](https://github.com/apps/codecov/installations/select_target) to enable full functionality.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##              dev     #147      +/-   ##
==========================================
+ Coverage   89.28%   89.40%   +0.12%     
==========================================
  Files         114      114              
  Lines        1764     1784      +20     
  Branches      303      130     -173     
==========================================
+ Hits         1575     1595      +20     
  Misses        158      158              
  Partials       31       31              
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/taxprofiler/taxpasta/pull/147?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).

Midnighter: > My only question is: is the warning message the same as the error message? I don't see a new text of the warning if it is meant to be different.

For now, the warning is just like the error message. We could capture it and turn it into something more descriptive in future. Let's test how this goes first in general.

Patch:
diff --git a/src/taxpasta/infrastructure/application/bracken/bracken_profile.py b/src/taxpasta/infrastructure/application/bracken/bracken_profile.py
index c15a49d..9a87282 100644
--- a/src/taxpasta/infrastructure/application/bracken/bracken_profile.py
+++ b/src/taxpasta/infrastructure/application/bracken/bracken_profile.py
@@ -26,6 +26,10 @@ from pandera.typing import DataFrame, Series
 from taxpasta.infrastructure.helpers import BaseDataFrameModel
 
 
+BRACKEN_FRACTION_TOTAL = 1.0
+BRACKEN_FRACTION_TOLERANCE = 0.01
+
+
 class BrackenProfile(BaseDataFrameModel):
     """Define the expected Bracken profile format."""
 
@@ -37,12 +41,16 @@ class BrackenProfile(BaseDataFrameModel):
     new_est_reads: Series[int] = pa.Field(ge=0)
     fraction_total_reads: Series[float] = pa.Field(ge=0.0, le=1.0)
 
-    @pa.check("fraction_total_reads", name="compositionality")
+    @pa.check("fraction_total_reads", name="compositionality", raise_warning=True)
     def check_compositionality(cls, fraction_total_reads: Series[float]) -> bool:
         """Check that the fractions of reads add up to one."""
         # Bracken reports fractions with five decimals but rounding errors accumulate.
         return fraction_total_reads.empty or bool(
-            np.isclose(fraction_total_reads.sum(), 1.0, atol=0.02)
+            np.isclose(
+                fraction_total_reads.sum(),
+                BRACKEN_FRACTION_TOTAL,
+                atol=BRACKEN_FRACTION_TOLERANCE,
+            )
         )
 
     @pa.dataframe_check
diff --git a/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile.py b/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile.py
index 1c55c6f..d6360ca 100644
--- a/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile.py
+++ b/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile.py
@@ -26,6 +26,10 @@ from pandera.typing import Series
 from taxpasta.infrastructure.helpers import BaseDataFrameModel
 
 
+CENTRIFUGE_PERCENT_TOTAL = 100.0
+CENTRIFUGE_PERCENT_TOLERANCE = 1.0
+
+
 class CentrifugeProfile(BaseDataFrameModel):
     """Define the expected centrifuge profile format."""
 
@@ -36,7 +40,13 @@ class CentrifugeProfile(BaseDataFrameModel):
     taxonomy_id: Series[int] = pa.Field(ge=0)
     name: Series[str] = pa.Field()
 
-    @pa.check("percent", name="compositionality")
+    @pa.check("percent", name="compositionality", raise_warning=True)
     def check_compositionality(cls, percent: Series[float]) -> bool:
         """Check that the percent of 'unclassified' and 'root' add up to a hundred."""
-        return percent.empty or bool(np.isclose(percent[:2].sum(), 100.0, atol=1.0))
+        return percent.empty or bool(
+            np.isclose(
+                percent[:2].sum(),
+                CENTRIFUGE_PERCENT_TOTAL,
+                atol=CENTRIFUGE_PERCENT_TOLERANCE,
+            )
+        )
diff --git a/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile_reader.py b/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile_reader.py
index 50e37ce..5c14e9f 100644
--- a/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile_reader.py
+++ b/src/taxpasta/infrastructure/application/centrifuge/centrifuge_profile_reader.py
@@ -51,14 +51,14 @@ class CentrifugeProfileReader(ProfileReader):
             header=None,
             index_col=False,
             skipinitialspace=True,
-            names=[
-                CentrifugeProfile.percent,
-                CentrifugeProfile.clade_assigned_reads,
-                CentrifugeProfile.direct_assigned_reads,
-                CentrifugeProfile.taxonomy_level,
-                CentrifugeProfile.taxonomy_id,
-                CentrifugeProfile.name,
-            ],
         )
         cls._check_num_columns(result, CentrifugeProfile)
+        result.columns = [
+            CentrifugeProfile.percent,
+            CentrifugeProfile.clade_assigned_reads,
+            CentrifugeProfile.direct_assigned_reads,
+            CentrifugeProfile.taxonomy_level,
+            CentrifugeProfile.taxonomy_id,
+            CentrifugeProfile.name,
+        ]
         return result
diff --git a/src/taxpasta/infrastructure/application/diamond/diamond_profile_reader.py b/src/taxpasta/infrastructure/application/diamond/diamond_profile_reader.py
index 41eac27..844b9fc 100644
--- a/src/taxpasta/infrastructure/application/diamond/diamond_profile_reader.py
+++ b/src/taxpasta/infrastructure/application/diamond/diamond_profile_reader.py
@@ -39,12 +39,12 @@ class DiamondProfileReader(ProfileReader):
             sep="\t",
             header=None,
             index_col=False,
-            names=[
-                DiamondProfile.query_id,
-                DiamondProfile.taxonomy_id,
-                DiamondProfile.e_value,
-            ],
-            dtype={DiamondProfile.e_value: float},
+            dtype={2: float},
         )
         cls._check_num_columns(result, DiamondProfile)
+        result.columns = [
+            DiamondProfile.query_id,
+            DiamondProfile.taxonomy_id,
+            DiamondProfile.e_value,
+        ]
         return result
diff --git a/src/taxpasta/infrastructure/application/ganon/ganon_profile.py b/src/taxpasta/infrastructure/application/ganon/ganon_profile.py
index a425fa1..fb44f17 100644
--- a/src/taxpasta/infrastructure/application/ganon/ganon_profile.py
+++ b/src/taxpasta/infrastructure/application/ganon/ganon_profile.py
@@ -27,6 +27,10 @@ from pandera.typing import Series
 from taxpasta.infrastructure.helpers import BaseDataFrameModel
 
 
+GANON_PERCENT_TOTAL = 100.0
+GANON_PERCENT_TOLERANCE = 1.0
+
+
 class GanonProfile(BaseDataFrameModel):
     """Define the expected ganon profile format."""
 
@@ -40,7 +44,7 @@ class GanonProfile(BaseDataFrameModel):
     number_cumulative: Series[int] = pa.Field(ge=0)
     percent_cumulative: Series[float] = pa.Field(ge=0.0, le=100.0)
 
-    @pa.dataframe_check
+    @pa.dataframe_check(name="compositionality", raise_warning=True)
     def check_compositionality(cls, profile: pd.DataFrame) -> bool:
         """Check that the percent of 'unclassified' and 'root' add up to a hundred."""
         # Ganon reports percentage to 5 decimal places, but rounding errors do add up.
@@ -50,7 +54,7 @@ class GanonProfile(BaseDataFrameModel):
                     profile[cls.rank].isin(["unclassified", "root"]),
                     cls.percent_cumulative,
                 ].sum(),
-                100.0,
-                atol=0.1,
+                GANON_PERCENT_TOTAL,
+                atol=GANON_PERCENT_TOLERANCE,
             )
         )
diff --git a/src/taxpasta/infrastructure/application/ganon/ganon_profile_reader.py b/src/taxpasta/infrastructure/application/ganon/ganon_profile_reader.py
index bc27641..295e77c 100644
--- a/src/taxpasta/infrastructure/application/ganon/ganon_profile_reader.py
+++ b/src/taxpasta/infrastructure/application/ganon/ganon_profile_reader.py
@@ -51,17 +51,17 @@ class GanonProfileReader(ProfileReader):
             header=None,
             index_col=False,
             skipinitialspace=True,
-            names=[
-                GanonProfile.rank,
-                GanonProfile.target,
-                GanonProfile.lineage,
-                GanonProfile.name,
-                GanonProfile.number_unique,
-                GanonProfile.number_shared,
-                GanonProfile.number_children,
-                GanonProfile.number_cumulative,
-                GanonProfile.percent_cumulative,
-            ],
         )
         cls._check_num_columns(result, GanonProfile)
+        result.columns = [
+            GanonProfile.rank,
+            GanonProfile.target,
+            GanonProfile.lineage,
+            GanonProfile.name,
+            GanonProfile.number_unique,
+            GanonProfile.number_shared,
+            GanonProfile.number_children,
+            GanonProfile.number_cumulative,
+            GanonProfile.percent_cumulative,
+        ]
         return result
diff --git a/src/taxpasta/infrastructure/application/kaiju/kaiju_profile.py b/src/taxpasta/infrastructure/application/kaiju/kaiju_profile.py
index 8326636..b097273 100644
--- a/src/taxpasta/infrastructure/application/kaiju/kaiju_profile.py
+++ b/src/taxpasta/infrastructure/application/kaiju/kaiju_profile.py
@@ -27,6 +27,10 @@ from pandera.typing import Series
 from taxpasta.infrastructure.helpers import BaseDataFrameModel
 
 
+KAIJU_PERCENT_TOTAL = 100.0
+KAIJU_PERCENT_TOLERANCE = 1.0
+
+
 class KaijuProfile(BaseDataFrameModel):
     """Define the expected kaiju profile format."""
 
@@ -36,11 +40,13 @@ class KaijuProfile(BaseDataFrameModel):
     taxon_id: Series[pd.Int64Dtype] = pa.Field(nullable=True)
     taxon_name: Series[str] = pa.Field()
 
-    @pa.check("percent", name="compositionality")
+    @pa.check("percent", name="compositionality", raise_warning=True)
     def check_compositionality(cls, percent: Series[float]) -> bool:
         """Check that the percentages add up to a hundred."""
         # Kaiju reports percentages with sixth decimals
-        return percent.empty or bool(np.isclose(percent.sum(), 100.0, atol=1.0))
+        return percent.empty or bool(
+            np.isclose(percent.sum(), KAIJU_PERCENT_TOTAL, atol=KAIJU_PERCENT_TOLERANCE)
+        )
 
     @pa.check("file", name="unique_filename")
     def check_unique_filename(cls, file_col: Series[str]) -> bool:
diff --git a/src/taxpasta/infrastructure/application/kmcp/kmcp_profile.py b/src/taxpasta/infrastructure/application/kmcp/kmcp_profile.py
index 5e105ee..9fa09aa 100644
--- a/src/taxpasta/infrastructure/application/kmcp/kmcp_profile.py
+++ b/src/taxpasta/infrastructure/application/kmcp/kmcp_profile.py
@@ -26,6 +26,10 @@ from pandera.typing import Series
 from taxpasta.infrastructure.helpers import BaseDataFrameModel
 
 
+KMCP_PERCENT_TOTAL = 100.0
+KMCP_PERCENT_TOLERANCE = 1.0
+
+
 class KMCPProfile(BaseDataFrameModel):
     """Define the expected KMCP profile format."""
 
@@ -49,8 +53,12 @@ class KMCPProfile(BaseDataFrameModel):
     taxonomic_path: Series[str] = pa.Field(nullable=True, alias="taxpath")
     taxonomic_path_lineage: Series[str] = pa.Field(nullable=True, alias="taxpathsn")
 
-    @pa.check("percentage", name="compositionality")
+    @pa.check("percentage", name="compositionality", raise_warning=True)
     def check_compositionality(cls, percentage: Series[float]) -> bool:
         """Check that the percentages add up to a hundred."""
         # KMCP profile reports percentages with sixth decimals
-        return percentage.empty or bool(np.isclose(percentage.sum(), 100.0, atol=1.0))
+        return percentage.empty or bool(
+            np.isclose(
+                percentage.sum(), KMCP_PERCENT_TOTAL, atol=KMCP_PERCENT_TOLERANCE
+            )
+        )
diff --git a/src/taxpasta/infrastructure/application/kraken2/kraken2_profile.py b/src/taxpasta/infrastructure/application/kraken2/kraken2_profile.py
index 33d656e..837ae5b 100644
--- a/src/taxpasta/infrastructure/application/kraken2/kraken2_profile.py
+++ b/src/taxpasta/infrastructure/application/kraken2/kraken2_profile.py
@@ -29,6 +29,10 @@ from pandera.typing import Series
 from taxpasta.infrastructure.helpers import BaseDataFrameModel
 
 
+KRAKEN2_PERCENT_TOTAL = 100.0
+KRAKEN2_PERCENT_TOLERANCE = 1.0
+
+
 class Kraken2Profile(BaseDataFrameModel):
     """Define the expected kraken2 profile format."""
 
@@ -41,7 +45,7 @@ class Kraken2Profile(BaseDataFrameModel):
     taxonomy_id: Series[int] = pa.Field(ge=0)
     name: Series[str] = pa.Field()
 
-    @pa.dataframe_check
+    @pa.dataframe_check(name="compositionality", raise_warning=True)
     def check_compositionality(cls, profile: pd.DataFrame) -> bool:
         """Check that the percent of 'unclassified' and 'root' add up to a hundred."""
         # Kraken2 reports percentages only to the second decimal, so we expect
@@ -52,7 +56,7 @@ class Kraken2Profile(BaseDataFrameModel):
                 profile.loc[
                     profile[cls.taxonomy_lvl].isin(["U", "R"]), cls.percent
                 ].sum(),
-                100.0,
-                atol=1.0,
+                KRAKEN2_PERCENT_TOTAL,
+                atol=KRAKEN2_PERCENT_TOLERANCE,
             )
         )
diff --git a/src/taxpasta/infrastructure/application/megan6/megan6_profile_reader.py b/src/taxpasta/infrastructure/application/megan6/megan6_profile_reader.py
index ec887a3..41eb977 100644
--- a/src/taxpasta/infrastructure/application/megan6/megan6_profile_reader.py
+++ b/src/taxpasta/infrastructure/application/megan6/megan6_profile_reader.py
@@ -38,8 +38,9 @@ class Megan6ProfileReader(ProfileReader):
         result = pd.read_table(
             filepath_or_buffer=profile,
             sep="\t",
-            names=[Megan6Profile.taxonomy_id, Megan6Profile.count],
             index_col=False,
+            header=None,
         )
         cls._check_num_columns(result, Megan6Profile)
+        result.columns = [Megan6Profile.taxonomy_id, Megan6Profile.count]
         return result
diff --git a/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile.py b/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile.py
index 3eb920d..afbee11 100644
--- a/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile.py
+++ b/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile.py
@@ -29,6 +29,10 @@ from pandera.typing import Series
 from taxpasta.infrastructure.helpers import BaseDataFrameModel
 
 
+METAPHLAN_PERCENT_TOTAL = 100.0
+METAPHLAN_PERCENT_TOLERANCE = 1.0
+
+
 class MetaphlanProfile(BaseDataFrameModel):
     """Define the expected metaphlan profile format."""
 
@@ -38,7 +42,7 @@ class MetaphlanProfile(BaseDataFrameModel):
     relative_abundance: Series[float] = pa.Field(ge=0.0, le=100.0)
     additional_species: Optional[Series[str]] = pa.Field(nullable=True)
 
-    @pa.dataframe_check
+    @pa.dataframe_check(name="compositionality", raise_warning=True)
     def check_compositionality(cls, profile: pd.DataFrame) -> bool:
         """Check that the percentages per rank add up to a hundred."""
         # Parse the rank from the given lineage.
@@ -46,7 +50,7 @@ class MetaphlanProfile(BaseDataFrameModel):
         return profile.empty or bool(
             np.allclose(
                 profile.groupby(rank, sort=False)[cls.relative_abundance].sum(),
-                100.0,
-                atol=1.0,
+                METAPHLAN_PERCENT_TOTAL,
+                atol=METAPHLAN_PERCENT_TOLERANCE,
             )
         )
diff --git a/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile_reader.py b/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile_reader.py
index d9c955f..04ec732 100644
--- a/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile_reader.py
+++ b/src/taxpasta/infrastructure/application/metaphlan/metaphlan_profile_reader.py
@@ -46,15 +46,15 @@ class MetaphlanProfileReader(ProfileReader):
             skiprows=num_header_lines,
             header=None,
             index_col=False,
-            names=[
-                MetaphlanProfile.clade_name,
-                MetaphlanProfile.ncbi_tax_id,
-                MetaphlanProfile.relative_abundance,
-                MetaphlanProfile.additional_species,
-            ],
-            dtype={MetaphlanProfile.ncbi_tax_id: str},
+            dtype={1: str},
         )
         cls._check_num_columns(result, MetaphlanProfile)
+        result.columns = [
+            MetaphlanProfile.clade_name,
+            MetaphlanProfile.ncbi_tax_id,
+            MetaphlanProfile.relative_abundance,
+            MetaphlanProfile.additional_species,
+        ]
         return result
 
     @classmethod
diff --git a/src/taxpasta/infrastructure/application/motus/motus_profile_reader.py b/src/taxpasta/infrastructure/application/motus/motus_profile_reader.py
index ab4771d..5776e27 100644
--- a/src/taxpasta/infrastructure/application/motus/motus_profile_reader.py
+++ b/src/taxpasta/infrastructure/application/motus/motus_profile_reader.py
@@ -40,13 +40,13 @@ class MotusProfileReader(ProfileReader):
             sep="\t",
             skiprows=3,
             header=None,
-            names=[
-                MotusProfile.consensus_taxonomy,
-                MotusProfile.ncbi_tax_id,
-                MotusProfile.read_count,
-            ],
             index_col=False,
-            dtype={MotusProfile.ncbi_tax_id: "Int64"},
+            dtype={1: "Int64"},
         )
         cls._check_num_columns(result, MotusProfile)
+        result.columns = [
+            MotusProfile.consensus_taxonomy,
+            MotusProfile.ncbi_tax_id,
+            MotusProfile.read_count,
+        ]
         return result


Test patch:
diff --git a/tests/integration/test_bracken_etl.py b/tests/integration/test_bracken_etl.py
index bff6e3a..47e85ac 100644
--- a/tests/integration/test_bracken_etl.py
+++ b/tests/integration/test_bracken_etl.py
@@ -71,6 +71,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path:
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_bracken_etl(
     bracken_data_dir: Path,
     filename: str,
diff --git a/tests/integration/test_diamond_etl.py b/tests/integration/test_diamond_etl.py
index f28db5f..cc3bef2 100644
--- a/tests/integration/test_diamond_etl.py
+++ b/tests/integration/test_diamond_etl.py
@@ -22,6 +22,7 @@
 from pathlib import Path
 
 import pytest
+from pandas.errors import ParserError
 from pandera.errors import SchemaErrors
 
 from taxpasta.application.error import StandardisationError
@@ -60,11 +61,11 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path:
         "diamond_valid_2.tsv",
         pytest.param(
             "diamond_invalid_1.tsv",
-            marks=pytest.mark.raises(exception=SchemaErrors),
+            marks=pytest.mark.raises(exception=ParserError),
         ),
         pytest.param(
             "diamond_invalid_2.tsv",
-            marks=pytest.mark.raises(exception=SchemaErrors),
+            marks=pytest.mark.raises(exception=ParserError),
         ),
     ],
 )
diff --git a/tests/integration/test_ganon_etl.py b/tests/integration/test_ganon_etl.py
index 094a3ce..595a9da 100644
--- a/tests/integration/test_ganon_etl.py
+++ b/tests/integration/test_ganon_etl.py
@@ -59,7 +59,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path:
         "2612_pe_ERR5766176_db1.ganon.tre",
         pytest.param(
             "invalid_2612_pe_ERR5766176_db1.ganon_missing_column.tre",
-            marks=pytest.mark.raises(exception=SchemaErrors),
+            marks=pytest.mark.raises(exception=ValueError),
         ),
     ],
 )
diff --git a/tests/integration/test_kaiju_etl.py b/tests/integration/test_kaiju_etl.py
index d789657..caa6373 100644
--- a/tests/integration/test_kaiju_etl.py
+++ b/tests/integration/test_kaiju_etl.py
@@ -64,6 +64,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path:
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_kaiju_etl(
     kaiju_data_dir: Path,
     filename: str,
diff --git a/tests/integration/test_kraken2_etl.py b/tests/integration/test_kraken2_etl.py
index 8baf87e..b1bcb03 100644
--- a/tests/integration/test_kraken2_etl.py
+++ b/tests/integration/test_kraken2_etl.py
@@ -71,6 +71,7 @@ def other_profile(data_dir: Path, request: pytest.FixtureRequest) -> Path:
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_kraken2_etl(
     kraken2_data_dir: Path,
     filename: str,
diff --git a/tests/integration/test_metaphlan_etl.py b/tests/integration/test_metaphlan_etl.py
index 4cc9ff9..c74067e 100644
--- a/tests/integration/test_metaphlan_etl.py
+++ b/tests/integration/test_metaphlan_etl.py
@@ -86,6 +86,7 @@ def test_valid_profile_etl(
     )
 
 
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_invalid_profile_etl(
     invalid_metaphlan_profile: Path,
 ):
diff --git a/tests/unit/infrastructure/application/bracken/test_bracken_profile.py b/tests/unit/infrastructure/application/bracken/test_bracken_profile.py
index 599ccab..db7ee36 100644
--- a/tests/unit/infrastructure/application/bracken/test_bracken_profile.py
+++ b/tests/unit/infrastructure/application/bracken/test_bracken_profile.py
@@ -159,6 +159,7 @@ def test_column_presence(profile: pd.DataFrame):
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_fraction_total_reads(profile: pd.DataFrame):
     """Test that the fraction column is checked."""
     BrackenProfile.validate(profile)
diff --git a/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py b/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py
index 17d8286..aa118a4 100644
--- a/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py
+++ b/tests/unit/infrastructure/application/centrifuge/test_centrifuge_profile.py
@@ -135,6 +135,7 @@ def test_column_presence(profile: pd.DataFrame):
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_percent(profile: pd.DataFrame):
     """Test that the percent column is checked."""
     CentrifugeProfile.validate(profile)
diff --git a/tests/unit/infrastructure/application/ganon/test_ganon_profile.py b/tests/unit/infrastructure/application/ganon/test_ganon_profile.py
index 48b5031..1de3579 100644
--- a/tests/unit/infrastructure/application/ganon/test_ganon_profile.py
+++ b/tests/unit/infrastructure/application/ganon/test_ganon_profile.py
@@ -128,7 +128,7 @@ def test_column_presence(profile: pd.DataFrame):
                 )
             ),
             marks=pytest.mark.raises(
-                exception=SchemaError, message="check_compositionality"
+                exception=SchemaError, message="<Check compositionality>"
             ),
         ),
         pytest.param(
@@ -148,11 +148,12 @@ def test_column_presence(profile: pd.DataFrame):
                 )
             ),
             marks=pytest.mark.raises(
-                exception=SchemaError, message="check_compositionality"
+                exception=SchemaError, message="<Check compositionality>"
             ),
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_percent(profile: pd.DataFrame):
     """Test that the percent column (percent_cumulative) is checked."""
     GanonProfile.validate(profile)
diff --git a/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py b/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py
index 923764c..54f527d 100644
--- a/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py
+++ b/tests/unit/infrastructure/application/kaiju/test_kaiju_profile.py
@@ -143,6 +143,7 @@ def test_column_presence(profile: pd.DataFrame):
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_percent(profile: pd.DataFrame):
     """Test that the percent column is checked."""
     KaijuProfile.validate(profile)
diff --git a/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py b/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py
index b0635ad..eeda381 100644
--- a/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py
+++ b/tests/unit/infrastructure/application/kmcp/test_kmcp_profile.py
@@ -171,6 +171,7 @@ def test_column_presence(profile: pd.DataFrame):
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_percent(profile: pd.DataFrame):
     """Test that the percent column (percent_cumulative) is checked."""
     KMCPProfile.validate(profile)
diff --git a/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py b/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py
index 2202f63..4f2af02 100644
--- a/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py
+++ b/tests/unit/infrastructure/application/kraken2/test_kraken2_profile.py
@@ -164,6 +164,7 @@ def test_column_presence(profile: pd.DataFrame):
         ),
     ],
 )
+@pytest.mark.filterwarnings("error::UserWarning")
 def test_percent(profile: pd.DataFrame):
     """Test that the percent column is checked."""
     Kraken2Profile.validate(profile)