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
  • /
  • module
  • /
  • groupcol.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:43a4b56e2f319b2ac7ed3809f732f4937ef4a4e5
directory badge
swh:1:dir:c2fbeb3a282ae4e712de69c4c8697d75059f7bda

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 ...
groupcol.R
### Author: Franck Soubès
### Bioinformatics Master Degree - University of Bordeaux, France
### Link: https://github.com/GeT-TRiX/MA_Trix_App/
### Where: GET-TRiX's facility
### Application: MATRiX is a shiny application for Mining and functional Analysis of TRanscriptomics data
### Licence: GPL-3.0


#' renderncolour is a shiny widget which aims is to return for each group a colorbox picker
#'
#' @param id Shiny id
#'
#' @return Widget in the gui
#'
#' @export


renderncolour <- function(id){
  ns <- NS(id)
  uiOutput(ns("colorbox"))
}

#' colorChooser is a shiny module which aims is to dynamically affect for each group a color picker
#'
#' @param input Internal
#' @param output Internal
#' @param session Internal
#' @param data A reactive character vector for each selected group
#'
#' @return A reactive character vector that associated for each group a selected color
#'
#' @export
#'


colorChooser <- function(input, output, session, data){

  output$colorbox <- renderUI({
    ns <- session$ns
    colorfluid()
  })


  colorfluid <- reactive({
    req(initwidgetcol())
    lapply(1:length(initwidgetcol()), function(i){

      j = length(initwidgetcol())
      if(length(initwidgetcol()) %%2==0){
        if (i %% 2 == 0) {
          fluidRow(column(6, initwidgetcol()[[i - 1]]), column(6, initwidgetcol()[[i]]))
        }
      }
      else{
        if (i %% 2 ==0 && j!=i) {
          fluidRow(column(6, initwidgetcol()[[i - 1]]), column(6, initwidgetcol()[[i]]))
        }
        else if (j == i){
          fluidRow(column(6, initwidgetcol()[[i]]))
        }
      }

    })

  })

  initwidgetcol <- reactive({

    req(mycolgrp())
    ns <- session$ns
    pal = brewer.pal(8,"Dark2") %>%
      list(brewer.pal(10,"Paired")) %>%
      unlist()

    lapply(seq_along(unique(mycolgrp())), function(x) {
      colourInput(
        ns(paste("colgroup", x, sep = "_")),
        levels(mycolgrp())[x],
        pal[x],
        allowedCols =  pal,
        palette = "limited",
        returnName = T)
    })
  })


  getwidgvalues <- reactive({
    req(mycolgrp())
    lapply(seq_along(unique(mycolgrp())), function(i) {

      input[[paste("colgroup", i, sep = "_")]]
    })
  })

  mycolgrp <- reactive  ({
    req(data())
    mygrpcol <- data() %>%
      sort() %>%
      unique() %>%
      droplevels()

    return(mygrpcol)
  })


  return(reactive(getwidgvalues()))
}

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