wanglf19 / scCaps

An interpretable deep-learning architecture of capsule networks for identifying cellular-type gene expression programs from single-cell RNA-seq data
26 stars 11 forks source link

code questions #1

Open xxlovexx1314 opened 3 years ago

xxlovexx1314 commented 3 years ago

for your code in demo_reproducing_figures.ipynb where from Visualization_Capsule_Keras import * how can i get this module, how to install Visualization_Capsule_Keras?

Besides, the input gene vector is actually a matrix of gene-cell, is that right?

xxlovexx1314 commented 3 years ago

And when I use the Capsule module for the type capsule part, I got this error: ValueError: Cannot do batch_dot on inputs with shapes (None, 8, 8, 16) and (None, 8, None, 16) with axes=[2, 3]. x.shape[2] != y.shape[3] (8 != 16).

wanglf19 commented 3 years ago

To fix the ValueError. Please make sure that the environment you used is correct(Python 3.6, conda 4.4.10, keras 2.2.4, tensorflow 1.11.0). And you could establish the environment through code "conda create -n sccaps python=3.6 keras=2.2.4 tensorflow=1.11.0".

the input is a matrix of cell-gene

The module Visualization_Capsule_Keras locates in default folder

xxlovexx1314 commented 3 years ago

To fix the ValueError. Please make sure that the environment you used is correct(Python 3.6, conda 4.4.10, keras 2.2.4, tensorflow 1.11.0). And you could establish the environment through code "conda create -n sccaps python=3.6 keras=2.2.4 tensorflow=1.11.0".

the input is a matrix of cell-gene

The module Visualization_Capsule_Keras locates in default folder

Thanks for you kind reply, I believe my version is fine, and I figured it out using b = tf.einsum('bij,binj->bin', o, u_hat_vecs) instead of b = K.batch_dot(o, u_hat_vecs, [2, 3]) in the Visualization_Capsule_Keras module. Then I got the plot exactly same as yours. However, when I tried to continued the next steps deeply, I met other questions: 1: the step for dividing whole domain along PC into 61 points, and calculating the the prediction on each point. so we actually calculate the accuracy prediction for the pca points? not the cell type?

2:how can we convert the predictions, the output vectors, to the cell type annotation?

wanglf19 commented 3 years ago
  1. The heatmap in the previous step will indicate the relationship between the type capsule (y axis, cell type) and the primary capsule (x axis). In gene selection step, pca point related with a particular primary capsule that associate with a specific cell type (from heatmap) will be analyzed. So the selected genes should be related with that specific cell type.

  2. Each element in the output vector represent the probability of the input sample belong to the one specific cell type.

JiaQiao111 commented 3 years ago

the step for dividing whole domain along PC into 61 points, and calculating the the prediction on each point.

I use b = tf.einsum('bij,binj->bin', o, u_hat_vecs) instead of b = K.batch_dot(o, u_hat_vecs, [2, 3]) in the Visualization_Capsule_Keras module the same way you do,but still has other error.as follows: ValueError: Shape must be rank 3 but is rank 4 for 0th input and equation: bij,binj->bin for '{{node capsule_1/einsum/Einsum}} = Einsum[N=2, T=DT_FLOAT, equation="bij,binj->bin"](capsule_1/l2_normalize, capsule_1/transpose_1)' with input shapes: [?,8,8,16], [?,8,?,16]. How did you solve it??