Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • a78cb8f
  • /
  • function
  • /
  • decideTestTrix.R
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge
swh:1:cnt:402e00c3238b684ef9c22d84bdda1e5e248ce70a
directory badge
swh:1:dir:de48f4b3b44890b63710117d534c1001e76424e9

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
decideTestTrix.R
### Author: Yannick Lippi
### Modified: Franck Soubès
### Bioinformatics Master Degree - University of Bordeaux, France
### Link: https://github.com/fsoubes/MA_Trix_App
### Where: GET-TRiX's facility
### Application: MATRiX is a shiny application for Microarray Analysis on Transcriptomic impact of Xenobiotics
### Licence: GPL-3.0



#' decTestTRiX is a function
#'
#' @param adj A data frame with the "adj.P.Val"
#' @param logfc A data frame with the "logFC"
#' @param pval A data frame with the "P.value"
#' @param DEGcutoff A numeric value for tresholding the data on the pvalue
#' @param FC A numeric value for tresholding the data on the FC value
#' @param cutoff_meth A character to choose the method appropriate, "FDR" in order to cut off with the "adj.P.Val" and "None" for the "P.value"; default is set to "FDR"
#' @param maxDE A numeric value that gives a maximal number of genes to display for all the differents contrasts
#' @param contrast A numeric value representing the length of the data frame
#'
#' @return \DEsel a matrix of double values containing the signficant genes
#'
#' @export

decTestTRiX <- function(adj,logfc,pval, DEGcutoff = 0.05 ,FC = 1,cutoff_meth = "FDR",maxDE = NULL,contrast = 1:ncol(adj)){
  ## select probes with cutoff_meth<= DEGcutoff and FoldChange > FC and nbr of selected probes < maxDE (if nb FC selected >maxDE)


  if (length(contrast) == 1)
    contrast = c(contrast, contrast)


  
  if (is.na(maxDE) || is.null(maxDE))
    maxDE = nrow(adj)


  if (cutoff_meth == "FDR")
    pList = adj[, contrast]


  
  if(cutoff_meth=="None")
    pList= pval[,contrast]


  ## select on pvalue
  DEp = pList <= DEGcutoff
  


  ## select on FC
  DEFC = 2 ** abs(logfc[, contrast]) >= FC

  ## reduce selection to maxDE
  if (any(colSums(DEFC, na.rm=TRUE) > maxDE)) {


    DEmax = pList

    for (i in 1:ncol(DEFC))

    {
      if (maxDE > sum(DEFC[, i], na.rm=TRUE)) {
        maxDEi = sum(DEFC[, i], na.rm=TRUE)
      } else
        maxDEi = maxDE

      ord = order(DEmax[, i])
      msi = max(DEmax[ord, i][DEFC[ord, i]][1:maxDEi])

      DEmax[, i] = DEmax[, i] <= msi

    }

    DEsel = DEp & DEFC & DEmax
  }

  else{
    DEsel = DEp & DEFC
  }

  DEsel = which(rowSums(DEsel, na.rm = TRUE) > 0)
  elements= list(DEsel, length(DEsel))

  return(elements)

}

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API