Dienstag, 27. Oktober 2015

My first python package on pypi - mspy

Have you heard about http://www.mmass.org/?
It's a python application (with a GUI) for processing and visualizing mass spectrometric data.
Unfortunately, development is discontinued (the latest release was  Jul 1, 2013)*. Unfortunately since there are a few cool features in mMass:
  • mzXML file access
  • peak detection and deisotoping
  • recalibration
  • ...

Since mMass, at the first glance is code of good quality, and algorithms are separated from the GUI, it was relatively easy to create a python package containing the algorithm part**. This part is now available as package here:

https://pypi.python.org/pypi/mspy

(Windows 64 version for the start)

so
pip install mspy
will do.

The sources of the package is now here:
https://github.com/wolski/mspy

There are no unit tests (I did not find any, if I will be using mspy I will be adding some).


* Martin Strohalm, PhD. the developer of mMass is now, according to his linked in profile, at Thermo Fischer in Bremen developing I guess some super cool software in C# for the Thermo Orbitrap Mass-specs.

** Although the author specified in the setup.py file is Martin Strohalm at pypi I am missleadingly specified as the author!?

Montag, 26. Oktober 2015

Resharper C++ and findMFBase

Finally got findMFBase
build in with VS. (see my previous post about findMFBase).

The generated .vcproj's build the unit tests shipped with findMFBase.
I have an academic licence of C++ Resharper and would like to put this software to some use.

The problem is that C++ ReSharper seems not to be aware of the header files of findMFBase (a header only library).

As long as I am in the .cpp file everything seems fine but if I open an header than the #include statements pointing to other header files within the findMFBase library are marked in red.

I did the cmake glob trick to have the header files included in the project.

file(GLOB Demo_HEADERS "sql/*.sql" "include/*.h" "include/**/*.h" "include/**/**/*.h"
 "include/**/**/**/*.h" "src/**/*.h" "src/**/**/*.h" ".travis.yml")
add_library(headers SHARED ${Demo_HEADERS} Dummy.cpp)


But as already said Resharper C++ is not aware of them.

I did post the problem also at the C++ ReSharper forum. Curious what they reply? Hopefully they are not going recommend to use clion because of cmake (Visual Studio is so much cooler).

Freitag, 23. Oktober 2015

Building findMFBase on windows for VisualStudio

I am trying to build the project https://github.com/findMF/findMFBase 
on windows. (for details of linux build check the .travis.yml file and take a look at Travis build results).

Since, cmake's find_boost does not work on windows, and also setting Boost_DIR in CMake GUI does not work I needed to add to the topmost CMakeLists.txt file

set(BOOST_ROOT "C:/boost/boost_1_57_0/")

Likely you boost installation is somewhere else so adjust it.

I did download prebuild boost libraries from here:
http://sourceforge.net/projects/boost/files/boost-binaries/1.57.0/

And also renamed the lib_win64... directory (the containing the .lib files) into lib/

Than I did run (in PowerShell):

mkdir findMFBaseBuild
cd findMFBaseBuild
cmake ..\findMFBase -G "Visual Studio 12 2013 Win64"

(Since I have VS 2013 community edition installed)

Than I open the generated sln in VS and build the ALL_BUILD project.


What I struggled with when building on windows was the following (now fixed)


Some projects are build but the first project having a dependency on data_time fails with
fatal error LNK1104: cannot open file 'libboost_date_time-vc120-mt-gd-1_59.lib'

I did a search for liboost_*.lib vs. boost_*.lib which returns some discussions on Stackoverflow pointing too:

SET( USE_STATIC_BOOST ON)
set(Boost_USE_STATIC_LIBS ${USE_STATIC_BOOST})


So the solution:
add_definitions( -DBOOST_ALL_NO_LIB )

For more detail see http://www.boost.org/doc/libs/1_57_0/libs/config/doc/html/index.html



Donnerstag, 15. Oktober 2015

Virtualenv on windows and building python packages

using now conda to manage virtual envs on windows (update 19/12/2015)

http://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/

for interop with pycharm see:

http://stackoverflow.com/questions/28390961/using-anaconda-within-pycharm

Very helpful (notice got it running only with python 2.7):

http://www.tylerbutler.com/2012/05/how-to-install-python-pip-and-virtualenv-on-windows-with-powershell/

Once you have set up the virtual env and you want to use it in a new powershell just edit the shortcut to PS so that :
Target: %SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Unrestricted
Start In: %HOMEDRIVE%%HOMEPATH%

Creating virtual environment:
Import-Module virtualenvwrapper
New-VirtualEnvironment applicake


Loading a virtual env:

Import-Module virtualenvwrapper 
(not sure if it is actually necessary?)

# I have already these environments
Set-VirtualEnvironment engineer
Set-VirtualEnvironment applicake
Set-VirtualEnvironment mspy

Virtual env on linux

source virtenvs/systemmhc/bin/activate

Building native python packages on windows just download:

Microsoft Visual C++ Compiler for Python 2.7


afterwards you can install numpy by executing
pip install numpy

Some package are more difficult to build because of their dependencies. In such a case visit:
http://www.lfd.uci.edu/~gohlke/pythonlibs/

Building python packages

Just create a folder in the folder create a setup.py file, create a subfolder, place in the subfolder your .py files and an __init__.py file (see my tiny python project cakeme).

install package in user directory  (no virtual env but --user directory):

pip install --user cakeme

install package locally in development mode:

pip install --user -e . (begin in the package directory)

create local whl file

python setup.py bdist_wheel

Register package with pypi.python.org


python setup.py register

Pushing changes in python package to pypi:


python setup.py bdist_wheel upload




How to install a whl file:

pip install some-package.whl

Some more tipps for powershell users:

$env:Path += ";C:\Program Files\Sublime Text 2\"

Montag, 12. Oktober 2015

Calling pwiz build from visual studio

I got this information from Parag and since it might be relevant to many I post it here:

So it means that you can use visual studio as plain text editor when developing pwiz. I might use notepad++ instead.

Donnerstag, 1. Oktober 2015

maltcms - getting started

http://maltcms.sourceforge.net/

git clone git://git.code.sf.net/p/maltcms/code
git fetch origin
git checkout release-1.4.0

cd maltcms-code
mvn install


Furthermore, download data from:
http://sourceforge.net/projects/maltcms/files/maltcms/example-data/

in
maltcms-code\maltcms-distribution\target\maltcms-1.4.0-SNAPSHOT-bin\maltcms-1.4.0-SNAPSHOT>

bin\maltcms.bat -Xrunjdwp:transpt=dt_socket,server=y,address=8888,suspend=y -c cfg\pipelines\bipace.mpl -f C:\Users\wolski\prog\maltcms-sampledata\maltcms-example-data\cdf\1D\*.cdf -o testOutput

bin\maltcms.bat -c cfg\pipelines\bipace.mpl -f C:\Users\wolski\prog\maltcms-sampledata\maltcms-example-data\cdf\1D\*.cdf -o testOutput


user information:
http://maltcms.sourceforge.net/maven/maltcms/1.3.2/gettingStarted.html


More information:
http://www.biomedcentral.com/1471-2105/13/214