Entering edit mode
3.9 years ago
rohitsatyam102
▴
850
Hi Everyone!!
I am using the following package for SVA analysis. Using normalized log2 values from DESeq2 object. However, I am getting the error at the SVA step. The entire code is as follows:
sampleTable <- read.csv("samplesheet.csv", header = T, stringsAsFactors = FALSE, sep = ",")
rownames(sampleTable)<-sampleTable[,1]
rownames(sampleTable)
ddsHTSeq<-DESeqDataSetFromHTSeqCount(sampleTable = sampleTable, directory = ".", design = ~ Sampletype + Batch)
keep <- rowSums(counts(ddsHTSeq)) > 10
ddsHTSeq <- ddsHTSeq[keep,]
ddsHTSeq <- estimateSizeFactors(ddsHTSeq)
normalized_counts <- counts(ddsHTSeq, normalized=TRUE)
##Checking the source of variation
###SVA analysis using Expression Normalization workflow package
log2_normalized_counts<-log2(normalized_counts+1)
inpData <- expSetobj(log2_normalized_counts, sampleTable)
## Set the covariates whose effect size on the data needs to be calculated
cvrts_eff_var <- c("Sampletype", "Batch")
pct_thrsh <- 0.75
## Perform the PVCA analysis
library(grid, lib.loc = "C:/Program Files/R/R-3.6.2/library")
png("PVCA_Batch_eff.png", width = 10, height = 9, units = 'in', res = 700)
pvcAnaly(inpData, pct_thrsh, cvrts_eff_var)
dev.off()
##Surrogate variable analysis
## Choose a biological variable that is to be used to calculate the surrogate variables
biol_var_sva <- "Sampletype"
sur_var_obj <- surVarAnaly(inpData, biol_var_sva)
Error in names(x) <- value : 'names' attribute [2] must be the same length as the vector [0]
But when I use:
biol_var_sva <- "Batch"
#Number of significant surrogate variables is: 1
#Iteration (out of 5 ):1 2 3 4 5
## The newly generated surrogate variables sv1 is appended to the ExpressionSet object
inpData_sv <- sur_var_obj$expSetobject
var_names <- "sv1"
pData(inpData_sv)<-conTocat(pData(inpData_sv), var_names)
Error in 1:len : argument of length 0
I am unable to understand what's wrong over here. Please help.