diff --git a/.coveragerc b/.coveragerc index b088f0e..1464ce5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,7 +3,7 @@ branch = True omit = */tests* */__init__.py - q2_time/_version.py + q2_ritme/_version.py versioneer.py [report] @@ -11,5 +11,5 @@ fail_under = 90 omit = */tests* */__init__.py - q2_time/_version.py + q2_ritme/_version.py versioneer.py diff --git a/.gitattributes b/.gitattributes index a35e8fd..d47b216 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -q2_time/_version.py export-subst +q2_ritme/_version.py export-subst diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ca63747..974ebc5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,7 +55,7 @@ jobs: run: | python -m pip install --upgrade pip make create-env - conda activate time && make dev && make test-cov + conda activate ritme && make dev && make test-cov - name: Hack - template coverage output path run: echo "COV=coverage xml -o $GITHUB_WORKSPACE/coverage.xml" >> $GITHUB_ENV @@ -63,14 +63,15 @@ jobs: # # TODO: include this once this is a Q2 plugin and remove above run tests # - uses: qiime2/action-library-packaging@alpha1 # with: - # package-name: q2-time + # package-name: q2-ritme # additional-tests: ${{ env.COV }} # build-target: dev # library-token: ${{ secrets.LIBRARY_TOKEN }} - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 - with: - # TODO: remove token when repos is public - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: true + # # TODO: add back codecov once repos renaming is detected correctly + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v3 + # with: + # # TODO: remove token when repos is public + # token: ${{ secrets.CODECOV_TOKEN }} + # fail_ci_if_error: true diff --git a/MANIFEST.in b/MANIFEST.in index aede649..3097a7c 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,2 @@ include versioneer.py -include q2_time/_version.py +include q2_ritme/_version.py diff --git a/Makefile b/Makefile index e2873a3..ef4f302 100644 --- a/Makefile +++ b/Makefile @@ -13,13 +13,13 @@ test: all # todo: adjust coverage threshold once final test-cov: all - py.test --cov=q2_time --cov-report xml:coverage.xml --cov-fail-under=80 + py.test --cov=q2_ritme --cov-report xml:coverage.xml --cov-fail-under=80 install: all $(PYTHON) setup.py install create-env: install-req - mamba create -y -n time -c qiime2 -c conda-forge -c bioconda -c defaults $(shell python get_requirements.py ci/recipe/meta.yaml conda) + mamba create -y -n ritme -c qiime2 -c conda-forge -c bioconda -c defaults $(shell python get_requirements.py ci/recipe/meta.yaml conda) install-req: @command -v mamba >/dev/null 2>&1 || { echo "Installing mamba..."; conda install -y mamba -n base -c conda-forge; } diff --git a/README.md b/README.md index 7d7174f..354a49a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# q2-time -![CI](https://github.com/adamovanja/q2-time/actions/workflows/ci.yml/badge.svg) -[![codecov](https://codecov.io/gh/adamovanja/q2-time/branch/main/graph/badge.svg?token=VQ4D7FXMCB)](https://codecov.io/gh/adamovanja/q2-time) +# q2-ritme +![CI](https://github.com/adamovanja/q2-ritme/actions/workflows/ci.yml/badge.svg) +[![codecov](https://codecov.io/gh/adamovanja/q2-ritme/branch/main/graph/badge.svg?token=VQ4D7FXMCB)](https://codecov.io/gh/adamovanja/q2-ritme) Longitudinal modeling approaches accounting for high-dimensional, sparse and compositional nature of microbial time-series. ## Setup - + To install the required dependencies for this package run: ```shell make create-env -conda activate time +conda activate ritme make dev ``` diff --git a/ci/recipe/meta.yaml b/ci/recipe/meta.yaml index 0c7f97c..fd8bebc 100644 --- a/ci/recipe/meta.yaml +++ b/ci/recipe/meta.yaml @@ -2,7 +2,7 @@ {% set version = data.get('version') or 'placehold' %} package: - name: q2-time + name: q2-ritme version: {{ version }} source: @@ -44,12 +44,12 @@ test: - coverage - pytest-cov imports: - - q2_time - - qiime2.plugins.time + - q2_ritme + - qiime2.plugins.ritme commands: - - pytest --cov q2_time --pyargs q2_time + - pytest --cov q2_ritme --pyargs q2_ritme about: - home: https://github.com/adamovanja/q2-time + home: https://github.com/adamovanja/q2-ritme license: BSD-3-Clause license_family: BSD diff --git a/experiments/ma5_tune.ipynb b/experiments/ma5_tune.ipynb index 6cf50e4..4c99b26 100644 --- a/experiments/ma5_tune.ipynb +++ b/experiments/ma5_tune.ipynb @@ -28,11 +28,11 @@ "import pandas as pd\n", "from IPython.display import display\n", "\n", - "from q2_time.process_data import load_n_split_data\n", - "from q2_time.tune_models import run_all_trials\n", - "from q2_time.evaluate_models import get_best_model, get_best_data_processing\n", - "from q2_time.feature_space.transform_features import transform_features\n", - "from q2_time.config import (\n", + "from q2_ritme.process_data import load_n_split_data\n", + "from q2_ritme.tune_models import run_all_trials\n", + "from q2_ritme.evaluate_models import get_best_model, get_best_data_processing\n", + "from q2_ritme.feature_space.transform_features import transform_features\n", + "from q2_ritme.config import (\n", " HOST_ID,\n", " TARGET,\n", " TRAIN_SIZE,\n", diff --git a/experiments/try_tune.ipynb b/experiments/try_tune.ipynb index dc6938d..c976243 100644 --- a/experiments/try_tune.ipynb +++ b/experiments/try_tune.ipynb @@ -27,11 +27,11 @@ "import pandas as pd\n", "from IPython.display import display\n", "\n", - "from q2_time.process_data import load_n_split_data\n", - "from q2_time.tune_models import run_all_trials\n", - "from q2_time.evaluate_models import get_best_model, get_best_data_processing\n", - "from q2_time.feature_space.transform_features import transform_features\n", - "from q2_time.config import (\n", + "from q2_ritme.process_data import load_n_split_data\n", + "from q2_ritme.tune_models import run_all_trials\n", + "from q2_ritme.evaluate_models import get_best_model, get_best_data_processing\n", + "from q2_ritme.feature_space.transform_features import transform_features\n", + "from q2_ritme.config import (\n", " HOST_ID,\n", " TARGET,\n", " SEED_DATA,\n", diff --git a/q2_time/__init__.py b/q2_ritme/__init__.py similarity index 100% rename from q2_time/__init__.py rename to q2_ritme/__init__.py diff --git a/q2_time/_version.py b/q2_ritme/_version.py similarity index 99% rename from q2_time/_version.py rename to q2_ritme/_version.py index f28af21..eb2fb70 100644 --- a/q2_time/_version.py +++ b/q2_ritme/_version.py @@ -44,8 +44,8 @@ def get_config(): cfg.VCS = "git" cfg.style = "pep440" cfg.tag_prefix = "" - cfg.parentdir_prefix = "q2-time-" - cfg.versionfile_source = "q2_time/_version.py" + cfg.parentdir_prefix = "q2-ritme-" + cfg.versionfile_source = "q2_ritme/_version.py" cfg.verbose = False return cfg diff --git a/q2_time/citations.bib b/q2_ritme/citations.bib similarity index 100% rename from q2_time/citations.bib rename to q2_ritme/citations.bib diff --git a/q2_time/config.py b/q2_ritme/config.py similarity index 100% rename from q2_time/config.py rename to q2_ritme/config.py diff --git a/q2_time/evaluate_models.py b/q2_ritme/evaluate_models.py similarity index 100% rename from q2_time/evaluate_models.py rename to q2_ritme/evaluate_models.py diff --git a/q2_time/feature_space/_process_train.py b/q2_ritme/feature_space/_process_train.py similarity index 85% rename from q2_time/feature_space/_process_train.py rename to q2_ritme/feature_space/_process_train.py index ae2945f..16d969f 100644 --- a/q2_time/feature_space/_process_train.py +++ b/q2_ritme/feature_space/_process_train.py @@ -1,5 +1,5 @@ -from q2_time.feature_space.transform_features import transform_features -from q2_time.process_data import split_data_by_host +from q2_ritme.feature_space.transform_features import transform_features +from q2_ritme.process_data import split_data_by_host def process_train(config, train_val, target, host_id, seed_data): diff --git a/q2_time/feature_space/transform_features.py b/q2_ritme/feature_space/transform_features.py similarity index 100% rename from q2_time/feature_space/transform_features.py rename to q2_ritme/feature_space/transform_features.py diff --git a/q2_time/model_space/_static_searchspace.py b/q2_ritme/model_space/_static_searchspace.py similarity index 100% rename from q2_time/model_space/_static_searchspace.py rename to q2_ritme/model_space/_static_searchspace.py diff --git a/q2_time/model_space/_static_trainables.py b/q2_ritme/model_space/_static_trainables.py similarity index 99% rename from q2_time/model_space/_static_trainables.py rename to q2_ritme/model_space/_static_trainables.py index ab8ebd9..6be0d6d 100644 --- a/q2_time/model_space/_static_trainables.py +++ b/q2_ritme/model_space/_static_trainables.py @@ -19,7 +19,7 @@ from sklearn.metrics import mean_squared_error from tensorflow.keras import layers, models, optimizers -from q2_time.feature_space._process_train import process_train +from q2_ritme.feature_space._process_train import process_train def _predict_rmse(model: BaseEstimator, X: np.ndarray, y: np.ndarray) -> float: diff --git a/q2_time/plugin_setup.py b/q2_ritme/plugin_setup.py similarity index 74% rename from q2_time/plugin_setup.py rename to q2_ritme/plugin_setup.py index 878e86a..5b9cea2 100644 --- a/q2_time/plugin_setup.py +++ b/q2_ritme/plugin_setup.py @@ -8,15 +8,15 @@ from qiime2.plugin import Citations, Plugin -from q2_time import __version__ +from q2_ritme import __version__ -citations = Citations.load("citations.bib", package="q2_time") +citations = Citations.load("citations.bib", package="q2_ritme") plugin = Plugin( - name="time", + name="ritme", version=__version__, - website="https://github.com/adamovanja/q2-time", - package="q2_time", + website="https://github.com/adamovanja/q2-ritme", + package="q2_ritme", description="This is a QIIME 2 plugin for longitudinal modeling applied to " "microbial time-series.", short_description="", diff --git a/q2_time/process_data.py b/q2_ritme/process_data.py similarity index 97% rename from q2_time/process_data.py rename to q2_ritme/process_data.py index c97bbb7..a88f73b 100644 --- a/q2_time/process_data.py +++ b/q2_ritme/process_data.py @@ -3,8 +3,8 @@ from sklearn.model_selection import GroupShuffleSplit # todo: adjust to json file to be read in from user -from q2_time.config import HOST_ID, SEED_DATA, TARGET, TRAIN_SIZE -from q2_time.simulate_data import simulate_data +from q2_ritme.config import HOST_ID, SEED_DATA, TARGET, TRAIN_SIZE +from q2_ritme.simulate_data import simulate_data def load_data(path2md: str = None, path2ft: str = None) -> (pd.DataFrame, pd.DataFrame): diff --git a/q2_time/simulate_data.py b/q2_ritme/simulate_data.py similarity index 100% rename from q2_time/simulate_data.py rename to q2_ritme/simulate_data.py diff --git a/q2_time/tests/__init__.py b/q2_ritme/tests/__init__.py similarity index 100% rename from q2_time/tests/__init__.py rename to q2_ritme/tests/__init__.py diff --git a/q2_time/tests/test_feature_space.py b/q2_ritme/tests/test_feature_space.py similarity index 94% rename from q2_time/tests/test_feature_space.py rename to q2_ritme/tests/test_feature_space.py index 246dbdc..f4ed543 100644 --- a/q2_time/tests/test_feature_space.py +++ b/q2_ritme/tests/test_feature_space.py @@ -7,8 +7,8 @@ from scipy.stats.mstats import gmean from skbio.stats.composition import ilr -from q2_time.feature_space._process_train import process_train -from q2_time.feature_space.transform_features import ( +from q2_ritme.feature_space._process_train import process_train +from q2_ritme.feature_space.transform_features import ( PSEUDOCOUNT, alr, transform_features, @@ -16,7 +16,7 @@ class TestTransformFeatures(TestPluginBase): - package = "q2_time.test" + package = "q2_ritme.test" def setUp(self): super().setUp() @@ -119,7 +119,7 @@ def test_transform_features_error(self): class TestProcessTrain(TestPluginBase): - package = "q2_time.test" + package = "q2_ritme.test" def setUp(self): super().setUp() @@ -144,8 +144,8 @@ def _assert_called_with_df(self, mock, expected_df, *expected_args): for expected, actual in zip(expected_args, args[1:]): assert expected == actual, f"Expected {expected}, but got {actual}" - @patch("q2_time.feature_space._process_train.transform_features") - @patch("q2_time.feature_space._process_train.split_data_by_host") + @patch("q2_ritme.feature_space._process_train.transform_features") + @patch("q2_ritme.feature_space._process_train.split_data_by_host") def test_process_train(self, mock_split_data_by_host, mock_transform_features): # Arrange ls_ft = ["F0", "F1"] diff --git a/q2_time/tests/test_process_data.py b/q2_ritme/tests/test_process_data.py similarity index 98% rename from q2_time/tests/test_process_data.py rename to q2_ritme/tests/test_process_data.py index da0c557..8a2b1be 100644 --- a/q2_time/tests/test_process_data.py +++ b/q2_ritme/tests/test_process_data.py @@ -6,7 +6,7 @@ from pandas.testing import assert_frame_equal from qiime2.plugin.testing import TestPluginBase -from q2_time.process_data import ( +from q2_ritme.process_data import ( filter_merge_n_sort, load_data, load_n_split_data, @@ -15,7 +15,7 @@ class TestProcessData(TestPluginBase): - package = "q2_time.test" + package = "q2_ritme.test" def setUp(self): super().setUp() diff --git a/q2_time/tests/test_simulate_data.py b/q2_ritme/tests/test_simulate_data.py similarity index 94% rename from q2_time/tests/test_simulate_data.py rename to q2_ritme/tests/test_simulate_data.py index 2e79002..520d007 100644 --- a/q2_time/tests/test_simulate_data.py +++ b/q2_ritme/tests/test_simulate_data.py @@ -3,13 +3,13 @@ from pandas.testing import assert_frame_equal from qiime2.plugin.testing import TestPluginBase -from q2_time.simulate_data import simulate_feature_table, simulate_metadata +from q2_ritme.simulate_data import simulate_feature_table, simulate_metadata class TestFeatureTableSimulation(TestPluginBase): """Test all related to simulate_feature_table""" - package = "q2_time.tests" + package = "q2_ritme.tests" def test_default_feature_table(self): """Test default functionality""" @@ -40,7 +40,7 @@ def test_randomness(self): class TestMetadataSimulation(TestPluginBase): """Test all related to simulate_metadata""" - package = "q2_time.tests" + package = "q2_ritme.tests" def setUp(self): super().setUp() diff --git a/q2_time/tests/test_static_searchspace.py b/q2_ritme/tests/test_static_searchspace.py similarity index 95% rename from q2_time/tests/test_static_searchspace.py rename to q2_ritme/tests/test_static_searchspace.py index cd6ad5b..7a4a967 100644 --- a/q2_time/tests/test_static_searchspace.py +++ b/q2_ritme/tests/test_static_searchspace.py @@ -1,12 +1,12 @@ from qiime2.plugin.testing import TestPluginBase -from q2_time.model_space import _static_searchspace as ss +from q2_ritme.model_space import _static_searchspace as ss class TestStaticSearchSpace(TestPluginBase): """Test all static search space dictionaries""" - package = "q2_time.tests" + package = "q2_ritme.tests" def setUp(self): super().setUp() diff --git a/q2_time/tests/test_static_trainables.py b/q2_ritme/tests/test_static_trainables.py similarity index 85% rename from q2_time/tests/test_static_trainables.py rename to q2_ritme/tests/test_static_trainables.py index d82f3fc..e979f43 100644 --- a/q2_time/tests/test_static_trainables.py +++ b/q2_ritme/tests/test_static_trainables.py @@ -9,13 +9,13 @@ from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error -from q2_time.model_space import _static_trainables as st +from q2_ritme.model_space import _static_trainables as st class TestHelperFunctions(TestPluginBase): """Test all related to helper functions used by static_trainables""" - package = "q2_time.tests" + package = "q2_ritme.tests" def setUp(self): super().setUp() @@ -46,7 +46,7 @@ def test_report_results_manually(self, mock_get_trial_dir, mock_report): class TestTrainables(TestPluginBase): - package = "q2_time.tests" + package = "q2_ritme.tests" def setUp(self): super().setUp() @@ -64,9 +64,9 @@ def setUp(self): self.seed_data = 0 self.seed_model = 0 - @patch("q2_time.model_space._static_trainables.process_train") - @patch("q2_time.model_space._static_trainables.LinearRegression") - @patch("q2_time.model_space._static_trainables._report_results_manually") + @patch("q2_ritme.model_space._static_trainables.process_train") + @patch("q2_ritme.model_space._static_trainables.LinearRegression") + @patch("q2_ritme.model_space._static_trainables._report_results_manually") def test_train_linreg(self, mock_report, mock_linreg, mock_process_train): # define input parameters config = {"fit_intercept": True} @@ -92,9 +92,9 @@ def test_train_linreg(self, mock_report, mock_linreg, mock_process_train): mock_linreg_instance.fit.assert_called_once() mock_report.assert_called_once() - @patch("q2_time.model_space._static_trainables.process_train") - @patch("q2_time.model_space._static_trainables.RandomForestRegressor") - @patch("q2_time.model_space._static_trainables._report_results_manually") + @patch("q2_ritme.model_space._static_trainables.process_train") + @patch("q2_ritme.model_space._static_trainables.RandomForestRegressor") + @patch("q2_ritme.model_space._static_trainables._report_results_manually") def test_train_rf(self, mock_report, mock_rf, mock_process_train): # Arrange config = {"n_estimators": 100, "max_depth": 10} @@ -122,9 +122,9 @@ def test_train_rf(self, mock_report, mock_rf, mock_process_train): mock_rf_instance.fit.assert_called_once() mock_report.assert_called_once() - @patch("q2_time.model_space._static_trainables.process_train") - @patch("q2_time.model_space._static_trainables.models.Sequential") - @patch("q2_time.model_space._static_trainables.k_cc") + @patch("q2_ritme.model_space._static_trainables.process_train") + @patch("q2_ritme.model_space._static_trainables.models.Sequential") + @patch("q2_ritme.model_space._static_trainables.k_cc") def test_train_nn(self, mock_checkpoint, mock_nn, mock_process_train): # Arrange config = { @@ -162,10 +162,10 @@ def test_train_nn(self, mock_checkpoint, mock_nn, mock_process_train): mock_nn_instance.fit.assert_called_once() mock_checkpoint.assert_called_once() - @patch("q2_time.model_space._static_trainables.process_train") - @patch("q2_time.model_space._static_trainables.xgb.DMatrix") - @patch("q2_time.model_space._static_trainables.xgb.train") - @patch("q2_time.model_space._static_trainables.xgb_cc") + @patch("q2_ritme.model_space._static_trainables.process_train") + @patch("q2_ritme.model_space._static_trainables.xgb.DMatrix") + @patch("q2_ritme.model_space._static_trainables.xgb.train") + @patch("q2_ritme.model_space._static_trainables.xgb_cc") def test_train_xgb( self, mock_checkpoint, mock_xgb_train, mock_dmatrix, mock_process_train ): diff --git a/q2_time/tune_models.py b/q2_ritme/tune_models.py similarity index 97% rename from q2_time/tune_models.py rename to q2_ritme/tune_models.py index 10f5db1..a5a371f 100644 --- a/q2_time/tune_models.py +++ b/q2_ritme/tune_models.py @@ -9,8 +9,8 @@ from ray.tune.schedulers import AsyncHyperBandScheduler, HyperBandScheduler # todo: adjust to json file to be read in from user -from q2_time.model_space import _static_searchspace as ss -from q2_time.model_space import _static_trainables as st +from q2_ritme.model_space import _static_searchspace as ss +from q2_ritme.model_space import _static_trainables as st model_trainables = { # model_type: trainable diff --git a/setup.cfg b/setup.cfg index 65e2457..86cd486 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,10 +1,10 @@ [versioneer] VCS=git style=pep440 -versionfile_source = q2_time/_version.py -versionfile_build = q2_time/_version.py +versionfile_source = q2_ritme/_version.py +versionfile_build = q2_ritme/_version.py tag_prefix = -parentdir_prefix = q2-time- +parentdir_prefix = q2-ritme- [flake8] max-line-length = 88 diff --git a/setup.py b/setup.py index 4806bfe..ba0b455 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ import versioneer setup( - name="q2-time", + name="q2-ritme", version=versioneer.get_version(), cmdclass=versioneer.get_cmdclass(), license="BSD-3-Clause", @@ -20,10 +20,10 @@ author_email="anja.adamov@hest.ethz.ch", description="This is a QIIME 2 plugin for longitudinal modeling applied to " "microbial time-series.", - url="https://github.com/adamovanja/q2-time", - entry_points={"qiime2.plugins": ["q2-time=q2_time.plugin_setup:plugin"]}, + url="https://github.com/adamovanja/q2-ritme", + entry_points={"qiime2.plugins": ["q2-ritme=q2_ritme.plugin_setup:plugin"]}, package_data={ - "q2_time": ["citations.bib"], + "q2_ritme": ["citations.bib"], }, zip_safe=False, )