Skip to content

Commit

Permalink
Updates for publish workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
rodvrees committed Feb 1, 2024
1 parent e74b091 commit 653dc05
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 5 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish

on:
workflow_dispatch:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/im2deep
permissions:
id-token: write
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- name: Install dependencies
run: |
python -m pip install --upgrade pip build
- name: Build
run: python -m build

- name: Install
run: pip install dist/im2deep-*.whl

- name: Test package
run: |
im2deep --help
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,4 @@ ENV/
# vscode
.vscode/
.pytest_cache/
IM2Deep.code-workspace
4 changes: 2 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include im2deep/models/*
include im2deep/reference_data/*
include im2deep/models/**/*
include im2deep/reference_data/**/*
16 changes: 14 additions & 2 deletions im2deep/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ def main(
"""Command line interface to IM2Deep."""
setup_logging(log_level)
try:
#TODO: Add other arguments like calibrate_per_charge, use_charge_state, n_jobs
run(psm_file, calibration_file, output_file, model_name, calibrate_per_charge, use_charge_state, n_jobs)
except IM2DeepError as e:
LOGGER.error(e)
Expand All @@ -137,7 +136,6 @@ def run(
# Read input file
df_pred = pd.read_csv(file_pred)
df_pred.fillna("", inplace=True)
del file_pred

list_of_psms = []
for seq, mod, charge, ident in zip(
Expand Down Expand Up @@ -215,6 +213,20 @@ def run(
):
file_pred_out.write(f"{seq},{mod},{charge},{CCS}\n")
file_pred_out.close()
else:
file_pred_out_path = Path(file_pred)
file_pred_out_path.with_stem(file_pred_out_path.stem + "_predictions")
file_pred_out = open(file_pred_out_path, "w")
file_pred_out.write("seq,modifications,charge,predicted CCS\n")
for seq, mod, charge, ident, CCS in zip(
df_pred["seq"],
df_pred["modifications"],
df_pred["charge"],
df_pred.index,
calibrated_psm_list_pred_df["predicted_ccs_calibrated"],
):
file_pred_out.write(f"{seq},{mod},{charge},{CCS}\n")
file_pred_out.close()

LOGGER.info("IM2Deep finished!")

Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ dependencies = [
"deeplc",
"deeplcretrainer",
"psm_utils",
"tensorflow>=2.2,<2.13.0"
"tensorflow>=2.2,<2.13.0",
"pandas",
"numpy",
"rich"
]

[project.optional-dependencies]
Expand All @@ -50,6 +53,9 @@ im2deep = "im2deep.__main__:main"
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.setuptools.dynamic]
version = {attr = "im2deep.__version__"}

[tool.isort]
profile = "black"

Expand Down

0 comments on commit 653dc05

Please sign in to comment.