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
Binary file added .DS_Store
Binary file not shown.
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- run: pip install ruff
- run: ruff check pepdata/

test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: |
pip install pytest pytest-cov
pip install -r requirements.txt
pip install .
- run: pytest tests/
Binary file added .hypothesis/unicode_data/13.0.0/charmap.json.gz
Binary file not shown.
7 changes: 2 additions & 5 deletions lint.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#!/bin/bash
set -o errexit

find pepdata test -name '*.py' \
| xargs pylint \
--errors-only \
--disable=print-statement
ruff check pepdata/ tests/

echo 'Passes pylint check'
echo 'Passes ruff check'
Binary file added pepdata/.DS_Store
Binary file not shown.
2 changes: 0 additions & 2 deletions pepdata/amino_acid.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
# limitations under the License.


from __future__ import print_function, division, absolute_import

class AminoAcid(object):
def __init__(
self, full_name, short_name, letter, contains=None):
Expand Down
2 changes: 0 additions & 2 deletions pepdata/amino_acid_alphabet.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
Quantify amino acids by their physical/chemical properties
"""

from __future__ import print_function, division, absolute_import

import numpy as np

from .amino_acid import AminoAcid
Expand Down
2 changes: 0 additions & 2 deletions pepdata/amino_acid_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import

from .amino_acid_alphabet import letter_to_index

"""
Expand Down
2 changes: 0 additions & 2 deletions pepdata/blosum.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import

from os.path import join

from .static_data import MATRIX_DIR
Expand Down
2 changes: 0 additions & 2 deletions pepdata/chou_fasman.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import

from .amino_acid_alphabet import amino_acid_name_indices

# Chou-Fasman of structural properties from
Expand Down
2 changes: 0 additions & 2 deletions pepdata/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# limitations under the License.


from __future__ import print_function, division, absolute_import

import numpy as np

def transform_peptide(peptide, property_dict):
Expand Down
3 changes: 1 addition & 2 deletions pepdata/iedb/alleles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import
from collections import namedtuple
import os
import xml
Expand Down Expand Up @@ -63,7 +62,7 @@ class and source organism.
continue
name = name_element.text

synonyms = set([])
synonyms = set()
for synonym_element in allele.iterfind("Synonyms"):
for synonym in synonym_element.text.split(","):
synonyms.add(synonym.strip())
Expand Down
2 changes: 0 additions & 2 deletions pepdata/iedb/memoize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import

from functools import wraps

def _prepare_memoization_key(args, kwargs):
Expand Down
3 changes: 2 additions & 1 deletion pepdata/iedb/mhc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -10,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import
import logging
import os

Expand Down
31 changes: 11 additions & 20 deletions pepdata/iedb/tcell.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand All @@ -11,7 +13,6 @@
# limitations under the License.


from __future__ import print_function, division, absolute_import
import logging
import os

Expand All @@ -24,15 +25,9 @@
from .common import bad_amino_acids, cache
from .columns import (
get_assay_method,
get_assay_num_tested,
get_assay_response_measured,
get_assay_units,
get_host_name,
get_mhc_allele,
get_mhc_assay,
get_mhc_class,
get_epitope_source_organism,
get_epitope_type,
get_epitope_name,

)
Expand Down Expand Up @@ -119,10 +114,10 @@ def load_dataframe(
encoding="latin-1")

mhc = get_mhc_allele(df)
mhc_class = get_mhc_class(df)
mhc_class_series = get_mhc_class(df)
epitopes = get_epitope_name(df)
organism = get_host_name(df)
assay_method = get_assay_method(df)
assay_method_series = get_assay_method(df)


# Sometimes the IEDB seems to put in an extra comma in the
Expand Down Expand Up @@ -177,23 +172,19 @@ def load_dataframe(
# "HLA-Class I,allele undetermined"
# or
# "Class I,allele undetermined"
]

if hla:
mask &= df[mhc_allele_column_key].str.contains(hla, na=False)

if exclude_hla:
mask &= ~(df[mhc_allele_column_key].str.contains(exclude_hla, na=False))
if mhc_pattern:
mask &= mhc.str.contains(mhc_pattern, na=False)

if assay_group:
mask &= df[assay_group_column_key].str.contains(assay_group)
if exclude_mhc:
mask &= ~(mhc.str.contains(exclude_mhc, na=False))

if assay_method:
mask &= df[assay_method_column_key].str.contains(assay_method)
if assay_method is not None and assay_method_series is not None:
mask &= assay_method_series.str.contains(assay_method, na=False)

if peptide_length:
assert peptide_length > 0
mask &= df[epitope_column_key].str.len() == peptide_length
mask &= epitopes.str.len() == peptide_length

df = df[mask]

Expand Down
4 changes: 1 addition & 3 deletions pepdata/peptide_vectorizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# limitations under the License.


from __future__ import print_function, division, absolute_import

import numpy as np
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.preprocessing import normalize
Expand All @@ -28,7 +26,7 @@ def make_count_vectorizer(reduced_alphabet, max_ngram):
return CountVectorizer(
analyzer='char',
ngram_range=(1, max_ngram),
dtype=np.float,
dtype=np.float64,
preprocessor=preprocessor)

class PeptideVectorizer(object):
Expand Down
1 change: 0 additions & 1 deletion pepdata/pmbec.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import
from os.path import join

from .static_data import MATRIX_DIR
Expand Down
2 changes: 0 additions & 2 deletions pepdata/reduced_alphabet.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
Peterson, Kondev, et al.
http://www.rpgroup.caltech.edu/publications/Peterson2008.pdf
"""
from __future__ import print_function, division, absolute_import

def dict_from_list(groups):
aa_to_group = {}
for i, group in enumerate(groups):
Expand Down
2 changes: 0 additions & 2 deletions pepdata/residue_contact_energies.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from __future__ import print_function, division, absolute_import

from os.path import join

from .amino_acid_alphabet import canonical_amino_acid_letters, dict_to_amino_acid_matrix
Expand Down
1 change: 0 additions & 1 deletion pepdata/static_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# limitations under the License.


from __future__ import print_function, division, absolute_import
from os.path import dirname, realpath, join

PACKAGE_DIR = dirname(realpath(__file__))
Expand Down
2 changes: 1 addition & 1 deletion pepdata/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.2.0"
__version__ = "1.2.2"


def print_version():
Expand Down
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[build-system]
requires = ["setuptools>=64"]
build-backend = "setuptools.build_meta"

[project]
name = "pepdata"
requires-python = ">=3.9"
authors = [{name="Alex Rubinsteyn", email="alex.rubinsteyn@mssm.edu"}]
description = "Immunological peptide datasets and amino acid properties"
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Console",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Topic :: Scientific/Engineering :: Bio-Informatics",
]
readme = "README.md"
dynamic = ["version", "dependencies"]

[tool.setuptools.dynamic]
version = {attr = "pepdata.version.__version__"}
dependencies = {file = ["requirements.txt"]}

[tool.setuptools.packages.find]
exclude = ["test", "test.*"]

[project.urls]
"Homepage" = "https://github.com/openvax/pepdata"
"Bug Tracker" = "https://github.com/openvax/pepdata/issues"

[tool.ruff.lint]
select = ["E", "F"]
ignore = ["F821", "E501", "F841", "E731", "E741", "E722", "E721"]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401"]
"test*/*" = ["F401"]
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy>=1.7
numpy>=2.0.0,<3.0.0
scipy>=0.9
pandas>=0.17
scikit-learn>=0.14.1
Expand Down
76 changes: 0 additions & 76 deletions setup.py

This file was deleted.

Loading
Loading