Pyteomics documentation v4.2.0dev2

auxiliary - common functions and objects

Contents

auxiliary - common functions and objects

Math

linear_regression_vertical() - a wrapper for NumPy linear regression, minimizes the sum of squares of y errors.

linear_regression() - alias for linear_regression_vertical().

linear_regression_perpendicular() - a wrapper for NumPy linear regression, minimizes the sum of squares of (perpendicular) distances between the points and the line.

Target-Decoy Approach

qvalues() - estimate q-values for a set of PSMs.

filter() - filter PSMs to specified FDR level using TDA or given PEPs.

filter.chain() - a chained version of filter().

fdr() - estimate FDR in a set of PSMs using TDA or given PEPs.

Project infrastructure

PyteomicsError - a pyteomics-specific exception.

Helpers

Charge - a subclass of int for charge states.

ChargeList - a subclass of list for lists of charges.

print_tree() - display the structure of a complex nested dict.

memoize() - makes a memoization function decorator.

cvquery() - traverse an arbitrarily nested dictionary looking for keys which are cvstr instances, or objects with an attribute called accession.


pyteomics.auxiliary.math.linear_regression(x, y=None, a=None, b=None)[source]

Alias of linear_regression_vertical().

pyteomics.auxiliary.math.linear_regression_perpendicular(x, y=None)[source]

Calculate coefficients of a linear regression y = a * x + b. The fit minimizes perpendicular distances between the points and the line.

Requires numpy.

Parameters:
x, y : array_like of float

1-D arrays of floats. If y is omitted, x must be a 2-D array of shape (N, 2).

Returns:
out : 4-tuple of float

The structure is (a, b, r, stderr), where a – slope coefficient, b – free term, r – Peason correlation coefficient, stderr – standard deviation.

pyteomics.auxiliary.math.linear_regression_vertical(x, y=None, a=None, b=None)[source]

Calculate coefficients of a linear regression y = a * x + b. The fit minimizes vertical distances between the points and the line.

Requires numpy.

Parameters:
x, y : array_like of float

1-D arrays of floats. If y is omitted, x must be a 2-D array of shape (N, 2).

a : float, optional

If specified then the slope coefficient is fixed and equals a.

b : float, optional

If specified then the free term is fixed and equals b.

Returns:
out : 4-tuple of float

The structure is (a, b, r, stderr), where a – slope coefficient, b – free term, r – Peason correlation coefficient, stderr – standard deviation.

pyteomics.auxiliary.target_decoy.fdr(psms=None, formula=1, is_decoy=None, ratio=1, correction=0, pep=None, decoy_prefix='DECOY_', decoy_suffix=None)

Estimate FDR of a data set using TDA or given PEP values. Two formulas can be used. The first one (default) is:

FDR = \frac{N_{decoy}}{N_{target} * ratio}

The second formula is:

FDR = \frac{N_{decoy} * (1 + \frac{1}{ratio})}{N_{total}}

Note

This function is less versatile than qvalues(). To obtain FDR, you can call qvalues() and take the last q-value. This function can be used (with correction = 0 or 1) when numpy is not available.

Parameters:
psms : iterable, optional

An iterable of PSMs, e.g. as returned by read(). Not needed if is_decoy is an iterable.

formula : int, optional

Can be either 1 or 2, defines which formula should be used for FDR estimation. Default is 1.

is_decoy : callable, iterable, or str

If callable, should accept exactly one argument (PSM) and return a truthy value if the PSM is considered decoy. Default is is_decoy(). If array-like, should contain float values for all given PSMs. If string, it is used as a field name (PSMs must be in a record array or a pandas.DataFrame).

pep : callable, iterable, or str, optional

If callable, a function used to determine the posterior error probability (PEP). Should accept exactly one argument (PSM) and return a float. If array-like, should contain float values for all given PSMs. If string, it is used as a field name (PSMs must be in a record array or a pandas.DataFrame).

Note

If this parameter is given, then PEP values will be used to calculate FDR. Otherwise, decoy PSMs will be used instead. This option conflicts with: is_decoy, formula, ratio, correction.

ratio : float, optional

The size ratio between the decoy and target databases. Default is 1. In theory, the “size” of the database is the number of theoretical peptides eligible for assignment to spectra that are produced by in silico cleavage of that database.

correction : int or float, optional

Possible values are 0, 1 and 2, or floating point numbers between 0 and 1.

0 (default): no correction;

1: enable “+1” correction. This accounts for the probability that a false positive scores better than the first excluded decoy PSM;

2: this also corrects that probability for finite size of the sample, so the correction will be slightly less than “+1”.

If a floating point number is given, then instead of the expectation value for the number of false PSMs, the confidence value is used. The value of correction is then interpreted as desired confidence level. E.g., if correction=0.95, then the calculated q-values do not exceed the “real” q-values with 95% probability.

See this paper for further explanation.

Note

Requires numpy, if correction is a float or 2.

Note

Correction is only needed if the PSM set at hand was obtained using TDA filtering based on decoy counting (as done by using filter() without correction).

Returns:
out : float

The estimation of FDR, (roughly) between 0 and 1.

pyteomics.auxiliary.target_decoy.filter(*args, **kwargs)

Read args and yield only the PSMs that form a set with estimated false discovery rate (FDR) not exceeding fdr.

Requires numpy and, optionally, pandas.

Parameters:
positional args : iterables

Iterables to read PSMs from. All positional arguments are chained. The rest of the arguments must be named.

fdr : float, keyword only, 0 <= fdr <= 1

Desired FDR level.

key : callable / array-like / iterable / str, keyword only

A function used for sorting of PSMs. Should accept exactly one argument (PSM) and return a number (the smaller the better). The default is a function that tries to extract e-value from the PSM.

Warning

The default function may not work with your files, because format flavours are diverse.

reverse : bool, keyword only, optional

If True, then PSMs are sorted in descending order, i.e. the value of the key function is higher for better PSMs. Default is False.

is_decoy : callable / array-like / iterable / str, keyword only

A function used to determine if the PSM is decoy or not. Should accept exactly one argument (PSM) and return a truthy value if the PSM should be considered decoy.

remove_decoy : bool, keyword only, optional

Defines whether decoy matches should be removed from the output. Default is True.

Note

If set to False, then by default the decoy PSMs will be taken into account when estimating FDR. Refer to the documentation of fdr() for math; basically, if remove_decoy is True, then formula 1 is used to control output FDR, otherwise it’s formula 2. This can be changed by overriding the formula argument.

formula : int, keyword only, optional

Can be either 1 or 2, defines which formula should be used for FDR estimation. Default is 1 if remove_decoy is True, else 2 (see fdr() for definitions).

ratio : float, keyword only, optional

The size ratio between the decoy and target databases. Default is 1. In theory, the “size” of the database is the number of theoretical peptides eligible for assignment to spectra that are produced by in silico cleavage of that database.

correction : int or float, keyword only, optional

Possible values are 0, 1 and 2, or floating point numbers between 0 and 1.

0 (default): no correction;

1: enable “+1” correction. This accounts for the probability that a false positive scores better than the first excluded decoy PSM;

2: this also corrects that probability for finite size of the sample, so the correction will be slightly less than “+1”.

If a floating point number is given, then instead of the expectation value for the number of false PSMs, the confidence value is used. The value of correction is then interpreted as desired confidence level. E.g., if correction=0.95, then the calculated q-values do not exceed the “real” q-values with 95% probability.

See this paper for further explanation.

pep : callable / array-like / iterable / str, keyword only, optional

If callable, a function used to determine the posterior error probability (PEP). Should accept exactly one argument (PSM) and return a float. If array-like, should contain float values for all given PSMs. If string, it is used as a field name (PSMs must be in a record array or a DataFrame).

Note

If this parameter is given, then PEP values will be used to calculate q-values. Otherwise, decoy PSMs will be used instead. This option conflicts with: is_decoy, remove_decoy, formula, ratio, correction. key can still be provided. Without key, PSMs will be sorted by PEP.

full_output : bool, keyword only, optional

If True, then an array of PSM objects is returned. Otherwise, an iterator / context manager object is returned, and the files are parsed twice. This saves some RAM, but is ~2x slower. Default is True.

Note

The name for the parameter comes from the fact that it is internally passed to qvalues().

q_label : str, optional

Field name for q-value in the output. Default is 'q'.

score_label : str, optional

Field name for score in the output. Default is 'score'.

decoy_label : str, optional

Field name for the decoy flag in the output. Default is 'is decoy'.

pep_label : str, optional

Field name for PEP in the output. Default is 'PEP'.

**kwargs : passed to the chain() function.
Returns:
out : iterator or numpy.ndarray or pandas.DataFrame
pyteomics.auxiliary.target_decoy.qvalues(*args, **kwargs)

Read args and return a NumPy array with scores and q-values. q-values are calculated either using TDA or based on provided values of PEP.

Requires numpy (and optionally pandas).

Parameters:
positional args : iterables

Iterables to read PSMs from. All positional arguments are chained. The rest of the arguments must be named.

key : callable / array-like / iterable / str, keyword only

If callable, a function used for sorting of PSMs. Should accept exactly one argument (PSM) and return a number (the smaller the better). If array-like, should contain scores for all given PSMs. If string, it is used as a field name (PSMs must be in a record array or a DataFrame).

Warning

The default function may not work with your files, because format flavours are diverse.

reverse : bool, keyword only, optional

If True, then PSMs are sorted in descending order, i.e. the value of the key function is higher for better PSMs. Default is False.

is_decoy : callable / array-like / iterable / str, keyword only

If callable, a function used to determine if the PSM is decoy or not. Should accept exactly one argument (PSM) and return a truthy value if the PSM should be considered decoy. If array-like, should contain boolean values for all given PSMs. If string, it is used as a field name (PSMs must be in a record array or a DataFrame).

pep : callable / array-like / iterable / str, keyword only, optional

If callable, a function used to determine the posterior error probability (PEP). Should accept exactly one argument (PSM) and return a float. If array-like, should contain float values for all given PSMs. If string, it is used as a field name (PSMs must be in a record array or a DataFrame).

Note

If this parameter is given, then PEP values will be used to calculate q-values. Otherwise, decoy PSMs will be used instead. This option conflicts with: is_decoy, remove_decoy, formula, ratio, correction. key can still be provided. Without key, PSMs will be sorted by PEP.

remove_decoy : bool, keyword only, optional

Defines whether decoy matches should be removed from the output. Default is False.

Note

If set to False, then by default the decoy PSMs will be taken into account when estimating FDR. Refer to the documentation of fdr() for math; basically, if remove_decoy is True, then formula 1 is used to control output FDR, otherwise it’s formula 2. This can be changed by overriding the formula argument.

formula : int, keyword only, optional

Can be either 1 or 2, defines which formula should be used for FDR estimation. Default is 1 if remove_decoy is True, else 2 (see fdr() for definitions).

ratio : float, keyword only, optional

The size ratio between the decoy and target databases. Default is 1. In theory, the “size” of the database is the number of theoretical peptides eligible for assignment to spectra that are produced by in silico cleavage of that database.

correction : int or float, keyword only, optional

Possible values are 0, 1 and 2, or floating point numbers between 0 and 1.

0 (default): no correction;

1: enable “+1” correction. This accounts for the probability that a false positive scores better than the first excluded decoy PSM;

2: this also corrects that probability for finite size of the sample, so the correction will be slightly less than “+1”.

If a floating point number is given, then instead of the expectation value for the number of false PSMs, the confidence value is used. The value of correction is then interpreted as desired confidence level. E.g., if correction=0.95, then the calculated q-values do not exceed the “real” q-values with 95% probability.

See this paper for further explanation.

q_label : str, optional

Field name for q-value in the output. Default is 'q'.

score_label : str, optional

Field name for score in the output. Default is 'score'.

decoy_label : str, optional

Field name for the decoy flag in the output. Default is 'is decoy'.

pep_label : str, optional

Field name for PEP in the output. Default is 'PEP'.

full_output : bool, keyword only, optional

If True, then the returned array has PSM objects along with scores and q-values. Default is False.

**kwargs : passed to the chain() function.
Returns:
out : numpy.ndarray

A sorted array of records with the following fields:

  • ‘score’: np.float64
  • ‘is decoy’: np.bool_
  • ‘q’: np.float64
  • ‘psm’: np.object_ (if full_output is True)
pyteomics.auxiliary.target_decoy.sigma_T(psms, is_decoy, ratio=1)[source]

Calculates the standard error for the number of false positive target PSMs.

The formula is:

.. math ::
sigma(T) = sqrt{frac{(d + 1) cdot {p}}{(1 - p)^{2}}} = sqrt{frac{d+1}{r^{2}} cdot (r+1)}

This estimation is accurate for low FDRs. See the article for more details.

pyteomics.auxiliary.target_decoy.sigma_fdr(psms=None, formula=1, is_decoy=None, ratio=1)[source]

Calculates the standard error of FDR using the formula for negative binomial distribution. See sigma_T() for math. This estimation is accurate for low FDRs. See also the article for more details.

class pyteomics.auxiliary.utils.BinaryDataArrayTransformer[source]

Bases: object

A base class that provides methods for reading base64-encoded binary arrays.

Attributes:
compression_type_map : dict

Maps compressor type name to decompression function

Methods

binary_array_record Hold all of the information about a base64 encoded array needed to decode the array.
decode_data_array(self, source[, …]) Decode a base64-encoded, compressed bytestring into a numerical array.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

class binary_array_record[source]

Bases: pyteomics.auxiliary.utils.binary_array_record

Hold all of the information about a base64 encoded array needed to decode the array.

Attributes:
compression

Alias for field number 1

data

Alias for field number 0

dtype

Alias for field number 2

key

Alias for field number 4

source

Alias for field number 3

Methods

count()
decode(self) Decode data into a numerical array
index() Raises ValueError if the value is not present.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

compression

Alias for field number 1

count()
data

Alias for field number 0

decode(self)[source]

Decode data into a numerical array

Returns:
np.ndarray
dtype

Alias for field number 2

index()

Raises ValueError if the value is not present.

key

Alias for field number 4

source

Alias for field number 3

decode_data_array(self, source, compression_type=None, dtype=<type 'numpy.float64'>)[source]

Decode a base64-encoded, compressed bytestring into a numerical array.

Parameters:
source : bytes

A base64 string encoding a potentially compressed numerical array.

compression_type : str, optional

The name of the compression method used before encoding the array into base64.

dtype : type, optional

The data type to use to decode the binary array from the decompressed bytes.

Returns:
np.ndarray
pyteomics.auxiliary.utils.memoize(maxsize=1000)[source]

Make a memoization decorator. A negative value of maxsize means no size limit.

pyteomics.auxiliary.utils.print_tree(d, indent_str=' -> ', indent_count=1)[source]

Read a nested dict (with strings as keys) and print its structure.

class pyteomics.auxiliary.structures.BasicComposition(*args, **kwargs)[source]

Bases: collections.defaultdict, collections.Counter

A generic dictionary for compositions. Keys should be strings, values should be integers. Allows simple arithmetics.

Attributes:
default_factory

Factory for default value called by __missing__().

Methods

clear()
elements(self) Iterator over elements repeating each as many times as its count.
get()
has_key()
items()
iteritems()
iterkeys()
itervalues()
keys()
most_common(self[, n]) List the n most common elements and their counts from the most common to the least.
pop() If key is not found, d is returned if given, otherwise KeyError is raised
popitem() 2-tuple; but raise KeyError if D is empty.
setdefault()
subtract(\*args, \*\*kwds) Like dict.update() but subtracts counts instead of replacing them.
update(\*args, \*\*kwds) Like dict.update() but add counts instead of replacing them.
values()
viewitems()
viewkeys()
viewvalues()
copy  
fromkeys  
__init__(self, *args, **kwargs)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

clear()
copy(self)[source]
default_factory

Factory for default value called by __missing__().

elements(self)

Iterator over elements repeating each as many times as its count.

>>> c = Counter('ABCABC')
>>> sorted(c.elements())
['A', 'A', 'B', 'B', 'C', 'C']

# Knuth’s example for prime factors of 1836: 2**2 * 3**3 * 17**1 >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) >>> product = 1 >>> for factor in prime_factors.elements(): # loop over factors … product *= factor # and multiply them >>> product 1836

Note, if an element’s count has been set to zero or is a negative number, elements() will ignore it.

classmethod fromkeys(cls, iterable, v=None)

v defaults to None.

get()
has_key()
items()
iteritems()
iterkeys()
itervalues()
keys()
most_common(self, n=None)

List the n most common elements and their counts from the most common to the least. If n is None, then list all element counts.

>>> Counter('abcdeabcdabcaba').most_common(3)
[('a', 5), ('b', 4), ('c', 3)]
pop()

If key is not found, d is returned if given, otherwise KeyError is raised

popitem()

2-tuple; but raise KeyError if D is empty.

setdefault()
subtract(*args, **kwds)

Like dict.update() but subtracts counts instead of replacing them. Counts can be reduced below zero. Both the inputs and outputs are allowed to contain zero and negative counts.

Source can be an iterable, a dictionary, or another Counter instance.

>>> c = Counter('which')
>>> c.subtract('witch')             # subtract elements from another iterable
>>> c.subtract(Counter('watch'))    # subtract elements from another counter
>>> c['h']                          # 2 in which, minus 1 in witch, minus 1 in watch
0
>>> c['w']                          # 1 in which, minus 1 in witch, minus 1 in watch
-1
update(*args, **kwds)

Like dict.update() but add counts instead of replacing them.

Source can be an iterable, a dictionary, or another Counter instance.

>>> c = Counter('which')
>>> c.update('witch')           # add elements from another iterable
>>> d = Counter('watch')
>>> c.update(d)                 # add elements from another counter
>>> c['h']                      # four 'h' in which, witch, and watch
4
values()
viewitems()
viewkeys()
viewvalues()
class pyteomics.auxiliary.structures.CVQueryEngine[source]

Bases: object

Traverse an arbitrarily nested dictionary looking for keys which are cvstr instances, or objects with an attribute called accession.

Methods

__call__(self, data[, accession]) If accession is None, calls index() on data, otherwise calls query() with data and accession.
index(self, data) Construct a flat dict whose keys are the accession numbers for all qualified keys in data and whose values are the mapped values from data.
query(self, data, accession) Search data for a key with the accession number accession.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

index(self, data)[source]

Construct a flat dict whose keys are the accession numbers for all qualified keys in data and whose values are the mapped values from data.

query(self, data, accession)[source]

Search data for a key with the accession number accession. Returns None if not found.

class pyteomics.auxiliary.structures.Charge[source]

Bases: int

A subclass of int. Can be constructed from strings in “N+” or “N-” format, and the string representation of a Charge is also in that format.

Attributes:
denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

Methods

bit_length() Number of bits necessary to represent self in binary.
conjugate() Returns self, the complex conjugate of any int.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

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

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

class pyteomics.auxiliary.structures.ChargeList(*args, **kwargs)[source]

Bases: list

Just a list of :py:class:`Charge`s. When printed, looks like an enumeration of the list contents. Can also be constructed from such strings (e.g. “2+, 3+ and 4+”).

Methods

append() L.append(object) – append object to end
count()
extend() L.extend(iterable) – extend list by appending elements from the iterable
index() Raises ValueError if the value is not present.
insert() L.insert(index, object) – insert object before index
pop() Raises IndexError if list is empty or index is out of range.
remove() L.remove(value) – remove first occurrence of value.
reverse() L.reverse() – reverse IN PLACE
sort() L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1
__init__(self, *args, **kwargs)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

append()

L.append(object) – append object to end

count()
extend()

L.extend(iterable) – extend list by appending elements from the iterable

index()

Raises ValueError if the value is not present.

insert()

L.insert(index, object) – insert object before index

pop()

Raises IndexError if list is empty or index is out of range.

remove()

L.remove(value) – remove first occurrence of value. Raises ValueError if the value is not present.

reverse()

L.reverse() – reverse IN PLACE

sort()

L.sort(cmp=None, key=None, reverse=False) – stable sort IN PLACE; cmp(x, y) -> -1, 0, 1

exception pyteomics.auxiliary.structures.PyteomicsError(msg, *values)[source]

Bases: exceptions.Exception

Exception raised for errors in Pyteomics library.

Attributes:
message : str

Error message.

__init__(self, msg, *values)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

pyteomics.auxiliary.structures.clear_unit_cv_table()[source]

Clear the module-level unit name and controlled vocabulary accession table.

class pyteomics.auxiliary.structures.cvstr[source]

Bases: str

A helper class to associate a controlled vocabullary accession number with an otherwise plain str object

Methods

capitalize() Return a copy of the string S with only its first character capitalized.
center() Return S centered in a string of length width.
count() Return the number of non-overlapping occurrences of substring sub in string S[start:end].
decode() Decodes S using the codec registered for encoding.
encode() Encodes S using the codec registered for encoding.
endswith() Return True if S ends with the specified suffix, False otherwise.
expandtabs() Return a copy of S where all tab characters are expanded using spaces.
find() Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
format() Return a formatted version of S, using substitutions from args and kwargs.
index() Like S.find() but raise ValueError when the substring is not found.
isalnum() Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
isalpha() Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
isdigit() Return True if all characters in S are digits and there is at least one character in S, False otherwise.
islower() Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
isspace() Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
istitle() Return True if S is a titlecased string and there is at least one character in S, i.e.
isupper() Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
join() Return a string which is the concatenation of the strings in the iterable.
ljust() Return S left-justified in a string of length width.
lower() Return a copy of the string S converted to lowercase.
lstrip() Return a copy of the string S with leading whitespace removed.
partition(sep) Search for the separator sep in S, and return the part before it, the separator itself, and the part after it.
replace() Return a copy of string S with all occurrences of substring old replaced by new.
rfind() Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rindex() Like S.rfind() but raise ValueError when the substring is not found.
rjust() Return S right-justified in a string of length width.
rpartition(sep) Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it.
rsplit() Return a list of the words in the string S, using sep as the delimiter string, starting at the end of the string and working to the front.
rstrip() Return a copy of the string S with trailing whitespace removed.
split() Return a list of the words in the string S, using sep as the delimiter string.
splitlines() Return a list of the lines in S, breaking at line boundaries.
startswith() Return True if S starts with the specified prefix, False otherwise.
strip() Return a copy of the string S with leading and trailing whitespace removed.
swapcase() Return a copy of the string S with uppercase characters converted to lowercase and vice versa.
title() Return a titlecased version of S, i.e.
translate() Return a copy of the string S, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256 or None.
upper() Return a copy of the string S converted to uppercase.
zfill() Pad a numeric string S with zeros on the left, to fill a field of the specified width.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

capitalize()

Return a copy of the string S with only its first character capitalized.

center()

Return S centered in a string of length width. Padding is done using the specified fill character (default is a space)

count()

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

decode()

Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeDecodeError. Other possible values are ‘ignore’ and ‘replace’ as well as any other name registered with codecs.register_error that is able to handle UnicodeDecodeErrors.

encode()

Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that is able to handle UnicodeEncodeErrors.

endswith()

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs()

Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.

find()

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format()

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{‘ and ‘}’).

index()

Like S.find() but raise ValueError when the substring is not found.

isalnum()

Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.

isalpha()

Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.

isdigit()

Return True if all characters in S are digits and there is at least one character in S, False otherwise.

islower()

Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.

isspace()

Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.

istitle()

Return True if S is a titlecased string and there is at least one character in S, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.

isupper()

Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.

join()

Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.

ljust()

Return S left-justified in a string of length width. Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string S converted to lowercase.

lstrip()

Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

partition(sep) -> (head, sep, tail)

Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.

replace()

Return a copy of string S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

rfind()

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex()

Like S.rfind() but raise ValueError when the substring is not found.

rjust()

Return S right-justified in a string of length width. Padding is done using the specified fill character (default is a space)

rpartition(sep) -> (head, sep, tail)

Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.

rsplit()

Return a list of the words in the string S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator.

rstrip()

Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

split()

Return a list of the words in the string S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.

splitlines()

Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.

startswith()

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip()

Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

swapcase()

Return a copy of the string S with uppercase characters converted to lowercase and vice versa.

title()

Return a titlecased version of S, i.e. words start with uppercase characters, all remaining cased characters have lowercase.

translate()

Return a copy of the string S, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256 or None. If the table argument is None, no translation is applied and the operation simply removes the characters in deletechars.

upper()

Return a copy of the string S converted to uppercase.

zfill()

Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.

class pyteomics.auxiliary.structures.unitfloat[source]

Bases: float

Attributes:
imag

the imaginary part of a complex number

real

the real part of a complex number

unit_info

Methods

as_integer_ratio() Return a pair of integers, whose ratio is exactly equal to the original float and with a positive denominator.
conjugate() Return self, the complex conjugate of any float.
fromhex() Create a floating-point number from a hexadecimal string.
hex() Return a hexadecimal representation of a floating-point number.
is_integer() Return True if the float is an integer.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

as_integer_ratio() -> (int, int)

Return a pair of integers, whose ratio is exactly equal to the original float and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.

>>> (10.0).as_integer_ratio()
(10, 1)
>>> (0.0).as_integer_ratio()
(0, 1)
>>> (-.25).as_integer_ratio()
(-1, 4)
conjugate()

Return self, the complex conjugate of any float.

fromhex()

Create a floating-point number from a hexadecimal string. >>> float.fromhex(‘0x1.ffffp10’) 2047.984375 >>> float.fromhex(‘-0x1p-1074’) -4.9406564584124654e-324

hex()

Return a hexadecimal representation of a floating-point number. >>> (-0.1).hex() ‘-0x1.999999999999ap-4’ >>> 3.14159.hex() ‘0x1.921f9f01b866ep+1’

imag

the imaginary part of a complex number

is_integer()

Return True if the float is an integer.

real

the real part of a complex number

class pyteomics.auxiliary.structures.unitint[source]

Bases: int

Attributes:
denominator

the denominator of a rational number in lowest terms

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

Methods

bit_length() Number of bits necessary to represent self in binary.
conjugate() Returns self, the complex conjugate of any int.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

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

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

real

the real part of a complex number

class pyteomics.auxiliary.structures.unitstr[source]

Bases: str

Methods

capitalize() Return a copy of the string S with only its first character capitalized.
center() Return S centered in a string of length width.
count() Return the number of non-overlapping occurrences of substring sub in string S[start:end].
decode() Decodes S using the codec registered for encoding.
encode() Encodes S using the codec registered for encoding.
endswith() Return True if S ends with the specified suffix, False otherwise.
expandtabs() Return a copy of S where all tab characters are expanded using spaces.
find() Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end].
format() Return a formatted version of S, using substitutions from args and kwargs.
index() Like S.find() but raise ValueError when the substring is not found.
isalnum() Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.
isalpha() Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.
isdigit() Return True if all characters in S are digits and there is at least one character in S, False otherwise.
islower() Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.
isspace() Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.
istitle() Return True if S is a titlecased string and there is at least one character in S, i.e.
isupper() Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.
join() Return a string which is the concatenation of the strings in the iterable.
ljust() Return S left-justified in a string of length width.
lower() Return a copy of the string S converted to lowercase.
lstrip() Return a copy of the string S with leading whitespace removed.
partition(sep) Search for the separator sep in S, and return the part before it, the separator itself, and the part after it.
replace() Return a copy of string S with all occurrences of substring old replaced by new.
rfind() Return the highest index in S where substring sub is found, such that sub is contained within S[start:end].
rindex() Like S.rfind() but raise ValueError when the substring is not found.
rjust() Return S right-justified in a string of length width.
rpartition(sep) Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it.
rsplit() Return a list of the words in the string S, using sep as the delimiter string, starting at the end of the string and working to the front.
rstrip() Return a copy of the string S with trailing whitespace removed.
split() Return a list of the words in the string S, using sep as the delimiter string.
splitlines() Return a list of the lines in S, breaking at line boundaries.
startswith() Return True if S starts with the specified prefix, False otherwise.
strip() Return a copy of the string S with leading and trailing whitespace removed.
swapcase() Return a copy of the string S with uppercase characters converted to lowercase and vice versa.
title() Return a titlecased version of S, i.e.
translate() Return a copy of the string S, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256 or None.
upper() Return a copy of the string S converted to uppercase.
zfill() Pad a numeric string S with zeros on the left, to fill a field of the specified width.
__init__

x.__init__(…) initializes x; see help(type(x)) for signature

capitalize()

Return a copy of the string S with only its first character capitalized.

center()

Return S centered in a string of length width. Padding is done using the specified fill character (default is a space)

count()

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

decode()

Decodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeDecodeError. Other possible values are ‘ignore’ and ‘replace’ as well as any other name registered with codecs.register_error that is able to handle UnicodeDecodeErrors.

encode()

Encodes S using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that is able to handle UnicodeEncodeErrors.

endswith()

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs()

Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.

find()

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format()

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{‘ and ‘}’).

index()

Like S.find() but raise ValueError when the substring is not found.

isalnum()

Return True if all characters in S are alphanumeric and there is at least one character in S, False otherwise.

isalpha()

Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.

isdigit()

Return True if all characters in S are digits and there is at least one character in S, False otherwise.

islower()

Return True if all cased characters in S are lowercase and there is at least one cased character in S, False otherwise.

isspace()

Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.

istitle()

Return True if S is a titlecased string and there is at least one character in S, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return False otherwise.

isupper()

Return True if all cased characters in S are uppercase and there is at least one cased character in S, False otherwise.

join()

Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.

ljust()

Return S left-justified in a string of length width. Padding is done using the specified fill character (default is a space).

lower()

Return a copy of the string S converted to lowercase.

lstrip()

Return a copy of the string S with leading whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

partition(sep) -> (head, sep, tail)

Search for the separator sep in S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return S and two empty strings.

replace()

Return a copy of string S with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

rfind()

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex()

Like S.rfind() but raise ValueError when the substring is not found.

rjust()

Return S right-justified in a string of length width. Padding is done using the specified fill character (default is a space)

rpartition(sep) -> (head, sep, tail)

Search for the separator sep in S, starting at the end of S, and return the part before it, the separator itself, and the part after it. If the separator is not found, return two empty strings and S.

rsplit()

Return a list of the words in the string S, using sep as the delimiter string, starting at the end of the string and working to the front. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator.

rstrip()

Return a copy of the string S with trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

split()

Return a list of the words in the string S, using sep as the delimiter string. If maxsplit is given, at most maxsplit splits are done. If sep is not specified or is None, any whitespace string is a separator and empty strings are removed from the result.

splitlines()

Return a list of the lines in S, breaking at line boundaries. Line breaks are not included in the resulting list unless keepends is given and true.

startswith()

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip()

Return a copy of the string S with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead. If chars is unicode, S will be converted to unicode before stripping

swapcase()

Return a copy of the string S with uppercase characters converted to lowercase and vice versa.

title()

Return a titlecased version of S, i.e. words start with uppercase characters, all remaining cased characters have lowercase.

translate()

Return a copy of the string S, where all characters occurring in the optional argument deletechars are removed, and the remaining characters have been mapped through the given translation table, which must be a string of length 256 or None. If the table argument is None, no translation is applied and the operation simply removes the characters in deletechars.

upper()

Return a copy of the string S converted to uppercase.

zfill()

Pad a numeric string S with zeros on the left, to fill a field of the specified width. The string S is never truncated.

class pyteomics.auxiliary.file_helpers.ChainBase(*sources, **kwargs)[source]

Bases: object

Chain sequence_maker() for several sources into a single iterable. Positional arguments should be sources like file names or file objects. Keyword arguments are passed to the sequence_maker() function.

Attributes:
sources : Iterable

Sources for creating new sequences from, such as paths or file-like objects

kwargs : Mapping

Additional arguments used to instantiate each sequence

Methods

map(self[, target, processes, …]) Execute the target function over entries of this object across up to processes processes.
from_iterable  
next  
sequence_maker  
__init__(self, *sources, **kwargs)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

map(self, target=None, processes=-1, queue_timeout=4, args=None, kwargs=None, **_kwargs)[source]

Execute the target function over entries of this object across up to processes processes.

Results will be returned out of order.

Parameters:
target : Callable, optional

The function to execute over each entry. It will be given a single object yielded by the wrapped iterator as well as all of the values in args and kwargs

processes : int, optional

The number of worker processes to use. If negative, the number of processes will match the number of available CPUs.

queue_timeout : float, optional

The number of seconds to block, waiting for a result before checking to see if all workers are done.

args : Sequence, optional

Additional positional arguments to be passed to the target function

kwargs : Mapping, optional

Additional keyword arguments to be passed to the target function

**_kwargs

Additional keyword arguments to be passed to the target function

Yields:
object

The work item returned by the target function.

class pyteomics.auxiliary.file_helpers.FileReader(source, **kwargs)[source]

Bases: pyteomics.auxiliary.file_helpers.IteratorContextManager

Abstract class implementing context manager protocol for file readers.

Methods

next  
reset  
__init__(self, source, **kwargs)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

reset(self)[source]

Resets the iterator to its initial state.

class pyteomics.auxiliary.file_helpers.FileReadingProcess(reader_spec, target_spec, qin, qout, args_spec, kwargs_spec)[source]

Bases: multiprocessing.process.Process

Process that does a share of distributed work on entries read from file. Reconstructs a reader object, parses an entries from given indexes, optionally does additional processing, sends results back.

The reader class must support the __getitem__() dict-like lookup.

Attributes:
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

Methods

is_alive(self) Return whether process is alive
join(self[, timeout]) Wait until child process terminates
start(self) Start child process
terminate(self) Terminate process; sends SIGTERM signal or uses TerminateProcess()
is_done  
run  
__init__(self, reader_spec, target_spec, qin, qout, args_spec, kwargs_spec)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

is_alive(self)

Return whether process is alive

join(self, timeout=None)

Wait until child process terminates

pid

Return identifier (PID) of process or None if it has yet to start

run(self)[source]

Method to be run in sub-process; can be overridden in sub-class

start(self)

Start child process

terminate(self)

Terminate process; sends SIGTERM signal or uses TerminateProcess()

class pyteomics.auxiliary.file_helpers.IndexSavingMixin(*args, **kwargs)[source]

Bases: pyteomics.auxiliary.file_helpers.NoOpBaseReader

Common interface for IndexSavingXML and IndexSavingTextReader.

Methods

prebuild_byte_offset_file(cls, path) Construct a new XML reader, build its byte offset index and write it to file
write_byte_offsets(self) Write the byte offsets in _offset_index to the file at _byte_offset_filename
__init__(self, *args, **kwargs)

x.__init__(…) initializes x; see help(type(x)) for signature

classmethod prebuild_byte_offset_file(cls, path)[source]

Construct a new XML reader, build its byte offset index and write it to file

Parameters:
path : str

The path to the file to parse

write_byte_offsets(self)[source]

Write the byte offsets in _offset_index to the file at _byte_offset_filename

class pyteomics.auxiliary.file_helpers.IndexSavingTextReader(source, **kwargs)[source]

Bases: pyteomics.auxiliary.file_helpers.IndexSavingMixin, pyteomics.auxiliary.file_helpers.IndexedTextReader

Attributes:
default_index
delimiter
index
label

Methods

prebuild_byte_offset_file(cls, path) Construct a new XML reader, build its byte offset index and write it to file
write_byte_offsets(self) Write the byte offsets in _offset_index to the file at _byte_offset_filename
build_byte_index  
get_by_id  
get_by_ids  
get_by_index  
get_by_index_slice  
get_by_indexes  
get_by_key_slice  
next  
reset  
__init__(self, source, **kwargs)

x.__init__(…) initializes x; see help(type(x)) for signature

classmethod prebuild_byte_offset_file(cls, path)

Construct a new XML reader, build its byte offset index and write it to file

Parameters:
path : str

The path to the file to parse

reset(self)

Resets the iterator to its initial state.

write_byte_offsets(self)

Write the byte offsets in _offset_index to the file at _byte_offset_filename

class pyteomics.auxiliary.file_helpers.IndexedReaderMixin(*args, **kwargs)[source]

Bases: pyteomics.auxiliary.file_helpers.NoOpBaseReader

Common interface for IndexedTextReader and IndexedXML.

Attributes:
default_index
index

Methods

get_by_id  
get_by_ids  
get_by_index  
get_by_index_slice  
get_by_indexes  
get_by_key_slice  
__init__(self, *args, **kwargs)

x.__init__(…) initializes x; see help(type(x)) for signature

class pyteomics.auxiliary.file_helpers.IndexedTextReader(source, **kwargs)[source]

Bases: pyteomics.auxiliary.file_helpers.IndexedReaderMixin, pyteomics.auxiliary.file_helpers.FileReader

Abstract class for text file readers that keep an index of records for random access. This requires reading the file in binary mode.

Attributes:
default_index
delimiter
index
label

Methods

build_byte_index  
get_by_id  
get_by_ids  
get_by_index  
get_by_index_slice  
get_by_indexes  
get_by_key_slice  
next  
reset  
__init__(self, source, **kwargs)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

reset(self)

Resets the iterator to its initial state.

class pyteomics.auxiliary.file_helpers.OffsetIndex(*args, **kwargs)[source]

Bases: collections.OrderedDict, pyteomics.auxiliary.file_helpers.WritableIndex

An augmented OrderedDict that formally wraps getting items by index

Attributes:
index_sequence

Keeps a cached copy of the items() sequence stored as a tuple to avoid repeatedly copying the sequence over many method calls.

Methods

clear(self)
copy(self)
from_index(self, index[, include_value]) Get an entry by its integer index in the ordered sequence of this mapping.
from_slice(self, spec[, include_value]) Get a slice along index in the ordered sequence of this mapping.
fromkeys(cls, iterable[, value]) If not specified, the value defaults to None.
get()
has_key()
items(self)
iteritems(self) od.iteritems -> an iterator over the (key, value) pairs in od
iterkeys(self)
itervalues(self) od.itervalues -> an iterator over the values in od
keys(self)
popitem(self[, last]) Pairs are returned in LIFO order if last is true or FIFO order if false.
setdefault(self, key[, default])
update(\*args, \*\*kwds) If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values(self)
viewitems(self)
viewkeys(self)
viewvalues(self)
between  
find  
load  
pop  
save  
sort  
__init__(self, *args, **kwargs)[source]

Initialize an ordered dictionary. The signature is the same as regular dictionaries, but keyword arguments are not recommended because their insertion order is arbitrary.

clear(self)
copy(self)
from_index(self, index, include_value=False)[source]

Get an entry by its integer index in the ordered sequence of this mapping.

Parameters:
index: int

The index to retrieve.

include_value: bool

Whether to return both the key and the value or just the key. Defaults to False.

Returns:
object:

If include_value is True, a tuple of (key, value) at index else just the key at index.

from_slice(self, spec, include_value=False)[source]

Get a slice along index in the ordered sequence of this mapping.

Parameters:
spec: slice

The slice over the range of indices to retrieve

include_value: bool

Whether to return both the key and the value or just the key. Defaults to False

Returns:
list:

If include_value is True, a tuple of (key, value) at index else just the key at index for each index in spec

classmethod fromkeys(cls, iterable, value=None)

If not specified, the value defaults to None.

get()
has_key()
index_sequence

Keeps a cached copy of the items() sequence stored as a tuple to avoid repeatedly copying the sequence over many method calls.

Returns:
tuple
items(self)
iteritems(self)

od.iteritems -> an iterator over the (key, value) pairs in od

iterkeys(self)
itervalues(self)

od.itervalues -> an iterator over the values in od

keys(self)
pop(self, *args, **kwargs)[source]

value. If key is not found, d is returned if given, otherwise KeyError is raised.

popitem(self, last=True)

Pairs are returned in LIFO order if last is true or FIFO order if false.

setdefault(self, key, default=None)
update(*args, **kwds)

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values(self)
viewitems(self)
viewkeys(self)
viewvalues(self)
class pyteomics.auxiliary.file_helpers.TableJoiner(*sources, **kwargs)[source]

Bases: pyteomics.auxiliary.file_helpers.ChainBase

Methods

map(self[, target, processes, …]) Execute the target function over entries of this object across up to processes processes.
concatenate  
from_iterable  
next  
sequence_maker  
__init__(self, *sources, **kwargs)

x.__init__(…) initializes x; see help(type(x)) for signature

map(self, target=None, processes=-1, queue_timeout=4, args=None, kwargs=None, **_kwargs)

Execute the target function over entries of this object across up to processes processes.

Results will be returned out of order.

Parameters:
target : Callable, optional

The function to execute over each entry. It will be given a single object yielded by the wrapped iterator as well as all of the values in args and kwargs

processes : int, optional

The number of worker processes to use. If negative, the number of processes will match the number of available CPUs.

queue_timeout : float, optional

The number of seconds to block, waiting for a result before checking to see if all workers are done.

args : Sequence, optional

Additional positional arguments to be passed to the target function

kwargs : Mapping, optional

Additional keyword arguments to be passed to the target function

**_kwargs

Additional keyword arguments to be passed to the target function

Yields:
object

The work item returned by the target function.

class pyteomics.auxiliary.file_helpers.TimeOrderedIndexedReaderMixin(*args, **kwargs)[source]

Bases: pyteomics.auxiliary.file_helpers.IndexedReaderMixin

Attributes:
default_index
index
time

Methods

get_by_id  
get_by_ids  
get_by_index  
get_by_index_slice  
get_by_indexes  
get_by_key_slice  
__init__(self, *args, **kwargs)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

Contents