How to load data csv in MAST
1
0
Entering edit mode
@francescobrundugmailcom-5985
Last seen 3.2 years ago

Hi,

I am trying to understand how to load a plain csv file in MAST. I looked for the vignettes (e.g. https://github.com/RGLab/MAST/blob/master/vignettes/MAST-Intro.Rmd ) but it is unclear to me how it can be done. My idea is about something as simple as:

df <- read.table(...)

Is it possible, or do I have to use an intermediate package to provide data to MAST?

Thanks,

Francesco

mast • 396 views
2
Entering edit mode
@francescobrundugmailcom-5985
Last seen 3.2 years ago

Reading from the reference I found the method FromMatrix(), and I solved with:

# Assuming the original file is tab-separated, with cells on rows and genes on columns
df <- t(read.table('file.txt', sep = '\t', header = TRUE, row.names = 1))
fData <- data.frame(primerid=rownames(df))
cData <- data.frame(wellKey=colnames(df))
sca <- FromMatrix(as.matrix(df), cData = cData, fData = fData)