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
3 changes: 1 addition & 2 deletions pori_python/ipr/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os
import pandas as pd
import re
from Bio.Data.IUPACData import protein_letters_3to1
from numpy import nan
from typing import Any, Callable, Dict, Iterable, List, Set, Tuple, cast

Expand All @@ -31,7 +30,7 @@
TMB_SIGNATURE,
TMB_SIGNATURE_VARIANT_TYPE,
)
from .util import hash_key, logger, pandas_falsy
from .util import hash_key, logger, pandas_falsy, protein_letters_3to1

protein_letters_3to1.setdefault("Ter", "*")

Expand Down
34 changes: 34 additions & 0 deletions pori_python/ipr/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,37 @@ def get_preferred_gene_name(
def pandas_falsy(field: Any) -> bool:
"""Check if a field is python falsy or pandas null."""
return bool(pd.isnull(field) or not field)


# the below is copied from
# https://github.com/biopython/biopython/blob/master/Bio/Data/IUPACData.py
# to allow us to remove otherwise unnecessary biopython dependency

protein_letters_1to3 = {
"A": "Ala",
"C": "Cys",
"D": "Asp",
"E": "Glu",
"F": "Phe",
"G": "Gly",
"H": "His",
"I": "Ile",
"K": "Lys",
"L": "Leu",
"M": "Met",
"N": "Asn",
"P": "Pro",
"Q": "Gln",
"R": "Arg",
"S": "Ser",
"T": "Thr",
"V": "Val",
"W": "Trp",
"Y": "Tyr",
}
protein_letters_1to3_extended = {
**protein_letters_1to3,
**{"B": "Asx", "X": "Xaa", "Z": "Glx", "J": "Xle", "U": "Sec", "O": "Pyl"},
}

protein_letters_3to1 = {value: key for key, value in protein_letters_1to3.items()}
1 change: 0 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ python_requires = >=3.9
dependency_links = []
include_package_data = true
install_requires =
biopython
jsonschema
pandas>=1.1.0
requests
Expand Down