Biophysical
Mixin for sequence-level biophysical properties (e.g. GRAVY, molecular weight, pI) via Biopython ProtParam.
Biophysical characterization of peptide (and future protein) sequences.
Methods:
| Name | Description |
|---|---|
get_peptide_properties |
Compute peptide biophysical properties and annotate |
Source code in src/scpviz/pAnnData/biophysical.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |
get_peptide_properties
get_peptide_properties(
properties: Sequence[str] = DEFAULT_PEPTIDE_PROPERTIES,
*,
accessions: list[str] | None = None,
sequence_from: str | None = None,
force: bool = False,
return_copy: bool = False,
monoisotopic: bool = False,
charge_at_pH: float | None = None,
protein_scale: dict[str, float] | None = None,
protein_scale_window: int = 9,
protein_scale_edge: float = 1.0
) -> pd.DataFrame
Compute peptide biophysical properties for peptides in this object.
Supports local metrics (e.g. length) and Biopython ProtParam metrics.
Scalar metrics (e.g. gravy, molecular_weight, isoelectric_point)
are written to .pep.var unless return_copy=True. Dict- or list-valued
metrics are stored in object columns (e.g. aa_counts, flexibility).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
properties
|
list of str
|
Metric names to compute (local and/or Biopython; see
Supported properties below). Default: |
DEFAULT_PEPTIDE_PROPERTIES
|
accessions
|
list of str
|
Protein accessions or gene names. When
|
None
|
sequence_from
|
str
|
Column in |
None
|
force
|
bool
|
Required to compute properties for every peptide in the object. |
False
|
return_copy
|
bool
|
If |
False
|
monoisotopic
|
bool
|
Use monoisotopic mass for |
False
|
charge_at_pH
|
float
|
pH for |
None
|
protein_scale
|
dict
|
Amino-acid scale dict when |
None
|
protein_scale_window
|
int
|
Window size for |
9
|
protein_scale_edge
|
float
|
Edge weight for |
1.0
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: Columns |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Example
Peptide sequences only (no pAnnData): clean, then compute:
from scpviz import utils as scutils
raw_peptides = [
"[K].KPVVDCVVSVPCFYTDAER.[R]",
"[R].MQHNLEQQIQAR.[N] MOD:1xOxidation [M1]",
]
cleaned = [scutils.strip_peptide_sequence(p) for p in raw_peptides]
props = scutils.compute_peptide_properties(cleaned)
Peptides linked to a selected protein list (default: annotates .pep.var):
protein_list = ["P34932", "Q9CZW5"]
df = pdata.get_peptide_properties(accessions=protein_list)
df.head()
# accession peptide_id peptide_sequence gravy molecular_weight isoelectric_point
Single accession or gene name:
Mix local and Biopython metrics:
df = pdata.get_peptide_properties(
properties=["length", "gravy", "molecular_weight"],
accessions=protein_list,
)
Compute without modifying .pep.var:
All peptides in the object (may be slow; requires force=True):
Supported properties
Pass any mix of the names below in properties.
Local (scpviz, not Biopython):
length→length— amino-acid count of the cleaned sequence (len(sequence))
Biopython (Bio.SeqUtils.ProtParam.ProteinAnalysis method names). See
Bio.SeqUtils.ProtParam:
Scalar (one .pep.var / DataFrame column each):
gravy→gravymolecular_weight→molecular_weightaromaticity→aromaticityinstability_index→instability_indexisoelectric_point→isoelectric_pointcharge_at_pH→charge_at_pH_<pH>(requirescharge_at_pHkwarg)
Tuple-valued (split into multiple columns):
secondary_structure_fraction→ss_helix,ss_turn,ss_sheetmolar_extinction_coefficient→extinction_reduced,extinction_oxidized
Dict- or list-valued (object columns):
count_amino_acids→aa_counts(dict)get_amino_acids_percent→aa_percent(dict)flexibility→flexibility(list)protein_scale→protein_scale(list; requiresprotein_scale,protein_scale_window, andprotein_scale_edgekwargs)
Default properties: gravy, molecular_weight, isoelectric_point.
Note
Sequence parsing auto-detects DIA-NN (Stripped.Sequence) and Proteome
Discoverer (Annotated Sequence) formats.
Source code in src/scpviz/pAnnData/biophysical.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | |