R/02_diff.R

Defines functions plotDsADiff

plotDsADiff <- function(fns, color, files, data, cellFile, e, prettyColnames, clust, annotation, alpha, cex) {

  filter <- files[cellFile]%in%fns

  par(mar=c(0,0,0,0))

  if(color=='(density)') {
    EmbedSOM::PlotEmbed(
      e[filter,],
      cex=cex,
      alpha=alpha,
      plotf=scattermoreplot,
      frame.plot=F)
  }
  else if (color=='(cluster)') {

    cl <- factor(clust)

    EmbedSOM::PlotEmbed(
      e[filter,],
      clust=cl[filter],
      plotf=scattermoreplot,
      cex=cex,
      alpha=alpha,
      frame.plot=F)

    plotClusterTextAnnotation(e, cl, annotation)
  }
  else if (color=='(file)') {
    file <- factor(cellFile)
    EmbedSOM::PlotEmbed(
      e[filter,],
      clust=file[filter],
      plotf=scattermoreplot,
      cex=cex,
      alpha=alpha,
      frame.plot=F)
  }
  else
    EmbedSOM::PlotEmbed(
      e[filter,],
      data=matrix(ncol=1, data[filter, findColIds(color, prettyColnames)]),
      value=1,
      plotf=scattermoreplot,
      cex=cex,
      alpha=alpha,
      frame.plot=F)
}
exaexa/ShinySOM documentation built on Aug. 1, 2020, 2:07 p.m.