1, Open the script file
source(‘xxx’) #’xxx’ script path, for example
’C:/Users/R/Desktop/qq.R’
2, Creat Seurat object and draw the spatial clustering diagram
FilePath : The folder path where “barcode.tsv.gz、barcode_pos.tsv.gz、feature.tsv.gz、matrix.mtx.gz” are stored
barcode_pos_file : The folder path for “barcode_pos.tsv.gz”
out_path : The output directory for the files.
png_path : he staing(.png format), If it is in .tiff format, it needs to be converted. Please note that when converting, the resolution can be adjusted to avoid large .png files that may fail to be read.
Please note that the Seurat object must be named "object".
object <- Create_object(
FilePath = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/’,
barcode_pos_file = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/barcodes_pos.tsv.gz’,
out_path = ‘C:/Users/R/Desktop/temp/Cluster/’,
png_path = ‘C:/Users/R/Desktop/temp/he.png’,
min.cells = 10, # Minimum number of cells expressing a gene to be retained, adjustable (default: 10)
min.features = 100, # Minimum number of genes a cell must have to be retained, adjustable (default: 100)
dims = 1:30, # Select how many principal components for subsequent analysis, adjustable (default: 1:30)
resolution = 0.5, # Set the "granularity" for downstream analysis; higher values result in more clusters, adjustable (default: 0.5)
point_size = 3, # Size of points, adjust based on matrix file level ,smaller level requires smaller value.
width = 12, # Width of the output image, adjustable (default: 12).
height = 5, # Height of the output image, adjustable (default: 5).
Cluster = T, # Perform clustering analysis or not (default: F).
label = T # Output clustered image with labels or not
umap_cluster_label
3, UMI statistics
object <- Create_object(
FilePath = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/’,
barcode_pos_file = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/barcodes_pos.tsv.gz’,
out_path = ‘C:/Users/R/Desktop/temp/UMI_stat/’,
png_path = ‘C:/Users/R/Desktop/temp/he.png’,
point_size = 3, #same as above
width = 12, #same as above
height = 5, #same as above
UMI_stat = T) # Whether to perform UMI statistics.
UMI_viol_heatmap
4, nFeature statistics
object <- Create_object(
FilePath = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/’,
barcode_pos_file = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/barcodes_pos.tsv.gz’,
out_path = ‘C:/Users/R/Desktop/temp/Gene_stat/’,
png_path = ‘C:/Users/R/Desktop/temp/he.png’,
point_size = 2, #same as above
width = 12, #same as above
height = 5, #same as above
nFeature_stat = T) #Whether to perform nFeature
nFeature_viol_heatmap
5, Output marker genes for each cluster and plot individual gene expression heatmaps
object <- Create_object(
FilePath = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/’,
barcode_pos_file = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/barcodes_pos.tsv.gz’,
out_path = ‘C:/Users/R/Desktop/temp/Single_gene_1/’,
png_path = ‘C:/Users/R/Desktop/temp/he.png’,
point_size = 2, # same as above
Gene_stat = T, # Whether to perform marker gene plotting
top_gene = 1, # How many top marker genes to select for each cluster, adjustable. The value should not be set too high
min.pct = 0.25, # The proportion of a gene in any two cell clusters should not be lower than this threshold, adjustable.
logfc.threshold = 0.25, #Differential fold-change threshold, adjustable.
markpic_width = 8, # Width of violin plot and tsne plot.
markpic_height = 12, #Heightof violin plot and tsne plot
Heat map list
6, Plot gene clustering maps for one or multiple genes:
object <- Create_object(
FilePath = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/’,
barcode_pos_file = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/barcodes_pos.tsv.gz’,
out_path = ‘C:/Users/R/Desktop/temp/Test/Single_gene_2/’,
png_path = ‘C:/Users/R/Desktop/temp/he.png’,
point_size = 2.6, #same as above
Gene_stat = T, #Whether to perform mark gene plotting
Custom_gene = T, #Whether to perform custom gene plotting
alpha_continuous = c(0.5,1) # Adjust transparency range based on gene expression levels
gene_list = c(‘Hpca’)) #Genes to plot, multiple source inputs supported
Hpca
Select a black background to highlight
object <- Create_object(
FilePath = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/’,
barcode_pos_file = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/barcodes_pos.tsv.gz’,
out_path = ‘C:/Users/R/Desktop/temp/Test/Single_gene_2/’,
png_path = ‘C:/Users/R/Desktop/temp/he.png’,
point_size = 2.6, #same as above
Gene_stat = T, #Whether to perform mark gene plotting
Custom_gene = T, #Whether to persorm custom gene plotting
dark_background = T, #dark background
gene_list = c(‘Hpca’)) #Genes to plot, multiple source inputs supported
Hpca
7, Plot individual cluster map
object <- Create_object(
FilePath = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/’,
barcode_pos_file = ‘E:/AAAWork/BSTViewer_project/subdata/L13_heAuto/barcodes_pos.tsv.gz’,
out_path = ‘C:/Users/R/Desktop/temp/TestL6/single/’,
png_path = ‘C:/Users/R/Desktop/temp/he.png’,
point_size = 2, #same as above
Single_cluster = T #Whether to perform individual cluster plotting