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

https://forge.inrae.fr/genotoul-bioinfo/mixKernel.git
23 July 2025, 18:44:20 UTC
  • Code
  • Branches (7)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/dev
    • refs/heads/master
    • refs/heads/plotind3
    • refs/tags/v0.8
    • refs/tags/v0.9
    • refs/tags/v0.9-1
    • refs/tags/v0.9-2
    No releases to show
  • 6b121a7
  • /
  • R
  • /
  • plotVar.kernel.pca.R
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

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
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:53b6f56396ce9c492d60349f0c6f41f1b8ff5c98
origin badgedirectory badge
swh:1:dir:6ecf297ce903ef7e227d9cfc3b863e853aa9fa07
origin badgerevision badge
swh:1:rev:33e748dfd5e2f99f13fe3529959bada1cafc3e54
origin badgesnapshot badge
swh:1:snp:8bf247850490c25027dc03263fbade6682091726

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
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 33e748dfd5e2f99f13fe3529959bada1cafc3e54 authored by Nathalie Vialaneix on 25 April 2025, 08:34:15 UTC
updated mixKernel website
Tip revision: 33e748d
plotVar.kernel.pca.R
#' Plot importance of variables in kernel PCA
#' 
#' Provides a representation of variable importance in kernel PCA.
#'
#' @details
#' \code{plotVar.kernel.pca} produces a barplot for each block. The variables for which the 
#' importance has been computed with \code{\link{kernel.pca.permute}} are 
#' displayed. The representation is limited to the \code{ndisplay} most important 
#' variables.
#'
#' @param object : a kernel.pca object returned by \code{\link{kernel.pca}}.
#' @param blocks a numerical vector indicating the block variables to display.
#' @param ndisplay integer. The number of important variables per blocks shown in 
#' the representation. Default: \code{5}.
#' @param ncol integer. Each block of variables is displayed in a separate 
#' subfigure. \code{ncol} sets the number of columns for the global figure. 
#' Default: \code{2}.
#' @param ... external arguments.
#' 
#' @author Jerome Mariette <jerome.mariette@@inrae.fr>
#' Nathalie Vialaneix <nathalie.vialaneix@@inrae.fr>
#' @references Crone L. and Crosby D. (1995). Statistical applications of a metric on subspaces
#' to satellite meteorology. \emph{Technometrics}, \bold{37}(3), 324-328.
#' @seealso \code{\link{kernel.pca}}, \code{\link{kernel.pca.permute}}
#' @export
#' @examples
#' data(TARAoceans)
#' 
#' # compute one kernel for the psychem dataset
#' phychem.kernel <- compute.kernel(TARAoceans$phychem, kernel.func = "linear")
#' # perform a KPCA
#' kernel.pca.result <- kernel.pca(phychem.kernel)
#' # compute importance for all variables in this kernel
#' kernel.pca.result <- kernel.pca.permute(kernel.pca.result, phychem = colnames(TARAoceans$phychem))
#' 
#' \dontrun{plotVar.kernel.pca(kernel.pca.result, ndisplay = 10)}
#' 
plotVar.kernel.pca <- function(object, blocks = unique(object$cc.blocks), 
                               ndisplay = 5, ncol = 2, ...) {
  
  df.values <- df.variables <- df.blocks <- vector(length = ndisplay * length(blocks))
  i <- 1
  for (block in blocks) {
    values.block <- object$cc.distances[which(object$cc.blocks == block)]
    variables.block <- object$cc.variables[which(object$cc.blocks == block)]
    ordered.ids <- order(values.block, decreasing = TRUE)
    next.i <- i + ndisplay - 1
    df.values[i:next.i] <- values.block[ordered.ids][1:ndisplay]
    df.variables[i:next.i] <- variables.block[ordered.ids][1:ndisplay]
    df.blocks[i:next.i] <- rep(block, ndisplay)
    i <- i + ndisplay
  }

  df <- data.frame("variables" = df.variables, "values" = df.values,
                   "blocks" = df.blocks)
  df$variables <- reorder(df$variables, -df$values)

  ggplot(df, aes_string(x="variables", y = "values", fill="blocks")) +
    geom_bar(stat = "identity") + theme_bw() + 
    theme(axis.text.x = element_text(angle=45, hjust=1)) + ylab("") + xlab("") +
    facet_wrap(~ blocks, ncol = ncol, scales = "free_x") + 
    theme(legend.position = "none")
  
}

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