Skip to content
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
python-version: ["3.10", "3.12", "3.13"]

steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
Expand All @@ -29,7 +29,7 @@ jobs:
pip install uv
uv pip install flake8 pytest sentencepiece rdkit --system
uv pip install git+https://github.com/novonordisk-research/pepfunn.git --system
uv pip install . "transformers<5" --system
uv pip install . "transformers<5.13" --system
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
Expand Down
12 changes: 8 additions & 4 deletions autopeptideml/db/negative_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def add_negatives_from_db(
verbose: bool = True,
sample_by: str = 'mw',
n_jobs: int = cpu_count(),
random_state: int = 1
random_state: int = 1,
_to_seq: bool = False
) -> pd.DataFrame:
"""
Augments a dataset with negative samples from a target database to achieve a desired negative/positive ratio.
Expand Down Expand Up @@ -206,7 +207,7 @@ def add_negatives_from_db(

if isinstance(target_db, pd.DataFrame):
db = target_db

path = None
else:
db, path = get_neg_db(target_db, verbose=verbose, return_path=True)

Expand All @@ -231,11 +232,14 @@ def add_negatives_from_db(
n_bins = 50
else:
n_bins = 10
if 'sequence' not in db:
if 'sequence' not in db and _to_seq:
from autopeptideml.pipeline import get_pipeline
pipe = get_pipeline('to-sequences')
db['sequence'] = pipe(db['smiles'], n_jobs=n_jobs, verbose=verbose)
db.to_csv(path, index=False)
if path is not None:
db.to_csv(path, index=False)
if not _to_seq:
db['sequence'] = [None for s in range(len(db))]
db[sample_by], disc = discretizer(db[sample_by].to_numpy(),
n_bins=n_bins,
return_discretizer=True)
Expand Down
Loading