Skip to content

Commit

Permalink
Merge pull request alyssafrazee#87 from alyssafrazee/alyssa-bugfix
Browse files Browse the repository at this point in the history
Fix plotting bug.
  • Loading branch information
JMF47 authored Oct 5, 2016
2 parents a06ad84 + ab5a850 commit 564a94a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions R/plotMeans.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,14 @@ plotMeans = function(gene, gown, overall=FALSE, groupvar, groupname='all',
if(colorby == "transcript"){
# mean transcript-level expression measurement for this group
t_id = texpr(gown, 'all')$t_id
i = which(gtrans$tid == t_id)
smalldat = texpr(gown, meas)[i,]
expr_matrix_i = which(t_id %in% gtrans$tid)
smalldat = texpr(gown, meas)[expr_matrix_i,]
datacols = which(sampleNames(gown) %in% samples[[p]])
if(length(i) > 1) {
if(length(expr_matrix_i) > 1) {
tmeans = rowMeans(smalldat[,datacols])
} else {
tmeans = mean(smalldat[datacols])
names(tmeans) = t_id[i]
names(tmeans) = texpr(gown, 'all')$t_id[expr_matrix_i] # i has length 1
}
}

Expand All @@ -151,8 +151,7 @@ plotMeans = function(gene, gown, overall=FALSE, groupvar, groupname='all',
# draw the transcripts
for(tx in unique(gtrans$tid)){
if(colorby == "transcript") {
mycolor = closestColor(tmeans[which(names(tmeans)==tx)],
colscale)
mycolor = closestColor(tmeans[which(names(tmeans)==tx)], colscale)
}
txind = which(unique(gtrans$tid)==tx)
gtsub = gtrans[gtrans$tid==tx,]
Expand Down

0 comments on commit 564a94a

Please sign in to comment.