R: data.table::fread error when converting MAF files to data table
1
0
Entering edit mode
2.8 years ago

I want to merge the 50 MAF files with the sample information so that I can read it as a data.table and subset it.

library(maftools)

# Load MAF files
maf = system.file("extdata", list.files(path="mafs/"), package="maftools")

# Load sample information
si <- system.file("extdata", "sample-information.tsv", package="maftools")

d = read.maf(maf=maf, clinicalData=si)

Traceback:

Error in data.table::fread(file = maf, sep = "\t", stringsAsFactors = FALSE,  : 
  File '' does not exist or is non-readable. getwd()=='C:/Users/User/Documents/VanAllen'

> traceback()
3: stop("File '", file, "' does not exist or is non-readable. getwd()=='", 
       getwd(), "'")
2: data.table::fread(file = maf, sep = "\t", stringsAsFactors = FALSE, 
       verbose = FALSE, data.table = TRUE, showProgress = TRUE, 
       header = TRUE, fill = TRUE, skip = "Hugo_Symbol", quote = "")
1: read.maf(maf = maf, clinicalData = si)
1: data.table::fread(input = maf)

Maftools documentation: https://www.bioconductor.org/packages/release/bioc/manuals/maftools/man/maftools.pdf

data.table maftools bioconductor fread • 2.1k views
ADD COMMENT
0
Entering edit mode

Are you trying to read your own data or the example data from the package?

ADD REPLY
0
Entering edit mode

Yes, I want to read my own data.

ADD REPLY
0
Entering edit mode

Then this entire extdata thing is wrong. extdata are meant for files provided by a package, e.g. for demo purposes. You have to run list.files() pointing to the directory where your files are, and also use the argument list.files(x=path/to/your/folder, full_names=TRUE).

ADD REPLY
0
Entering edit mode
2.8 years ago
zx8754 12k

From the maftools manuals - read.maf:

maf tab delimited MAF file. File can also be gz compressed. Required. Alternatively, you can also provide already read MAF file as a dataframe.

And in your code you are supplying a list of files.

maf = system.file("extdata", list.files(...
ADD COMMENT
0
Entering edit mode

It doesn't work when I want to read my own data.

ADD REPLY
0
Entering edit mode

From the codes you have provided, you are using example data from the package. In any case, ensure the code runs with an example data provided by the package, then check the file structure. Then ensure the real data structure is the same with the example data and try to read in your own data.

ADD REPLY

Login before adding your answer.

Traffic: 2132 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6