hartleys / QoRTs

Quality of RNA-Seq Toolset
52 stars 14 forks source link

Change plotting order / Overplotting #45

Closed royfrancis closed 7 years ago

royfrancis commented 7 years ago

What would be the easiest way to change plotting order?

bpg <- build.plotter.colorByGroup(qortsdata)
makePlot.gene.cdf(bpg,plot.intercepts=F)
makePlot.legend.over("bottomright",bpg);

cgd-group

As see above, the few 'Control' samples and 'Small' samples are hidden behind all the 'Large' samples. I was wondering if I could change the order of levels in the group.ID factor for decoder? Would that work? Thanks.

royfrancis commented 7 years ago

Ok. Changing the factor level doesn't work. I just tried it out.

hartleys commented 7 years ago

QoRTs does actually have a hidden function for this. The qorts plotter object (bpg in your code) has a data frame in it called "lanebam.params" with a column titled "plot.priority". For most plotters, this will all be set to the same value.

So you can access (and edit) this data frame using the commands:

#say you have a list of unique.ID's that you want to highlight, called "myhighlightlist"
#if you want, you can set this to the list of uid's that are in group "small" or "control".
myhighlightlist <- bpg$decoder$unique.ID[ as.character(bpg$decoder$group.ID) != "Large" ]

#view the lanebam.params data frame:
head(bpg$lanebam.params)

#set the priority to 2 for the replicates you want on "top", set it to 1 otherwise.
bpg$lanebam.params[! bpg$unique.ID %in% myhighlightlist] <- 1;
bpg$lanebam.params[bpg$unique.ID %in% myhighlightlist] <- 2;

You can also add even more priorities, QoRTs will plot them in order starting at the smallest and go up.

royfrancis commented 7 years ago

That works! Thanks :-)