openms / pyopenms-docs Goto Github PK
View Code? Open in Web Editor NEWpyOpenMS readthedocs documentation, additional utilities, addons, scripts, and examples.
Home Page: https://pyopenms.readthedocs.io
License: Other
pyOpenMS readthedocs documentation, additional utilities, addons, scripts, and examples.
Home Page: https://pyopenms.readthedocs.io
License: Other
Currently the .mzTab need to be hardcoded to be loaded into the widget.
An improvement would be to do this over a load button inside an empty widget.
Also other buttons as save could be implemented if one wants to change and save the table
needs rework
Currently, it is called using a spectrum file name.
As a pure view class this should only take the MSExperiment and not add logic for loading files.
@timosachsenberg @JeeH-K please change this to access data more efficiently using get_peaks
, the current approach below is very inefficient:
can we run them and check if an error is produced?
how to report?
# -*- coding: utf-8 -*-
"""
ConsoleWidget is used to allow execution of user-supplied python commands
in an application. It also includes a command history and functionality for trapping
and inspecting stack traces.
"""
import initExample ## Add path to library (just for examples; you do not need this)
import pyqtgraph as pg
from pyqtgraph.Qt import QtCore, QtGui
import numpy as np
import pyqtgraph.console
app = pg.mkQApp()
## build an initial namespace for console commands to be executed in (this is optional;
## the user can always import these modules manually)
namespace = {'pg': pg, 'np': np}
## initial text to display in the console
text = """
This is an interactive python console. The numpy and pyqtgraph modules have already been imported
as 'np' and 'pg'.
Go, play.
"""
c = pyqtgraph.console.ConsoleWidget(namespace=namespace, text=text)
c.show()
c.setWindowTitle('pyqtgraph example: ConsoleWidget')
## Start Qt event loop unless running in interactive mode or using pyside.
if __name__ == '__main__':
import sys
if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'):
QtGui.QApplication.instance().exec_()
Currently, the fastest way to generate 2D spectra plots is to use either TOPPView or ImageCreator. Both are not available in pyOpenMS and adding ImageCreator to the library would introduce new and possibly conflicting dependencies (e.g., QImage).
https://github.com/OpenMS/OpenMS/blob/develop/src/utils/ImageCreator.cpp
Do we have other options?
E.g. only move the bilinear interpolation and gridding to the library and expose a pyOpenMS interface that returns a numpy image that can be directly displayed in pyqtgraph.
potentially important for a pyTOPP publication
add to https://pyopenms.readthedocs.io/en/latest/parameter_handling.html
how to getDescription in a nice way
and see if text still works
Small example for SpectrumAlignment class (e.g., theoretical vs. observed)
see Chemistry
In the pyopenms docs there is an example about how to calculate the TIC from a MSExperiment. Isn't it better to use the TIC information in a Chromatogram:
tic = exp.getChromatograms()[0]
for rt, i in zip(*tic.get_peaks()):
# use rt and i to construct the data structure of your choice
might be a nice way to create interactive pyOpenMS jupyter notebooks from examples.
Not sure if it works with our dependencies though...
Especially in the introduction there are often core blocks with both python code and in the next line the output.
This should be avoided for binder.
e.g. which branches get built, which version of python/sphinx is used etc.
I do not have rights to change that on RTD settings.
e.g., for easy integration into ML
Currently, the Spectrum viewer widget loads the whole experiment into memory.
That way it is not feasible to inspect many different mzML files.
OpenMS provides an OnDiscExperiment that doesn't load the whole mzML file into memory but directly accesses
the spectra through an index in the mzML file.
It would be beneficial to change that.
scikit learn does it like that and it might be useful
Wrapping:
static const std::string NamesOfPolarity[SIZE_OF_POLARITY];
static const std::string NamesOfInletType[SIZE_OF_INLETTYPE];
static const std::string NamesOfIonizationMethod[SIZE_OF_IONIZATIONMETHOD];
static const std::string NamesOfDerivatizationAgent[static_cast<int>(DerivatizationAgent::SIZE_OF_DERIVATIZATIONAGENT)];
static const std::string NamesOfMassIntensityType[static_cast<int>(MassIntensityType::SIZE_OF_MASSINTENSITYTYPE)];
static const std::string NamesOfSpecificity[SIZE_OF_SPECIFICITY];
static const std::string NamesOfNumpressCompression[SIZE_OF_NUMPRESSCOMPRESSION];
static const std::string NamesOfProcessingAction[SIZE_OF_PROCESSINGACTION];
static const std::string NamesOfSpecificityType[SIZE_OF_SPECIFICITYTYPE];
static const std::string NamesOfChecksumType[SIZE_OF_CHECKSUMTYPE];
static const std::string NamesOfIonOpticsType[SIZE_OF_IONOPTICSTYPE];
static const std::string NamesOfSpectrumType[SIZE_OF_SPECTRUMTYPE];
static const std::string NamesOfType[SIZE_OF_TYPE];
static const std::string NamesOfAcquisitionMode[SIZE_OF_ACQUISITIONMODE];
static const std::string NamesOfIsotopeVariant[SIZE_OF_ISOTOPEVARIANT];
static const std::string NamesOfScanMode[SIZE_OF_SCANMODE];
static const std::string NamesOfActivationMethod[SIZE_OF_ACTIVATIONMETHOD];
static const std::string NamesOfActivationMethodShort[SIZE_OF_ACTIVATIONMETHOD];
static const std::string NamesOfQuantTypes[SIZE_OF_QUANT_TYPES];
static const std::string NamesOfAnalyzerType[SIZE_OF_ANALYZERTYPE];
static const std::string NamesOfResolutionMethod[SIZE_OF_RESOLUTIONMETHOD];
static const std::string NamesOfResolutionType[SIZE_OF_RESOLUTIONTYPE];
static const std::string NamesOfScanDirection[SIZE_OF_SCANDIRECTION];
static const std::string NamesOfScanLaw[SIZE_OF_SCANLAW];
static const std::string NamesOfReflectronState[SIZE_OF_REFLECTRONSTATE];
static const std::string NamesOfSampleState[SIZE_OF_SAMPLESTATE];
static const std::string NamesOfPeakMassType[SIZE_OF_PEAKMASSTYPE];
static const std::string NamesOfAnnotationState[SIZE_OF_ANNOTATIONSTATE];
static const std::string NamesOfLabelType[SIZE_OF_LABEL_TYPE];
Examples:
using getChromtograms()
and by manual calculation
https://pyopenms.readthedocs.io/en/latest/getting_started.html#tic-calculation
Add target / decoy creation, PeptideIndexer, FDR, filtering
https://pyopenms.readthedocs.io/en/latest/peptide_search.html#simplesearch
also protein inference at the end
Maybe in a colored box e.g. something like
In this section, you will learn:
It will be good to have Launch with Google Colab button similar to launch with binder option.
few sentences so that the reader with no background can at least get an idea how to classify the information/topic that follows
Hi,
I wonder if there is a repository of workflows are building blocks to build workflows with PyOpenMs?
In particular, I am looking for an implementation of a TMT 11 quantitative proteomics workflow.
Some sample code how to add filters to (e.g., the MS column)
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, \
QHBoxLayout, QWidget, QDesktopWidget, QMessageBox, \
QLabel, QAction, QFileDialog, QTableView, QSplitter, QComboBox, \
QDialog, QToolButton, QLineEdit, QRadioButton, QGroupBox, QGridLayout, QMenu,\
QFormLayout, QDialogButtonBox, QAbstractItemView
from PyQt5.QtCore import Qt, QAbstractTableModel, pyqtSignal, QItemSelectionModel, QSortFilterProxyModel
from PyQt5.QtGui import QStandardItemModel, QStandardItem, QPainter, QIcon, QBrush, QColor, QPen, QPixmap
import random
class myWindow(QMainWindow):
def __init__(self, parent=None):
super(myWindow, self).__init__(parent)
self.centralwidget = QWidget(self)
self.view = QTableView(self.centralwidget)
self.gridLayout = QGridLayout(self.centralwidget)
self.gridLayout.addWidget(self.view, 1, 0, 1, 3)
self.setCentralWidget(self.centralwidget)
self.model = QStandardItemModel(self)
# fill table with values
for rowName in range(15):
self.model.invisibleRootItem().appendRow(
[QStandardItem("MS {0}".format(random.randint(1,3)))] +
[
QStandardItem("blablub")
for columns in range(4)
]
)
self.proxy = QSortFilterProxyModel(self)
self.proxy.setSourceModel(self.model)
self.view.setModel(self.proxy)
self.horizontalHeader = self.view.horizontalHeader()
self.horizontalHeader.sectionClicked.connect(self.on_view_horizontalHeader_sectionClicked)
@QtCore.pyqtSlot(int)
def on_view_horizontalHeader_sectionClicked(self, logicalIndex):
if logicalIndex != 0: return # allow filter on first column only
self.logicalIndex = logicalIndex
self.menuValues = QMenu(self)
self.signalMapper = QtCore.QSignalMapper(self)
valuesUnique = [ self.model.item(row, self.logicalIndex).text()
for row in range(self.model.rowCount())
]
actionAll = QAction("All", self)
actionAll.triggered.connect(self.on_actionAll_triggered)
self.menuValues.addAction(actionAll)
self.menuValues.addSeparator()
for actionNumber, actionName in enumerate(sorted(list(set(valuesUnique)))):
action = QAction(actionName, self)
self.signalMapper.setMapping(action, actionNumber)
action.triggered.connect(self.signalMapper.map)
self.menuValues.addAction(action)
self.signalMapper.mapped.connect(self.on_signalMapper_mapped)
headerPos = self.view.mapToGlobal(self.horizontalHeader.pos())
posY = headerPos.y() + self.horizontalHeader.height()
posX = headerPos.x() + self.horizontalHeader.sectionPosition(self.logicalIndex)
self.menuValues.exec_(QtCore.QPoint(posX, posY))
@QtCore.pyqtSlot()
def on_actionAll_triggered(self):
filterColumn = self.logicalIndex
filterString = QtCore.QRegExp( "",
QtCore.Qt.CaseInsensitive,
QtCore.QRegExp.RegExp
)
self.proxy.setFilterRegExp(filterString)
self.proxy.setFilterKeyColumn(filterColumn)
@QtCore.pyqtSlot(int)
def on_signalMapper_mapped(self, i):
stringAction = self.signalMapper.mapping(i).text()
filterColumn = self.logicalIndex
filterString = QtCore.QRegExp( stringAction,
QtCore.Qt.CaseSensitive,
QtCore.QRegExp.FixedString
)
self.proxy.setFilterRegExp(filterString)
self.proxy.setFilterKeyColumn(filterColumn)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
main = myWindow()
main.show()
main.resize(400, 600)
sys.exit(app.exec_())
Hi I am new to pyopenms
I needed to extract the scan polarity ; I think I can use the tag 'MS:1000130' in mzml file; but I am unable to understand how I can use getitem to do that; so far I understood that I could do that with it ;
<cvParam cvRef="MS" accession="MS:1000130" value="" name="positive scan" />
Any example code will be appreciated.
Thanks
Amnah
probably via pandoc or rst ?
Or at least do not tell users to use Anaconda and then install things from pip..
Spyder might actually work if both comes from conda, i.e. same QT version is used.
On Windows , Pytho 3.8.6. an upgrade from 2.4.0 tpo 2.6.0 raised the following exception:
Updating dependencies
Resolving dependencies...
Package operations: 0 installs, 1 update, 0 removals
• Updating pyopenms (2.4.0 -> 2.6.0)
EnvCommandError
Command D:\mvp-end-device-agent\.venv\Scripts\pip.exe install --no-deps -U file:///C:/Users/Plasmion/AppData/Local/pypoetry/Cache/artifacts/e5/19/70/ec2071b487ede5fe00136b514692e0ba8dbd27f9303bfa7f79dd9c2fa6/pyopenms-2.6.0-cp38-cp38-win_amd64.whl errored with the following return code 2, and output:
Processing c:\users\plasmion\appdata\local\pypoetry\cache\artifacts\e5\19\70\ec2071b487ede5fe00136b514692e0ba8dbd27f9303bfa7f79dd9c2fa6\pyopenms-2.6.0-cp38-cp38-win_amd64.whl
ERROR: Exception:
Traceback (most recent call last):
File "D:\mvp-end-device-agent\.venv\lib\site-packages\pip\_internal\cli\base_command.py", line 228, in _main
status = self.run(options, args)
File "D:\mvp-end-device-agent\.venv\lib\site-packages\pip\_internal\cli\req_command.py", line 182, in wrapper
return func(self, options, args)
File "D:\mvp-end-device-agent\.venv\lib\site-packages\pip\_internal\commands\install.py", line 323, in run
requirement_set = resolver.resolve(
File "D:\mvp-end-device-agent\.venv\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 183, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "D:\mvp-end-device-agent\.venv\lib\site-packages\pip\_internal\resolution\legacy\resolver.py", line 391, in _resolve_one
dist = abstract_dist.get_pkg_resources_distribution()
File "D:\mvp-end-device-agent\.venv\lib\site-packages\pip\_internal\distributions\wheel.py", line 29, in get_pkg_resources_distribution
with ZipFile(self.req.local_file_path, allowZip64=True) as z:
File "d:\python\python386\lib\zipfile.py", line 1269, in __init__
self._RealGetContents()
File "d:\python\python386\lib\zipfile.py", line 1336, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
e.g., put a link like "See all wrapped method definitions."
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.