Skip to content

Commit

Permalink
Rename package to macta-tools
Browse files Browse the repository at this point in the history
The new plan is to separate MACTA's functionality into a different
package. This is mainly for containerization - we can create a container
specifically for the functionality, then call it from the main scripts.
  • Loading branch information
AleksBekker committed Aug 4, 2023
1 parent a03e599 commit 9fe04e5
Show file tree
Hide file tree
Showing 30 changed files with 50 additions and 2,558 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
__pycache__
.pytest_cache
*.egg-info
Pipfile.lock

.coverage
.tox
Expand Down
6 changes: 3 additions & 3 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ name = "pypi"

[packages]
anndata = "==0.8.0"
celltypist = "==1.3.0"
# celltypist = "==1.3.0"
pandas = "==2.0.0"
pydantic = ">=2.0"
scanpy = "*"
scvi-tools = "*"
scarches = "*"
# scvi-tools = "*"
# scarches = "*"

[dev-packages]
flake8 = "*"
Expand Down
2,507 changes: 0 additions & 2,507 deletions Pipfile.lock

This file was deleted.

9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ The goal of this code is to assemble multiple python-based cell type annotation

```bash
git clone https://github.com/AleksBekker/MACTA_py
cd MACTA_py
# conda create -n macta_py python=3.7
pip install -e .
pipenv install -d
pipenv run pip install ".[EXTRAS_YOU_WILL_BE_USING]"
```

## Citations
Expand Down Expand Up @@ -59,7 +58,5 @@ pip install -e .
Please refer to the repo's dependency tree (github.com/AleksBekker/MACTA_py/network/dependencies)
for information on all other packages used, including:

- Autopep8
- Pandas


- Pydantic
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "macta"
name = "macta_tools"
version = "0.0.4"
authors = [{ name = "Aleksandr Bekker", email = "alekso.bekker@gmail.com" }]
description = "Annotation tools for the MACTA suite"
Expand Down Expand Up @@ -34,10 +34,10 @@ celltypist = ["celltypist>=1.3.0"]
scanvi = ["scvi-tools", "scarches"]

# Per-version extras
py38 = ["macta[celltypist]"]
py39 = ["macta[celltypist]"]
py310 = ["macta[celltypist]"]
torch38 = ["macta[scanvi]"]
py38 = ["macta_tools[celltypist]"]
py39 = ["macta_tools[celltypist]"]
py310 = ["macta_tools[celltypist]"]
torch38 = ["macta_tools[scanvi]"]

# Testing extras
testing = [
Expand All @@ -52,14 +52,14 @@ testing = [

[tool.setuptools.packages.find]
where = ["src"]
include = ["macta*"]
include = ["macta_tools*"]
namespaces = false

[tool.setuptools.package-data]
"pkgname" = ["py.typed"]

[tool.pytest.ini_options]
addopts = "--cov=macta"
addopts = "--cov=macta_tools"
testpaths = ["tests"]

[tool.mypy]
Expand Down
4 changes: 0 additions & 4 deletions src/macta/__init__.py

This file was deleted.

8 changes: 0 additions & 8 deletions src/macta/utils/requirements/__init__.py

This file was deleted.

5 changes: 5 additions & 0 deletions src/macta_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from macta_tools import tools, utils
from macta_tools._annotate import annotate
from macta_tools._cli import run_from_cli

__all__ = ['annotate', 'tools', 'utils', 'run_from_cli']
2 changes: 1 addition & 1 deletion src/macta/_annotate.py → src/macta_tools/_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pandas as pd
from anndata import AnnData

from macta.tools import AVAILABLE, CTAToolInterface
from macta_tools.tools import AVAILABLE, CTAToolInterface


def annotate(expr_data: AnnData, ref_data: Union[AnnData, pd.DataFrame], annot_type: str, result_type: str = 'labels',
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from contextlib import suppress
from typing import Dict

from macta.tools._cta_tool_interface import CTAToolInterface
from macta_tools.tools._cta_tool_interface import CTAToolInterface

AVAILABLE: Dict[str, CTAToolInterface] = {}
__all__ = ['AVAILABLE', 'CTAToolInterface']


with suppress(ImportError):
from macta.tools._celltypist_interface import CelltypistInterface
from macta_tools.tools._celltypist_interface import CelltypistInterface
__all__.append('CelltypistInterface')
AVAILABLE['celltypist'] = CelltypistInterface()

with suppress(ImportError):
from macta.tools._scanvi import ScanviInterface
from macta_tools.tools._scanvi import ScanviInterface
__all__.append('ScanviInterface')
AVAILABLE['scanvi'] = ScanviInterface()
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from celltypist import models
from celltypist.classifier import AnnotationResult

from macta.tools._cta_tool_interface import CTAToolInterface
from macta.utils.requirements import EqualityRequirement, RequirementList
from macta_tools.tools._cta_tool_interface import CTAToolInterface
from macta_tools.utils.requirements import EqualityRequirement, RequirementList

# Disable `celltypist`'s trivial output logs
logging.getLogger(celltypist.__name__).setLevel(logging.ERROR)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import pandas as pd

from macta.utils.requirements import RequirementList
from macta_tools.utils.requirements import RequirementList


class CTAToolInterface(ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import pandas as pd
from scanpy import AnnData

from macta.tools._cta_tool_interface import CTAToolInterface
from macta.utils.contexts import suppress_logging
from macta.utils.requirements import EqualityRequirement, NotNoneRequirement, RequirementList
from macta_tools.tools._cta_tool_interface import CTAToolInterface
from macta_tools.utils.contexts import suppress_logging
from macta_tools.utils.requirements import EqualityRequirement, NotNoneRequirement, RequirementList

# Suppress the output that comes with importing scArches
with suppress_logging():
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions src/macta_tools/utils/requirements/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from macta_tools.utils.requirements._contains_requirement import ContainsRequirement
from macta_tools.utils.requirements._equality_requirement import EqualityRequirement
from macta_tools.utils.requirements._is_instance_requirement import IsInstanceRequirement
from macta_tools.utils.requirements._not_none_requirement import NotNoneRequirement
from macta_tools.utils.requirements._requirement import Requirement
from macta_tools.utils.requirements._requirement_list import RequirementList

__all__ = ['Requirement', 'ContainsRequirement', 'IsInstanceRequirement', 'EqualityRequirement', 'RequirementList', 'NotNoneRequirement']
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import field_validator

from macta.utils.requirements._requirement import Requirement
from macta_tools.utils.requirements._requirement import Requirement


class ContainsRequirement(Requirement):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, cast

from macta.utils.requirements._requirement import Requirement
from macta_tools.utils.requirements._requirement import Requirement


class EqualityRequirement(Requirement):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import field_validator

from macta.utils.requirements._requirement import Requirement
from macta_tools.utils.requirements._requirement import Requirement


class IsInstanceRequirement(Requirement):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any, Optional

from macta.utils.requirements._requirement import Requirement
from macta_tools.utils.requirements._requirement import Requirement


class NotNoneRequirement(Requirement):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import pydantic
from pydantic import field_validator

from macta.utils.requirements._is_instance_requirement import IsInstanceRequirement
from macta.utils.requirements._requirement import Requirement
from macta_tools.utils.requirements._is_instance_requirement import IsInstanceRequirement
from macta_tools.utils.requirements._requirement import Requirement


# TODO: make this inherit from `dict` and use its methods to store data
Expand Down
2 changes: 1 addition & 1 deletion tests/tools/test_celltypist.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Skip this file if this module cannot be used with the current MACTA installation
try:
from macta.tools import CelltypistInterface
from macta_tools.tools import CelltypistInterface
except ImportError:
pytest.skip(allow_module_level=True, reason='Celltypist-compatible extra not installed.')

Expand Down
2 changes: 1 addition & 1 deletion tests/tools/test_scanvi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Skip this file if this module cannot be used with the current MACTA installation
try:
from macta.tools import ScanviInterface
from macta_tools.tools import ScanviInterface
except ImportError:
pytest.skip(allow_module_level=True, reason='SCANVI-compatible extra not installed.')

Expand Down
2 changes: 1 addition & 1 deletion tests/utils/requirements/test_contains_requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest

from macta.utils.requirements import ContainsRequirement
from macta_tools.utils.requirements import ContainsRequirement


@pytest.mark.parametrize('collection, obj', [
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/requirements/test_is_instance_requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from macta.utils.requirements import IsInstanceRequirement
from macta_tools.utils.requirements import IsInstanceRequirement


@pytest.mark.parametrize('obj_type, obj', [
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/requirements/test_requirement_list.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from macta.utils.requirements import EqualityRequirement, RequirementList
from macta_tools.utils.requirements import EqualityRequirement, RequirementList


def test_basic_rqlist() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/requirements/test_some_requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import pytest

from macta.utils.requirements import NotNoneRequirement
from macta_tools.utils.requirements import NotNoneRequirement


def test_not_none_requirement_catches_none() -> None:
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 4.0.0
envlist = py38, py39, py310, torch38, flake8, isort, mypy
envlist = py{38, 39, 310}, torch38, flake8, isort, mypy
skip_missing_interpreters=True
isolated_build = true

Expand Down

0 comments on commit 9fe04e5

Please sign in to comment.