This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do I combine MAF files with clinical data to perform clinical enrichment analysis?

I want to read into a list of MAF files and combine it with the clinical data and then perform clinical enrichment analysis.

library(maftools)

# Load MAF files (By default, silent mutations are discarded using removeSilent=TRUE; Hence, silent mutations do not need to be subsetted in Question 2)
d <- merge_mafs(lapply(Sys.glob("mafs/Patient*.maf"), read.maf))

# Load sample information
c <- read.table(file="sample-information.tsv", sep="\t", header=T)  

# Combine MAF and sample info
d <- read.maf(maf=d, clinicalData=c)

Traceback:

-Reading Error in file.info(file) : invalid filename argument

    # Clinical enrichment

    response.ce = clinicalEnrichment(maf=d, clinicalFeature="Response")

Error in `[.data.table`(getClinicalData(x = maf), ,
c("Tumor_Sample_Barcode",  :    column(s) not found: Response
maftools maf mutation

1 answer

From what I understand, the merge_mafs function merges the MAF files and created an MAF object. The read.maf reads the MAF file (not MAF object) and creates an MAF object.

To add clinical data to the MAF object, you can try the following:

# Load MAF files (By default, silent mutations are discarded using removeSilent=TRUE; Hence, silent mutations do not need to be subsetted in Question 2)
d <- merge_mafs(lapply(Sys.glob("mafs/Patient*.maf"), read.maf))

# Load sample information
c <- read.table(file="sample-information.tsv", sep="\t", header=T)  

# Combine MAF and sample info
d@clinical.data <- c

Log in to answer this question.