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
  • /
  • server
  • /
  • PCAselgroup.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:ca517bde5e8b9546a4c160bbdfc476d12a7dc6c7
directory badge
swh:1:dir:b4f135b203230666f5e14abbaf58604b20e67ee4

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 ...
PCAselgroup.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
#' 
#' 
#' 
#' #########################################
#' ######## PCA part                       #
#' #########################################


subsetgroup_pca <- callModule(boxChooser, "selgrouppca", label = "Choose your group to visualize", data = reactive(levels(csvf()[[2]]$Grp)) , group = csvf, case = 1 , empty =T)


#' PCAres is a reactive function that computed a PCA of non-normalized data
#'
#' @param csvf a data frame corresponding to the WorkingSet
#' @param new_datapca a reactive data frame
#'
#' @return PCAres a reactive data frame with PCA attributes
#'
#' @export


PCAres <- reactive({
  req(csvf())
  mypca = res.pca(new_datapca(), scale = F)
  return(mypca)
})


#' Scree_plot is a reactive function which aim is to display the eigenvalues of the data
#'
#' @param PCAres a reactive data frame with PCA attributes
#'
#' @return Screeplot a reactive plot
#'
#' @export

Scree_plot <- reactive({
  req(PCAres())
  mybar = eboulis(PCAres())
  return(mybar + theme_classic())

})



#' new_datapca is a reactive function that aim is to select specific individuals in the data frame
#'
#' @param csvf Data frame corresponding to the Workingset
#'
#' @return new_datapca a reactive data frame
#'
#' @export
#'


new_datapca <- reactive({
  req(csvf())
  select(csvf()[[1]], as.character(factor(subsetgroup_pca()$X)))
})


callModule(downoutputfiles, "downloadplots", projectname = projectname , suffix= "_screeplot." , data = Scree_plot  )



output$eigpca <- renderPlot({
  
  validate(
    need(csvf(), 'You need to import data to visualize this plot!') %next%
      need(length(subsetgroup_pca()) >0 ,'You need to select groups!') %next%
      need(length(unique(
        subsetgroup_pca()$Grp
      )) > 1, 'You need to select more than one group!')
  )

  plot(Scree_plot())

},  height = plotHeight)

js$calcHeight()


#' labeled is a reactive function which aim is to display or not the labels in the PCA render plot
#'
#' @param label a boolean input
#'
#' @return Labeled a reactive  boolean depending of the user's choice to display or not the labels
#'
#' @export

labeled <- reactive({
  if (input$label == T)
    showlab = "all"
  else
    showlab = "none"

  return (showlab)
})


output$PCA <- renderPlot({
  validate(
    need(csvf(), 'You need to import data to visualize this plot!') %next%
      need(length(unique(
        subsetgroup_pca()$Grp
      )) > 0, 'You need to select groups!') %next%
      need(length(unique(
        subsetgroup_pca()$Grp
      )) > 1, 'You need to select more than one group!')
  )

  plot(PCAplot() + theme_minimal())

},  height = plotHeight)


# output$PCAvarender <- renderPlot({
#   validate(
#     need(csvf(), 'You need to import data to visualize this plot!') %next%
#       need(length(unique(
#         subsetgroup_pca()$Grp
#       )) > 0, 'You need to select groups!') %next%
#       need(length(unique(
#         subsetgroup_pca()$Grp
#       )) > 1, 'You need to select more than one group!')
#   )
# 
#   plot(PCAvarplot())
# 
# },  height = plotHeight)


callModule(downoutputfiles, "savepca", projectname = projectname , suffix= "_pca." , data = PCAplot  )

colorspca <- callModule(colorChooser, "myPanelcolpca", data = reactive(subsetgroup_pca()$Grp)) #assign color input widget for each groups

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