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

Argument 'x' must be of type logical, integer or numeric, not 'character' #4

Open
Kathi123456 opened this issue Jul 1, 2020 · 4 comments
Assignees

Comments

@Kathi123456
Copy link

Kathi123456 commented Jul 1, 2020

Hello,

if I am using the script CSV-to-FCS I get an error when I want to run the last row:
write.FCS(data_subset.ff, paste0(a, ".fcs"))

Fehler in colMaxs(mat[, empty_range_chnl, drop = FALSE]) :
Argument 'x' must be of type logical, integer or numeric, not 'character'.

Does anyone have an idea how to solve this problem?

Thanks in advance!

Kind regards
Kathi

@tomashhurst
Copy link
Member

Hi there,

I think the issue you might have a column of 'character' values in your CSV files? FCS files don't like character values, as it can only encode numerical data (in the tabular format). There is an edit where it can convert character entries into numbers -- i.e. "Sample 1" would be come '1', "Sample 2" would become '2' etc.

@d-cac
Copy link

d-cac commented Jul 23, 2020

Hi,
I got the exact same issue.
I want to convert .fcs to .csv in order to do manual adjustment of the values, and then convert the file back to .fcs, but I get the exact same error at the last line of the script. I can convert a .cvs to a .fcs successfully using the script if I do it before I open it and adjust the values in Excel or Google Sheets, so I guess the problem lies here. For me the layout looks exactly the same after I have edited the .cvs file.
In order to do correction of the values I have to change all dots to commas, but I change them right back before I run the file through the script.

Any suggestions?

Best wishes

Daniel

@d-cac
Copy link

d-cac commented Jul 24, 2020

If i changed my location to "USA", I didn't have to bother with the decimal separator. Then it worked fine.

@tomashhurst tomashhurst self-assigned this Jul 27, 2020
@christianrickert
Copy link

It looks like @d-cac had a localization issue (non-English decimal separator). The solution is either to replace the commas with dots manually using a text editor or a script or by saving the file with the corresponding regions settings applied (either in the software's localization settings or with the operating system's region settings).

The issue that @Kathi123456 encountered is a regular issue at our service core (from a proprietary software data export). We're therefore providing a little Python script, the txt2csv_sanitizer, that prepares text files for the CSV-to-FCS export. If you want to clean up existing CSV files, make these adjustments to the code:

  1. Replace the line of code that removes commas from header entries here:
    pass
  2. Change the delimiter variable for the input file here:
    DELIMITER_IN = ","
  3. Change the file target variable to match your CSV input files here:
    FILE_TARGET = ".csv"
    (the matching is case-sensitive)

With these changes, the Python script will take any CSV file in the specified import folder (by default a folder named "import" at the same location as the script), remove non-numeric data from the file and write the data back to the specified export folder.

I hope this recommendation helps people who encounter similar issues!

Chris

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

4 participants