Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to v1.0 #12

Merged
merged 56 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
bbfc916
Updated to v1.0
mwalzer Mar 24, 2021
a00f820
activate autodoc/sphinx for readthedocs.io
mwalzer Mar 24, 2021
014d4fc
trying to fix autodoc, added a examples doc template
mwalzer Mar 26, 2021
39fec86
seems readthedocs can't do w/o requirements.txt :(
mwalzer Mar 26, 2021
f17baa7
updated version in setup.py, minimised requirements.txt
mwalzer Mar 26, 2021
c02b875
Adding autodoc result rst files
mwalzer Mar 26, 2021
316cf87
inheritance diagram works fine locally
mwalzer Mar 26, 2021
8d0fe6a
index experiment with readthedocs
mwalzer May 5, 2021
d9322bb
improved the load function for less manual typing/wrapping
mwalzer May 18, 2021
e09e75f
added first functional version of a SemanticCheck class
mwalzer May 18, 2021
c4b30bf
fixed version checks
mwalzer May 18, 2021
b4e8c99
fixed semanticvalidation issues:
mwalzer Jul 13, 2021
0b7919e
adding first draft for validation tests
mwalzer Jul 13, 2021
8351577
improved pre-validation checks
mwalzer Jul 16, 2021
81951ba
improved JsonSerialisable usability and syntaxcheck
mwalzer Jul 19, 2021
3928ba6
temp fix for schema source in syntactic validation
mwalzer Jul 19, 2021
3313ff3
url fix for 3928ba6
mwalzer Jul 19, 2021
0596050
more JS convenient validation return object
mwalzer Jul 19, 2021
aed91fe
fixed rectify function for load of full mzQC dict and mzQC file objec…
mwalzer Oct 11, 2021
453b6b9
Adding ASMS21 demo notebook
mwalzer Oct 25, 2021
6b177db
fixed tests to reflect version and schema changes
mwalzer Oct 25, 2021
ebf0dba
Added jupyter readme for asms21
mwalzer Oct 25, 2021
54d1614
Update README.md
mwalzer Oct 27, 2021
2cad4a3
updated the Dockerfiles
mwalzer Oct 28, 2021
9849e2b
Merge branch 'v1.0.0' of github.com:bigbio/mzqc-pylib into v1.0.0
mwalzer Oct 28, 2021
83aedff
updated ipynb s
mwalzer Oct 28, 2021
a0e0c02
delete 4.5 steps to mzQC (basically a clone of mzqc in 5...)
mwalzer Oct 28, 2021
0725c4f
update docker base image
mwalzer Oct 28, 2021
b8277d7
updated workshop ipynb dockerfile
mwalzer Oct 28, 2021
a1468ab
updated license and files with version impact
mwalzer Oct 28, 2021
e625b46
Adding a Validator API (as part of heroku online availability
mwalzer Mar 7, 2022
293dd97
Added syntax validation docu and fix to default schema location
mwalzer Mar 7, 2022
28e3629
fix issue #14
mwalzer Mar 7, 2022
6807efc
removed checked TODOs from comments
mwalzer Mar 7, 2022
a61da97
fix some URLs after orga move
mwalzer Mar 8, 2022
deb4484
updated sphinx doc (static pages and source config)
mwalzer Mar 9, 2022
a09b9cb
fix code-block markup in static sphinx page?
mwalzer Mar 9, 2022
29021a3
fix code-block markup in static sphinx page!
mwalzer Mar 9, 2022
618f3c1
finish renaming repo
mwalzer Mar 10, 2022
d94ba54
switching container repo config
mwalzer Mar 10, 2022
cda759d
switching container repo config
mwalzer Mar 10, 2022
6b5a667
Merge branch 'v1.0.0' of github.com:MS-Quality-hub/mzqc-pylib into v1…
mwalzer Mar 10, 2022
a5f0c2a
githubactions pip chokes on the rename
mwalzer Mar 10, 2022
c03cf23
update readme badge
mwalzer Mar 10, 2022
25bc39f
using v1.0.0 Dockerfile for now
mwalzer Mar 10, 2022
5d3cca9
improve container build tags
mwalzer Mar 11, 2022
36b6ef0
switch to official docker GH actions
mwalzer Mar 11, 2022
8156e37
correct gh action target repo for container_build
mwalzer Mar 11, 2022
9d1b56c
correcting registry target repo in container_build
mwalzer Mar 11, 2022
d371cd8
fudging with container tags
mwalzer Mar 11, 2022
24e1cdf
fudging with container tags
mwalzer Mar 11, 2022
cbd41c0
fudging with container tags
mwalzer Mar 11, 2022
5594b41
finished adjusting the container tags
mwalzer Mar 11, 2022
b7515f5
updated release gh action
mwalzer Mar 11, 2022
ce640f0
Added circle r/w test
mwalzer Mar 11, 2022
0694325
Merge branch 'v1.0.0' of github.com:MS-Quality-hub/mzqc-pylib into v1…
mwalzer Mar 11, 2022
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
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ENV LC_ALL C.UTF-8
RUN echo "deb http://http.debian.net/debian buster main" > /etc/apt/sources.list.d/debian-unstable.list


RUN pip install numpy requests matplotlib pronto jupyter flask matplotlib pytest mypy sphinx
RUN pip install numpy scipy requests matplotlib pronto jupyter flask matplotlib pytest mypy sphinx pandas plotly kaleido
#RUN pip install -e . # devcontainer.json: "postCreateCommand": "pip install -e .",

ARG USERNAME=vscode
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"dockerFile": "Dockerfile",
"context": "..",
"extensions": [
"ms-python.python", "littlefoxteam.vscode-python-test-adapter", "njpwerner.autodocstring"
"ms-python.python", "ms-python.vscode-pylance", "littlefoxteam.vscode-python-test-adapter", "ms-vscode.test-adapter-converter",
"njpwerner.autodocstring", "ms-toolsai.jupyter"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python"
Expand Down
50 changes: 39 additions & 11 deletions .github/workflows/container_build.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,45 @@
name: container-build
name: container-build-and-push
on:
pull_request:
types: ['opened', 'edited', 'reopened', 'synchronize']

jobs:
build:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: mwalzer/mzqc-pylib
username: ${{ secrets.quay_user_mzqc_action }}
password: ${{ secrets.quay_pw_mzqc_action }}
registry: quay.io
dockerfile: containers/Dockerfile
-
name: Checkout
uses: actions/checkout@v2
-
name: Set tags
run: echo mwalzerpymzqc:${GITHUB_REF##*/}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# -
# name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.quay_user_mzqc_action }}
password: ${{ secrets.quay_pw_mzqc_action }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: containers/Dockerfile
platforms: linux/amd64
push: true
tags: |
quay.io/mwalzer/pymzqc:latest_pullrequest_build
quay.io/mwalzer/pymzqc:${{ github.head_ref }}_${{ github.sha }}
47 changes: 35 additions & 12 deletions .github/workflows/release_container.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,41 @@
name: release-container
on:
release:
types: ['published', 'prereleased']
types: ['published']
jobs:
build:
docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: mwalzer/mzqc-pylib
username: ${{ secrets.quay_user_mzqc_action }}
password: ${{ secrets.quay_pw_mzqc_action }}
registry: quay.io
tag_names: true
dockerfile: containers/Dockerfile
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
# -
# name: Login to DockerHub
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to quay.io
uses: docker/login-action@v1
with:
registry: quay.io
username: ${{ secrets.quay_user_mzqc_action }}
password: ${{ secrets.quay_pw_mzqc_action }}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: containers/Dockerfile
platforms: linux/amd64
push: true
tags: |
quay.io/mwalzer/pymzqc:latest
quay.io/mwalzer/pymzqc:${{ github.event.release.tag_name }}
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@

mzqc/__pycache__/

tests/__pycache__/

.mypy_cache/

.pytest_cache/

mzqc_pylib.egg-info/
pymzqc.egg-info/

_build/
doc/build/**

doc/source/codegen/**
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@
],
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.pytestEnabled": true
"python.testing.pytestEnabled": true,
"jupyter.jupyterServerType": "local",
"python.pythonPath": "/usr/local/bin/python",
"python.testing.unittestArgs": [
"-v",
"-s",
"./tests",
"-p",
"*test*.py"
]
}
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019, Mathias Walzer
Copyright (c) 2019-22, Mathias Walzer
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand All @@ -8,7 +8,7 @@ modification, are permitted provided that the following conditions are met:
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of EBI nor bigbio nor the
* Neither the name of EBI nor PSI nor MS-Quality-Hub nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# MZQC python library
![](https://github.com/bigbio/mzqc-pylib/workflows/unit-tests/badge.svg)
![](https://github.com/bigbio/mzqc-pylib/workflows/release-container/badge.svg)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/bigbio/mzqc-pylib/v0.1.1?filepath=jupyter%2FMZQC_in_5_minutes.ipynb)
[![unit-tests](https://github.com/MS-Quality-hub/pymzqc/actions/workflows/unit_tests.yml/badge.svg)](https://github.com/MS-Quality-hub/pymzqc/actions/workflows/unit_tests.yml)
[![Docker Repository on Quay](https://quay.io/repository/mwalzer/pymzqc/status "Docker Repository on Quay")](https://quay.io/repository/mwalzer/pymzqc)
![](https://readthedocs.org/projects/pymzqc/badge/?version=v1.0.0&style=flat)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/MS-Quality-hub/pymzqc/v1.0.0?filepath=jupyter%2FMZQC_in_5_minutes.ipynb)

A python library to use mzQC files. Specifically, have a usable object representation of mzQC that can
* serialise
Expand All @@ -10,14 +11,14 @@ A python library to use mzQC files. Specifically, have a usable object represent
* semantic checks

## Install
Please install mzqc-pylib via [PyPI](https://pypi.org/). If you want the latest development install
Please install pymzqc via [PyPI](https://pypi.org/). If you want the latest development install
```
pip install -U git+https://github.com/bigbio/mzqc-pylib.git#egg=mzqc-pylib
pip install -U git+https://github.com/MS-Quality-hub/pymzqc.git#egg=pymzqc
```
However, we recommend using the [containers](https://quay.io/repository/mwalzer/mzqc-pylib) to check out the latest updates.
However, we recommend using the [containers](https://quay.io/repository/mwalzer/pymzqc) to check out the latest updates.

## Documentation
To get a nice and simple overview of how the mzQC-pylib works, visit [here](https://mzqc-pylib.readthedocs.io).
To get a nice and simple overview of how pymzqc works, visit [here](https://pymzqc.readthedocs.io).
The code documentation style convention is of the type "Sphinx/numpy".
If you however have successfully installed the library and want to **jump right in and use the library**, we suggest the [interactive guide](#5min-interactive-guide).

Expand All @@ -33,4 +34,4 @@ Contributions are welcome! (Fork and open PR)
This library implements python modules for (de-)serialisation and validity checks of the [PSI fileformat mzQC](http://www.psidev.info/groups/quality-control). To see the raw fileformat, including json schema and specification documentation, see https://github.com/HUPO-PSI/mzQC/. **The library follows the formats versioning**(which is 'v(Major).(Minor).(Patch)').

## 5min interactive guide
Have a go with our [interactive python notebook](https://mybinder.org/v2/gh/bigbio/mzqc-pylib/v0.1.1?filepath=jupyter%2FMZQC_in_5_minutes.ipynb) to explore what is possible. ([static version](https://github.com/bigbio/mzqc-pylib/blob/master/jupyter/MZQC_in_5_minutes.ipynb))
Have a go with our [interactive python notebook](https://mybinder.org/v2/gh/MS-Quality-hub/pymzqc/v1.0.0?filepath=jupyter%2FMZQC_in_5_minutes.ipynb) to explore what is possible. ([static version](https://github.com/MS-Quality-hub/pymzqc/blob/master/jupyter/MZQC_in_5_minutes.ipynb))
1 change: 1 addition & 0 deletions acessories/heroku/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn mzqc_heroku_validator:app
64 changes: 64 additions & 0 deletions acessories/heroku/mzqc_heroku_validator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#sudo apt update
#sudo apt install python3 python3-pip python3-flask
#pip install Flask
#pip install git+https://github.com/MS-Quality-hub/pymzqc.git@v1.0.0
#pip install flask-restful
#pip install gunicorn

import json
from flask import Flask
from flask import Flask, jsonify, request
from flask_restful import Resource, Api
from flask_cors import CORS

from mzqc.MZQCFile import MzQcFile as mzqc_file
from mzqc.MZQCFile import JsonSerialisable as mzqc_io
from mzqc.SemanticCheck import SemanticCheck
from mzqc.SyntaxCheck import SyntaxCheck

app = Flask(__name__)
api = Api(app)
CORS(app)

class Status(Resource):
def get(self):
try:
return {'status': 'API is running'}
except:
return {'status': 'API fetch was unsuccessful'}

class Validator(Resource):
def post(self):
default_unknown = jsonify({"general": "No mzQC structure detectable."})
inpu = request.form.get('validator_input', None)
try:
target = mzqc_io.FromJson(inpu)
except Exception as e:
return default_unknown

if type(target['mzQC']) != mzqc_file:
return default_unknown
else:
safe = target['mzQC']
removed_items = list(filter(lambda x: not x.uri.startswith('http'), safe.controlledVocabularies))
safe.controlledVocabularies = list(filter(lambda x: x.uri.startswith('http'), safe.controlledVocabularies))
print(safe)
sem_val_res = SemanticCheck().validate(safe)
print(sem_val_res)
proto_response = {k: [str(i) for i in v] for k,v in sem_val_res.items()}
proto_response.update({"unrecognised CVs": [str(it) for it in removed_items]})
print(proto_response)
valt = mzqc_io.ToJson(target)
syn_val_res = SyntaxCheck().validate(valt)
proto_response.update(syn_val_res)
# convert val_res ErrorTypes to strings
# add note on removed CVs
return jsonify(proto_response)
return default_unknown


api.add_resource(Status, '/','/status/')
api.add_resource(Validator, '/validator/')

if __name__ == '__main__':
app.run()
80 changes: 80 additions & 0 deletions acessories/heroku/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
git+git://github.com/MS-Quality-hub/pymzqc.git@v1.0.0
aniso8601==9.0.1
argon2-cffi==20.1.0
async-generator==1.10
attrs==21.2.0
backcall==0.2.0
bleach==3.3.1
certifi==2021.5.30
cffi==1.14.6
chardet==4.0.0
charset-normalizer==2.0.3
click==8.0.1
cycler==0.10.0
debugpy==1.3.0
decorator==4.4.2
defusedxml==0.7.1
entrypoints==0.3
fastobo==0.10.1
Flask==2.0.1
Flask-Cors==3.0.10
Flask-RESTful==0.3.9
gunicorn==20.1.0
idna==3.2
ipykernel==6.0.3
ipython==7.25.0
ipython-genutils==0.2.0
ipywidgets==7.6.3
itsdangerous==2.0.1
jedi==0.18.0
Jinja2==3.0.1
jsonschema==3.2.0
jupyter==1.0.0
jupyter-client==6.1.12
jupyter-console==6.4.0
jupyter-core==4.7.1
jupyterlab-pygments==0.1.2
jupyterlab-widgets==1.0.0
kiwisolver==1.3.1
MarkupSafe==2.0.1
matplotlib==3.4.2
matplotlib-inline==0.1.2
mistune==0.8.4
nbclient==0.5.3
nbconvert==6.1.0
nbformat==5.1.3
nest-asyncio==1.5.1
networkx==2.5.1
notebook==6.4.0
numpy==1.21.1
packaging==21.0
pandocfilters==1.4.3
parso==0.8.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.3.1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Critical OSS Vulnerability:

pkg:pypi/pillow@8.3.1

1 Critical, 0 Severe, 0 Moderate, 0 Unknown vulnerabilities have been found across 1 dependencies

Components
    pkg:pypi/pillow@8.3.1
      CRITICAL Vulnerabilities (1)

        [CVE-2021-23437] The package pillow 5.2.0 and before 8.3.2 are vulnerable to Regular Expression D...

        The package pillow 5.2.0 and before 8.3.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the getrgb function.

        CVSS Score: 7.5

        CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

(at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `ignore`)

prometheus-client==0.11.0
prompt-toolkit==3.0.19
pronto==2.4.2
ptyprocess==0.7.0
pycparser==2.20
Pygments==2.9.0
pyparsing==2.4.7
pyrsistent==0.18.0
python-dateutil==2.8.2
pytz==2021.1
pyzmq==22.1.0
qtconsole==5.1.1
QtPy==1.9.0
requests==2.26.0
Send2Trash==1.7.1
six==1.16.0
terminado==0.10.1
testpath==0.5.0
tornado==6.1
traitlets==5.0.5
urllib3==1.26.6
wcwidth==0.2.5
webencodings==0.5.1
Werkzeug==2.0.1
widgetsnbextension==3.5.1
1 change: 1 addition & 0 deletions acessories/heroku/runtime.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python-3.8.11
4 changes: 4 additions & 0 deletions acessories/heroku/wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from mzqc_heroku_validator import app

if __name__ == '__main__':
app.run()
Loading