Christina Theodoris
commited on
Commit
•
10d3f10
1
Parent(s):
0960cf6
update dependencies, reinstate compatibility with python<3.9 with typing for List
Browse files- geneformer/in_silico_perturber.py +2 -1
- geneformer/perturber_utils.py +5 -4
- requirements.txt +20 -0
- setup.py +16 -0
geneformer/in_silico_perturber.py
CHANGED
@@ -31,6 +31,7 @@ import logging
|
|
31 |
import os
|
32 |
import pickle
|
33 |
from collections import defaultdict
|
|
|
34 |
|
35 |
import seaborn as sns
|
36 |
import torch
|
@@ -873,7 +874,7 @@ class InSilicoPerturber:
|
|
873 |
cos_sims_dict: defaultdict,
|
874 |
cos_sims_data: torch.Tensor,
|
875 |
filtered_input_data: Dataset,
|
876 |
-
indices_to_perturb:
|
877 |
gene_list=None,
|
878 |
):
|
879 |
if gene_list is not None and cos_sims_data.shape[0] != len(gene_list):
|
|
|
31 |
import os
|
32 |
import pickle
|
33 |
from collections import defaultdict
|
34 |
+
from typing import List
|
35 |
|
36 |
import seaborn as sns
|
37 |
import torch
|
|
|
874 |
cos_sims_dict: defaultdict,
|
875 |
cos_sims_data: torch.Tensor,
|
876 |
filtered_input_data: Dataset,
|
877 |
+
indices_to_perturb: List[List[int]],
|
878 |
gene_list=None,
|
879 |
):
|
880 |
if gene_list is not None and cos_sims_data.shape[0] != len(gene_list):
|
geneformer/perturber_utils.py
CHANGED
@@ -3,6 +3,7 @@ import logging
|
|
3 |
import pickle
|
4 |
import re
|
5 |
from collections import defaultdict
|
|
|
6 |
|
7 |
import numpy as np
|
8 |
import pandas as pd
|
@@ -275,9 +276,9 @@ def remove_indices_from_emb_batch(emb_batch, list_of_indices_to_remove, gene_dim
|
|
275 |
def remove_perturbed_indices_set(
|
276 |
emb,
|
277 |
perturb_type: str,
|
278 |
-
indices_to_perturb:
|
279 |
-
tokens_to_perturb:
|
280 |
-
original_lengths:
|
281 |
input_ids=None,
|
282 |
):
|
283 |
if perturb_type == "overexpress":
|
@@ -306,7 +307,7 @@ def remove_perturbed_indices_set(
|
|
306 |
|
307 |
def make_perturbation_batch(
|
308 |
example_cell, perturb_type, tokens_to_perturb, anchor_token, combo_lvl, num_proc
|
309 |
-
) -> tuple[Dataset,
|
310 |
if combo_lvl == 0 and tokens_to_perturb == "all":
|
311 |
if perturb_type in ["overexpress", "activate"]:
|
312 |
range_start = 1
|
|
|
3 |
import pickle
|
4 |
import re
|
5 |
from collections import defaultdict
|
6 |
+
from typing import List
|
7 |
|
8 |
import numpy as np
|
9 |
import pandas as pd
|
|
|
276 |
def remove_perturbed_indices_set(
|
277 |
emb,
|
278 |
perturb_type: str,
|
279 |
+
indices_to_perturb: List[List],
|
280 |
+
tokens_to_perturb: List[List],
|
281 |
+
original_lengths: List[int],
|
282 |
input_ids=None,
|
283 |
):
|
284 |
if perturb_type == "overexpress":
|
|
|
307 |
|
308 |
def make_perturbation_batch(
|
309 |
example_cell, perturb_type, tokens_to_perturb, anchor_token, combo_lvl, num_proc
|
310 |
+
) -> tuple[Dataset, List[int]]:
|
311 |
if combo_lvl == 0 and tokens_to_perturb == "all":
|
312 |
if perturb_type in ["overexpress", "activate"]:
|
313 |
range_start = 1
|
requirements.txt
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
anndata>=0.9
|
2 |
+
datasets>=2.12
|
3 |
+
loompy>=3.0
|
4 |
+
matplotlib>=3.7
|
5 |
+
numpy>=1.23
|
6 |
+
packaging>=23.0
|
7 |
+
pandas>=2.0
|
8 |
+
pyarrow>=12.0
|
9 |
+
pytz>=2023.0
|
10 |
+
ray>=2.6
|
11 |
+
scanpy>=1.9
|
12 |
+
scikit_learn>=1.2
|
13 |
+
scipy>=1.10
|
14 |
+
seaborn>=0.12
|
15 |
+
setuptools>=65.6
|
16 |
+
statsmodels>=0.14
|
17 |
+
tdigest>=0.5.2
|
18 |
+
torch>=2.0.1
|
19 |
+
tqdm>=4.65
|
20 |
+
transformers>=4.28
|
setup.py
CHANGED
@@ -11,12 +11,28 @@ setup(
|
|
11 |
predictions in settings with limited data in \
|
12 |
network biology.",
|
13 |
packages=["geneformer"],
|
|
|
14 |
include_package_data=True,
|
15 |
install_requires=[
|
|
|
16 |
"datasets",
|
17 |
"loompy",
|
|
|
18 |
"numpy",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
"tdigest",
|
|
|
|
|
20 |
"transformers",
|
21 |
],
|
22 |
)
|
|
|
11 |
predictions in settings with limited data in \
|
12 |
network biology.",
|
13 |
packages=["geneformer"],
|
14 |
+
python_requires=">=3.10",
|
15 |
include_package_data=True,
|
16 |
install_requires=[
|
17 |
+
"anndata",
|
18 |
"datasets",
|
19 |
"loompy",
|
20 |
+
"matplotlib",
|
21 |
"numpy",
|
22 |
+
"packaging",
|
23 |
+
"pandas",
|
24 |
+
"pyarrow",
|
25 |
+
"pytz",
|
26 |
+
"ray",
|
27 |
+
"scanpy",
|
28 |
+
"scikit-learn",
|
29 |
+
"scipy",
|
30 |
+
"seaborn",
|
31 |
+
"setuptools",
|
32 |
+
"statsmodels",
|
33 |
"tdigest",
|
34 |
+
"torch",
|
35 |
+
"tqdm",
|
36 |
"transformers",
|
37 |
],
|
38 |
)
|