Skip to content
Snippets Groups Projects
Commit 44e21870 authored by Gervaise Henry's avatar Gervaise Henry :cowboy:
Browse files

Add rscript to calculate tpm

parent 6675415d
Branches
Tags
2 merge requests!37v0.0.1,!22Resolve "process_count"
gc()
library(optparse)
library(edgeR)
option_list=list(
make_option("--count",action="store",type='character',help="Count File")
)
opt=parse_args(OptionParser(option_list=option_list))
rm(option_list)
if (!("count" %in% names(opt))){
print("No count file passed, exiting.")
exit()
} else if (!file.exists(opt$count)) {
print("No count file passed, exiting.")
exit()
}
repRID <- basename(gsub(".featureCounts","",opt$count))
count <- read.delim(opt$count, comment.char="#")
rpk <- count$Q.Y5JA.sorted.deduped.bam/count$Length/1000
scale <- sum(rpk)/1000000
tpm <- rpk/scale
output <- cbind(count,tpm)
colnames(output)[7] <- "count"
write.table(output,file=paste0(repRID,".countTable.csv"),sep=",",row.names=FALSE,quote=FALSE)
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment