Subgraph decomposition and graph representation learning for single cell Hi-C imputation and clustering.
The structure of the HiC-SGL model. It consists of an encoder and a decoder. The encoder extracts the local feature of each edge and the global feature of the cell graph. The decoder estimates the likelihood of each edge being present in the cell map using the encoded feature.
python==3.9.6
pandas==1.4.4
pytorch==1.12.1
numpy==1.23.1
torch-geometric==2.1.0
required data
scHiC dataset:“data.txt" is a table file, which needs to contain attributes::
"label_info.pickle": file, the attribute "cell type" records the category corresponding to the cell id
”config.JSON”: The configuration file of the dataset, including properties:
python HicProcess.py --dir [dir]
Get cell map (torch_geomertic.data), save in dir/cellgraph directory;cell feature(torch.tensor), save in dir/cellatr directory
python pretrain.py --cuda [cuda] --dir [dir]
[cuda] GPU used
[dir] the folder where the data is located
Get the pre-training weight, save it in the /GCLweight directory
python train.py --cuda [cuda] --dir[dir] [--pre]
If --pre is included, the model uses pre-trained weights, otherwise it does not
Get the trained model parameters and save them in the dir/weight directory
The utils module implements some methods for conveniently obtaining data, models, calling models for cell imputation, and obtaining cell embedding.
function | description | args | return |
---|---|---|---|
get_cells | obtain cell map and cell features | data_dir(str): data directory path; c (int) chromosome number | cellgraph(list[torch_geometric.data]), cell feature(tensor) |
get_model | obtain model | data_dir(str): data directory path; c (int) chromosome number; state(str)( 'init', 'pretrained', 'trained'); device(str):model device | model (torch.nn.Module) |
get_cell_embed | Get trained cell embeddings | data_dir(str): data directory path | cell embed (numpy.array) |
impute_cell | impute cell | raw_cell(list[torch_geometric.data]:raw cell, model(torch.nn.Module): model | imputed cell(torch.tensor) |
Please contact zhengjh39@mail2.sysu.edu.cn