I load in bam files, and try to count reads for transcripts for edgeR and DEseq....
### call in the tools
library(GenomicRanges)
library(Rsamtools)
library(DESeq)
library(edgeR)
library(org.Mm.eg.db)
#####script begin
txdb=makeTranscriptDbFromUCSC(genome='mm9',tablename='refGene')
ex_by_gene=exonsBy(txdb,'gene')
readsa=readBamGappedAlignments("a_accepted_hits.bam")
countsa = countOverlaps(ex_by_gene,readsa)
countTableabcd = data.frame(conditiona=countsa,conditionb=countsb,conditionc=countsc,conditiond=countsd,stringsAsFactors=FALSE)
rownames(countTableabcd)=names(ex_by_gene)
write.table(countTableabcd,file="countTableabcd.txt",sep="\t")
####### script end
Error in as.vector(colSums(data)) :
error in evaluating the argument 'x' in selecting a method for function 'as.vector': Error in colSums(data) : 'x' must be an array of at least two dimensions
Could anyone explain what does the error reports mean? I guess that is the error form the step making "countsa", right? How to solve this?
Thx,
### call in the tools
library(GenomicRanges)
library(Rsamtools)
library(DESeq)
library(edgeR)
library(org.Mm.eg.db)
#####script begin
txdb=makeTranscriptDbFromUCSC(genome='mm9',tablename='refGene')
ex_by_gene=exonsBy(txdb,'gene')
readsa=readBamGappedAlignments("a_accepted_hits.bam")
countsa = countOverlaps(ex_by_gene,readsa)
countTableabcd = data.frame(conditiona=countsa,conditionb=countsb,conditionc=countsc,conditiond=countsd,stringsAsFactors=FALSE)
rownames(countTableabcd)=names(ex_by_gene)
write.table(countTableabcd,file="countTableabcd.txt",sep="\t")
####### script end
Error in as.vector(colSums(data)) :
error in evaluating the argument 'x' in selecting a method for function 'as.vector': Error in colSums(data) : 'x' must be an array of at least two dimensions
Could anyone explain what does the error reports mean? I guess that is the error form the step making "countsa", right? How to solve this?
Thx,
Comment