UNPKG

sequaljs

Version:

JavaScript/TypeScript library for parsing and manipulating ProForma peptide sequence notation

516 lines 16.9 kB
import { BaseBlock } from "./base_block"; /** * Represents a value in a ProForma modification string. */ export declare class PipeValue { static SYNONYM: string; static INFO_TAG: string; static MASS: string; static OBSERVED_MASS: string; static CROSSLINK: string; static BRANCH: string; static AMBIGUITY: string; static GLYCAN: string; static GAP: string; static FORMULA: string; value: string; private _type; crosslinkId: string | null; isBranch: boolean; isBranchRef: boolean; isCrosslinkRef: boolean; ambiguityGroup: string | null; isAmbiguityRef: boolean; localizationScore: number | null; source: string | null; originalValue: string | null; mass: number | null; observedMass: number | null; isValidGlycan: boolean; isValidFormula: boolean; assignedTypes: string[]; charge: string | null; chargeValue: number | null; /** * Initializes a PipeValue object. * * @param value - The value of the pipe value. * @param valueType - The type of the pipe value. * @param originalValue - The original value of the pipe value. */ constructor(value: string, valueType: string, originalValue?: string | null); /** * Extracts properties from the value. * @private */ private _extractProperties; /** * Returns a string representation of the pipe value. * @returns The string representation. */ toString(): string; /** * Gets the type of the pipe value. */ get type(): string; /** * Sets the type of the pipe value. * @param value - The new type. */ set type(value: string); /** * Assigns a type to the pipe value. * @param value - The type to assign. */ assignType(value: string): void; } /** * Represents the value of a modification. */ export declare class ModificationValue { private static KNOWN_SOURCES; private _primaryValue; private _source; private _mass; private _pipeValues; /** * Initializes a ModificationValue object. * * @param value - The value of the modification. * @param mass - The mass of the modification. */ constructor(value: string, mass?: number | null); /** * Validates a glycan string. * * @param glycan - The glycan string to validate. * @returns True if the glycan is valid, false otherwise. */ static validateGlycan(glycan: string): boolean; /** * Validates a formula string. * * @param formula - The formula string to validate. * @returns True if the formula is valid, false otherwise. */ static validateFormula(formula: string): boolean; /** * Gets the localization score of the modification. */ get localizationScore(): number | null; /** * Parses the value of the modification. * @param value - The value to parse. * @private */ private _parseValue; /** * Processes the primary value of the modification. * @param value - The primary value to process. * @private */ private _processPrimaryValue; /** * Validates a glycan string. * @param glycan - The glycan string to validate. * @returns True if the glycan is valid, false otherwise. * @private */ private static _validateGlycan; /** * Validates a custom monosaccharide formula. * @param formula - The formula to validate. * @returns True if the formula is valid, false otherwise. * @private */ private static _validateCustomMonosaccharide; /** * Validates a formula string. * @param formula - The formula to validate. * @returns True if the formula is valid, false otherwise. * @private */ private static _validateFormula; /** * Processes a pipe component of the modification. * @param component - The pipe component to process. * @private */ private _processPipeComponent; /** * Gets the source of the modification. */ get source(): string | null; /** * Gets the primary value of the modification. */ get primaryValue(): string; /** * Gets the mass of the modification. */ get mass(): number | null; /** * Gets the pipe values of the modification. */ get pipeValues(): PipeValue[]; /** * Gets the info tags of the modification. */ get infoTags(): string[]; /** * Gets the synonyms of the modification. */ get synonyms(): string[]; /** * Gets the observed mass of the modification. */ get observedMass(): number | null; /** * Gets the ambiguity group of the modification. */ get ambiguityGroup(): string | null; /** * Checks if the modification is an ambiguity reference. */ get isAmbiguityRef(): boolean; /** * Checks if the modification is a crosslink reference. */ get isCrosslinkRef(): boolean; /** * Checks if the modification is a branch reference. */ get isBranchRef(): boolean; /** * Checks if the modification is a branch. */ get isBranch(): boolean; /** * Gets the crosslink ID of the modification. */ get crossLinkId(): string | null; } /** * Represents a modification to a sequence. */ export declare class Modification extends BaseBlock { static readonly KNOWN_SOURCES: Set<string>; private _source; private _originalValue; private _crosslinkId; private _isCrosslinkRef; private _isBranchRef; private _isBranch; private _isAmbiguityRef; private _ambiguityGroup; private _regex; private _modType; private _labile; private _labileNumber; private _fullName; private _allFilled; private _modValue; inRange: boolean; rangeStart: number | null; rangeEnd: number | null; localizationScore: number | null; private _isIonType; private _positionConstraint; private _limitPerPosition; private _colocalizeKnown; private _colocalizeUnknown; /** * Initializes a Modification object. * * @param value - The value of the modification. * @param position - The position of the modification in the sequence. * @param regexPattern - The regex pattern for the modification. * @param fullName - The full name of the modification. * @param modType - The type of the modification. * @param labile - Whether the modification is labile. * @param labilNumber - The labile number of the modification. * @param mass - The mass of the modification. * @param allFilled - Whether all positions of the modification are filled. * @param crosslinkId - The crosslink ID of the modification. * @param isCrosslinkRef - Whether the modification is a crosslink reference. * @param isBranchRef - Whether the modification is a branch reference. * @param isBranch - Whether the modification is a branch. * @param ambiguityGroup - The ambiguity group of the modification. * @param isAmbiguityRef - Whether the modification is an ambiguity reference. * @param inRange - Whether the modification is in a range. * @param rangeStart - The start of the range. * @param rangeEnd - The end of the range. * @param localizationScore - The localization score of the modification. * @param modValue - The modification value. * @param isIonType - Whether the modification is an ion type. * @param positionConstraint - The position constraint of the modification. * @param limitPerPosition - The limit per position of the modification. * @param colocalizeKnown - Whether to colocalize known modifications. * @param colocalizeUnknown - Whether to colocalize unknown modifications. */ constructor(value: string, position?: number, regexPattern?: string, fullName?: string, modType?: string, labile?: boolean, labilNumber?: number, mass?: number, allFilled?: boolean, crosslinkId?: string, isCrosslinkRef?: boolean, isBranchRef?: boolean, isBranch?: boolean, ambiguityGroup?: string, isAmbiguityRef?: boolean, inRange?: boolean, rangeStart?: number, rangeEnd?: number, localizationScore?: number, modValue?: ModificationValue, isIonType?: boolean, positionConstraint?: string[], limitPerPosition?: number, colocalizeKnown?: boolean, colocalizeUnknown?: boolean); /** * Gets the value of the modification. */ get value(): string; /** * Sets the value of the modification. * @param val - The new value. */ set value(val: string); /** * Gets the mass of the modification. */ get mass(): number; /** * Sets the mass of the modification. * @param val - The new mass. */ set mass(val: number); /** * Gets the observed mass of the modification. */ get observedMass(): number | null; /** * Gets the ambiguity group of the modification. */ get ambiguityGroup(): string | null; /** * Checks if the modification is an ambiguity reference. */ get isAmbiguityRef(): boolean; /** * Gets the synonyms of the modification. */ get synonyms(): string[]; /** * Gets the modification value. */ get modValue(): ModificationValue; /** * Sets the modification value. * @param val - The new modification value. */ set modValue(val: ModificationValue); /** * Gets the info tags of the modification. */ get infoTags(): string[]; /** * Gets the crosslink ID of the modification. */ get crosslinkId(): string | null; /** * Checks if the modification is a crosslink reference. */ get isCrosslinkRef(): boolean; /** * Gets the source of the modification. */ get source(): string | null; /** * Gets the original value of the modification. */ get originalValue(): string; /** * Gets the regex pattern of the modification. */ get regex(): RegExp | null; /** * Gets the type of the modification. */ get modType(): string; /** * Checks if the modification is labile. */ get labile(): boolean; /** * Gets the labile number of the modification. */ get labileNumber(): number; /** * Gets the full name of the modification. */ get fullName(): string | null; /** * Checks if all positions of the modification are filled. */ get allFilled(): boolean; /** * Checks if the modification is an ion type. */ get isIonType(): boolean; /** * Gets the position constraint of the modification. */ getPositionConstraint(): string[] | null; /** * Gets the limit per position of the modification. */ getLimitPerPosition(): number | null; /** * Checks if to colocalize known modifications. */ getColocalizeKnown(): boolean; /** * Checks if to colocalize unknown modifications. */ getColocalizeUnknown(): boolean; /** * Finds the positions of the modification in a sequence. * * @param seq - The sequence to search in. * @yields The start and end positions of the modification. */ findPositions(seq: string): Generator<[number, number], void, unknown>; /** * Converts the modification to a dictionary representation. * @returns A dictionary containing the modification's attributes. */ toDict(): Record<string, any>; /** * Checks if two modifications are equal. * @param other - The other modification to compare with. * @returns True if the modifications are equal, false otherwise. */ equals(other: any): boolean; /** * Generates a hash for the modification. * @returns The hash code. */ hashCode(): number; /** * Returns a string representation of the modification. * @returns The string representation. */ toString(): string; /** * Validates a glycan string. * * @param glycan - The glycan string to validate. * @returns True if the glycan is valid, false otherwise. */ static validateGlycan(glycan: string): boolean; /** * Validates a formula string. * * @param formula - The formula string to validate. * @returns True if the formula is valid, false otherwise. */ static validateFormula(formula: string): boolean; /** * Checks if a modification is an ion type modification. * * @param modStr - The modification string to check. * @returns True if the modification is an ion type modification, false otherwise. */ static isIonTypeModification(modStr: string): boolean; /** * Checks if the modification is a branch reference. */ get isBranchRef(): boolean; /** * Checks if the modification is a branch. */ get isBranch(): boolean; /** * Converts the modification to a ProForma string. * @returns The ProForma string. */ toProforma(): string; /** * Checks if the modification has an ambiguity. */ get hasAmbiguity(): boolean; } /** * Represents a global modification to a sequence. */ export declare class GlobalModification extends Modification { targetResidues: string[] | null; globalModType: string; /** * Initializes a GlobalModification object. * * @param value - The value of the modification. * @param target_residues - The target residues of the modification. * @param mod_type - The type of the modification. * @param positionConstraint - The position constraint of the modification. * @param limitPerPosition - The limit per position of the modification. * @param colocalizeKnown - Whether to colocalize known modifications. * @param colocalizeUnknown - Whether to colocalize unknown modifications. */ constructor(value: string, target_residues?: string[] | null, mod_type?: string, positionConstraint?: string[], limitPerPosition?: number, colocalizeKnown?: boolean, colocalizeUnknown?: boolean); /** * Converts the modification to a ProForma string. * @returns The ProForma string. */ toProforma(): string; /** * Returns a string representation of the modification. * @returns The string representation. */ toString(): string; } /** * Represents a map of modifications in a sequence. */ export declare class ModificationMap { seq: string; ignorePositions: Set<number>; modDictByName: Record<string, Modification>; modPositionDict: Record<string, number[]>; positionToMods: Map<number, Modification[]>; /** * Initializes a ModificationMap object. * * @param seq - The sequence. * @param mods - The modifications in the sequence. * @param ignore_positions - The positions to ignore in the sequence. * @param parse_position - Whether to parse the position of the modifications. * @param mod_position_dict - A dictionary of modification positions. */ constructor(seq: string, mods?: Modification[], ignore_positions?: Set<number>, parse_position?: boolean, mod_position_dict?: Record<string, number[]>); /** * Builds the mappings for the modifications. * @param mods - The modifications to build the mappings for. * @param parse_position - Whether to parse the position of the modifications. * @private */ _buildMappings(mods: Modification[], parse_position: boolean): void; /** * Gets the positions of a modification. * * @param mod_name - The name of the modification. * @returns The positions of the modification. */ getModPositions(mod_name: string): number[] | null; /** * Gets a modification by name. * * @param mod_name - The name of the modification. * @returns The modification. */ getMod(mod_name: string): Modification | null; /** * Gets the modifications at a specific position. * * @param position - The position to get the modifications from. * @returns The modifications at the specified position. */ getModsAtPosition(position: number): Modification[]; /** * Checks if a modification exists at a specific position. * * @param position - The position to check. * @param mod_name - The name of the modification. * @returns True if the modification exists at the specified position, false otherwise. */ hasModAtPosition(position: number, mod_name?: string): boolean; /** * Converts the modification map to a dictionary representation. * @returns A dictionary containing the modification map's attributes. */ toDict(): Record<string, any>; } //# sourceMappingURL=modification.d.ts.map