diff --git a/CHANGELOG.md b/CHANGELOG.md index ebc9836..f9dd345 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,10 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [0.0.1] - 1900-12-31 +## [0.1.0] - 2024-07-15 ### Added +- function to read the metadata or alkane file in csv/tsv/xls/xlsx format +- function to process the metadata file: validate file names, derive and rearrange additional metadata columns +- function to save the processed metadata or alkane dataframe as tsv + ### Removed ### Changed diff --git a/CITATION.cff b/CITATION.cff index ba205a6..1045ff0 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -13,5 +13,7 @@ repository-code: "https://github.com/RECETOX/rcx-tk" keywords: - rcx - process metadata + - alkanes + - metabolomics message: "If you use this software, please cite it using these metadata." license: MIT diff --git a/NOTICE b/NOTICE deleted file mode 100644 index 965c3ce..0000000 --- a/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -This product includes rcx_tk, software developed by -Netherlands eScience Center. diff --git a/README.dev.md b/README.dev.md index af6f34a..4c401f0 100644 --- a/README.dev.md +++ b/README.dev.md @@ -2,26 +2,31 @@ If you're looking for user documentation, go [here](README.md). -## Development install +## Package installation -```shell -# Create a virtual environment, e.g. with -python -m venv env +To create a new environment, use the micromamba: + +```console +micromamba create -n rcx-tk poetry +micromamba activate rcx-tk +``` +To install all dependencies specified in the `pyproject.toml` file, use poetry: -# activate virtual environment -source env/bin/activate +```console +poetry install +``` -# make sure to have a recent version of pip and setuptools -python -m pip install --upgrade pip setuptools +A command line interface was also implemented using Click, so the package can be run by either using python3: -# (from the project root directory) -# install rcx_tk as an editable package -python -m pip install --no-cache-dir --editable . -# install development dependencies -python -m pip install --no-cache-dir --editable .[dev] +```console +python3 -m rcx_tk --method='' ``` -Afterwards check that the install directory is present in the `PATH` environment variable. +or using poetry: + +```console +poetry run rcx_tk --method='' +``` ## Running the tests @@ -116,9 +121,9 @@ make doctest Bumping the version across all files is done with [bump-my-version](https://github.com/callowayproject/bump-my-version), e.g. ```shell -bump-my-version bump major # bumps from e.g. 0.3.2 to 1.0.0 -bump-my-version bump minor # bumps from e.g. 0.3.2 to 0.4.0 -bump-my-version bump patch # bumps from e.g. 0.3.2 to 0.3.3 +poetry version major # bumps from e.g. 0.3.2 to 1.0.0 +poetry version minor # bumps from e.g. 0.3.2 to 0.4.0 +poetry version patch # bumps from e.g. 0.3.2 to 0.3.3 ``` ## Making a release @@ -145,50 +150,37 @@ In a new terminal: # has the state of origin/main branch cd $(mktemp -d rcx_tk.XXXXXX) git clone git@github.com:RECETOX/rcx-tk . +``` -# make sure to have a recent version of pip and the publishing dependencies -python -m pip install --upgrade pip -python -m pip install .[publishing] - -# create the source distribution and the wheel -python -m build +Create and activate a new environment: -# upload to test pypi instance (requires credentials) -python -m twine upload --repository testpypi dist/* +```console +micromamba create -n rcx-tk-pypi poetry +micromamba activate rcx-tk-pypi ``` -Visit -[https://test.pypi.org/project/rcx_tk](https://test.pypi.org/project/rcx_tk) -and verify that your package was uploaded successfully. Keep the terminal open, we'll need it later. +Create an account on PyPI. -In a new terminal, without an activated virtual environment or an env directory: +In the Account settings, find the API tokens section and click on "Add API token". Copy your token. -```shell -cd $(mktemp -d rcx_tk-test.XXXXXX) +Add your API token to Poetry: -# prepare a clean virtual environment and activate it -python -m venv env -source env/bin/activate +```console +poetry config pypi-token.pypi your-api-token +``` -# make sure to have a recent version of pip and setuptools -python -m pip install --upgrade pip +Build your project: -# install from test pypi instance: -python -m pip -v install --no-cache-dir \ ---index-url https://test.pypi.org/simple/ \ ---extra-index-url https://pypi.org/simple rcx_tk +```console +poetry build ``` -Check that the package works as it should when installed from pypitest. - -Then upload to pypi.org with: +Publish your package to PyPI: -```shell -# Back to the first terminal, -# FINAL STEP: upload to PyPI (requires credentials) -python -m twine upload dist/* +```console +poetry publish ``` ### (3/3) GitHub -Don't forget to also make a [release on GitHub](https://github.com/RECETOX/rcx-tk/releases/new). If your repository uses the GitHub-Zenodo integration this will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. +Don't forget to also make a [release on GitHub](https://github.com/RECETOX/rcx-tk/releases/new). If your repository uses the GitHub-Zenodo integration this will also trigger Zenodo into making a snapshot of your repository and sticking a DOI on it. \ No newline at end of file diff --git a/README.md b/README.md index a60470a..904c97e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ ## Badges -(Customize these badges with your own links, and check https://shields.io/ or https://badgen.net/ to see which other badges are available.) - | fair-software.eu recommendations | | | :-- | :-- | | (1/5) code repository | [![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)](https://github.com/RECETOX/rcx-tk) | @@ -21,9 +19,16 @@ ## How to use rcx_tk -Tools for internal use +`rcx-tk` package provides tools to process the metadata or alkane files. + +On the input, the user is expected to supply a path to the metadata/alkane file in tsv/csv/xls/xlsx file. The file is then converted to a dataframe which is further processed. The main steps are: + +- columns rearrangement +- validation of the file names +- validation that the `injectionNumber` column is of integer type +- derivation of new metadata: `sampleName`, `sequenceIdentifier`, `sampleIdentifier` and `localOrder` -The project setup is documented in [project_setup.md](project_setup.md). Feel free to remove this document (and/or the link to this document) if you don't need it. +Finally, the processed dataframe is saved into user-defined location. ## Installation @@ -32,12 +37,23 @@ To install rcx_tk from GitHub repository, do: ```console git clone git@github.com:RECETOX/rcx-tk.git cd rcx-tk -python -m pip install . +poetry install +``` + +The main functions are process_metadata_file and process_alkane_ri_file. + +The tool can be run also using command-line interface, either by the python3 or poetry: + +```console +python3 --method='' ``` +```console +poetry run rcx_tk --method='' +``` ## Documentation -Include a link to your project's full documentation here. +The project is documented [here](https://rcx-tk.readthedocs.io/en/latest/?badge=latest). ## Contributing diff --git a/next_steps.md b/next_steps.md deleted file mode 100644 index affbc71..0000000 --- a/next_steps.md +++ /dev/null @@ -1,47 +0,0 @@ -# Next steps - -## Put the generated files under version control - -Once your Python package is created, put it under [version -control](https://guide.esciencecenter.nl/#/best_practices/version_control) using -[git](https://git-scm.com/) and [GitHub](https://github.com/). - -Note that the next step assumes you have setup your connection to GitHub via SSH, -see [Connecting to GitHub with SSH](https://docs.github.com/en/github-ae@latest/authentication/connecting-to-github-with-ssh). - -Alternatively, you can also use a personal access token, see -[Creating a personal access token](https://docs.github.com/en/github-ae@latest/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). If you choose this option, below you will have to replace -`git@github.com:` by `https://github.com/`. - -```shell -cd rcx-tk -git init -git add --all -git commit -m "first commit" -git branch -M main -git remote add origin git@github.com:RECETOX/rcx-tk -``` - -## Push the initial commit to a new repo on GitHub - -Go to -[https://github.com/organizations/RECETOX/repositories/new](https://github.com/organizations/RECETOX/repositories/new) -and create a new repository named `rcx-tk` as an empty repository, then push your commits to GitHub: - -```shell -git push --set-upstream origin main -``` - -## Check automatically generated issues - -A short while after you push your commits to GitHub for the first time, a few issues outlining next steps will added -automatically ([here](https://github.com/RECETOX/rcx-tk/issues?q=author%3Aapp%2Fgithub-actions)). Resolve them to complete the -setup of your repository. - -## Project development documentation - -The [README.dev.md](README.dev.md) contains developer documentation. - -## Project layout explained - -For an explanation of what files are there, and what each of these do, please refer to [project_setup.md](project_setup.md). diff --git a/project_setup.md b/project_setup.md index 496eea5..ea20020 100644 --- a/project_setup.md +++ b/project_setup.md @@ -11,9 +11,6 @@ checklist](https://guide.esciencecenter.nl/#/best_practices/checklist). This repository is set up with Python versions: -- 3.8 -- 3.9 -- 3.10 - 3.11 - 3.12 @@ -23,19 +20,23 @@ versions. ## Package management and dependencies -You can use either pip or conda for installing dependencies and package management. This repository does not force you -to use one or the other, as project requirements differ. For advice on what to use, please check [the relevant section -of the -guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=dependencies-and-package-management). +For installing the dependencies and package management, [micromamba](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) and [poetry](https://python-poetry.org/) have been used. -- Runtime dependencies should be added to `pyproject.toml` in the `dependencies` list under `[project]`. -- Development dependencies should be added to `pyproject.toml` in one of the lists under `[project.optional-dependencies]`. +The dependencies are listed in the `pyproject.toml` file under the section `[tool.poetry.dependencies]` and `[tool.poetry.group.dev.dependencies]`. ## Packaging/One command install -You can distribute your code using PyPI. -[The guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=building-and-packaging-code) can -help you decide which tool to use for packaging. +To create a new environment, use the micromamba: + +```console +micromamba create -n rcx-tk poetry +micromamba activate rcx-tk +``` +To install all dependencies specified in the `pyproject.toml` file, use poetry: + +```console +poetry install +``` ## Testing and code coverage @@ -114,4 +115,4 @@ help you decide which tool to use for packaging. ## NOTICE - List of attributions of this project and Apache-license dependencies -- [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/licensing?id=notice) +- [Relevant section in the guide](https://guide.esciencecenter.nl/#/best_practices/licensing?id=notice) \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8d81a19..c416b25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,7 +2,7 @@ name = "rcx-tk" version = "0.1.0" description = "This package adjusts and cleans the metadata file provided by a user." -authors = ["Zargham Ahmad " ] +authors = ["Zargham Ahmad " , "Kristina Gomoryova "] license = "MIT" readme = "README.md" keywords = ["metadata", "alkanes", "metabolomics"] @@ -117,17 +117,11 @@ known-first-party = ["rcx_tk"] force-single-line = true no-lines-before = ["future","standard-library","third-party","first-party","local-folder"] -[[tool.bumpversion.files]] -filename = "src/rcx_tk/__init__.py" - -[[tool.bumpversion.files]] -filename = "pyproject.toml" - -[[tool.bumpversion.files]] -filename = "CITATION.cff" - -[[tool.bumpversion.files]] -filename = "docs/conf.py" - [tool.poetry.scripts] rcx_tk = "rcx_tk.__main__:main" + +[tool.poetry_bumpversion.file."src/rcx_tk/__init__.py"] +[tool.poetry_bumpversion.file."CITATION.cff"] +[tool.poetry_bumpversion.file."docs/conf.py"] +[tool.poetry_bumpversion.file."pyproject.toml"] +