scDREAMER_SUP API

class scDREAMER.scDREAMER_SUP(sess, batch, cell_type, plot_cell_type, name, epoch=300, lr_ae=0.0002, lr_dis=0.0007, lr_bc=0.0007, beta1=0.9, batch_size=128, X_dim=2000, z_dim=10, dataset_name='Pancreas', num_layers=1, g_h_dim=[512, 256, 0, 0], d_h_dim=[512, 256, 0, 0], gen_activation='sig', leak=0.2, keep_param=0.9, trans='sparse', is_bn=False, g_iter=2, lam=1.0, sampler='normal')

scDREAMER class parameter setting

param batch:

obs key containing the batch information

type batch:

string

param cell_type:

obs key containing the cell type information

type cell_type:

string

param name:

path to the AnnData(adata) object. adata.X contains counts info. adata.obs contains batch and celltype info

type name:

AnnData

param epoch:

number of epoches to train the model, defaults to 300

type epoch:

int, optional

param lr_ae:

learning rate, defaults to 0.0007

type lr_ae:

float, optional

param lr_bc:

learning rate, defaults to 0.0007

type lr_bc:

float, optional

param lr_dis:

learning rate, defaults to 0.0007

type lr_dis:

float, optional

param beta1:

beta1, defaults to 0.9

type beta1:

float, optional

param batch_size:

batch size, defaults to 128

type batch_size:

int, optional

param X_dim:

Top heighly variable genes, defaults to 2000

type X_dim:

int, optional

param z_dim:

Embeddings dimention, defaults to 10

type z_dim:

int, optional

param dataset_name:

dataset name, defaults to “Pancreas”

type dataset_name:

str, optional

param num_layers:

number of hidden layers, defaults to 1

type num_layers:

int, optional

param g_h_dim:

neurons in encoder hidden layers (uses only num_layers), defaults to [512, 256, 0, 0]

type g_h_dim:

list, optional

param d_h_dim:

neurons in decoder hidden layers (uses only num_layers), defaults to [512, 256, 0, 0]

type d_h_dim:

list, optional

param gen_activation:

activation function, defaults to “sig”

type gen_activation:

str, optional

param leak:

leak, defaults to 0.2

type leak:

float, optional

param keep_param:

keep, defaults to 0.9

type keep_param:

float, optional

param trans:

translation, defaults to “sparse”

type trans:

str, optional

param sampler:

z sampler, defaults to “normal”

type sampler:

str, optional

batchClassifier(z, z_dim, reuse=False)

batchClassifier takes the latent space representation and try to differentiate between different batches

Parameters:
  • z – tensor of shape [batch_size, z_dim]

  • batch – tensor of shape [batch_size] -> batchinfo of the train data

  • reuse – True -> Reuse the discriminator variables,False -> Create or search of variables before creating

Returns:

tensor of shape [batch_size, 1]

build_model()

Build the complete tensorflow network of the model

classifier(z, reuse=True)

Classifier takes the latent space representation and try to differentiate between different cell types

Parameters:
  • z – tensor of shape [batch_size, z_dim]

  • batch – tensor of shape [batch_size] -> batchinfo of the train data

  • reuse – True -> Reuse the discriminator variables, False -> Create or search of variables before creating

Returns:

tensor of shape [batch_size, 1]

decoder(z, reuse=False)

Decoder part of the autoencoder.

Parameters:
  • z (tensor) – input to the decoder

  • reuse (bool, optional) – True -> Reuse the decoder variables, False -> Create or search of variables before creating, defaults to False

Returns:

tensor which should ideally be the input given to the encoder.

Return type:

tensor

decoderY(y, reuse=False)

Hierarchically stacked encoder network of VAE

Parameters:
  • y (tensor) – tensor to pass encoder shape

  • reuse (bool, optional) – reuse the weight of network(used at the time of building the network), defaults to False

discriminator2(z, z_dim, reuse=False)

Discriminator that is used to match the input x with reconstructed x.

Parameters:
  • x – tensor of shape [batch_size, x_dim]

  • reuse – True -> Reuse the discriminator variables, False -> Create or search of variables before creating

Returns:

tensor of shape [batch_size, 1]

encoder(x, reuse=False)

Encoder network of VAE

Parameters:
  • x (tensor) – tensor to pass encoder shape

  • reuse (bool, optional) – reuse the weight of network(used at the time of building the network), defaults to False

encoderY(z, reuse=False)

Hierarchically stacked encoder network of VAE

Parameters:
  • z (tensor) – tensor to pass encoder shape

  • reuse (bool, optional) – reuse the weight of network(used at the time of building the network), defaults to False