SequenceSet and ComplexSet

Both collection classes support every transform. from_sequence_list stores results and returns None; export_features is the shared export method. spectrum_length and export_datatable remain compatibility spellings.

class protspect.features.SequenceSet(embedding=mappingproxy({'A': mappingproxy({'A': 8, 'R': -3, 'N': -4, 'D': -5, 'C': -2, 'Q': -2, 'E': -3, 'G': -1, 'H': -4, 'I': -4, 'L': -4, 'K': -2, 'M': -3, 'F': -5, 'P': -2, 'S': 1, 'T': -1, 'W': -6, 'Y': -5, 'V': -2}), 'R': mappingproxy({'A': -3, 'R': 10, 'N': -2, 'D': -5, 'C': -8, 'Q': 0, 'E': -2, 'G': -6, 'H': -1, 'I': -7, 'L': -6, 'K': 3, 'M': -4, 'F': -6, 'P': -5, 'S': -3, 'T': -3, 'W': -7, 'Y': -5, 'V': -6}), 'N': mappingproxy({'A': -4, 'R': -2, 'N': 11, 'D': 1, 'C': -5, 'Q': -1, 'E': -2, 'G': -2, 'H': 0, 'I': -7, 'L': -7, 'K': -1, 'M': -5, 'F': -7, 'P': -5, 'S': 0, 'T': -1, 'W': -8, 'Y': -5, 'V': -7}), 'D': mappingproxy({'A': -5, 'R': -5, 'N': 1, 'D': 10, 'C': -8, 'Q': -2, 'E': 2, 'G': -4, 'H': -3, 'I': -8, 'L': -8, 'K': -3, 'M': -8, 'F': -8, 'P': -5, 'S': -2, 'T': -4, 'W': -10, 'Y': -7, 'V': -8}), 'C': mappingproxy({'A': -2, 'R': -8, 'N': -5, 'D': -8, 'C': 14, 'Q': -7, 'E': -9, 'G': -7, 'H': -8, 'I': -3, 'L': -5, 'K': -8, 'M': -4, 'F': -4, 'P': -8, 'S': -3, 'T': -3, 'W': -7, 'Y': -6, 'V': -3}), 'Q': mappingproxy({'A': -2, 'R': 0, 'N': -1, 'D': -2, 'C': -7, 'Q': 11, 'E': 2, 'G': -5, 'H': 1, 'I': -6, 'L': -5, 'K': 2, 'M': -2, 'F': -6, 'P': -4, 'S': -2, 'T': -3, 'W': -5, 'Y': -4, 'V': -5}), 'E': mappingproxy({'A': -3, 'R': -2, 'N': -2, 'D': 2, 'C': -9, 'Q': 2, 'E': 10, 'G': -6, 'H': -2, 'I': -7, 'L': -7, 'K': 0, 'M': -5, 'F': -8, 'P': -4, 'S': -2, 'T': -3, 'W': -8, 'Y': -7, 'V': -5}), 'G': mappingproxy({'A': -1, 'R': -6, 'N': -2, 'D': -4, 'C': -7, 'Q': -5, 'E': -6, 'G': 9, 'H': -6, 'I': -9, 'L': -8, 'K': -5, 'M': -7, 'F': -8, 'P': -6, 'S': -2, 'T': -5, 'W': -7, 'Y': -8, 'V': -8}), 'H': mappingproxy({'A': -4, 'R': -1, 'N': 0, 'D': -3, 'C': -8, 'Q': 1, 'E': -2, 'G': -6, 'H': 13, 'I': -7, 'L': -6, 'K': -3, 'M': -5, 'F': -4, 'P': -5, 'S': -3, 'T': -4, 'W': -5, 'Y': 1, 'V': -7}), 'I': mappingproxy({'A': -4, 'R': -7, 'N': -7, 'D': -8, 'C': -3, 'Q': -6, 'E': -7, 'G': -9, 'H': -7, 'I': 8, 'L': 2, 'K': -6, 'M': 1, 'F': -2, 'P': -7, 'S': -5, 'T': -3, 'W': -6, 'Y': -4, 'V': 4}), 'L': mappingproxy({'A': -4, 'R': -6, 'N': -7, 'D': -8, 'C': -5, 'Q': -5, 'E': -7, 'G': -8, 'H': -6, 'I': 2, 'L': 8, 'K': -6, 'M': 3, 'F': 0, 'P': -7, 'S': -6, 'T': -4, 'W': -5, 'Y': -4, 'V': 0}), 'K': mappingproxy({'A': -2, 'R': 3, 'N': -1, 'D': -3, 'C': -8, 'Q': 2, 'E': 0, 'G': -5, 'H': -3, 'I': -6, 'L': -6, 'K': 10, 'M': -4, 'F': -6, 'P': -3, 'S': -2, 'T': -3, 'W': -8, 'Y': -5, 'V': -5}), 'M': mappingproxy({'A': -3, 'R': -4, 'N': -5, 'D': -8, 'C': -4, 'Q': -2, 'E': -5, 'G': -7, 'H': -5, 'I': 1, 'L': 3, 'K': -4, 'M': 12, 'F': -1, 'P': -5, 'S': -4, 'T': -2, 'W': -4, 'Y': -5, 'V': 0}), 'F': mappingproxy({'A': -5, 'R': -6, 'N': -7, 'D': -8, 'C': -4, 'Q': -6, 'E': -8, 'G': -8, 'H': -4, 'I': -2, 'L': 0, 'K': -6, 'M': -1, 'F': 11, 'P': -7, 'S': -5, 'T': -5, 'W': 0, 'Y': 4, 'V': -3}), 'P': mappingproxy({'A': -2, 'R': -5, 'N': -5, 'D': -5, 'C': -8, 'Q': -4, 'E': -4, 'G': -6, 'H': -5, 'I': -7, 'L': -7, 'K': -3, 'M': -5, 'F': -7, 'P': 12, 'S': -3, 'T': -4, 'W': -8, 'Y': -7, 'V': -6}), 'S': mappingproxy({'A': 1, 'R': -3, 'N': 0, 'D': -2, 'C': -3, 'Q': -2, 'E': -2, 'G': -2, 'H': -3, 'I': -5, 'L': -6, 'K': -2, 'M': -4, 'F': -5, 'P': -3, 'S': 9, 'T': 2, 'W': -7, 'Y': -5, 'V': -4}), 'T': mappingproxy({'A': -1, 'R': -3, 'N': -1, 'D': -4, 'C': -3, 'Q': -3, 'E': -3, 'G': -5, 'H': -4, 'I': -3, 'L': -4, 'K': -3, 'M': -2, 'F': -5, 'P': -4, 'S': 2, 'T': 9, 'W': -7, 'Y': -5, 'V': -1}), 'W': mappingproxy({'A': -6, 'R': -7, 'N': -8, 'D': -10, 'C': -7, 'Q': -5, 'E': -8, 'G': -7, 'H': -5, 'I': -6, 'L': -5, 'K': -8, 'M': -4, 'F': 0, 'P': -8, 'S': -7, 'T': -7, 'W': 17, 'Y': 2, 'V': -5}), 'Y': mappingproxy({'A': -5, 'R': -5, 'N': -5, 'D': -7, 'C': -6, 'Q': -4, 'E': -7, 'G': -8, 'H': 1, 'I': -4, 'L': -4, 'K': -5, 'M': -5, 'F': 4, 'P': -7, 'S': -5, 'T': -5, 'W': 2, 'Y': 12, 'V': -5}), 'V': mappingproxy({'A': -2, 'R': -6, 'N': -7, 'D': -8, 'C': -3, 'Q': -5, 'E': -5, 'G': -8, 'H': -7, 'I': 4, 'L': 0, 'K': -5, 'M': 0, 'F': -3, 'P': -6, 'S': -4, 'T': -1, 'W': -5, 'Y': -5, 'V': 8})}), compute_cross_spectra=True, *, normalization='none', center=False, method='fourier', transform_options=None)[source]

Compute features for sequences sharing one embedding and transform grid.

Parameters:
  • embedding (mapping, optional) – Channel-to-residue score mappings; defaults to canonical BLOSUM100.

  • compute_cross_spectra (bool, optional) – Compute within-sequence channel cross-products, including auto-spectra.

  • method ({'fourier', 'z', 'mellin', 'wavelet'}, optional) – Transform used by all sequences. Defaults to Fourier.

  • transform_options (mapping, optional) – Backend options such as radius, mellin_c, wavelet, level, and mode.

  • normalization ({"none", "length", "sqrt_length", "energy"}, optional) – Per-channel scaling before transformation.

  • center (bool, optional) – Center each channel over actual residues before scaling and padding.

from_sequence_list(sequences, spectrum_length=None, attributes=None, *, length=None)[source]

Populate the set from an iterable of nonempty sequence strings.

length defaults to the smallest power of two covering the longest sequence. spectrum_length is the compatibility spelling; do not provide both. attributes maps metadata names to equal-length columns, one value per sequence. Mutates this object and returns None.

export_features(component='amplitude', *, kinds=('coefficients',), selector=None, attributes=None)[source]

Return a DataFrame for any backend using TransformResult.features.

All sequences share one grid. selector receives a coordinate dictionary; kinds can include aligned within-sequence cross_coefficients. Metadata columns must not collide with feature names. Populate the set first.

class protspect.features.ComplexSet(embedding=mappingproxy({'A': mappingproxy({'A': 8, 'R': -3, 'N': -4, 'D': -5, 'C': -2, 'Q': -2, 'E': -3, 'G': -1, 'H': -4, 'I': -4, 'L': -4, 'K': -2, 'M': -3, 'F': -5, 'P': -2, 'S': 1, 'T': -1, 'W': -6, 'Y': -5, 'V': -2}), 'R': mappingproxy({'A': -3, 'R': 10, 'N': -2, 'D': -5, 'C': -8, 'Q': 0, 'E': -2, 'G': -6, 'H': -1, 'I': -7, 'L': -6, 'K': 3, 'M': -4, 'F': -6, 'P': -5, 'S': -3, 'T': -3, 'W': -7, 'Y': -5, 'V': -6}), 'N': mappingproxy({'A': -4, 'R': -2, 'N': 11, 'D': 1, 'C': -5, 'Q': -1, 'E': -2, 'G': -2, 'H': 0, 'I': -7, 'L': -7, 'K': -1, 'M': -5, 'F': -7, 'P': -5, 'S': 0, 'T': -1, 'W': -8, 'Y': -5, 'V': -7}), 'D': mappingproxy({'A': -5, 'R': -5, 'N': 1, 'D': 10, 'C': -8, 'Q': -2, 'E': 2, 'G': -4, 'H': -3, 'I': -8, 'L': -8, 'K': -3, 'M': -8, 'F': -8, 'P': -5, 'S': -2, 'T': -4, 'W': -10, 'Y': -7, 'V': -8}), 'C': mappingproxy({'A': -2, 'R': -8, 'N': -5, 'D': -8, 'C': 14, 'Q': -7, 'E': -9, 'G': -7, 'H': -8, 'I': -3, 'L': -5, 'K': -8, 'M': -4, 'F': -4, 'P': -8, 'S': -3, 'T': -3, 'W': -7, 'Y': -6, 'V': -3}), 'Q': mappingproxy({'A': -2, 'R': 0, 'N': -1, 'D': -2, 'C': -7, 'Q': 11, 'E': 2, 'G': -5, 'H': 1, 'I': -6, 'L': -5, 'K': 2, 'M': -2, 'F': -6, 'P': -4, 'S': -2, 'T': -3, 'W': -5, 'Y': -4, 'V': -5}), 'E': mappingproxy({'A': -3, 'R': -2, 'N': -2, 'D': 2, 'C': -9, 'Q': 2, 'E': 10, 'G': -6, 'H': -2, 'I': -7, 'L': -7, 'K': 0, 'M': -5, 'F': -8, 'P': -4, 'S': -2, 'T': -3, 'W': -8, 'Y': -7, 'V': -5}), 'G': mappingproxy({'A': -1, 'R': -6, 'N': -2, 'D': -4, 'C': -7, 'Q': -5, 'E': -6, 'G': 9, 'H': -6, 'I': -9, 'L': -8, 'K': -5, 'M': -7, 'F': -8, 'P': -6, 'S': -2, 'T': -5, 'W': -7, 'Y': -8, 'V': -8}), 'H': mappingproxy({'A': -4, 'R': -1, 'N': 0, 'D': -3, 'C': -8, 'Q': 1, 'E': -2, 'G': -6, 'H': 13, 'I': -7, 'L': -6, 'K': -3, 'M': -5, 'F': -4, 'P': -5, 'S': -3, 'T': -4, 'W': -5, 'Y': 1, 'V': -7}), 'I': mappingproxy({'A': -4, 'R': -7, 'N': -7, 'D': -8, 'C': -3, 'Q': -6, 'E': -7, 'G': -9, 'H': -7, 'I': 8, 'L': 2, 'K': -6, 'M': 1, 'F': -2, 'P': -7, 'S': -5, 'T': -3, 'W': -6, 'Y': -4, 'V': 4}), 'L': mappingproxy({'A': -4, 'R': -6, 'N': -7, 'D': -8, 'C': -5, 'Q': -5, 'E': -7, 'G': -8, 'H': -6, 'I': 2, 'L': 8, 'K': -6, 'M': 3, 'F': 0, 'P': -7, 'S': -6, 'T': -4, 'W': -5, 'Y': -4, 'V': 0}), 'K': mappingproxy({'A': -2, 'R': 3, 'N': -1, 'D': -3, 'C': -8, 'Q': 2, 'E': 0, 'G': -5, 'H': -3, 'I': -6, 'L': -6, 'K': 10, 'M': -4, 'F': -6, 'P': -3, 'S': -2, 'T': -3, 'W': -8, 'Y': -5, 'V': -5}), 'M': mappingproxy({'A': -3, 'R': -4, 'N': -5, 'D': -8, 'C': -4, 'Q': -2, 'E': -5, 'G': -7, 'H': -5, 'I': 1, 'L': 3, 'K': -4, 'M': 12, 'F': -1, 'P': -5, 'S': -4, 'T': -2, 'W': -4, 'Y': -5, 'V': 0}), 'F': mappingproxy({'A': -5, 'R': -6, 'N': -7, 'D': -8, 'C': -4, 'Q': -6, 'E': -8, 'G': -8, 'H': -4, 'I': -2, 'L': 0, 'K': -6, 'M': -1, 'F': 11, 'P': -7, 'S': -5, 'T': -5, 'W': 0, 'Y': 4, 'V': -3}), 'P': mappingproxy({'A': -2, 'R': -5, 'N': -5, 'D': -5, 'C': -8, 'Q': -4, 'E': -4, 'G': -6, 'H': -5, 'I': -7, 'L': -7, 'K': -3, 'M': -5, 'F': -7, 'P': 12, 'S': -3, 'T': -4, 'W': -8, 'Y': -7, 'V': -6}), 'S': mappingproxy({'A': 1, 'R': -3, 'N': 0, 'D': -2, 'C': -3, 'Q': -2, 'E': -2, 'G': -2, 'H': -3, 'I': -5, 'L': -6, 'K': -2, 'M': -4, 'F': -5, 'P': -3, 'S': 9, 'T': 2, 'W': -7, 'Y': -5, 'V': -4}), 'T': mappingproxy({'A': -1, 'R': -3, 'N': -1, 'D': -4, 'C': -3, 'Q': -3, 'E': -3, 'G': -5, 'H': -4, 'I': -3, 'L': -4, 'K': -3, 'M': -2, 'F': -5, 'P': -4, 'S': 2, 'T': 9, 'W': -7, 'Y': -5, 'V': -1}), 'W': mappingproxy({'A': -6, 'R': -7, 'N': -8, 'D': -10, 'C': -7, 'Q': -5, 'E': -8, 'G': -7, 'H': -5, 'I': -6, 'L': -5, 'K': -8, 'M': -4, 'F': 0, 'P': -8, 'S': -7, 'T': -7, 'W': 17, 'Y': 2, 'V': -5}), 'Y': mappingproxy({'A': -5, 'R': -5, 'N': -5, 'D': -7, 'C': -6, 'Q': -4, 'E': -7, 'G': -8, 'H': 1, 'I': -4, 'L': -4, 'K': -5, 'M': -5, 'F': 4, 'P': -7, 'S': -5, 'T': -5, 'W': 2, 'Y': 12, 'V': -5}), 'V': mappingproxy({'A': -2, 'R': -6, 'N': -7, 'D': -8, 'C': -3, 'Q': -5, 'E': -5, 'G': -8, 'H': -7, 'I': 4, 'L': 0, 'K': -5, 'M': 0, 'F': -3, 'P': -6, 'S': -4, 'T': -1, 'W': -5, 'Y': -5, 'V': 8})}), compute_cross_cross_spectra=False, *, normalization='none', center=False, method='fourier', transform_options=None)[source]

Compute ordered cross-chain products for paired sequences.

embedding defaults to BLOSUM100. The historical compute_cross_cross_spectra option is unimplemented; True raises NotImplementedError rather than silently doing nothing. normalization and center follow SequenceFFT.compute_spectra and are applied to each chain independently before cross-products. method selects fourier, z, mellin, or wavelet; transform_options supplies the backend options. Use export_features for every backend. export_datatable is a Fourier-only compatibility adapter with the original frequency selectors and names.

from_sequence_list(A_sequences, B_sequences, spectrum_length=None, attributes=None, *, length=None)[source]

Populate equally sized collections of paired A/B sequence strings.

All chains share length (or compatibility spectrum_length), defaulting to the smallest power of two covering the longest chain. Attribute columns have one value per pair. A and B store chain results; AB stores every ordered channel product after each chain’s preprocessing. Fourier compatibility attributes are also available when method=’fourier’.

export_features(component='amplitude', *, chain_ID='AB', kinds=('coefficients',), selector=None, attributes=None)[source]

Export either chain or ordered A/B coefficient products for any backend.

chain_ID is A, B, or AB. Paired products use every A/B channel combination; wavelet products remain band/position features, not Fourier cross-spectra.