Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ics template attempt #199

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/create_visc_project.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,4 @@ rstudio_visc_project <- function(path, ...) {
path = path
)
}

8 changes: 5 additions & 3 deletions R/template.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ use_bib <- function(study_name) {
#' }
use_visc_report <- function(report_name = "PT-Report",
path = ".",
report_type = c("empty", "generic", "bama", "nab")) {
report_type = c("empty", "generic", "bama",
"nab", "ics")) {

stopifnot(report_type %in% c("empty", "generic", "bama", "nab"))
stopifnot(report_type %in% c("empty", "generic", "bama", "nab", "ics"))

if (report_type == "empty") {
rmarkdown::draft(
Expand Down Expand Up @@ -187,7 +188,8 @@ challenge_visc_report <- function(report_name) {
#' \dontrun{
#' use_visc_methods(path = "bama/BAMA-PT-Report", assay = "bama")
#' }
use_visc_methods <- function(path = ".", assay = c("generic", "bama", "nab")) {
use_visc_methods <- function(path = ".", assay = c("generic", "bama",
"nab", "ics")) {

pkg_ver <- utils::packageVersion("VISCtemplates")

Expand Down
13 changes: 13 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,16 @@ The R package structure is used for analysis projects because it provides an eas
1. Ben Marwick, Carl Boettiger, and Lincoln Mullen. Paper: [Packaging data analytical work reproducibily using R (and friends)](https://peerj.com/preprints/3192/)
2. Karthik Ram. Rstudio::conf 2019 talk: [How To Make Your Data Analysis Notebooks More Reproducible](https://github.com/karthik/rstudio2019)
3. rOpenSci Community Call: [Reproducible Research with R](https://ropensci.org/commcalls/2019-07-30/)

## Notes on how to create a new template

* To make new template, in R folder call template_R and function use_visc_report, so then add new report type. Function creates rmd and looks for methods files. Same thing for use_visc_methods. Saves stat methods, lab methods, biological endpoints files.

* Add template language in inst/templates. Create methods-ics and make the 3 methods rmds (copy bama into new folder called methods-ics) and this is new template.

* Modify each rmd to include template language. Html comments are not printed. Look at comments to try to follow the style and organization. E.g., enter information by [], helpful comments in html comments.

* Made line breaks so the line doesn't go off the screen, has some guidance as to how and why. Every sentence gets a new line, and if it's more than 80 char width you break it down further. Make breaks where there are commas or where sentence broken in natural way.

* Package maintainer guidelines describes creating a release.
Workflow is based on Gitflow. Main branch always has reviewed and current release of package. Create devel branch, which is working branch for package. Anytime you want a new feature, you branch off devel and then merge into devel. This helps manage multiple development features. Once devel is ready for next release, then release branch gets created from devel and last minute changes or changes happen on release branch. Once that's finished, release branch gets merged to main branch and then back to devel. Release branch - write news.md, test everything, update vignettes or README
19 changes: 19 additions & 0 deletions inst/templates/methods-ics/ics-biological-endpoints.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "{{ study_name}} Biological Endpoints"
output: github_document
---

<!-- This file was adapted from VISCtemplates {{pkg_ver}}. -->

Response rate and the magnitude of HIV-specific $\mathrm{CD4}^+$ and $\mathrm{CD8}^+$ T-cell responses as measured by the Intracellular Cytokine Staining (ICS) assay for $\mathrm{IFN-}\gamma$, IL-2, IL-4, IL-5, IL-13, IL-17A, and IL-21 markers. Values are reported as the frequency of memory $\mathrm{CD4}^+$ and $\mathrm{CD8}^+$ T cells; whereas peripheral T-follicular helper cell (pTfh) responses are reported as the frequency of central memory $\mathrm{CD4}^+$ $\mathrm{CXCR5}^+$ T cells that produce IL-21.
Any Th1 cytokine is defined as IFN-$\gamma$ or IL-2 and any Th2 cytokine is defined as IL-4, IL-5, or IL-13.

<Celia, a note that in some reports we have a section called statistical endpoints, which contains “definition of a positive response” and “response magnitude” sections below. My first thought is to incorporate response magnitude language into the biological endpoints section somehow, and put the definition of a positive response in stat methods. Would be interested in your thoughts here.

## Definition of a Positive Response

The MIMOSA (Mixture Models for Single-Cell Assays) (@MIMOSA2014) model incorporates cell count and cell proportion information to define a positive response by ICS by comparing peptides stimulated cells and unstimulated negative controls. This method assumes a common distribution for cytokine positive cells in stimulated and unstimulated samples in non-responders, resulting in paired differences that are zero on average. In contrast, for responders, the distribution of the proportion of cytokine positive cells for stimulated samples is assumed to be greater than for unstimulated samples, resulting in paired differences that are greater than zero on average. The MIMOSA method models this structure through a Bayesian hierarchical mixture model framework. One component (or distribution) of the model represents the responders, and the other component models the non-responders. The parameters defining these distributions, as well as the probabilities that each ICS response is either a responder or non-responder, are estimated from the observed data. This sharing of information across vaccine responders and non-responders increases the sensitivity and specificity to make positivity calls. Once the probabilities of peptide-stimulated responses being responders are estimated from MIMOSA models, a false-discovery rate multiplicity adjustment procedure is applied (@Newton2004). Responses with false-discovery rate q-values < 0.01 are considered positive.

## Response Magnitude

Background-adjusted percent positive T cells for each cytokine across peptide pools was compared. The percent positive measurement was background adjusted by subtracting the percent positive cells from the negative controls.
14 changes: 14 additions & 0 deletions inst/templates/methods-ics/ics-lab-methods.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: "{{ study_name}} Lab Methods"
output: github_document
---

<!-- This file was adapted from VISCtemplates {{pkg_ver}}. -->

<!-- These lab methods are for VRC-specific studies -->

HIV-specific $\mathrm{CD4}^+$ and $\mathrm{CD8}^+$ T-cell responses were examined using ICS and flow cytometry. Cryopreserved PBMCs were stimulated with <INSERT PEPTIDE POOLS>.

Cytokine markers were measured in three T-cell subsets (total memory $\mathrm{CD4}^+$, total memory $\mathrm{CD8}^+$, and central memory $\mathrm{CD4}^+$ $\mathrm{CXCR5}^+$) (see Figure \ref{subsets}). Seven cytokines ($\mathrm{IFN-}\gamma$, IL-2, IL-4, IL-5, IL-13, IL-17A, and IL-21) were measured in memory $\mathrm{CD4}^+$ T cells. $\mathrm{IFN-}\gamma$ and IL-2 were measured in memory $\mathrm{CD8}^+$ T cells and IL-21 was measured in central memory $\mathrm{CXCR5}^+$ T cells (a subset of $\mathrm{CD4}^+$ T cells). As a negative control, the mock was DMSO and costimulatory antibodies (anti-CD28 and anti-CD49d). In general, samples were excluded from analysis if the cell viability was less than 35% or if the total events acquired was less than 35,000.

<!-- INSERT figure for ICS cell subsets and cytokine markers - Need reference for where to find this figure -->
26 changes: 26 additions & 0 deletions inst/templates/methods-ics/ics-statistical-methods.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "Statistical Methods"
output: github_document
---

<!-- This file was adapted from VISCtemplates {{pkg_ver}}. -->

## Statistical Endpoints

## Polyfunctionality analysis

Combinatorial Polyfunctionality Analysis of Single Cells (COMPASS) software has been used to analyze functional response. COMPASS is a statistical framework that enables unbiased analysis of antigen-specific T-cell subsets. COMPASS uses a Bayesian hierarchical framework to estimate posterior probabilities of T-cell response for each cytokine combination for each T-cell subset, time point, and antigen. Heatmaps are plotted of COMPASS posterior probabilities for $\mathrm{CD4}^+$ memory T cells stimulated with gp120 and gp41 peptide pools. Columns correspond to the different cell subsets modeled by COMPASS (shown are the subsets with detectable antigen-specific responses that had over five cells in more than two animals), color-coded by the markers they express (white = "off", shaded = "on", grouped by color = "degree of functionality"), and ordered by degree of functionality from one function on the left to five functions on the right (blue to green to pink). Subsets with maximum posterior probabilities <0.005 were removed from the heatmap. Rows correspond to animals, which are ordered by their treatment, and by functionality score (FS) within each group. Each cell of the heatmap shows the probability that the corresponding cell-subset (column) exhibits an antigen-specific response in the corresponding animal (row), where the probability is color-coded from white (zero) to purple (one).

COMPASS also defines two scores that summarize an antigen-specific polyfunctional profile. The functionality score (FS) is defined as the proportion of antigen-specific subsets detected among all possible ones. The polyfunctionality score (PFS) is similar, but it weighs the different subsets by their degree of functionality, naturally favoring subsets with higher degrees of functionality, motivated by the observations that a higher-degree function has been correlated with good outcomes in certain vaccine studies (@COMPASS2014).

## Statistical Tests

To assess if two groups have different response rates, group comparisons (as outlined in Section \ref{primary-objectives}) were conducted using Fisher's exact test for each peptide pool, T-cell subset and cytokine at each time point.
Using the Wilcoxon rank-sum test, objective-based group comparisons of response magnitude (background-adjusted percent positive T cells) were performed for responders only for each peptide pool, T-cell subset and cytokine at each time point. Tests were performed if there are at least 3 responders in each group.
Using the Wilcoxon rank-sum test, objective-based group comparisons of functionality and polyfunctionality scores were performed for the complete group of 7 cytokine markers.
Spearman correlations between response magnitude (background-adjusted percent positive T cells, functionality score, and polyfunctionality score) and subsequent number of challenges received were calculated for each population, time point, and group. Spearman correlation testing was only done within groups with at least 3 positive responders. Spearman test significance was determined using an approximate method by a conditional Monte Carlo procedure with 10,000 resamples when there were ties (@hothorn_hornik_wiel_zeileis_2008) and an exact method otherwise.

## Graphical Analysis

Response rates were plotted with 95% Wilson score confidence intervals for each experimental group, time point and antigen. Accompanying tables of response rates with sample sizes and confidence intervals are also provided.
Distributions of background-adjusted percent positive T cells were plotted for each experimental group, time point, T-cell subset, peptide pool and cytokine with box plots superimposed on the distribution of responders. The mid-line of the box denotes the median and the ends of the box denote the $25^{th}$ and $75^{th}$ percentiles. The whiskers denote the most extreme data points that are no more than 1.5 times the interquartile range (i.e., height of the box). Accompanying tables of the descriptive statistics are also provided.