Skip to content

Commit

Permalink
dssp imports
Browse files Browse the repository at this point in the history
  • Loading branch information
edikedik committed Aug 27, 2024
1 parent 351e826 commit a81ee00
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions lXtractor/ext/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from .pdb_ import PDB, filter_by_method
from .sifts import SIFTS
from .uniprot import fetch_uniprot, UniProt
from .dssp import dssp_run, dssp_to_df, dssp_set_ss_annotation, DSSP_COLUMNS
3 changes: 3 additions & 0 deletions lXtractor/ext/dssp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from lXtractor.core import GenericStructure, ProteinStructure
from lXtractor.util import load_structure, save_structure, run_sp

__all__ = ["dssp_to_df", "dssp_run", "dssp_set_ss_annotation"]

DSSP_TO_SS8 = {"H": "H", "G": "G", "I": "I", "E": "E", "B": "B", "T": "T", "S": "S"}
DSSP_TO_SS3 = {"H": "H", "G": "H", "I": "H", "E": "E", "B": "E"}
DSSP_COLUMNS = (
Expand Down Expand Up @@ -74,6 +76,7 @@ def dssp_to_df(output: str | Path) -> pd.DataFrame:
additional columns: "ss8" and "ss3" with secondary structure
designations (original 8-state and converted 3-state).
"""

def parse(lines: abc.Iterable[str]) -> abc.Iterable[str]:
lines = filter(lambda x: bool(x.strip()), lines)
lines = dropwhile(lambda x: not x.startswith(" # RESIDUE AA "), lines)
Expand Down
3 changes: 2 additions & 1 deletion test/test_dssp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
import pandas as pd
import pytest

from lXtractor.ext.dssp import dssp_run, DSSP_COLUMNS
from lXtractor.ext import dssp_run
from lXtractor.ext.dssp import DSSP_COLUMNS
from lXtractor.util import load_structure
from test.common import ALL_STRUCTURES

Expand Down

0 comments on commit a81ee00

Please sign in to comment.