-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathREADME.Rmd
150 lines (99 loc) · 4.92 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
title: Walkthrough of Clone Calling from Prostate Cancer Visium Spatial Transcriptomics
Data with InferCNV
author: "Andrew Erickson, Nuffield Department of Surgical Sciences, Unviersity of Oxford"
output:
md_document:
variant: markdown_github
---
# siCNV: Spatial InferCNV from Spatial Transcriptomics Data
Spatially resolved transcriptomics has emerged as a genome-wide analysis of gene expression to explore tissues in an unsupervised manner. In this study we infer genome-wide copy-number variations (CNV) from spatially resolved mRNA profiles in situ. Gene expression has [previously been used to infer CNVs](https://github.com/broadinstitute/infercnv) in single cells, successfully identifying regions of chromosomal gain and loss. Here we expand into a spatial modality, generating CNV calls in each spatial region represented by barcoded spots.
We provide a R package via this github page, as well as [scripts to reproduce the main figures](https://github.com/aerickso/SpatialInferCNV/tree/main/FigureScripts) in the manuscript.
This code was tested using [R](https://www.r-project.org/) version 4.1.3, a Windows 11 Computer, 32GB RAM, and 12 CPUs (1.6 GHz).
For timely data-analyses of datasets comprising 2 or more Visium sections, consider use of a high performance cluster. In our project, the infercnv::run analyses steps were ran on the [BMRC](https://www.medsci.ox.ac.uk/divisional-services/support-services-1/bmrc/cluster-usage), with 10-20 CPUs, each 1.6 GHz and 16GB ram.
# System level dependency (for the hdf5r package)
SpatialInferCNV has HDF5 as a system level dependency which needs to be installed before installing the `hd5fr` R package. See here for details: https://github.com/hhoeflin/hdf5r#Requirements. For Windows users, you can download the windows version here: https://github.com/mannau/h5-libwin.
# Installation of SpatialInferCNV Dependencies - R
```{r, eval = FALSE}
install.packages("devtools")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("infercnv")
install.packages("tidyverse")
install.packages("Seurat")
install.packages("phylogram")
install.packages("ape")
install.packages("hdf5r")
```
# Installation
```{r, eval = FALSE}
install.packages("devtools")
library(devtools)
install_github("aerickso/SpatialInferCNV")
library(SpatialInferCNV)
```
# SpatialInferCNV installation via in a conda environment - MacOS or Linux
We also provide environment files to set up a conda environment in a MacOSX or Linux environment with all the dependencies necessary for SpatialInferCNV. Installation was tested using MacOS Mojave, Version 10.14.6 and an HPC running Scientific Linux 7.9. If you have anaconda installed, you can create a new environment and activate it by running the code below.
[environment.yml file](https://github.com/aerickso/SpatialInferCNV/blob/main/environment.yml)
```
conda env create -f environment.yml
conda activate SpatialInferCNV
```
If you want to run RStudio within this environment you can install it from the terminal with conda:
```
# make sure that the environment is active
conda install -c r rstudio
rstudio
```
Once you have created the environment you can install SpatialInferCNV.
```{r, eval = FALSE}
# From R
install.packages("devtools")
library(devtools)
install_github("aerickso/SpatialInferCNV")
```
# SpatialInferCNV installation via in a conda environment - Windows
This was tested in Anaconda3, conda version 4.12.0, on Windows 11, R version 4.1.3.
In anaconda3 terminal, create a new conda environment with R 4.1.3.
```
conda config --add channels conda-forge
conda create -n siCNV r-base=4.1.3
# Select yes to install all new packages
conda activate siCNV
R
```
Install devtools, and configure the file download method for windows to allow install_githb() to resolve
```{r, eval = FALSE}
install.packages("devtools")
library(devtools)
options(download.file.method = "wininet")
```
Installing R dependencies. Note: hdf5r has a system level dependency of hdf5, see above for more details.
```{r, eval = FALSE}
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("infercnv")
install.packages("tidyverse")
install.packages("Seurat")
install.packages("phylogram")
install.packages("ape")
install.packages("hdf5r")
# enter a to update/install all
library(infercnv)
library(tidyverse)
library(Seurat)
library(phylogram)
library(ape)
library(hdf5r)
```
After installing the R dependencies, install and initialize SpatialInferCNV.
```{r, eval = FALSE}
install_github("aerickso/SpatialInferCNV")
# enter 1 to update all
# yes
library(SpatialInferCNV)
```
# Userguide
The package provides a number of functions, please read the user guide [here](https://aerickso.github.io/SpatialInferCNV/).
# Study Data
We provide data used in this study at the following [Mendeley Repository](https://data.mendeley.com/v1/datasets/svw96g68dv/draft?a=3f263217-2bd3-4a3c-8125-8c517c3a9e29).