Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
847d7d4
Add cffconvert.yml to validate CITATION.cff
abelsiqueira Feb 3, 2022
ce47211
Update CITATION.cff cffversion to 1.2.0
abelsiqueira Feb 3, 2022
d31ff32
Fixed missing keyword in model dict
hechth Jun 20, 2023
eb6c603
Update SpectrumDocument.py
niekdejonge Aug 6, 2024
471e69e
Update setup.py
niekdejonge Aug 6, 2024
8a5b578
Update setup.py
niekdejonge Aug 6, 2024
0ee563d
Update setup.py
niekdejonge Aug 6, 2024
d4ee4e9
Update CI_build.yml
niekdejonge Aug 6, 2024
97432d3
Update test_spectrum_document.py
niekdejonge Aug 6, 2024
c602277
Remove add losses from integration test
niekdejonge Aug 6, 2024
427801e
Update test_spectrum_document.py
niekdejonge Aug 6, 2024
b12cd3d
Update SpectrumDocument.py
niekdejonge Aug 6, 2024
1540f95
Update test_spectrum_document.py
niekdejonge Aug 6, 2024
13033b5
Update test_spectrum_document.py
niekdejonge Aug 6, 2024
318641c
Update test_spectrum_document.py
niekdejonge Aug 6, 2024
96686af
Update README.rst
niekdejonge Aug 6, 2024
3f49ee5
Moved SpecDoc with losses to own class
hechth Aug 13, 2024
958d3a4
refactored tests
hechth Aug 13, 2024
153e856
Added sparse array type handling and tests
hechth Aug 13, 2024
69ede00
fixed warning in spec2vec test
hechth Aug 13, 2024
d4c706f
Added option to specify loss range and fixed test
hechth Aug 13, 2024
d5e0b17
lint
hechth Aug 13, 2024
b7d6f82
Merge remote-tracking branch 'origin/Add-loss_mz_from-and-loss_mz_to-…
hechth Aug 13, 2024
d65ee28
updated workflows
hechth Aug 13, 2024
a9b34e2
fixed documentation
hechth Aug 13, 2024
728d491
updated workflow with docs
hechth Aug 13, 2024
e1b9c21
Merge remote-tracking branch 'cffbots/cffbots-cffconvert' into compat…
hechth Aug 13, 2024
bd53cf4
Merge remote-tracking branch 'origin/patch-1' into compatability-updates
hechth Aug 13, 2024
c40f2b8
reintroduced meta.yaml
hechth Aug 13, 2024
210cfcf
removed losses from specdoc contrusctor
hechth Aug 14, 2024
10c5569
refactored model serialization and building tets and added new tests …
hechth Aug 14, 2024
059b84a
added test to check losses
hechth Aug 14, 2024
e4e9400
added test
hechth Aug 14, 2024
c255ad9
updated version and started working on import validation issues
hechth Aug 14, 2024
5acb2eb
fixed coverage run path
hechth Aug 14, 2024
6a22ce2
skip failing test case
hechth Aug 14, 2024
0194a81
linting
hechth Aug 14, 2024
10e34ab
linting spec2vec
niekdejonge Aug 14, 2024
c4c5fa6
linting test_spectrum_document
niekdejonge Aug 14, 2024
8ff67ce
disable sonarcloud
niekdejonge Aug 14, 2024
7c0aa29
Change python version in workflows to 3.10
niekdejonge Aug 14, 2024
15d7540
added twine to workflow setup
niekdejonge Aug 14, 2024
c6ae6dd
Quotes around 3.10 to prevent bug
niekdejonge Aug 14, 2024
25e1ba0
Remove scale
niekdejonge Aug 14, 2024
d707b3a
Remove cd readthedocs in workflow
niekdejonge Aug 14, 2024
3d52b18
move show pip list
niekdejonge Aug 14, 2024
f90f215
fixed doc building
hechth Aug 14, 2024
e2acd4d
updated conda envrionment to reflect poetry and updated CI
hechth Sep 2, 2024
abb733d
updated coumentation build
hechth Sep 3, 2024
e06e83d
changed meta.yaml version to current version
hechth Sep 3, 2024
dcab69a
switched to local build
hechth Sep 3, 2024
fe55d13
updated python version
hechth Sep 5, 2024
4ec0a58
updated build deps
hechth Sep 5, 2024
f249916
updated CI
hechth Sep 12, 2024
eb54db5
revert py dep
hechth Sep 12, 2024
52c58af
add poetry to host
hechth Sep 12, 2024
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
41 changes: 21 additions & 20 deletions .github/workflows/CI_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,36 @@ on:
jobs:

first_check:
name: first code check / python-3.8 / ubuntu-latest
name: first code check / python-3.9 / ubuntu-latest
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.8
python-version: 3.9
- name: Python info
run: |
which python
python --version
- name: Build package and create dev environment
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
python -m pip install --upgrade pip poetry
poetry install
- name: Show pip list
run: |
pip list
- name: Test with coverage
run: |
pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml
poetry run pytest --cov --cov-report term --cov-report xml --junitxml=xunit-result.xml
- name: Correct coverage paths
run: sed -i "s+$PWD/++g" coverage.xml
- name: Check style against standards using prospector
shell: bash -l {0}
run: prospector -o grouped -o pylint:pylint-report.txt
run: poetry run prospector -o grouped -o pylint:pylint-report.txt
- name: Check whether import statements are used consistently
shell: bash -l {0}
run: isort --check-only --diff --conda-env spec2vec-dev .
run: poetry run isort --check-only --diff --conda-env spec2vec-dev .
- name: SonarCloud Scan
if: github.repository == 'iomega/spec2vec'
uses: sonarsource/sonarcloud-github-action@master
Expand All @@ -53,15 +53,15 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.7', '3.8', '3.9']
python-version: ['3.9']
exclude:
# already tested in first_check job
- python-version: 3.8
- python-version: 3.9
os: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Python info
Expand All @@ -70,30 +70,31 @@ jobs:
python --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip poetry
- name: Build package
run: |
pip install wheel twine
python setup.py sdist bdist_wheel
poetry build
- name: Test package
run: |
poetry install --only dev
python -m twine check dist/*
- name: Show pip list
run: |
pip list
- name: Install development dependencies
run: |
pip install -e .[dev]
poetry install
- name: Test
run: |
pytest
poetry run pytest
- name: Show environment variables
shell: bash -l {0}
run: |
env | sort
- name: Build documentation
shell: bash -l {0}
run: |
cd readthedocs
make coverage doctest html
working-directory: readthedocs/
env:
Expand All @@ -108,7 +109,7 @@ jobs:
echo "The code is sufficiently documented with ${UNCOVERED_MEMBERS} uncovered members out of ${UNCOVERED_MEMBERS_ALLOWED} allowed.";

anaconda_build:
name: Anaconda build / python-3.7 / ubuntu-latest
name: Anaconda build / python-3.9 / ubuntu-latest
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -123,7 +124,7 @@ jobs:
activate-environment: spec2vec-build
auto-update-conda: true
environment-file: conda/environment-build.yml
python-version: 3.8
python-version: 3.9
- name: Show conda config
shell: bash -l {0}
run: |
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/cffconvert.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: cffconvert

on:
push:
paths:
- CITATION.cff

jobs:
validate:
name: "validate"
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v2

- name: Check whether the citation metadata from CITATION.cff is valid
uses: citation-file-format/[email protected]
with:
args: "--validate"
22 changes: 6 additions & 16 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,11 @@ on:
types: [published]

jobs:
publish:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- uses: actions/checkout@v4
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ pylint-report.txt
xunit-result.xml
.scannerwork/

docs/_build
docs/apidocs
readthedocs/_build
readthedocs/api

# ide
.idea
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ authors:
given-names: Maksym
orcid: "https://orcid.org/0000-0003-2056-8018"

cff-version: "1.1.0"
cff-version: 1.2.0
keywords:
- Word2Vec
- "similarity measures"
Expand Down
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ dataset.
s = msfilters.normalize_intensities(s)
s = msfilters.reduce_to_number_of_peaks(s, n_required=10, ratio_desired=0.5, n_max=500)
s = msfilters.select_by_mz(s, mz_from=0, mz_to=1000)
s = msfilters.add_losses(s, loss_mz_from=10.0, loss_mz_to=200.0)
s = msfilters.require_minimum_number_of_peaks(s, n_required=10)
return s

Expand All @@ -150,7 +149,7 @@ dataset.
spectrums = [s for s in spectrums if s is not None]

# Create spectrum documents
reference_documents = [SpectrumDocument(s, n_decimals=2) for s in spectrums]
reference_documents = [SpectrumDocument(s, n_decimals=2, loss_mz_from=10.0, loss_mz_to=200.0) for s in spectrums]

model_file = "references.model"
model = train_new_word2vec_model(reference_documents, iterations=[10, 20, 30], filename=model_file,
Expand Down
22 changes: 15 additions & 7 deletions conda/environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,23 @@ channels:
- bioconda
- conda-forge
- defaults
- nlesc
dependencies:
- gensim >=4.2.0
- matchms >=0.6.2
- numba >=0.51
- python
- gensim ==4.3.2
- matchms >=0.14.0, <=0.26.4
- numba
- numpy
- pip
- python >=3.7
- scipy
- tqdm
- pip:
- -e ..[dev]
- bump2version
- isort>=5.1.0
- pylint<2.12.0
- prospector
- pytest
- pytest-cov
- sphinx>=4.0.0
- sphinx_rtd_theme
- sphinxcontrib-apidoc
- yapf

13 changes: 0 additions & 13 deletions conda/environment.yml

This file was deleted.

46 changes: 12 additions & 34 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,65 +1,43 @@
{% set name = "spec2vec" %}
{% set version = "0.8.1" %}
{% set version = "0.8.0" %}

package:
name: {{ name|lower }}
version: {{ version }}

source:
path: ..

extra:
channels:
- nlesc
- conda-forge
- bioconda
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/spec2vec-{{ version }}.tar.gz
sha256: 0a5a4c3d79dcc4e2b22ad44bc04a67aee1f7789e42f1f0143c9a7ffef54ce5b0

build:
noarch: python
preserve_egg_dir: True
script: {{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation
number: 0
skip: True # [py2k]
script: {{ PYTHON }} -m pip install --no-deps --ignore-installed . -vv

requirements:
build:
- conda-build
- conda-verify
- pytest-runner
- python
- matchms >=0.6.2
- numpy {{ numpy }}
- setuptools
host:
- python >=3.7
- pip
- pytest-runner
- setuptools
run:
- gensim >=4.2.0
- matchms >=0.14.0, <=0.26.4
- numba >=0.51
- numpy
- pip
- python >=3.7
- scipy <=1.10.1
- gensim >=4.3.3
- matchms >=0.27.0
- tqdm

test:
imports:
- spec2vec
commands:
- pip check
requires:
- pip

about:
home: https://github.com/iomega/spec2vec
summary: Word2Vec based similarity measure of mass spectrometry data.
license: Apache-2.0
license_family: APACHE
license_file: LICENSE
summary: Word2Vec based similarity measure of mass spectrometry data.
description: Word2Vec based similarity measure of mass spectrometry data.
doc_url: https://spec2vec.readthedocs.io/
dev_url: https://github.com/iomega/spec2vec

extra:
recipe-maintainers:
- fdiblen
- florian-huber
- hechth
7 changes: 3 additions & 4 deletions integration-tests/test_user_workflow_spec2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
import gensim
import numpy as np
from matchms import calculate_scores
from matchms.filtering import (add_losses, add_parent_mass, default_filters,
from matchms.filtering import (add_parent_mass, default_filters,
normalize_intensities,
reduce_to_number_of_peaks,
require_minimum_number_of_peaks, select_by_mz)
from matchms.importing import load_from_mgf
from spec2vec import Spec2Vec, SpectrumDocument
from spec2vec import Spec2Vec, SpectrumDocumentWithLosses


def test_user_workflow_spec2vec():
Expand All @@ -26,7 +26,6 @@ def apply_my_filters(s):
s = normalize_intensities(s)
s = reduce_to_number_of_peaks(s, n_required=10, ratio_desired=0.5)
s = select_by_mz(s, mz_from=0, mz_to=1000)
s = add_losses(s, loss_mz_from=10.0, loss_mz_to=200.0)
s = require_minimum_number_of_peaks(s, n_required=5)
return s

Expand All @@ -40,7 +39,7 @@ def apply_my_filters(s):
spectrums = [s for s in spectrums if s is not None]

# convert spectrums to spectrum 'documents'
documents = [SpectrumDocument(s, n_decimals=1) for s in spectrums]
documents = [SpectrumDocumentWithLosses(s, n_decimals=1, loss_mz_from=10.0, loss_mz_to=200.0) for s in spectrums]

model_file = os.path.join(repository_root, "integration-tests", "test_user_workflow_spec2vec.model")
if os.path.isfile(model_file):
Expand Down
Loading