BasicProteinInferenceAlgorithm#
- class pyopenms.BasicProteinInferenceAlgorithm#
Bases:
DefaultParamHandlerAlgorithm class that implements simple protein inference by aggregation of peptide scores.
It has multiple parameter options like the aggregation method, when to distinguish peptidoforms, and if you want to use shared peptides (“use_shared_peptides”). First, the best PSM per spectrum is used, then only the best PSM per peptidoform is aggregated. Peptidoforms can optionally be distinguished via the treat_X_separate parameters:
Modifications (modified sequence string)
Charge states
The algorithm assumes posteriors or posterior error probabilities and converts to posteriors initially. Possible aggregation methods that can be set via the parameter “aggregation_method” are:
“best” (default)
“sum”
“product” (ignoring zeroes)
Annotation of the number of peptides used for aggregation can be disabled (see parameters). Supports multiple runs but goes through them one by one iterating over the full PeptideIdentification vector. Warning: Does not “link” the peptides to the resulting protein run. If you wish to do that you have to do it manually.
Usage:
from pyopenms import * from urllib.request import urlretrieve urlretrieve("https://raw.githubusercontent.com/OpenMS/OpenMS/develop/src/tests/class_tests/openms/data/newMergerTest_out.idXML", "BasicProteinInference_test.idXML") proteins = [] peptides = [] idf = IdXMLFile() idf.load("BasicProteinInference_test.idXML", proteins, peptides); bpia = BasicProteinInferenceAlgorithm() p = bpia.getParameters(); p.setValue("min_peptides_per_protein", 0); bpia.setParameters(p); bpia.run(peptides, proteins); # hits = proteins[0].getHits() print(hits[0].getScore()) # 0.6 print(hits[5].getScore()) # 0.9 print(hits[0].getMetaValue("nr_found_peptides")) # 1 print(hits[3].getMetaValue("nr_found_peptides")) # 2
- __init__() None#
Methods
__init__()endProgress([bytes_processed])Ends the progress display
Returns the default parameters
Returns the type of progress log being used
getName()Returns the name
Returns the parameters
Increment progress by 1 (according to range begin-end)
run(pep_ids, prot_ids)Overloaded function.
setLogType(type)Sets the progress log that should be used.
setName(name)Sets the name
setParameters(param)Sets the parameters
setProgress(value)Sets the current progress
startProgress(begin, end, label)Attributes
- class AggregationMethod(*values)#
Bases:
IntEnum- BEST = 2#
- PROD = 0#
- SUM = 1#
- as_integer_ratio()#
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- bit_count()#
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- bit_length()#
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- conjugate()#
Returns self, the complex conjugate of any int.
- denominator#
the denominator of a rational number in lowest terms
- classmethod from_bytes(bytes, byteorder='big', *, signed=False)#
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- getMapping()#
Returns a dict mapping int values to enum member name strings.
- imag#
the imaginary part of a complex number
- is_integer()#
Returns True. Exists for duck type compatibility with float.is_integer.
- numerator#
the numerator of a rational number in lowest terms
- real#
the real part of a complex number
- to_bytes(length=1, byteorder='big', *, signed=False)#
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- BEST = 2#
- PROD = 0#
- SUM = 1#
- endProgress(bytes_processed: int = 0) None#
Ends the progress display
- getDefaults() pyopenms.Param#
Returns the default parameters
- getLogType() pyopenms.ProgressLogger.LogType#
Returns the type of progress log being used
- getName() str#
Returns the name
- getParameters() pyopenms.Param#
Returns the parameters
- getSubsections() list[str]#
- nextProgress() None#
Increment progress by 1 (according to range begin-end)
- run(pep_ids: pyopenms.PeptideIdentificationList, prot_ids: collections.abc.Sequence[pyopenms.ProteinIdentification]) list[pyopenms.ProteinIdentification]#
- run(pep_ids: pyopenms.PeptideIdentificationList, prot_id: pyopenms.ProteinIdentification) None
- run(cmap: pyopenms.ConsensusMap, prot_id: pyopenms.ProteinIdentification, include_unassigned: bool) None
Overloaded function.
run(pep_ids: pyopenms.PeptideIdentificationList, prot_ids: collections.abc.Sequence[pyopenms.ProteinIdentification]) -> list[pyopenms.ProteinIdentification]
Performs basic aggregation-based inference per ProteinIdentification run. See class help.
- Parameters:
pep_ids – Vector of peptide identifications
prot_ids – Vector of protein identification runs. Scores will be overwritten and groups added.
- Returns:
Writes its results into prot_ids
run(pep_ids: pyopenms.PeptideIdentificationList, prot_id: pyopenms.ProteinIdentification) -> None
Performs basic aggregation-based inference on single ProteinIdentification run. See class help.
- Parameters:
pep_ids – Vector of peptide identifications
prot_id – ProteinIdentification run with possible proteins. Scores will be overwritten and groups added.
- Returns:
Writes its results into prot_ids
run(cmap: pyopenms.ConsensusMap, prot_id: pyopenms.ProteinIdentification, include_unassigned: bool) -> None
Performs basic aggregation-based inference on identifications in a ConsensusMap. See class help.
prot_id should contain the union of all proteins in the map. E.g. use ConsensusMapMergerAlgorithm and then pass the first=merged run.
- Parameters:
cmap – ConsensusMap = Consensus features with metadata and peptide identifications
prot_id – ProteinIdentification run with possible proteins. Scores will be overwritten and groups added.
- Returns:
Writes its results into prot_ids
In/out compatibility (pyOpenMS 3.5 behaviour): a Python list passed as
prot_idsis also updated in place with the returned contents.
- setLogType(type: pyopenms.ProgressLogger.LogType) None#
Sets the progress log that should be used. The default type is NONE!
- setName(name: str) None#
Sets the name
- setParameters(param: pyopenms.Param) None#
Sets the parameters
- setProgress(value: int) None#
Sets the current progress
- startProgress(begin: int, end: int, label: str) None#