Giter Site home page Giter Site logo

eyurtsev / flowcytometrytools Goto Github PK

View Code? Open in Web Editor NEW
112.0 112.0 45.0 20.01 MB

A python package for visualization and analysis of high-throughput flow cytometry data

Home Page: https://eyurtsev.github.io/FlowCytometryTools/

License: MIT License

Python 37.66% HTML 1.33% Jupyter Notebook 61.01%

flowcytometrytools's People

Contributors

aarmey avatar dwatson-bnovate avatar epgui avatar eyurtsev avatar jlumpe avatar nobregaipi avatar rpgoldman avatar yonatanf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flowcytometrytools's Issues

Unable to load fcs files

I'm trying to use FCMeasurement to read binary fcs files, but I get the following error:

File "/usr/local/lib/python2.7/dist-packages/fcsparser/api.py", line 178, in read_text
raise ParserFeatureNotImplementedError(msg)
fcsparser.api.ParserFeatureNotImplementedError: The first two characters were:
u'$'. The last two characters were: u' C'
Parser expects the same delimiter character in beginning and end of TEXT segment

Sorry if it's a basic question; first time using FC data on python.
Thanks,
CFBAN

Issue with accessing data in .fcs files

Hello!

I have an issue regarding accessing the data segment of my .fcs files with FlowCytometryTools. While accessing the meta data and channels works fine, as soon as I try to access the data, for example through sample.data or transformations I receive the error

"ValueError: item #0 of names is of type unicode and not string"

However, the testfile works just fine. My files are from a Partec Cube 8, in the FCS3.0 format.

Im quite new to the python language, so any help is appreciated.

Regards
JLautin

Tests error

Tests fail on Windows 7, Python 2.7, FlowCytomeryTools from master branch 19 May 2015:

>>> nosetests
======================================================================
ERROR: Failure: ImportError (No module named flowcytometrytools)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Anaconda\lib\site-packages\nose\loader.py", line 420, in loadTestsFromName
    addr.filename, addr.module)
  File "C:\Anaconda\lib\site-packages\nose\importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "C:\Anaconda\lib\site-packages\nose\importer.py", line 79, in importFromDir
    fh, filename, desc = find_module(part, path)
ImportError: No module named flowcytometrytools


-----------------------------------------------------------------------------
1) ERROR: Failure: ImportError (No module named flowcytometrytools)

   Traceback (most recent call last):
    C:\Anaconda\lib\site-packages\nose\loader.py line 420 in loadTestsFromName
      addr.filename, addr.module)
    C:\Anaconda\lib\site-packages\nose\importer.py line 47 in importFromPath
      return self.importFromDir(dir_path, fqname)
    C:\Anaconda\lib\site-packages\nose\importer.py line 79 in importFromDir
      fh, filename, desc = find_module(part, path)
   ImportError: No module named flowcytometrytools

hlog transformation and negative values

Hello,
congratulations, you have done a great tool. I however encounter problems with negative minimale values [-1 0] and new scales after an hlog transformations. With such minimales values, lxmin is <0 (log10(abs(xmin))) and f also. You should improve this point in next version. I added one test to slove this trouble :
if lmin<0: f=-lxmin/(-lxmin+lmax)
else : same ...
regards,
Marc

'pip install goreutilities' does not install the correct (latest) version and breaks Python 3 support

It seems the version of goreutils being installed on my machine (0.5.0) is the same version specified here https://bitbucket.org/gorelab/goreutilities/src/2c4224c5820a202394aa16a42afa581a73e5dc56/GoreUtilities/_version.py?at=master&fileviewer=file-view-default

However, the copy of the source installed in my virtualenv does not match the most up to date version of the source code. The version I get breaks in python 3.

IntervalGate bug(?)

I've been using your Flow package to do some batch processing. It's awesome. Thanks!

Anyway, I think there's a small bug in the _identify function for interval gates. At least in my hands, applying an interval gate always returned an error.

fix:

I edited gates.py, line 237, to:

def _identify(self, dataframe):

    idx = (dataframe[self.channels[0]] <= self.vert[1]) & (dataframe[self.channels[0]] >= self.vert[0])

    if self.region == 'out':
        idx = ~idx

    return idx

And then it works fine.

All the best, and thanks again!

Exporting FCS files of singlet "gate" with compensation values

Dear Dr. Yurtsev,

I work as a cytometrist at the Izmir Institute of Technology. I need to make doublet discrimination and compensation between fluorophores. May I consult you on a few topics on FlowCytometryTools?

Can I perform compensation by using FlowCytometryTools?

I especially need free software or an R/python package in which I can export FCS files of compensated singlet "gate." So, I can use this file for downstream analysis by using R or Python packages.

Can I export FCS files of compensated singlet "gate" by using FlowCytometryTools?

Can I perform dimensionality reduction and clustering for a multicolor panel?

If FlowCytometryTools cannot perform the above-mentioned specifications,

Doublet discrimination, compensation of fluorochromes
Exporting the FCS files of singlet "gate" with all of the fluorochromes’ compensation values
dimensionality reduction and clustering

Could you please recommend me an open source free flow cytometry data analysis software, R package or Python package?

Thank you in advance.

Kind Regards

Murat Delman
[email protected]

Issue with calling transform() on linear and glog

Not sure if I am calling this incorrectly but I tried the following two transforms:

tsample = sample.transform('glog',  channels=['Y2-A', 'B1-A', 'V2-A'], l=10)
tsample = sample.transform('linear',  channels=['Y2-A', 'B1-A', 'V2-A'], old_range=0.5, new_range=2.5)

but I am getting back (after stack trace attached)
stacktrace.txt

linear() got an unexpected keyword argument 'd'
I checked the code itself and looked like these were acceptable arguments, can you confirm?

Thank you

LMD to FCS

It would be cool to open LMD files (generated for example by Gallios machines).
Its possible to do it in R, so one could in principle reimplement in python or just use the R implementation and call it from python via Rpy2.

Here's an R script that does it:
https://gist.github.com/yoavram/198493cebbf0b323a9d8

Unable to load 96 well plate data

Hi,
I followed closely the tutorial, and can work without any issue with files containing only one sample.
However, when attempting at loading a 96 well plate .fcs file, I obtain the error:

"[...] UserWarning: There appears to be some information in the ANALYSIS sefment of file [...]. However, it might not be read correctly. u'{0}. However, it might not be read correctly.'.format(self.path))"

Then, regardless of the ID that I call, I can only access the A01 sample of my 96 well plate.

Do you have an idea as to what could cause this issue?

Thanks a lot!

FlowCytometryTools won't import

I am having trouble importing FlowCytometryTools, getting this error: "ImportError: cannot import name 'dedent' from 'matplotlib.cbook' "

bases.py installed by FlowCytometryTools version 0.51 is identical to version 0.50

Looks like version 0.51 does not have the updated bases.py regarding the addition of collections.abc

import FlowCytometryTools as fct
Traceback (most recent call last):
File "<pyshell#37>", line 1, in
import FlowCytometryTools as fct
File "/Users/apta/Library/Python/3.11/lib/python/site-packages/FlowCytometryTools/init.py", line 8, in
from FlowCytometryTools.core.containers import (FCMeasurement, FCCollection, FCOrderedCollection,
File "/Users/apta/Library/Python/3.11/lib/python/site-packages/FlowCytometryTools/core/containers.py", line 15, in
from FlowCytometryTools.core.bases import (Measurement, MeasurementCollection, OrderedCollection,
File "/Users/apta/Library/Python/3.11/lib/python/site-packages/FlowCytometryTools/core/bases.py", line 356, in
class MeasurementCollection(collections.MutableMapping, BaseObject):
AttributeError: module 'collections' has no attribute 'MutableMapping'

Bi-Exponential scale/trasformation

Hi,

I'm wondering if there's a possibility to reproduce with this package the bi-exponential transformation/scaling that is implemented in flow-jo.

Thanks in advance,

Best regard

Simone

logical (bi-exponetial) scale support?

Any thoughts on adding logical (eg bi-exponetial) scale support?

Here's an example:
here.

It would probably require a custom scale function for matplot lib (like this).

Here is the reference for the "logical" scaling equation: http://doi.org/10.1002/cyto.a.20258.

I haven't really been able to find anyone who has done this in python yet.

Thanks for the library BTW!

Load a csv file into FlowCytometryTools

Hi,
I am currently working with image analysis data. There I would love to be able to gate the cells as I could do in fcs. The problem is that they are not a .fcs file and I try to load it as a pandas dataframe with no success. I would really appreciate if you could help me to analyse my .csv file that is not from flow cytometry as if it were.
Thanks!
Irene

Use of deprecated function from matplotlib in docs

When I load FlowCytometryTools now, I get this warning message:

/Users/rpg/.virtualenvs/xplan-dev-env/lib/python3.6/site-packages/FlowCytometryTools/core/docstring.py:56: MatplotlibDeprecationWarning: 
The dedent function was deprecated in Matplotlib 3.1 and will be removed in 3.3. Use inspect.cleandoc instead.
  doc = dedent(doc)

It looks like this has been fixed in source, but PyPi still has an old version with the deprecated function. Would it be possible to make a release?

Subsampling function not working

Hello,

I'm struggling to figure out what to provide the subsampling method. From the API documentation it looks like there should be three items fed to the method:

image

However in the source it looks like it wants four items.

image

I'm starting with a 20,000 event FCMeasurement object and I want to subsample 1000 events randomly.

image

Following the API documentation I try:

tsample.subsample(1000, order='random', auto_resize=False)

But I get a TypeError:
TypeError: Population must be a sequence or set. For dicts, use list(d).

So trying the four inputs implied by the source code, I get the following error:

image

Would love to get this subsampling feature working. Thanks!

documentation figures are 404'd

a number of the figures on the github.io doc site (especially in the tutorial) are not found. Examples:

Any plans to add support for writing data in FCS format?

For example, one can imagine using Python to carry out some transformations on flow cytometry data, but then use other flow cytometry tools to visualize and further process the data. Since all these tools accept read FCS files, it would be nice to be able to save Python-transformed data in FCS format.

"500: Internal Server Error" when using gui with backend='webagg'

I used jupyter notebook and followed the tutorial, when I input

tsample.view_interactively(backend='webagg')

but the page 127.0.0.1:8080 shows 500: Internal Server Error and nothing else.
Then I looked the jupyter notebook information, and I saw

Traceback (most recent call last):
  File "/home/mon/anaconda3/lib/python3.6/site-packages/tornado/web.py", line 1413, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/home/mon/anaconda3/lib/python3.6/site-packages/FlowCytometryTools/gui/webagg_backend/gui.py", line 35, in get
    with open(app_path, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/mon/anaconda3/lib/python3.6/site-packages/FlowCytometryTools/gui/webagg_backend/app_template.html'
ERROR:tornado.access:500 GET / (127.0.0.1) 1.07ms

It seems that I lack the file /FlowCytometryTools/gui/webagg_backend/app_template.html, and I did not found it, which caused the error. So why didn't I have that file? How to save this problem?
Thank you!

MultipleMapping Class error

Hello,

Using FlowCytometryTools, we have had a number of issues running this code. We tend to get the error, "collections' has no attribute 'MutableMapping'".

When calling FCMeasurment, we get that the MutableMapping method in Measurment class is the culprit.

"MeasurementCollection(collections.MutableMapping, BaseObject
collections' has no attribute 'MutableMapping'"

In some environments, I have circumvented this by importing abc directly from collections in the begining of the script, but I am not sure why that is working, and doesn't always suffice. Have you experienced this issue in the past? It looks like this class has been updated before.

For background information, we are trying to install this on differnt machines. Some are mac M1 chip, some are Intel, some are microsoft, some are linux ubuntu. It doesn't seam to cooperate with all OS. We also have trouple installing it in a jupyter notebook.

We were wondering if the code needs to be updated with new version of python..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.