Christina Theodoris commited on
Commit
d1931b1
1 Parent(s): 79788b6

edit docstring codeblock highlighting

Browse files
geneformer/emb_extractor.py CHANGED
@@ -397,12 +397,12 @@ class EmbExtractor:
397
 
398
  **Parameters:**
399
 
400
- model_type : {"Pretrained","GeneClassifier","CellClassifier"}
401
  | Whether model is the pretrained Geneformer or a fine-tuned gene or cell classifier.
402
  num_classes : int
403
  | If model is a gene or cell classifier, specify number of classes it was trained to classify.
404
  | For the pretrained Geneformer model, number of classes is 0 as it is not a classifier.
405
- emb_mode : {"cell","gene"}
406
  | Whether to output cell or gene embeddings.
407
  cell_emb_style : "mean_pool"
408
  | Method for summarizing cell embeddings.
@@ -448,15 +448,14 @@ class EmbExtractor:
448
 
449
  >>> from geneformer import EmbExtractor
450
  >>> embex = EmbExtractor(model_type="CellClassifier",
451
- ... num_classes=3,
452
- ... emb_mode="cell",
453
- ... filter_data={"cell_type":["cardiomyocyte"]},
454
- ... max_ncells=1000,
455
- ... max_ncells_to_plot=1000,
456
- ... emb_layer=-1,
457
- ... emb_label=["disease","cell_type"],
458
- ... labels_to_plot=["disease","cell_type"],
459
- ... )
460
 
461
  """
462
 
@@ -552,10 +551,9 @@ class EmbExtractor:
552
  .. code-block :: python
553
 
554
  >>> embs = embex.extract_embs("path/to/model",
555
- ... "path/to/input_data",
556
- ... "path/to/output_directory",
557
- ... "output_prefix",
558
- ... )
559
 
560
  """
561
 
@@ -741,10 +739,9 @@ class EmbExtractor:
741
  .. code-block :: python
742
 
743
  >>> embex.plot_embs(embs=embs,
744
- ... plot_style="heatmap",
745
- ... output_directory="path/to/output_directory",
746
- ... output_prefix="output_prefix",
747
- ... )
748
 
749
  """
750
 
 
397
 
398
  **Parameters:**
399
 
400
+ model_type : {"Pretrained", "GeneClassifier", "CellClassifier"}
401
  | Whether model is the pretrained Geneformer or a fine-tuned gene or cell classifier.
402
  num_classes : int
403
  | If model is a gene or cell classifier, specify number of classes it was trained to classify.
404
  | For the pretrained Geneformer model, number of classes is 0 as it is not a classifier.
405
+ emb_mode : {"cell", "gene"}
406
  | Whether to output cell or gene embeddings.
407
  cell_emb_style : "mean_pool"
408
  | Method for summarizing cell embeddings.
 
448
 
449
  >>> from geneformer import EmbExtractor
450
  >>> embex = EmbExtractor(model_type="CellClassifier",
451
+ ... num_classes=3,
452
+ ... emb_mode="cell",
453
+ ... filter_data={"cell_type":["cardiomyocyte"]},
454
+ ... max_ncells=1000,
455
+ ... max_ncells_to_plot=1000,
456
+ ... emb_layer=-1,
457
+ ... emb_label=["disease", "cell_type"],
458
+ ... labels_to_plot=["disease", "cell_type"])
 
459
 
460
  """
461
 
 
551
  .. code-block :: python
552
 
553
  >>> embs = embex.extract_embs("path/to/model",
554
+ ... "path/to/input_data",
555
+ ... "path/to/output_directory",
556
+ ... "output_prefix")
 
557
 
558
  """
559
 
 
739
  .. code-block :: python
740
 
741
  >>> embex.plot_embs(embs=embs,
742
+ ... plot_style="heatmap",
743
+ ... output_directory="path/to/output_directory",
744
+ ... output_prefix="output_prefix")
 
745
 
746
  """
747
 
geneformer/in_silico_perturber.py CHANGED
@@ -7,22 +7,22 @@ Geneformer in silico perturber.
7
 
8
  >>> from geneformer import InSilicoPerturber
9
  >>> isp = InSilicoPerturber(perturb_type="delete",
10
- ... perturb_rank_shift=None,
11
- ... genes_to_perturb="all",
12
- ... model_type="CellClassifier",
13
- ... num_classes=0,
14
- ... emb_mode="cell",
15
- ... filter_data={"cell_type":["cardiomyocyte"]},
16
- ... cell_states_to_model={"state_key": "disease", "start_state": "dcm", "goal_state": "nf", "alt_states": ["hcm", "other1", "other2"]},
17
- ... state_embs_dict ={"nf": emb_nf, "hcm": emb_hcm, "dcm": emb_dcm, "other1": emb_other1, "other2": emb_other2},
18
- ... max_ncells=None,
19
- ... emb_layer=0,
20
- ... forward_batch_size=100,
21
- ... nproc=16)
22
  >>> isp.perturb_data("path/to/model",
23
- ... "path/to/input_data",
24
- ... "path/to/output_directory",
25
- ... "output_prefix")
26
 
27
  **Description:**
28
 
 
7
 
8
  >>> from geneformer import InSilicoPerturber
9
  >>> isp = InSilicoPerturber(perturb_type="delete",
10
+ ... perturb_rank_shift=None,
11
+ ... genes_to_perturb="all",
12
+ ... model_type="CellClassifier",
13
+ ... num_classes=0,
14
+ ... emb_mode="cell",
15
+ ... filter_data={"cell_type":["cardiomyocyte"]},
16
+ ... cell_states_to_model={"state_key": "disease", "start_state": "dcm", "goal_state": "nf", "alt_states": ["hcm", "other1", "other2"]},
17
+ ... state_embs_dict ={"nf": emb_nf, "hcm": emb_hcm, "dcm": emb_dcm, "other1": emb_other1, "other2": emb_other2},
18
+ ... max_ncells=None,
19
+ ... emb_layer=0,
20
+ ... forward_batch_size=100,
21
+ ... nproc=16)
22
  >>> isp.perturb_data("path/to/model",
23
+ ... "path/to/input_data",
24
+ ... "path/to/output_directory",
25
+ ... "output_prefix")
26
 
27
  **Description:**
28
 
geneformer/in_silico_perturber_stats.py CHANGED
@@ -7,15 +7,14 @@ Geneformer in silico perturber stats generator.
7
 
8
  >>> from geneformer import InSilicoPerturberStats
9
  >>> ispstats = InSilicoPerturberStats(mode="goal_state_shift",
10
- ... cell_states_to_model={"state_key": "disease",
11
- ... "start_state": "dcm",
12
- ... "goal_state": "nf",
13
- ... "alt_states": ["hcm", "other1", "other2"]})
14
- ... )
15
  >>> ispstats.get_stats("path/to/input_data",
16
- ... None,
17
- ... "path/to/output_directory",
18
- ... "output_prefix")
19
 
20
  **Description:**
21
 
 
7
 
8
  >>> from geneformer import InSilicoPerturberStats
9
  >>> ispstats = InSilicoPerturberStats(mode="goal_state_shift",
10
+ ... cell_states_to_model={"state_key": "disease",
11
+ ... "start_state": "dcm",
12
+ ... "goal_state": "nf",
13
+ ... "alt_states": ["hcm", "other1", "other2"]})
 
14
  >>> ispstats.get_stats("path/to/input_data",
15
+ ... None,
16
+ ... "path/to/output_directory",
17
+ ... "output_prefix")
18
 
19
  **Description:**
20