
1.1 conda installation
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
Run after the download completes (install by following the prompts)
sh Miniconda3-py39_4.12.0-Linux-x86_64.sh
After installation, run the following commands
source ~/.bashrc
1.2 Environment configuration
conda create -n (environment name) python=3.9
Activate the environment:
conda activate (environment name)
Add a mirror source
conda config –add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/bioconda/
conda config –add channels https://mirrors.bfsu.edu.cn/anaconda/cloud/conda-forge/
conda config –add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
conda config –add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
View mirror sources
conda config –show channels
1.3 Install python modules
conda install numpy=1.23.4
conda install opencv=4.7.0
conda install pandas=2.2.2
conda install matplotlib=3.8.4
conda install tqdm=4.66.4
conda install seaborn=0.12.2
conda install tifffile
conda install scanpy=1.9.8
1.4 Software installation
conda install samtools=1.18 sambamba=1.0.1 bedtools=2.31.1
conda install macs2=2.2.7.1
conda install deeptools=3.5.5
conda install ucsc-bedgraphtobigwig=472
conda install bwa=0.7.17
conda install bioconda::cutadapt=5.0
conda install bioconda::ucsc-bedsort
conda install bioconda::ucsc-bedclip
1.5 Install a specific R version (v4.3)
conda install -c conda-forge r-base=4.3.1
1.6 Install specific R packages
conda install -c conda-forge r-signac=1.14.0
conda install -c conda-forge r-seurat=4.3.0
conda install bioconda::bioconductor-rtracklayer=1.62.0
conda install -c conda-forge r-kableextra=1.4.0
conda install -c conda-forge r-optparse=1.7.5
conda install -c conda-forge r-this.path=2.7.0
conda install conda-forge::r-r.utils
conda install conda-forge::r-devtools=2.4.5
options(timeout = 9999999999999)
devtools::install_github(“davidsjoberg/ggsankey”)
install.packages(‘DT’)
The reference genome must be indexed with bwa (the pipeline uses bwa for alignment)
The gtf file must contain gene_id, gene_name and gene_biotype/gene_type
For the human and mouse genomes we recommend:
https://www.10xgenomics.com/support/software/cell-ranger-arc/latest/release-notes/reference-release-notes
refdata-cellranger-arc-GRCh38-2020-A-2.0.0
refdata-cellranger-arc-mm10-2020-A-2.0.0
For other genomes you may choose the version yourself.
The configuration file can be filled in by referring to config.txt; the contents are described below:
## fq data path; FQ1 is the read1 file path and FQ2 is the read2 file path
FQ1 /path/to/read_1.fq.gz
FQ2 /path/to/read_2.fq.gz
## Chip decoding file path
FLU /path/to/flu_info.txt
## Tissue brightfield image path
HE /path/to/HE.tif
#INSIDE 1 # Whether to subtract blank areas inside the tissue; default 1 (subtract), choose 0 to keep
## Tissue fluorescence image path
#FL /path/to/FL.tif # Tissue fluorescence image; choose either this or the HE image
#FLC -1 # Fluorescence image color channel; values are 0, 1 or 2; choose -1 for automatic detection
## Tissue region file path
JSON /path/to/roi.json # If not provided, the pipeline automatically identifies the region using the images above; fluorescence images are recommended for automatic identification
## Reference genome files
GenomeVer xxxx # Version information, shown in the report
Ref /path/to/ref/genome.fa # Genome fa file
Gtf /path/to/ref/gene.gtf # Genome gtf file
SPECIES human # Species file; human and mouse are human/mouse respectively; specify other species yourself
## Output results and output file prefix
OUTDIR /path/to/result/dir/
PREFIX outfile-prefix
## barcode type; V2 for the S3000 chip unless otherwise specified
BCType V2
## Number of threads
Threads 8
## cs sequence type; cs12 unless otherwise specified
CSType cs12
In the configured environment, run the command:
/path/to/BSATAC -c config.txt -s 0
where -c is the configuration file and -s is the selected step to run; 0 runs everything
outdir/
├── 01.fastq2BcUmi # barcode identification directory
├── 02.LinkBcChip # chip barcode correspondence
├── 03.AllheStat # multi-level resolution and tissue region processing
├── 04.Cutadapt # adapter filtering
├── 05.Mapping # reads alignment results
├── 06.Fragment # Fragment analysis
├── 07.WebReport # web-based report
├── BSTViewer_project # directory of collected results
└── prefix # raw chip barcode results
Please note: this analysis requires the outputs of BMK Manufacturing’s spatial RNA and spatial ATAC analysis pipelines!!!
The main results of spatial RNA and spatial ATAC are stored respectively inBSTViewer_projectthe folders.
Two approaches are provided below — Approach 1 and Approach 2. Approach 1 is recommended: alignment based on the scaled original image of HE/FL. Its advantages:
Notes:
BSTViewer_Projectthe folderhe_roi_small.png!Approach 1: FiJi alignment (original slide alignment)
step1: Joint analysis of BMK spatial ATAC and spatial transcriptomics — HE image alignment
https://live.csdn.net/v/510645
step2: Joint analysis of BMK spatial transcriptomics and spatial ATAC — barcode mapping after image alignment – CSDN blog
https://blog.csdn.net/m0_74235168/article/details/157131149?spm=1001.2014.3001.5501
step3: Joint analysis of BMK spatial ATAC and spatial transcriptomics — mapping Level1 spots to other levels – CSDN blog
https://blog.csdn.net/m0_74235168/article/details/157135254?spm=1001.2014.3001.5501
Approach 2: FiJi alignment (alignment of L1 rendered images)
Joint analysis of BMK spatial ATAC and spatial transcriptomics — section alignment (summary version)
https://blog.csdn.net/m0_74235168/article/details/157203989?sharetype=blogdetail&sharerId=157203989&sharerefer=PC&sharesource=m0_74235168&spm=1011.2480.3001.8118
Joint analysis of BMK spatial ATAC and spatial transcriptomics — HE image alignment (video version)
https://live.csdn.net/v/510645
Others: Downloading and installing Fiji (Windows 10)
https://zhuanlan.zhihu.com/p/18027378723
Special notes: this article explains the alignment principle in detail, along with the script implementation and result description. The scripts involved in the article are stored in [SpatialATAC/v1.0.2/fragment/ImageJ_FJ] .
2.1 Configuration file description
The configuration file can be filled in by referring to config.txt [SpatialATAC/v*/fragment/Joint_analysis/v*/] ; the contents are described below:
## ATAC and RNA analysis paths (under the first-level directory)
ATAC_analysis path/BSTViewer_project/
RNA_analysis path/BSTViewer_project/
###### Mapping file (obtained via Image Fiji) (by default the results of the four levels L18, L9, L7 and L5 are read)
Fiji path/
## Output path
outdir path/analysis
## Other parameters
alpha 0.1 ## Transparency, ranging from 0 to 1
logfc 0.1
2.2 Running the pipeline
perl Joint_main_v1.2.pl -c config.txt -s 0
where -a -b -c is the configuration file and -s is the selected step to run; 0 runs everything
perl Joint_main_v1.2.pl
Usage:
-a spatial config ## Configuration file of the main spatial transcriptomics pipeline
-b atac config ## Configuration file of the main spatial ATAC pipeline
-c joint config ## Configuration file for joint analysis (see 2.1)
-s run step
step number:
0: run all step
1: Joint analysis
2: Joint report
3: total report
2.3 Description of results
analysis/
├── L*_alignment
│ ├── L*_CoveragePlot.pdf ## Genome browser plot
│ ├── L*_CoveragePlot.png
│ ├── L*_heatmap.pdf ## Marker gene heatmap
│ ├── L*_heatmap.png
│ ├── L*_Joint_marker_gene.csv ## Joint analysis marker genes
│ ├── L*_joint.rds ## rds file
│ ├── L*_Sankey_plots.pdf ## Sankey diagram
│ ├── L*_Sankey_plots.png
│ ├── L*_Spatial_ATAC.cluster.pdf ## ATAC cluster plot
│ ├── L*_Spatial_ATAC.cluster.png
│ ├── L*_Spatial_Joint.cluster.pdf ## Joint analysis cluster plot
│ ├── L*_Spatial_Joint.cluster.png
│ ├── L*_Spatial_RNA.cluster.pdf ## RNA cluster plot
│ └── L*_Spatial_RNA.cluster.png
├── Readme.txt ## Documentation
└── report
├── Joint.html ## Joint analysis report
├── Spatial_ATAC_Joint.report.html ## Summary report of spatial /ATAC and joint analysis
└── src
**Special notes**
1. L*_joint.rds contains 3 assays: ATAC (peak matrix), Spatial (expression matrix) and RNA (activity matrix).
2. Two reports are generated: the joint analysis report, and a summary report of Spatial, ATAC and joint analysis
3.1 Running the pipeline
The scripts are stored in [v*/Cell_Split/ATAC_CellSplit_v1.3.pl]
perl ATAC_CellSplit_v1.3.pl
Description:
Version:v1.3
Usage:
-a <RNA analysis directory> must be given ## Spatial transcriptomics pipeline result path
-b <ATAC analysis directory> must be given ## ATAC pipeline result path
-ra L1_ATAC-RNA_barcode_relations_ALL.csv must be given ## L1 barcode mapping (obtained via FIJI image alignment)
-o <outdir> must be given ## Output path
-s mouse/human/other must be given ## Species selection
-g gtf/gff must be provided if -s is not mouse/human ## Provide the gtf for non-human and non-mouse species
-h Help document
3.2 Description of results
CellSplit/
├── ATAC_cluster.csv ## ATAC cell-segmentation-level clustering results
├── Cell.fragments.tsv.gz ## Cell-segmentation-level fragment file
├── Cell.fragments.tsv.gz.tbi
├── Cell_matrix ## Cell-segmentation-level matrix
│ ├── bins_5000
│ ├── bins_5000.barcodes.tsv
│ ├── bins_5000.matrix.mtx
│ ├── bins_5000.peak
│ └── matrix
│ ├── barcodes.tsv.gz
│ ├── features.tsv.gz
│ └── matrix.mtx.gz
├── Cell_Signac ## Cell-segmentation-level Signac analysis, similar to the routine Level analysis
│ ├── ATAC-Fragment_Size_Distribution.pdf
│ ├── ATAC-Fragment_Size_Distribution.png
│ ├── ATAC-TSS_by_Unique_Frags.pdf
│ ├── ATAC-TSS_by_Unique_Frags.png
│ ├── DimPlot_bin.0.0.0.8.pdf
│ ├── DimPlot_bin.0.0.0.8.png
│ ├── DimPlot_bin.0.0.1.2.pdf
│ ├── DimPlot_bin.0.0.1.2.png
│ ├── DimPlot_bin.0.0.1.5.pdf
│ ├── DimPlot_bin.0.0.1.5.png
│ ├── matrix
│ │ ├── barcodes_pos.tsv.gz
│ │ ├── barcodes.tsv.gz
│ │ ├── features.tsv.gz
│ │ └── matrix.mtx.gz
│ ├── object.rds
│ ├── QC_Vlnplot.0.0.pdf
│ ├── QC_Vlnplot.0.0.png
│ ├── Quantiles_DensityScatter.0.0.pdf
│ ├── Quantiles_DensityScatter.0.0.png
│ ├── Spatial_pos_cluster.0.0.0.8.pdf
│ ├── Spatial_pos_cluster.0.0.0.8.png
│ ├── Spatial_pos_cluster.0.0.1.2.pdf
│ ├── Spatial_pos_cluster.0.0.1.2.png
│ ├── Spatial_pos_cluster.0.0.1.5.pdf
│ └── Spatial_pos_cluster.0.0.1.5.png
├── CellSplit.L1_Cell.xls
├── CellSplit.L1.xls
├── ClusterPlot ## Cell-segmentation-level traceback plot
│ ├── ATAC.cell_cluster_color_outline_img.tif
│ ├── ATAC.cell_cluster_with_legend_img.tif
│ ├── clusters_colors.npy
│ ├── colors.npy
│ ├── Joint.cell_cluster_color_outline_img.tif
│ ├── Joint.cell_cluster_with_legend_img.tif
│ ├── Spatial.cell_cluster_color_outline_img.tif
│ └── Spatial.cell_cluster_with_legend_img.tif
├── Joint_CellSplit.rds ## Saved rds results of cell-segmentation-level joint analysis
├── Joint_cluster.csv ## Cell-segmentation-level joint analysis clustering results
├── Joint_marker_gene_top10.csv ## top10 marker genes
└── Spatial_cluster.csv ## Spatial transcriptomics cell-segmentation-level clustering results