snap-stanford/GEARS

Matching to Different Set of Controls

GordianArnav opened this issue · 1 comments

Is there a way to match 'A+ctrl1' to 'ctrl1' cells and 'A+ctrl2'to 'ctrl2' in the same adata object?

yhr91 commented

This is possible but would require some changes to the dataloader

Specifically, in this section, for each sample perturbed cell the dataloader will randomly pick a control cell as the basal state Xwhich is appended to the vector of basal states Xs

GEARS/gears/pertdata.py

Lines 578 to 584 in df09d7a

for cell_z in adata_.X:
# Use samples from control as basal expression
ctrl_samples = self.ctrl_adata[np.random.randint(0,
len(self.ctrl_adata), num_samples), :]
for c in ctrl_samples.X:
Xs.append(c)
ys.append(cell_z)

You would have to update this code to choose from different control populations based on the perturbed cell.

It sounds straightforward but the actual implementation may end up requiring additional changes. We've been experimenting with something similar internally. Let me know if you have any other questions.