A pleasant walk through computing

Comment for me? Send an email. I might even update the post!

Installing fcm flow cytrometry library on Windows 8.1

My friend Andrew is working with flow cytrometry, which is a fancy way of saying “a field I don’t understand.” He wanted to use a python library for analyzing data, but was having trouble getting it installed. After some effort, I found this worked. The core problem is that py-fcm hasn’t been updated to work with later versions of its dependencies. It also doesn’t list the versions of its dependent libraries, making installation difficult.

Fortunately, I happened across a site that maintains Windows binaries for lots of packages, plus a science-ready Python distribution. I don’t know if this will install properly on Windows 7, but believe it will.

Downloads

Enthought Canopy Express

This is a free Python distribution. I installed the x64 version, specifically 1.4.0-win-64, which used Python 2.7. It includes the following packages that py-fcm depends on: numpy, scipy, matplotlib, cython.

https://www.enthought.com/downloads/

DPMix

The Windows installer version of DPMix. I used version dpmix-01.win-amd64-py2.7.exe.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#dpmix

Py-FCM

Download the Windows installer fcm‑0.9.1.win‑amd64‑py2.7.exe from

http://www.lfd.uci.edu/~gohlke/pythonlibs/#py-fcm

Also, download the latest source. This just makes it easier to get the sample file.

https://code.google.com/p/py-fcm/source/browse/

NOTE

I did not install mpi4py, as it is an optional dependency, but here are the links. I also didn’t install the fcm GPU support.

http://www.lfd.uci.edu/~gohlke/pythonlibs/#mpi4py

https://bitbucket.org/mpi4py/mpi4py/downloads

Installation

1. Run the Canopy installer. It does not require administrative privileges. I stuck with the defaults.

image

image

image

Clicking “Start using Canopy” will configured the environment. When configured, a window will open, which you can then close. Your desktop will have two icons, one for Canopy, the other for PyLab.

2. Run the DPMix Windows installer. It will find the Python installation and use it.

image

image

image

3. Run the py-fcm Windows installer. It likewise will find and use the Python installation.

image

4. Modify gate.py script. This is critical, as the matplotlib library no longer uses nxutils.

  1. Open this file in a text editor (using your own Username for the directory): C:\Users\Charles\AppData\Local\Enthought\Canopy\User\Lib\site-packages\fcm\core\gate.py

  2. Comment out line 56, and uncomment line 52.

if name is None:
    name = self.name
idxs = points_in_poly(self.vert, fcm.view()[:, chan])

# matplotlib has points in poly routine in C
# no faster than our numpy version
#idxs = points_inside_poly(fcm.view()[:, chan], self.vert)

Also comment out the nxutils import on line 2

import numpy
#from matplotlib.nxutils import points_inside_poly

Test

  1. Unzip the py-fcm source. In the sample_data folder is a file named 3FITC_4PE_004.fcs.
  2. Open a text editor, and copy the complete path to the file, e.g.
    C:\Users\Charles\Documents\FCM Flow Cytometry\Py-FCM\py-fcm-91701cc7a98e\sample_data\3FITC_4PE_004.fcs
  3. Now, replace all back slashes with forward slashes.
    C:/Users/Charles/Documents/FCM Flow Cytometry/Py-FCM/3FITC_4PE_004.fcs
  4. Open PyLab from the icon on the desktop, and run the samples found here (reproduced below).

image

fcm provides the loadFCS() function to load fcs files:

>>> from fcm import loadFCS
>>> data = loadFCS('../sample_data/3FITC_4PE_004.fcs')
>>> data
3FITC_4PE_004
>>> data.channels
['FSC-H', 'SSC-H', 'FL1-H', 'FL2-H']
>>> data.shape
(94569, 4)

Since the FCMdata object returned by loadFCS() delegates to underlying numpy array, you can pass the FCMdata object to most numpy functions

>>> import numpy as np
>>> np.mean(data)
410.38791252947584
>>> np.mean(data,0)
array([ 538.76464803,  421.57733507,  340.03599488,  341.17367213])
>>> import pylab
>>> pylab.scatter(data[:,0],data[:,1], s=1, edgecolors='none')
>>> pylab.xlabel(data.channels[0])
>>> pylab.ylabel(data.channels[1])
>>> pylab.show()

_images/basic-1.png

 

References

Info about the nxutiles error. https://groups.google.com/forum/#!topic/py-fcm-dev/HibEajOCTEY

https://pythonhosted.org/fcm/install.html
https://code.google.com/p/py-fcm/
https://www.enthought.com/
http://www.scipy.org/index.html
http://matplotlib.org/
https://github.com/andrewcron/dpmix
http://docs.cython.org/src/quickstart/install.html
https://bitbucket.org/mpi4py/mpi4py/downloads
http://mpi4py.scipy.org/docs/usrman/install.html#requirements

Windows 8.1 Update 1 Driver Problem DTMB BDA TV USB

After updating to Windows 8.1 Update 1, my wife installed a USB flash drive that previously gave her no problems, and now wouldn’t show as a drive in Explorer. I got the same error on my (also updated) computer.

image

A notification was in the system tray to view devices, which showed the flash drive icon. Right-clicking that and choosing Troubleshoot suggested removing the device and reinserting. Some web searching said the same thing—which was almost right. However, the driver wasn’t being fully removed, so kept getting used again, resulting in the same error.

1

Instead, the driver needs to be completely removed. To do this:

  1. Plug in the flash drive.
  2. Open Device Manager.
  3. Find the bad device.
  4. Right-click and choose Uninstall.
  5. When prompted, check Delete the software for this device.
  6. Unplug the drive, then plug it back in.
  7. The drive should now be available.

image

4

Windows 8.1: Window Key + S = Search from Desktop

Something I don’t (didn’t) like about Windows 8.x is that, if you’re in the desktop, to search for an application required:

  1. Press Window key, taking you out of the desktop and into to the Modern UI.
  2. Start typing.

I hate switching contexts just to find/open an app that don’t have pinned. I mean, I can’t pin all of them! In Windows 7, this is

  1. Press Window key.
  2. Start typing.

I just discovered by exploration that in Windows 8.1 (and presumably 8.0), this sequence keeps me in the desktop:

  1. Press Window key + S.
  2. Start typing.

image

Likewise, Window key + Q, W or F. They all open the search sidebar. Note that “F” opens a file search, while the others open “search everything.”

I haven’t found a keyboard shortcut to open the Modern application list. Yet.