Graph construction

If you have your .h5ad file, you can read data using scanpy package. If not, you can use our read_10X_visium_with_label or our other functions to read data.

GSG.read_10X_Visium_with_label

This function reads the files in the specified folder and returns anndata object for subsequent operations.(Note: MUST STANDARD 10X FOLDER!)

Paramaters

path: str
      Path to directory for visium datafiles.
genome: str/None (default: None)
        Filter expression to genes within this genome.
count_file: str(default: filtered_feature_bc_matrix.h5)
            Which file in the passed directory to use as the count file.
library_id: str/None (default: None)
            Identifier for the visium library. Can be modified when concatenating multiple adata objects.
load_images: bool (default: True)
             Whether need load images.
quality: str (default: hires)
         The quality of loading images.
image_path: None

Returns

adata: anndata
       10X spatial transcriptome data.

GSG.Graph_Construction

Graph_10X is a function to construct the neighbor structure of the graph using spatial information. The input parameters of this function are the anndata object and the args object, the anndata object is the 10X spatial transcriptome data, and the args object holds various training parameters. The anndata object holds the gene expression information of the spatial transcriptome data as well as the spatial location of each captured point, and by using this method we use the spatial information of the points to construct the neighbor-joining map used in the subsequent model training and save the constructed graph in the dgl object. In addition, this function performs preprocessing operations on the spatial transcriptome data, including removing genes with low expression, normalizing the gene expression, and downscaling the data, and saves the gene expression after preprocessing in the dgl object as well.The return values of the function are the preprocessed anndata object and the dgl object.

Parameters

adata: anndata
       Spatial transcriptome data.

args: argparse
      The arguments of constructing graph. 

Returns

adata: anndata
       Spatial transcriptome data.

graph: dgl object
       The neighbor structure of the graph with spatial information.