how to convert lmd file to csv? [Flow Cytometry data]

0

Issue

lmd file extension is often used for generating flow cytometry data. But this couldn’t be directly used for processing either in R or Python. Is there a way to somehow convert it to csv or some renowned format?

Solution

This is a bit tricky. So far I haven’t come across any such direct conversion function. Perhaps, fcs is a more common format for flow-cytometry. Hence, we will first need to convert lmd to fcs and then to csv format.

Step 1: lmd to fcs [Using R]

# install
source("http://bioconductor.org/biocLite.R")
biocLite("flowCore")

# convert
library(tools) # for file_path_sans_ext

if (!requireNamespace("BiocManager", quietly = TRUE))
  install.packages("BiocManager")

BiocManager::install(version = '3.10')

BiocManager::install("flowCore")
library(flowCore)

in.fname <- 'Filename.LMD'
folder <- '/home/User/Desktop/Data/'
x <- read.FCS(paste0(folder, in.fname))
summary(x)
out.fname <- paste0(file_path_sans_ext(in.fname), '.fcs')
write.FCS(x, paste0(folder, out.fname))

Note: Change User and Filename with your desired path and filename respectively
Your fcs file will be saved in the same folder.

Source: https://github.com/eyurtsev/FlowCytometryTools/issues/3

Step 2: fcs to csv

This could be done simply using the read.FCS() function to read in a FCS file, and then using write.delim() or write.csv() to create a .txt or .csv file.

Source: https://www.bioconductor.org/packages/release/bioc/vignettes/flowCore/inst/doc/HowTo-flowCore.pdf

Answered By – Sachin Motwani

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More