Skip to content

Commit 39f0303

Browse files
authored
Merge pull request #198 from CRI-iAtlas/develop
1.3
2 parents d49c870 + d6eb9c3 commit 39f0303

55 files changed

Lines changed: 3658 additions & 91 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CONTRIBUTING.md

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# Contributing to CRI-iAtlas
2+
3+
Welcome, and thanks for your interest in contributing to the Cancer Research Institute (CRI) iAtlas!
4+
5+
If you would like to contribute code changes please follow these steps:
6+
7+
1. Search the issues list in the repo. Consider opening an issue related to the suggested feature.
8+
2. Create a personal fork and commit new code development to personal branches in that fork.
9+
3. Propose changes via pull request of personal branches.
10+
11+
12+
In case the intended contribution consists of a new module, please refer to the following steps to include shortcuts of new modules in the Explore Section of CRI-iAtlas.
13+
14+
## Procedures for Starting a New iAtlas Module
15+
16+
Procedures to include a new module in the initial page of the Explore Section of the current version of the portal CRI-iAtlas (February 2020).
17+
18+
This procedure lists the files that need to be updated or started, as well as the functions to call, when applicable. There is no reference to a specific line to update, as this can change over time. It is recommended to look for the section of the code with the settings of current modules - for example, in step 4.1., at the `server.R` file, look for `callModule` code for the existing modules, and include new code in this section.
19+
20+
### Steps
21+
Can be carried out in another order but all pieces need to be in place for full functionality.
22+
23+
#### 1. Create file with new module and save it in the modules folder : `modules/myshinynewmodule.R`.
24+
25+
#### 2. Edit `configuration.yaml`.
26+
27+
Add the new module name in the `module_files` list: `modules/myshinynewmodule.R`
28+
29+
IMPORTANT: if you create a script with functions, save it in the `functions` folder and add the file names in the `function_files` list in `configuration.yaml`
30+
31+
#### 3. In your module script `myshinynewmodule.R`, define the name of the UI and server function.
32+
33+
In this example, the names will be:
34+
35+
```
36+
newmodule_UI <-function(id){}
37+
38+
newmodule <- function(input, output, session){}
39+
```
40+
Please note that this function can take more arguments.
41+
42+
#### 4. Edit top level `server.R`.
43+
44+
Include a `callModule` for your module server function:
45+
46+
```
47+
callModule(newmodule, moduleN, …)
48+
```
49+
50+
Give module a number such as `moduleN`. Check if moduleN is unique.
51+
52+
Add the following in the `observeEvent` section:
53+
```
54+
observeEvent(input$link_to_moduleN, {
55+
shinydashboard::updateTabItems(session, "explorertabs", "new_module")
56+
})
57+
```
58+
Observe that in 4.2., "new_module” is distinct from newmodule defined in #3.
59+
60+
#### 5. Now it is time to include access to your new module in the initial page of the portal. To do so, edit `pages/explorepage.R`.
61+
62+
Add the following in the `tabItem` section found near bottom of this script:
63+
64+
```
65+
tabItem(
66+
tabName = "new_module",
67+
newmodule_UI("moduleN")
68+
)
69+
```
70+
71+
Add link to the left navigation bar (into code near the top of this script):
72+
73+
```
74+
menuSubItem(
75+
"Test Module", #text to display
76+
tabName = "new_module",
77+
icon = icon("cog") #can be different for other sections
78+
)
79+
```
80+
81+
Edit main section to include the new module in the initial Explore page:
82+
```
83+
fluidRow(
84+
imgLinkBox(
85+
width = 6,
86+
title = "New Module",
87+
linkId = "link_to_moduleN",
88+
imgSrc = "images/myimage.png", # if including images, read next step.
89+
boxText = "Short description of the module",
90+
linkText = "Open Module"
91+
)
92+
```
93+
You may have to adjust layout after step 5.3.
94+
95+
Include a png if you like. Save the image at `www/images/myimage.png`.
96+

README.md

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,20 @@ The portal is built entirely in **R** and **Shiny** using the **RStudio** develo
2222

2323
### MacOS Install instructions
2424

25-
Install brew: https://brew.sh/
25+
- Download and install gfortran: https://github.com/fxcoudert/gfortran-for-macOS/releases
26+
or https://cran.r-project.org/bin/macosx/tools/
2627

27-
Then:
28+
- Download and install R-3.6.2.pkg: https://cran.r-project.org/bin/macosx/
2829

29-
- brew install R
30-
- brew install cairo
31-
- download and install RStudio: https://rstudio.com/products/rstudio/download
30+
- Download and install X11 via XQuartz: https://www.xquartz.org/
3231

33-
### Initialize R Packages, Database and run App
32+
- Install cairo via Homebrew: `brew install cairo` (https://formulae.brew.sh/formula/cairo ; requires brew: https://brew.sh/ )
33+
34+
- Download and install RStudio: https://rstudio.com/products/rstudio/download
35+
36+
Please see the section "[Common Installation Errors (MacOS)](#Common-Installation-Errors-(MacOS))" at the end of this README for common issues encountered during installation.
37+
38+
### Initialize R Packages and run App
3439

3540
To run the app locally:
3641

@@ -44,16 +49,19 @@ To run the app locally:
4449
renv::restore()
4550
```
4651

47-
This may take some time to complete - get something nice to drink :)
52+
This may take some time to complete - walk away from your computer, rest your eyes, and catch up on those stretching exercises you are meant to be doing :)
4853

4954
1. Start the app by running:
5055

5156
```R
5257
shiny::runApp()
5358
```
5459

60+
5561
## Development
5662

63+
Please consult the [Contributing Guide](https://github.com/CRI-iAtlas/shiny-iatlas/blob/develop/CONTRIBUTING.md) for pointers on how to get started on a new module.
64+
5765
When adding any new dependencies to the application, they may be added using (where "useful_package" is the name of the package to add):
5866

5967
```R
@@ -70,7 +78,7 @@ renv::snapshot()
7078

7179
This will ensure the new package is added to the renv.lock file.
7280

73-
To remove an installed package, run (where "useful_package" is the name of the package to remove):
81+
To remove an installed package, run (where "no_longer_useful_package" is the name of the package to remove):
7482

7583
```R
7684
renv::remove("no_longer_useful_package")
@@ -80,7 +88,7 @@ For more on package management with renv, please see [https://rstudio.github.io/
8088

8189
## Deployment
8290

83-
The first time you deploy, go through the Deployment-Setup instructions below. Afterwards, you can just deploy as needed.
91+
The first time you deploy, go through the Deployment Setup instructions below. Afterwards, you can just deploy as per sub-section Deploy.
8492

8593
### Deployment Setup (First-Time-Only)
8694

@@ -108,8 +116,12 @@ rsconnect::deployApp()
108116

109117
## Data
110118

111-
Input data for the Shiny-iAtlas portal were accessed from multiple remote sources, including **Synapse**, the **ISB Cancer Genomics Cloud**, and **Google Drive**. For convenience, we have created locally cached versions of dataframe objects as **`feather`** files in the `data` folder:
119+
Input data for the Shiny-iAtlas portal are to a large extent obtained from the [Immune Landscape of Cancer](https://www.cell.com/immunity/abstract/S1074-7613(18)30121-3) study. These data can be accessed via the [Immunity journal publication page ](https://www.cell.com/immunity/abstract/S1074-7613(18)30121-3), the [manuscript page at NCI's Genomic Data Commons](https://gdc.cancer.gov/about-data/publications/panimmune) and on [iAtlas pages on Synapse](https://www.synapse.org/#!Synapse:syn21247064). This includes the main feature matrix and various feature and group annotations. Additionally some input files of results were pre-computed specifically for use by this app.
120+
121+
Some of the key input data can be found as dataframe objects in **`feather`** files within the `data` folder:
112122

123+
- `cell_image_id_annotations.feather`
124+
- `driver_mutations.feather`
113125
- `feature_df.feather`
114126
- `feature_method_df.feather`
115127
- `fmx_df.feather`
@@ -122,21 +134,59 @@ Input data for the Shiny-iAtlas portal were accessed from multiple remote source
122134

123135
## Methods
124136

125-
While many of the results presented in tables and plots are taken directly from IRWG data (including the main **feature matrix** and various feature and group annotations), we compute some values internally. Unless otherwise noted, the following methods/tools were used to compute summary statistics:
137+
Methods employed by the app are described in [Immune Landscape of Cancer](https://www.cell.com/immunity/abstract/S1074-7613(18)30121-3) study and can also be found in Methods descriptions displayed in the app (for example as seen in Data Description module).
138+
139+
### Concordance Index (CI)
126140

127-
### Correlation — Spearman's rank-order correlation
141+
Concordance indexes for survival endpoints with respect to different immune readouts are computed using a custom package developed by Tai-Hsien Ou Yang. The **[concordanceIndex](https://github.com/th86/concordanceIndex)** package includes a single eponymous function that can be used as follows:
128142

129143
```R
130-
stats::cor(x, y, method = "spearman", use = "pairwise.complete.obs")
144+
concordanceIndex::concordanceIndex(predictions, observations)
131145
```
132146

133-
### Concordance Index (CI)
147+
where `predictions` and `observations` are numerical vectors of identical length.
148+
149+
### Immune Subtype Classifier
150+
151+
The iAtlas Immune Subtype Classifier tool uses the **[ImmuneSubtypeClassifier](https://github.com/CRI-iAtlas/ImmuneSubtypeClassifier)** R package, developed by David L. Gibbs, for classification of immune subtypes, in cancer, using gene expression data.
134152

135-
Concordance indexes for survival endpoints with respect to different immune readouts were computed using a custom package developed by Tai-Hsien Ou Yang at Columbia University. The **concordanceIndex** package includes a single synonymous function that can be used as follows:
153+
### Common Installation Errors (MacOS)
136154

155+
When running `renv::restore()`, you may run into the following errors:
156+
157+
#### Error when installing `Cairo`:
137158
```R
138-
concordanceIndex::concordanceIndex(predictions, observations)
159+
checking for pkg-config... no
160+
configure: CAIRO_LIBS is unset, attempting to guess it.
161+
configure: CAIRO_CFLAGS=-I/usr/local/include/cairo
162+
checking if R was compiled with the RConn patch... no
163+
checking cairo.h usability... yes
164+
checking cairo.h presence... yes
165+
checking for cairo.h... yes
166+
checking for PNG support in Cairo... yes
167+
checking for ATS font support in Cairo... no
168+
configure: CAIRO_LIBS=-L/usr/local/lib -lcairo
169+
checking for library containing deflate... -lz
170+
checking whether Cairo programs can be compiled... yes
171+
checking whether cairo_image_surface_get_format is declared... no
172+
checking for FreeType support in cairo... yes
173+
checking whether FreeType needs additional flags... yes
174+
checking whether fontconfig/freetype2 location can be guessed... possibly
175+
checking whether additional flags work... no
176+
configure: error: Cannot use cairo-ft backend, although cairo claims it is working. Please check your caito installation and/or update cairo if necessary or set CAIRO_CFLAGS/CAIRO_LIBS accordingly.
177+
ERROR: configuration failed for packageCairo
178+
* removing/Users/ychae/Documents/iAtlas/shiny-iatlas/renv/staging/1/Cairo
179+
Error: install of package 'Cairo' failed
139180
```
181+
There are several possible reasons for this:
182+
- Make sure that you have XQuartz installed. If you've recently updated your MacOS, you will need to reinstall XQuartz.
183+
- You might be missing `pkg-config`. You can install this by opening a Terminal window and running `brew install pkg-config`.
140184

141-
... where `predictions` and `observations` are numerical vectors of the same length.
185+
#### Error when installing `RPostgres [1.1.1]:
186+
```R
187+
Installing RPostgres [1.1.1] ...
188+
FAILED
189+
Error installing package 'RPostgres':
190+
```
191+
Can be resolved by opening a Terminal window and running `brew install libpq`. You may also need to set `PKG_CONFIG_PATH="/usr/local/opt/libpq/lib/pkgconfig"`.
142192

configuration.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ module_files:
1313
- "modules/subtypeclassifiermodule.R"
1414
- "modules/submodules.R"
1515
- "modules/distribution_plot_module.R"
16+
- "modules/cytokinenetwork.R"
17+
- "modules/cellimagemodule.R"
18+
- "modules/cnvmodule.R"
1619

1720
function_files:
1821
- "functions/load_data.R"
@@ -32,6 +35,8 @@ function_files:
3235
- "functions/tablef_fun.R"
3336
- "functions/imageplot.R"
3437
- "functions/event_data_utils.R"
38+
- "functions/extracellnet_utils.R"
39+
- "functions/cellimage_utils.R"
3540

3641
page_files:
3742
- "pages/aboutpage.R"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**Title:** The Cell-to-Cell Communication Network
2+
3+
**Descriptions:** A network of documented ligand-receptor, cell-receptor, and cell-ligand pairs (Ramilowski et al., 2015 - https://www.nature.com/articles/ncomms8866) was retrieved from the FANTOM5 resource at (http://fantom.gsc.riken.jp/5/suppl/Ramilowski_et_al_2015/).
4+
5+
CIBERSORT cell types are more granular than the immune cells in FANTOM5 and were therefore summed to yield estimates for FANTOM5 immune cell abundances, as defined above in ‘‘Immune cellular fraction estimates’’ Aggregate 2. For example, FANTOM5 CD19 B cell estimates are the combination of CIBERSORT naive and memory B cells. This network was augmented with additional known interactions of immumodulators, and only ligand-receptor edges that contained at least one cell or one immune modulator were retained, yielding a ‘scaffold’ of possible interactions.
6+
7+
From the scaffold of possible interactions, interactions were identified that could be playing a role within the TME in each subtype or group as follows. Cellular fractions were binned into tertiles (low, medium, high), as were gene expression values for ligands and receptors, yielding ternary values for all ‘nodes’ in the network. The binning was performed over all TCGA samples. In subsequent processing, nodes and edges were treated uniformly in processing, without regard to type (cell,ligand,receptor). From the scaffold, interactions predicted to take place in the TME were identified first by a criterion for the nodes to be included (‘present’ in the network), then by a criterion for inclusion of edges, potential interactions. Nodes selection is based on the abundance threshold. For instance, for an abundance threshold of 66%, the node is entered into the subtype-network if at least 66% of samples within a subtype map to mid or high value bins. An edge present in the scaffold network between any two nodes is then evaluated for inclusion. A contingency table is populated for the ternary values of the two nodes, over all samples in the subtype, and a concordance versus discordance ratio (‘‘concordance score’’) is calculated for the edge in terms of the values of ((high,high)+ (low,low))/(1+(low,high)+(high,low)). Edges are included in the network based on their concordance value. A concordance threshold of 2, for example, selects edges that have both nodes simultaneously highly or lowly expressed (concordant) at least twice as frequent than samples with one node highly expressed and the other lowly expressed (discordant). On the other hand, an edge with a concordance threshold of 0.5 is considered discordant, ie, the frequency of samples with one node highly expressed and the other lowly expressed (discordant) is twice than samples with both nodes simultaneously highly or lowly expressed (concordant).
8+
9+
10+
[Reference List](https://www.cell.com/immunity/references/S1074-7613\(18\)30121-3)
11+
12+
**Contributors:** David L. Gibbs, Vesteinn Thorsson, Ilya Shmulevich
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
**Title:** Cell, ligand and receptor abundance
2+
3+
**Description:** To generate the cellular image for display, the figure was drawn in Adobe Illustrator, exported to SVG and transformed into “Cairo” graphic SVG format for import into R as a grid object (using the R package grImport2). The proteins and cells shown in the image were then made available for display as a node-edge network. In the node-edge network directionality of network edges follows that of the related iAtlas module devoted to showing extracellular networks of the tumor microenvironment.
4+
5+
To yield values for display, the gene expression values for each protein shown were first binned into tertiles (low, medium, high). The binning was performed over all TCGA samples. The ‘abundance’ was computed as the fraction of samples within a the selected subtype that map to the mid and high value bins. The abundance can thus range from 0 to 1. Identical binning was performed to yield cell abundance within the subtype.
6+
7+
Some details of the value estimation prior to binning are as follows. Immune cell abundance was estimated with CIBERSORT. The T Cell estimate corresponds to the CD8 T Cell estimate from CIBERSORT; Macrophage level is given by the sum of M0, M1, M2 macrophages according to CIBERSORT; Dendritic cells are a combination of CIBERSORT resting and activated Dendritic cells. The Tumor Cells estimate are estimated by TCGA tumor purity. The T cell receptor (TCR) value was approximated by the T Cell estimate. MHC Class I values (MHC) were set to the expression of the single HLA gene HLA-A, and MHC Class II (MHC-II) approximated by the expression of HLA-DPA1. In the network diagram, the TCR and peptide-mediated binding interactions are not shown. ICOSLG codes for the protein ICOSL.
8+
9+
**Acknowledgment:** The iAtlas team is grateful to Allison Kudla of the Institute for Systems Biology for producing the cell image file and for being patient with multiple requests for modifications. The figure was adapted from *CTLA-4 and PD-1/PD-L1 blockade: new immunotherapeutic modalities with durable clinical benefit in melanoma patients* PA Ott, FS Hodi, and C Robert; Clin Cancer Res. 2013 Oct 1;19(19):5300-9; doi: 10.1158/1078-0432.CCR-13-0143.
10+
11+
**Contributors:** Vesteinn Thorsson, Carolina Heimann, Allison Kudla, David L. Gibbs, Ilya Shmulevich
2.26 KB
Binary file not shown.

data/cell_image_object_ids.txt

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
T_cell
2+
T_cell_nucleus
3+
Dendritic_cell
4+
Dendritic_cell_nucleus
5+
Tissue_macrophage
6+
Tissue_macrophage_nucleus
7+
Tumor
8+
Tumor_nucleus
9+
ICOS
10+
PD-L2
11+
PD-L2
12+
PD-L1
13+
PD-L1
14+
PD-L1
15+
CD28
16+
CTLA-4
17+
CD40L
18+
CD40
19+
ICOSL
20+
CD86
21+
CD80
22+
PD-1
23+
PD-1
24+
PD-1
25+
PD-1
26+
PD-1
27+
Four.1BB
28+
Four.1BBL
29+
OX40L
30+
OX40
31+
GITRL
32+
GITR
33+
TCR
34+
TCR
35+
TCR
36+
MHC
37+
MHC
38+
MHC
39+
MHC-II
40+
LAG-3
41+
TIM-3
42+
Galectin_9
43+
TIGIT
44+
CD155
84 MB
Binary file not shown.

data/cnv_results_study.rda

77.5 MB
Binary file not shown.

data/cnv_results_tcga_subtype.rda

29.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)