Skip to content

Commit

Permalink
Improve code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
maltekuehl committed Sep 14, 2024
1 parent 17d0af7 commit 5091d65
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 1 deletion.
17 changes: 16 additions & 1 deletion pytximport/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,22 @@
def cli( # type: ignore
**kwargs,
) -> None:
"""Convert transcript-level expression to gene-level expression."""
"""Call the tximport function via the command line.
You can view the available options by running `pytximport --help`.
.. code-block:: bash
pytximport --help
For detailed information on pytximport's functionality, please refer to the README and online documentation.
Args:
**kwargs: The keyword arguments to pass to the tximport function.
Returns:
None
"""
# Add return_data to the kwargs with a default value of False
kwargs["return_data"] = False
kwargs["output_type"] = "anndata"
Expand Down
39 changes: 39 additions & 0 deletions test/test_anndata_replicates.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Test importing salmon quantification files."""

from pathlib import Path
from typing import List

import anndata as ad

from pytximport import tximport


def test_anndata_replicates(
fabry_disease_files: List[Path],
) -> None:
"""Test importing quantification files with inferential replicates with AnnData output.
Args:
fabry_disease_files (List[Path]): The paths to the quantification files.
"""
fabry_directory = fabry_disease_files[0].parent

result = tximport(
fabry_disease_files,
"salmon",
fabry_directory / "transcript_gene_mapping_human.tsv",
ignore_transcript_version=True,
ignore_after_bar=True,
output_type="anndata",
inferential_replicates=True,
inferential_replicate_variance=True,
inferential_replicate_transformer=None, # Do not recalculate counts but include the inferential replicates
)

assert isinstance(result, ad.AnnData), "The result is not an AnnData object."

# Check that variance is in the obsm
assert "variance" in result.obsm.keys()

# Check that inferential replicates is in the uns
assert "inferential_replicates" in result.uns.keys()

0 comments on commit 5091d65

Please sign in to comment.