|
|
| | USI () |
| | Default constructor (creates an empty/invalid USI)
|
| |
| | USI (const std::string &collection, const std::string &ms_run, IndexType index_type, const std::string &index, const std::string &interpretation="") |
| | Construct a USI from its components.
|
| |
| | USI (const std::string &usi_string) |
| | Construct a USI from its string representation.
|
| |
| | USI (const USI &)=default |
| | Copy constructor.
|
| |
| | USI (USI &&) noexcept=default |
| | Move constructor.
|
| |
| | ~USI ()=default |
| | Destructor.
|
| |
|
| USI & | operator= (const USI &)=default |
| | Copy assignment operator.
|
| |
| USI & | operator= (USI &&) noexcept=default |
| | Move assignment operator.
|
| |
|
| bool | operator== (const USI &rhs) const |
| | Equality operator.
|
| |
| bool | operator!= (const USI &rhs) const |
| | Inequality operator.
|
| |
| bool | operator< (const USI &rhs) const |
| | Less-than operator (for sorting/containers)
|
| |
|
| const std::string & | getCollection () const |
| | Returns the collection (dataset identifier or library name)
|
| |
| void | setCollection (const std::string &collection) |
| | Sets the collection (dataset identifier or library name)
|
| |
| const std::string & | getMSRun () const |
| | Returns the MS run file name.
|
| |
| void | setMSRun (const std::string &ms_run) |
| | Sets the MS run file name.
|
| |
| IndexType | getIndexType () const |
| | Returns the index type.
|
| |
| void | setIndexType (IndexType index_type) |
| | Sets the index type.
|
| |
| const std::string & | getIndex () const |
| | Returns the spectrum index as a string.
|
| |
| void | setIndex (const std::string &index) |
| | Sets the spectrum index.
|
| |
| const std::string & | getInterpretation () const |
| | Returns the interpretation (peptide sequence/charge)
|
| |
| void | setInterpretation (const std::string &interpretation) |
| | Sets the interpretation (peptide sequence/charge)
|
| |
| bool | hasInterpretation () const |
| | Returns true if an interpretation is present.
|
| |
|
| std::string | toString () const |
| | Converts the USI to its string representation.
|
| |
| bool | fromString (const std::string &usi_string) |
| | Parse a USI string and populate this object.
|
| |
|
|
| static USI | createFromScanNumber (const std::string &dataset_id, const std::string &filename, int scan_number, const std::string &interpretation="") |
| | Create a USI from spectrum metadata.
|
| |
| static USI | createFromNativeID (const std::string &dataset_id, const std::string &filename, const std::string &native_id) |
| | Create a USI from a native spectrum identifier.
|
| |
| static std::optional< int > | extractScanNumberFromNativeID (const std::string &native_id) |
| | Extract scan number from a native spectrum ID for USI generation.
|
| |
| static std::optional< std::pair< IndexType, std::string > > | nativeIdToUSIIndex (const std::string &native_id) |
| | Convert a native spectrum ID to USI index type and value per the PSI USI spec.
|
| |
| static std::string | indexTypeToString (IndexType index_type) |
| | Get the index type string representation.
|
| |
| static IndexType | indexTypeFromString (const std::string &type_string) |
| | Parse index type from string.
|
| |
| static std::string | extractBasename (const std::string &filepath) |
| | Extract basename from a file path (removes directory and extension).
|
| |
Utility class for handling Universal Spectrum Identifiers (USI).
The Universal Spectrum Identifier (USI) is a standardized identifier format defined by the HUPO-PSI (Human Proteome Organization - Proteomics Standards Initiative) for uniquely referencing mass spectrometry spectra across public repositories. The USI format enables unambiguous identification of spectra in ProteomeXchange partner repositories (PRIDE, PeptideAtlas, MassIVE, jPOST, iProX) and spectral libraries.
- USI Format
- The general format of a USI is:
mzspec:<collection>:<ms_run>:<index_type>:<index>[:interpretation]
Where:
- collection: ProteomeXchange dataset identifier (e.g., PXD000561) or spectral library name
- ms_run: Name of the MS run file (e.g., sample1.mzML)
- index_type: Type of spectrum index, typically "scan" or "index"
- index: Numeric identifier of the spectrum
- interpretation: Optional peptide interpretation in ProForma format (sequence/charge)
- Examples
- Basic spectrum reference:
mzspec:PXD000561:Adult_Frontalcortex.mzML:scan:12345
- With peptide interpretation:
mzspec:PXD000561:Adult_Frontalcortex.mzML:scan:12345:PEPTIDEK/2
- With modification:
mzspec:PXD000561:sample.mzML:scan:1234:PEPT[Phospho]IDEK/2
- PSI-MS CV Term
- USI is defined in the PSI-MS ontology as MS:1003063 (universal spectrum identifier).
- See also
- SpectrumLookup, SpectrumSettings, PeptideIdentification
-
https://www.psidev.info/usi (USI specification)
| static std::optional< int > extractScanNumberFromNativeID |
( |
const std::string & |
native_id | ) |
|
|
static |
Extract scan number from a native spectrum ID for USI generation.
Only returns a scan number when the native ID format unambiguously identifies a scan number suitable for the USI scan: index type (PSI USI spec section 3.3.5):
- Thermo standard:
controllerType=0 controllerNumber=1 scan=X → X
- Bare
scan=X (Bruker/Agilent simple format) → X
Non-standard Thermo (controllerType != 0), Waters, Bruker TDF, SCIEX WIFF, and index-based native IDs return std::nullopt — callers should use nativeIdToUSIIndex() for the full USI-spec-compliant mapping.
- Parameters
-
| native_id | Native spectrum identifier |
- Returns
- Scan number if this is a standard scan format, std::nullopt otherwise