pygot.tools.analysis.GRN#
- class pygot.tools.analysis.GRN[source]#
Bases:
object
Gene regulatory network infered by velocity linear regression
Example:#
grn = GRN() grn_adata = grn.fit(adata, species='human') print(grn_adata.ranked_edges.head()) #print the top regulatory relationship
Methods
- fit(adata, TF_constrain=True, TF_names=None, species='human', non_negative=True, layer_key=None, n_epoch=10000, lr=0.01, l1_penalty=0.005, init_beta=1.0, min_beta=1.0, init_jacobian=None, early_stopping=True, batch_size=2048, val_split=0.2, device=None, lineage_key=None)[source]#
fit the gene regulatory network
Arguments:#
- adata:
AnnData
Annotated data matrix, gene velocity should be stored in adata.layers[‘velocity’]
- TF_constrain: bool (default: True)
Only fit the transcriptional factor(TF)
- TF_names: list (default: None)
Names of TF, if None, use default TF names
- species: ‘human’ or ‘mm’ (default: ‘human’)
Default TF names of species
- non_negative: bool (default: True)
ONLY fit positive regulatory relationship, which may avoid overfit
- layer_key: str (default: None)
Data use as x, if None, use adata.X else should stored in adata.layers
- n_epoch: int (default: 10000)
Number of training epochs
- lr: float (default: 0.01)
Learning rate
- l1_penalty: float (default: 0.005)
l1 weight, control sparsity of grn
- init_beta: float or
GeneDegradation
(default: 1.0) Initial gene degrade rate
- min_beta: float (default: 1.0)
Lower bound of degrade rate
- init_jacobian: np.ndarray (default: None)
Initial grn
- early_stopping: bool (default: True)
Early stopping training
- batch_size: int (default: 2048)
Batch size of mini-batch training
- val_split: float (default: 0.2)
Validation dataset portion
- device:
torch.device
(default: None) torch device
- lineage_key: discard
This parameter is discarded
- returns:
grn_data – gene regulatory network
- rtype:
- adata: