Last active
          April 20, 2023 09:54 
        
      - 
      
 - 
        
Save federicomarini/4a543eebc7e7091d9169111f76d59de1 to your computer and use it in GitHub Desktop.  
    A function to wrap up the DESeq2 inputs&outputs, and plug that as SingleCellExperiment into iSEE
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # one needs this as well | |
| library(SingleCellExperiment) | |
| wrapup_for_iSEE <- function(dds, res) { | |
| # dds to vst | |
| vst <- vst(dds) | |
| sce <- SingleCellExperiment( | |
| assays = List( | |
| counts = counts(dds), | |
| normcounts = counts(dds,normalized = TRUE), | |
| vst_counts = assay(vst) | |
| ) | |
| ) | |
| # adding colData | |
| colData(sce) <- colData(dds) | |
| # adding rowData | |
| rowData(sce) <- res | |
| # log operations to have the rowData ready to use | |
| rowData(sce)$log10_baseMean <- log10(rowData(sce)$baseMean) | |
| rowData(sce)$log10_pvalue <- -log10(rowData(sce)$pvalue) | |
| return(sce) | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment