nolanlab / spade

SPADE: Spanning Tree Progression of Density Normalized Events
Other
46 stars 23 forks source link

Error in read.FCS #143

Open abbatidanilo opened 5 years ago

abbatidanilo commented 5 years ago

Hi, I am using spade to down-sample my flowSet. For this I use the following commands

SPADE.addDensityToFCS(infilename = fFvectorName[[i]], outfilename = fFvectorName_out[[i]])
# and then
SPADE.downsampleFCS(infilename = fFvectorName_out[[i]], outfilename = fFvectorName[[i]], exclude_pctile = p1, target_percent = p2, target_pctile = p3)

After the SPADE.downsampleFCS() function I tried to read the flowFrame with the canonical read.FCS() and I got the following error:

Error in read.FCS("tmpdata/perc0.2dfF_sample_1.fcs") : filetmpdata/perc0.2dfF_sample_1.fcsseems to be corrupted. The actual number of cells in data section (1) is not consistent with keyword '$TOT' (0)

As an indication, the FCS files I used, collect a very small amount of events (26) but in any case the related parameter is regularly set in input and it is correctly parsed after the first function SPADE.addDensityToFCS()

SamGG commented 5 years ago

Hi, I am not the developer, but I will try to understand your question. The file name given to your output file is surprising me because it point to a temporary folder. Did you really specify such a location? I guess you wrote a loop around the two commands you wrote in your question. Could you show more code? Best.

abbatidanilo commented 5 years ago

Hello SamGG, thank you for getting back to me. I checked the last commit and it was Mar 14, 2016... I thought that nobody was looking for this library since a while. In any case, I am using spade to perform a down sampling inside a webapp for cytofluorimetry. That's why I'am using a temporary folder, but the two functions works perfectly for most of the cases.

Sometimes I get the error I mentioned (_Error in read.FCS("tmpdata/perc0.2dfF_sample_1.fcs") : filetmpdata/perc0.2dfF_sample1.fcsseems to be corrupted) and sometime I got the following:

_Warning: Error in SPADE.downsampleFCS: unused argument (targetpercent = p2) where p2 is just a parameter set by default to 1.0 (100%). This looks like a warning but actually is treated as an error (the SPADE.downsampleFCS() function simply stops).

The first case, as a mention, could be related to my input .fcs files which are only test files with very few events (around 20!) but the second happens with samples of normal length with more than 10k events. In both cases the error is thrown by the SPADE.downsampleFCS()

The problem is that the associated help does not reflect exactly what it is implemented: _excludepctile, _targetpercent and _targetpctile are the implemented parameters (I set these parameters by default to 0.2, 1.0 and 0.9 respectively in my environment) On the other side on the provided help I see: _excludepctile, _targetpctile and _desiredsamples which I fear does not corresponds totally (the last is a number in the documentation while the implemented _targetpctile is clearly a percentage). I am currently using Package spade version 1.10.4 with RStudio Version 1.2.1335 and R 3.5.3