Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 21 additions & 18 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,40 @@ name: Python package
on:
push:
branches:
- main
- main
pull_request:
branches:
- main
- main

jobs:

build:
name: Build for (${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest'] # ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.9'] # ['3.7', '3.8', '3.9', '3.10', '3.11']
os: ["ubuntu-latest"]
python-version: ["3.11"]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Python info
shell: bash -l {0}

# Installation
- name: Install dependencies
run: |
which python3
python3 --version
- name: Upgrade pip and install dependencies
python -m pip install poetry
poetry install

# Testing
- name: Test with pytest
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install .[test]
- name: Run unit tests
run: pytest -v
- name: Verify that we can build the package
run: python3 setup.py sdist bdist_wheel
poetry run pytest
# Type checking
# - name: Type check
# run: |
# poetry run pytype .
70 changes: 70 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "Build and Publish docker image"

on:
workflow_dispatch: # This line adds the manual trigger
push:
branches: [ "main" ]
pull_request: # This should be removed once testing is complete
branches:
- main

env:
REGISTRY: ghcr.io

jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: downcase REPO name
run: |
echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.REPO }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
type=semver,pattern={{version}}
type=sha,enable=true,priority=100,prefix=sha-,suffix=,format=short

- name: Install Arial font
run: |
sudo apt-get update
sudo apt install ttf-mscorefonts-installer
sudo apt-get install -y ttf-mscorefonts-installer
sudo fc-cache -f

- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
push: false # Do not push at this stage
tags: ${{ steps.meta.outputs.tags }}

- name: Push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: |
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
org.opencontainers.image.revision=${{ github.sha }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,4 @@ tags

# Output files

out_*
out/out_*
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ The sections below outline the steps in each case.

## You have a question

1. use the search functionality [here](git@github.com:Workflomics/workflomics-QCmetric/issues) to see if someone already filed the same issue;
1. use the search functionality [here](git@github.com:Workflomics/pubmetric/issues) to see if someone already filed the same issue;
2. if your issue search did not yield any relevant results, make a new issue;
3. apply the "Question" label; apply other labels when relevant.

## You think you may have found a bug

1. use the search functionality [here](git@github.com:Workflomics/workflomics-QCmetric/issues) to see if someone already filed the same issue;
1. use the search functionality [here](git@github.com:Workflomics/pubmetric/issues) to see if someone already filed the same issue;
1. if your issue search did not yield any relevant results, make a new issue, making sure to provide enough information to the rest of the community to understand the cause and context of the problem. Depending on the issue, you may want to include:
- the [SHA hashcode](https://help.github.com/articles/autolinked-references-and-urls/#commit-shas) of the commit that is causing your problem;
- some identifying information (name and version number) for dependencies you're using;
Expand Down
27 changes: 27 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use an official Python runtime as a parent image
FROM python:3.11-slim

# Set the working directory in the container
WORKDIR /app

# Install Poetry
RUN pip install poetry

# Copy the pyproject.toml and poetry.lock files
COPY pyproject.toml poetry.lock /app/

# Copy the application code before installing dependencies
COPY . /app

# Set the PYTHONPATH environment variable
ENV PYTHONPATH=/app/src

# Install the dependencies using Poetry without creating a virtual environment
RUN poetry config virtualenvs.create false \
&& poetry install --no-dev --no-interaction --no-ansi

# Expose the port where the FastAPI app will run
EXPOSE 8000

# Command to run the FastAPI app using Uvicorn
CMD ["poetry", "run", "uvicorn", "src.pubmetric.api_controller:app", "--host", "0.0.0.0", "--port", "8000"]
33 changes: 27 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,46 @@

This code is currently under development.


## Overview

pubmetric is a library for benchmarking workflows based on the co-citation network connectivity of the publications describing the tools making up the workflow.


## Usage

First start Cytoscape, then open your notebook environment and run the code.


## Dependencies

Python packages listed in the `setup.py` file. You can install them using the following command: `pip install .`
For the development, you can include the test dependencies by running `pip install .[test]`
Python packages listed in the `pyproject.toml` file. You can install them using the following command:

```bash
poetry install
```

If you're setting up the project for development and need the test dependencies, you can include them by running:

```bash
poetry install --with dev
```

Cytoscape software, which can be downloaded from [https://cytoscape.org/](https://cytoscape.org/). Please make sure Cytoscape is open and running when executing the code.

## For Developers

Build the Docker image:

```bash
sudo docker build -t pubmetric_v0.2 -f Dockerfile .
```

You can run the Docker image with the following command:

```bash
sudo docker run -p 8000:8000 pubmetric_v0.2
```

This will start the FastAPI server on port 8000. For example you can access the OpenAPI specification (Swagger UI) at http://localhost:8000/docs.

## License

This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
This project is licensed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0).
1 change: 1 addition & 0 deletions data/out_default/doi_pmid_library.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"10.1002/pmic.201200439": "23148064", "10.1038/nbt.2377": "23051804", "10.1093/nar/gkz369": "31066453", "10.1093/bioinformatics/bth092": "14976030", "10.1038/nmeth.4256": "28394336"}
Binary file added data/out_default/graph.pkl
Binary file not shown.
1 change: 1 addition & 0 deletions data/out_default/tool_metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"creation_date": "2024-10-16 06:14:52.344396", "topic": "", "total_nr_tools": 15, "biotools_wo_pmid": 5, "pmid_from_doi": 5, "tools": [{"name": "PeptideProphet", "doi": null, "topics": ["Proteomics", "Proteomics experiment", "Statistics and probability"], "nr_publications": 1, "all_publications": ["12403597"], "publication_date": 2002, "pmid": "12403597"}, {"name": "ProteinProphet", "doi": null, "topics": ["Proteomics", "Proteomics experiment", "Statistics and probability"], "nr_publications": 1, "all_publications": ["14632076"], "publication_date": 2003, "pmid": "14632076"}, {"name": "StPeter", "doi": "10.1021/acs.jproteome.7b00786", "topics": ["Proteomics", "Proteomics experiment"], "nr_publications": 1, "all_publications": ["29400476"], "publication_date": 2018, "pmid": "29400476"}, {"name": "mzRecal", "doi": "10.1093/bioinformatics/btab056", "topics": ["Proteomics"], "nr_publications": 1, "all_publications": ["33538780"], "publication_date": 2021, "pmid": "33538780"}, {"name": "MS Amanda", "doi": "10.1021/pr500202e", "topics": ["Proteomics", "Protein modifications"], "nr_publications": 3, "all_publications": ["24909410", "33759252", "29863353"], "publication_date": 2014, "pmid": "24909410"}, {"name": "Comet", "doi": "10.1002/pmic.201200439", "topics": ["Proteomics", "Protein modifications"], "nr_publications": 2, "all_publications": [null, null], "publication_date": 2013, "pmid": "23148064"}, {"name": "idconvert", "doi": "10.1038/nbt.2377", "topics": ["Proteomics", "Proteomics experiment"], "nr_publications": 1, "all_publications": [null], "publication_date": 2012, "pmid": "23051804"}, {"name": "XTandem", "doi": "10.1093/bioinformatics/bth092", "topics": ["Proteomics", "Proteomics experiment"], "nr_publications": 1, "all_publications": [null], "publication_date": 2004, "pmid": "14976030"}, {"name": "MSFragger", "doi": "10.1038/nmeth.4256", "topics": ["Proteomics experiment", "Proteomics", "Protein modifications"], "nr_publications": 1, "all_publications": [null], "publication_date": 2017, "pmid": "28394336"}]}
4 changes: 2 additions & 2 deletions dev-viz-notebooks/ML_metric_eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"import wfqc.network as nw\n",
"import pumetric.network as nw\n",
"from scipy.stats import ttest_rel, spearmanr\n",
"from sklearn.metrics import confusion_matrix, mean_squared_error\n",
"from sklearn.model_selection import train_test_split\n",
Expand All @@ -30,7 +30,7 @@
"from sklearn.svm import SVR\n",
"from sklearn.preprocessing import KBinsDiscretizer\n",
"from sklearn import tree\n",
"from wfqc.metrics import *\n",
"from pumetric.metrics import *\n",
"from datetime import datetime"
]
},
Expand Down
6 changes: 3 additions & 3 deletions dev-viz-notebooks/TTP_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"\n",
"sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '../src')))\n",
"\n",
"from wfqc.metrics import *\n",
"from wfqc.network import create_network\n"
"from pumetric.metrics import *\n",
"from pumetric.network import create_network\n"
]
},
{
Expand Down Expand Up @@ -471,7 +471,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/broken_dataset_gen.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/graph_statistics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/metric_dev.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1344,7 +1344,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/network_dev.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/random_dataset_gen.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/rated_dataset_expanded.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/rated_dataset_parsing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
2 changes: 1 addition & 1 deletion dev-viz-notebooks/thresholding.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
6 changes: 3 additions & 3 deletions dev-viz-notebooks/workflow_length_stats.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"\n",
"sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), '../src')))\n",
"\n",
"from wfqc.metrics import *\n",
"from wfqc.network import create_network\n"
"from pumetric.metrics import *\n",
"from pumetric.network import create_network\n"
]
},
{
Expand Down Expand Up @@ -125,7 +125,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "WFQC",
"display_name": "pumetric",
"language": "python",
"name": "python3"
},
Expand Down
Loading