Closed YikaiLou closed 3 months ago
Hi Yikai, thanks for your question!
When m > 0
, we incorporate the Azimuthal Gabor Filter (AGF) as mentioned in the paper. This filter considers the direction (angle) between a cell and its neighbors, represented as a phase shift. Imagine a compass: each neighbor's contribution depends on its location relative to the center cell. The phase shift is why the calculation involves complex numbers as an intermediate step.
You're absolutely right about the modulus. We take the absolute value (modulus) of the complex number, but only after summing the contributions from all neighbors with their respective phase shifts. If we took the modulus of each neighbor individually and then summed them, it would be the same as using m = 0
(no AGF).
The benefit of AGF is its ability to detect expression gradients. Let's say a gene is generally more highly expressed in the top half of cells compared to the bottom half. Their contributions would result in a higher overall magnitude since their phases (i.e. direction relative to center cell) are closely matched. This will result in a higher final value compared to a scenario where the expression is evenly distributed around the cell. In simpler terms, AGF helps us identify directional trends in how genes are expressed across neighboring cells.
Regarding the number of neighbors: We use more neighbors for m > 0
because it can improve the accuracy of capturing expression gradients. Imagine you're trying to estimate the slope of a hill. More data points (neighbors) from different directions can provide a more reliable picture.
On a separate note, we'd generally recommend to start off with m = 0
(no AGF) as it's faster and can still provide very good results. We haven't tested m > 1
extensively, but it's likely not necessary for most applications.
I hope this clarifies how the matrix works with m > 0
!
Hi, @chousn ! Thank you for your response! Having read through your reply, I have a more profound comprehension of this part now. I reviewed the code and understood the process you described. Thanks again for your detailed answer.
Hello, sorry to bother you again. I am a bit confused about how to handle matrices when m>0. Here https://github.com/prabhakarlab/Banksy_py/blob/main/banksy/main.py#L232 I know how to handle the weight matrix when m>0, but this will result in complex numbers.And when creating a banksy matrix, it will run this part of the code https://github.com/prabhakarlab/Banksy_py/blob/main/banksy/embed_banksy.py#L143 . It takes the modulus of the complex number, but we did not change its modulus after performing the Fourier transform.So, for matrices m=0 and m=1, is it only changing the number of its neighbors https://github.com/prabhakarlab/Banksy_py/blob/main/banksy/main.py#L158 ? May I ask if my understanding is correct? If there are any errors, could you please tell me how the matrix works when m>0? Thank you very much!