From 35a91ea147736c3144af93fd1060c213689b420c Mon Sep 17 00:00:00 2001
From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu>
Date: Mon, 9 Mar 2020 11:59:10 -0500
Subject: [PATCH] Generalize count column earlier

---
 workflow/scripts/calculateTPM.R | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/workflow/scripts/calculateTPM.R b/workflow/scripts/calculateTPM.R
index 3643073..175bd3c 100644
--- a/workflow/scripts/calculateTPM.R
+++ b/workflow/scripts/calculateTPM.R
@@ -17,9 +17,10 @@ if (!("count" %in% names(opt))){
 
 repRID <- basename(gsub(".featureCounts","",opt$count))
 
-count <- read.delim(opt$count, comment.char="#")
+count <- read.delim(opt$count, comment.char="#") # if featureCounts file changes structure, be sure to update count and Length columns below
+colnames(count)[7] <- "count"
 
-rpk <- count$Q.Y5JA.sorted.deduped.bam/count$Length/1000
+rpk <- count$count/count$Length/1000
 
 scale <- sum(rpk)/1000000
 
-- 
GitLab