Closed giladmishne closed 1 year ago
Hi @giladmishne,
Thanks for raising this issue. Sharing below a quick solution to this problem but feel free to try other ideas.
First allow perturbation embeddings to be added or subtracted. This is currently the line where each perturbation's embedding is added together:
pert_index[1][i]
is just the index of the gene that is being perturbed. One simple solution could be to include a sign in that index which indicates whether the perturbation is an activation or a repression and then change the sign of the operation in line 160 accordingly. Perhaps something like:
pert_track[j.item()] = pert_track[j.item()] + (torch.sign(pert_index[1][i]) * pert_global_emb[pert_index[1][i]])
Then change how the signed indices are generated. Somewhere around this function, we would need to check the input adata to see if the perturbation is an activation or a repression and change the index accordingly: https://github.com/snap-stanford/GEARS/blob/aa1e003b250db4e76498f2c95491413dc25f99f8/gears/pertdata.py#L285-L289
Thanks! I have a sketch of this at https://github.com/giladmishne/GEARS/tree/pert_magnitude.
(Many of the changes are just trimmed whitespace by the editor I'm using -- apologies for the noise).
Thanks a lot! Would you mind opening a PR as well so we it's easier to track the discussion and compare changes
Done - see #17 .
Hi,
Thanks for releasing this package! One addition that would be great would be support for datasets that contain combinations of activations and repressions, including within the same perturbation. My understanding from @yhr91 is that this is not currently supported, but is not complex to add.
Thanks again!