pachterlab / sleuth

Differential analysis of RNA-Seq
http://pachterlab.github.io/sleuth
GNU General Public License v3.0
305 stars 95 forks source link

reordering factors to correct the fold change #147

Closed DrHeisenberg89 closed 7 years ago

DrHeisenberg89 commented 7 years ago

Hi there, I calculated the log fold change but it seems I mismatched the two different conditions (wild type and ko conditions); so the fold changes are basically inverted (e.g. rather than having an estimate of 10.08, I have an estimate of -10.08). How am I supposed to fix that problem? Can't find in the manual how can I reorder the factors.

warrenmcg commented 7 years ago

Hi @DrHeisenberg89, this is not an issue, so it's better asked at the google group, though googling "reorder factors in r" would help with this question (one of the top hits was this post).

But to answer your question directly, you would make sure that your conditions column is a factor and then use relevel, like this:

mydf <- data.frame(sample = c(1,2,3,4,5,6), condition = c(rep("wild type", 3), rep("ko", 3)))
mydf$condition <- as.factor(mydf$condition)
mydf$condition <- relevel(mydf$condition, "wild type")

I'm closing this. Please use the Github issues only if there is a bug (actual or probable) in the software or if you have a feature request. Please use the google group for all other use-related questions. And remember that Google searching and StackOverflow are your friends!