scDHA.w: scDHA.w

Description Usage Arguments Value Examples

View source: R/scDHA.R

Description

This function will plot a graph with normalized weights of all genes so user can select the appropriate number of genes to keep.

Usage

1
scDHA.w(data = data, sparse = FALSE, ncores = 10L, seed = NULL)

Arguments

data

Gene expression matrix, with rows represent samples and columns represent genes.

sparse

Boolen variable indicating whether data is a sparse matrix. The input must be a non negative sparse matrix.

ncores

Number of processor cores to use.

seed

Seed for reproducibility.

Value

A plot with normalized weights of all genes.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
library(scDHA)
#Load example data (Goolam dataset)
data('Goolam'); data <- t(Goolam$data); label <- as.character(Goolam$label)
#Log transform the data 
data <- log2(data + 1)
if(torch::torch_is_installed()) #scDHA need libtorch installed
{
  #Generate weight variances for each genes
  weight_variance <- scDHA.w(data, ncores = 2, seed = 1)
  #Plot weight variances for top 5,000 genes
  #plot(weight_variance, xlab = "Genes", ylab = "Normalized Weight Variance", xlim=c(1, 5000))
  #Plot the change of weight variances for top 5,000 genes
  #weight_variance_change <- weight_variance[-length(weight_variance)] - weight_variance[-1] 
  #plot(weight_variance_change, xlab = "Genes", ylab = "Weight Variance Change", xlim=c(1, 5000))
}

scDHA documentation built on Sept. 16, 2021, 1:07 a.m.