Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with accessing data in .fcs files #9

Closed
JLautin opened this issue Dec 17, 2015 · 6 comments
Closed

Issue with accessing data in .fcs files #9

JLautin opened this issue Dec 17, 2015 · 6 comments

Comments

@JLautin
Copy link

JLautin commented Dec 17, 2015

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

@eyurtsev
Copy link
Owner

Could you attach your FCS file, so I could debug?

Could you also confirm that you're using using python 2.7 rather than python >3?

At the command terminal you can type the following:

python --version

@JLautin
Copy link
Author

JLautin commented Dec 17, 2015

I'm running Python 2.7.10 64-bit on a mac (os x Yosemite).

I've attached a zipped file below, since it didn't support to attach .fcs files. Hope it doesn't mess with your AV too much.

Regards
JLautin
LMO_bacteria.fcs.zip

@eyurtsev
Copy link
Owner

Thanks! I will take a look at this over the weekend.

On Thu, Dec 17, 2015 at 9:28 AM, JLautin notifications@github.com wrote:

I'm running Python 2.7.10 64-bit on a mac (os x Yosemite).

I've attached a zipped file below, since it didn't support to attach .fcs
files. Hope it doesn't mess with your AV too much.

Regards
JLautin
LMO_bacteria.fcs.zip
https://github.com/eyurtsev/FlowCytometryTools/files/65467/LMO_bacteria.fcs.zip


Reply to this email directly or view it on GitHub
#9 (comment)
.

Eugene Yurtsev

Personal Website: http://eyurtsev.mit.edu

@eyurtsev
Copy link
Owner

Looks like this is caused by an issue with numpy numpy/numpy#2407

I'll try and release a fix within the next few days

If you need a fix quicker than that you can try and do the following:

  1. locate the directory for the fcsparser package
import fcsparser
fcsparser.__path__
  1. go to that directory and open api.py

  2. Make the following change in the code:

@@ -353,7 +353,8 @@ class FCSParser(object):
             # values saved in mixed data formats
             dtype = ','.join(par_numeric_type_list)
             data = numpy.fromfile(file_handle, dtype=dtype, count=num_events)
-            data.dtype.names = self.get_channel_names()
+            names = self.get_channel_names()
+            data.dtype.names = [name.encode('ascii', errors='ignore') for name in names]
         else:
             # values saved in a single data format
             dtype = par_numeric_type_list[0]

where a (-) is remove, and a (+) is add

@eyurtsev
Copy link
Owner

Fixed in this commit: eyurtsev/fcsparser@398b6b0

Please install the newest version of fcsparser (and FlowCytometryTools)

pip install fcsparser==0.1.2
pip install FlowCytometryTools==0.4.5

@JLautin
Copy link
Author

JLautin commented Dec 29, 2015

Thank you for solving it!

/JLautin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants