Importing raw counts on a script in R with these necessary packages
library(optparse)
library(DESeq2)
Then went ahead with the steps of:
- obtained file names
- loaded a control table
- experimental table loaded
- tables merged
- removed extra stuff to avoid duplicates
The following error is raised when trying to import the raw counts:
Error in match.names(clabs, names(xi)) :
names do not match previous names :Calls: rbind ... eval -> eval -> eval -> rbind -> rbind -> match.names In addition: Warning message: NAs introduced by coercion
The piece of code where it fails is this:
# importing the raw counts
if (is.null(opt$raw_counts) == FALSE) {
raw_counts_table <- read.table(counts_file, header=FALSE, sep = "\t", quote = "")
raw_counts_table <- data.frame(raw_counts_table,
do.call(rbind, strsplit(as.character(raw_counts_table$V1),'_')))
raw_counts_table$X2 <- as.numeric(as.character(raw_counts_table$X2))
raw_counts_table <- t(raw_counts_table[,c("X2", "V2")])
row.names(raw_counts_table) <- c("SAMPLE","RAW TOTAL")
colnames(raw_counts_table) <- raw_counts_table[1,]
raw_counts_table <- as.data.frame(raw_counts_table)
raw_counts_table <- raw_counts_table[-1,]
# Need to subtract off the total number of annotations
raw_counts_table["ANNOTATION COUNT",] <- colSums(complete_table)
raw_counts_table["OTHER",] <- raw_counts_table[1,] - raw_counts_table[2,]
complete_table <- rbind(complete_table, raw_counts_table["OTHER",])
}
Seems like variable names have changed?
I had to change the actual file names (adding a prefix) on a previous step script in order to go ahead, but now as I changed the file names back to the original seems to find a mismatch between files?
I have read from other posts
Links mention the error raises when two data frames don't have the same name. How could I know where exactly is the mismatch?
Thanks!