Entering edit mode
12 months ago
DareDevil
★
4.3k
I have 500 tumor samples collected at 5 batches. My samples don't have any groups. How will I do the batch correction. Is the step below correct?
#Expression data
counts = read.table("tumor.unstranded.txt", sep="\t", header = T, row.names = 1)
#Sample information
factors = read.table("target_batch.txt", sep="\t", row.names=1, header = T)
#create dds object
dds = DESeqDataSetFromMatrix(countData=counts,
colData=factors,
design = ~1 + Batch)
#Perform DESeq2
dds <- DESeq(dds)
#VST analysis
vsd <- vst(dds, blind=FALSE)
mat <- assay(vsd)
#remove batch
mat <- limma::removeBatchEffect(mat, vsd$Batch)
assay(vsd) <- mat
counts_batch_corrected <- assay(vsd)