This is a test version of Biostars. For the public version, visit https://www.biostars.org.
switchAnalyzeRlist conditions reversed

My design matrix is below:

  sampleID condition
1      c70    ScrVeh
2      c71    ScrVeh
3      c72    ScrVeh
4      c73    ScrIns
5      c74    ScrIns
6      c75    ScrIns

However, after I make my switchAnalyzeRlist and do aSwitchList$conditions, my conditions are reversed:

  condition nrReplicates
1    ScrIns            3
2    ScrVeh            3

I need the first condition to be ScrVeh and the second condition to be ScrIns, how do I reverse this? It is the same for my plots, which show ScrIns vs ScrVeh, where I want ScrVeh vs ScrIns. I've tried adding conditions to the argument but it didn't switch them:

switchPlot(aSwitchList, 
  gene = 'TGIF1', 
  condition1 = 'ScrVeh', 
  condition2 = 'ScrIns')

Here is how I made my switchAnalyzeRlist:

aSwitchList <- importRdata(isoformCountMatrix = salmonQuant$counts, 
  isoformRepExpression = salmonQuant$abundance, 
  designMatrix = myDesign,
  isoformExonAnnoation = "gencode.v34.annotation.gtf.gz",
  isoformNtFasta = fasta,
  fixStringTieAnnotationProblem = TRUE,
  showProgress = FALSE)
isoformswitchanalyzer switchanalyzerlist

Untested, but can you change aSwitchList$conditions to factor and set the levels to what you want?

aSwitchList$conditions %<>% factor(levels = c("ScrVeh", "ScrIns"))

Thank you for this suggestion, I tried it and got this (below), which I don't think will work for my downstream analysis

   condition nrReplicates 
        <NA>         <NA> 
Levels: ScrVeh ScrIns

1 answer

You can control that via the comparisonsToMake argument in importRdata().

Cheers Kristoffer

What an easy fix! This worked, thank you! :D

Log in to answer this question.