text stringlengths 0 828 |
|---|
:param encoded: a JSON decoded object literal (a dict) |
:returns: ""encoded"" or one of the these objects: :class:`Smi`, |
:class:`MzmlScan`, :class:`MzmlProduct`, :class:`MzmlPrecursor` |
"""""" |
if '__Smi__' in encoded: |
return Smi._fromJSON(encoded['__Smi__']) |
elif '__MzmlScan__' in encoded: |
return MzmlScan._fromJSON(encoded['__MzmlScan__']) |
elif '__MzmlProduct__' in encoded: |
return MzmlProduct._fromJSON(encoded['__MzmlProduct__']) |
elif '__MzmlPrecursor__' in encoded: |
return MzmlPrecursor._fromJSON(encoded['__MzmlPrecursor__']) |
else: |
return encoded" |
1946,"def _fromJSON(cls, jsonobject): |
""""""Generates a new instance of :class:`maspy.core.Si` from a decoded |
JSON object (as generated by :func:`maspy.core.Si._reprJSON()`). |
:param jsonobject: decoded JSON object |
:returns: a new instance of :class:`Si` |
"""""" |
newInstance = cls(None, None) |
newInstance.__dict__.update(jsonobject) |
return newInstance" |
1947,"def _fromJSON(cls, jsonobject): |
""""""Generates a new instance of :class:`maspy.core.MzmlScan` from a |
decoded JSON object (as generated by |
:func:`maspy.core.MzmlScan._reprJSON()`). |
:param jsonobject: decoded JSON object |
:returns: a new instance of :class:`MzmlScan` |
"""""" |
scanWindowList = _mzmlListAttribToTuple(jsonobject[0]) |
params = [tuple(param) for param in jsonobject[1]] |
return cls(scanWindowList, params)" |
1948,"def _fromJSON(cls, jsonobject): |
""""""Generates a new instance of :class:`maspy.core.MzmlProduct` from a |
decoded JSON object (as generated by |
:func:`maspy.core.MzmlProduct._reprJSON()`). |
:param jsonobject: decoded JSON object |
:returns: a new instance of :class:`MzmlProduct` |
"""""" |
isolationWindow =[tuple(param) for param in jsonobject] |
return cls(isolationWindow)" |
1949,"def _reprJSON(self): |
""""""Returns a JSON serializable represenation of a ``MzmlPrecursor`` |
class instance. Use :func:`maspy.core.MzmlPrecursor._fromJSON()` to |
generate a new ``MzmlPrecursor`` instance from the return value. |
:returns: a JSON serializable python object |
"""""" |
return {'__MzmlPrecursor__': (self.spectrumRef, self.activation, |
self.isolationWindow, self.selectedIonList |
) |
}" |
1950,"def _fromJSON(cls, jsonobject): |
""""""Generates a new instance of :class:`maspy.core.MzmlPrecursor` from a |
decoded JSON object (as generated by |
:func:`maspy.core.MzmlPrecursor._reprJSON()`). |
:param jsonobject: decoded JSON object |
:returns: a new instance of :class:`MzmlPrecursor` |
"""""" |
spectrumRef = jsonobject[0] |
activation = [tuple(param) for param in jsonobject[1]] |
isolationWindow =[tuple(param) for param in jsonobject[2]] |
selectedIonList = _mzmlListAttribToTuple(jsonobject[3]) |
return cls(spectrumRef, activation, isolationWindow, selectedIonList)" |
1951,"def getItems(self, specfiles=None, sort=False, reverse=False, |
selector=None): |
""""""Generator that yields filtered and/or sorted :class:`Sii` instances |
from ``self.container``. |
:param specfiles: filenames of ms-run files - if specified return only |
items from those files |
:type specfiles: str or [str, str, ...] |
:param sort: if ""sort"" is specified the returned list of items is sorted |
according to the :class:`Sii` attribute specified by ""sort"", if the |
attribute is not present the item is skipped. |
:param reverse: bool, ``True`` reverses the sort order |
:param selector: a function which is called with each ``Sii`` item and |
has to return True (include item) or False (discard item). By |
default only items with ``Sii.isValid == True`` are returned. |
:returns: items from container that passed the selector function |
"""""" |
selector = (lambda sii: sii.isValid) if selector is None else selector |
if specfiles is None: |
specfiles = [_ for _ in viewkeys(self.info)] |
else: |
specfiles = aux.toList(specfiles) |
return _getListItems(self.container, specfiles, sort, reverse, selector)" |
1952,"def getValidItem(self, specfile, identifier): |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.