diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bad5a1b1..0ad069ef 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,8 @@ - [Files stored on S3](#files-stored-on-s3) - [Development with `renv`](#development-with-renv) - [Typical development workflow](#typical-development-workflow) + - [Steps for creating renv.lock only changes pull requests](#steps-for-creating-renvlock-only-changes-pull-requests) + - [Multiple renv.lock changes from multiple branches](#multiple-renvlock-changes-from-multiple-branches) - [How we use `renv` with Docker](#how-we-use-renv-with-docker) - [Docker Image](#docker-image) - [Developing within the Docker container](#developing-within-the-docker-container) @@ -26,6 +28,7 @@ - [Spell check](#spell-check) - [Rendering Test](#rendering-test) - [Generation of live notebooks and rendering](#generation-of-live-notebooks-and-rendering) +- [Cheatsheets](#cheatsheets) @@ -237,3 +240,16 @@ This action first downloads input files for the notebooks from S3, so if there a After a pull request with changes to notebook files has been merged to master, we use the `make-live.yml` workflow to render current versions of the notebooks to html and to make the `-live.Rmd` versions of the files for training sessions. This workflow then files a PR to `master` with the rendered and live files. `make-live.yml` is currently manually triggered, but will likely change to running automatically on each PR with changes to notebook files in the near future. + + +## Cheatsheets + +Training modules have corresponding cheatsheets in `module-cheatsheets`. +Cheatsheets are written in plain markdown and can be converted to a shareable PDF format interactively as follows: + ++ Be on a MacOS computer ++ Install and/or open the [MacDown program](https://macdown.uranusjr.com/) ++ Open the markdown cheatsheet in MacDown, and go to `File` -> `Export` -> `PDF` ++ Save appropriately and voila! + +When choosing documentation links to incorporate in cheatsheets, we prefer to use [`https://rdrr.io/`](https://rdrr.io/) when possible for Base R and Bioconductor, and we prefer to use [`https://www.tidyverse.org/`](https://www.tidyverse.org/) for `tidyverse` functions. \ No newline at end of file diff --git a/components/dictionary.txt b/components/dictionary.txt index e6dde2c3..636dc454 100644 --- a/components/dictionary.txt +++ b/components/dictionary.txt @@ -184,6 +184,8 @@ lv LV LVs lysis +MacDown +MacOS macrophage Malhotra McInnes diff --git a/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.md b/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.md index 0ae94dde..5a1bc42d 100644 --- a/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.md +++ b/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.md @@ -4,101 +4,108 @@ ##### Each table represents a different library/tool and the corresponding commands. > Please note that these tables are not intended to tell you all the information you need to know about each command. > -> The hyperlinks found in each piece of code will take you to the documentation for further information on the usage of each command. +> The hyperlinks found in each piece of code will take you to the documentation for further information on the usage of each command. +Please be aware that the documentation will generally provide information about the given function's most current version (or a recent version, depending on how often the documentation site is updated). +This will usually (but not always!) match what you have installed on your machine. +If you have a different version of R or other R packages, the documentation may differ from what you have installed.
### Base `R` -Read the Base `R` documentation [**here**](https://www.rdocumentation.org/packages/base/versions/3.6.2). +Read the Base `R` documentation [**here**](https://rdrr.io/r/). | Library/Package | Piece of code | What it's called | What it does | |------------------------------------|----------------------|---------------------------------|---------------------------------------------------------------------------------------------------------------------------------| -| Base `R` | [`library()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/library) | Library | Loads and attaches additional packages to the R environment. | -| Base `R` | [`<-`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/assignOps.html) | Assignment operator | Assigns a name to something in the R environment. | -| Base `R` | [`c()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/c) | Combine | Combines values into a vector or list. | -| Base `R` | [`%in%`](http://www.datasciencemadesimple.com/in-operator-in-r/) | "in" logical operator | Checks if the given value(s) on the left side of the operator are in the vector or other R object defined on the right side of the operator. It returns a logical `TRUE` or `FALSE` statement. | -| Base `R` | [`rm(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/remove) | Remove | Removes object(s) `x` from your environment. | -| Base `R` | [`==, <=, >=, !=`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/Comparison.html) | Relational Operators | These are binary operators which allow for the comparison of values in an object. | -| Base `R` | [`str(x)`](https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/str) | Object Structure | Gets a summary of the object `x` structure. | -| Base `R` | [`class(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/class) | Object Class | Returns the type of the values in object `x`. | -| Base `R` | [`nrow(x)`; `ncol(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/nrow) | Number of Rows; Number of Columns | Get the number of rows and the number of columns in an object `x`, respectively. | -| Base `R` | [`length(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/length) | Number of Rows | Returns how long the object `x` is. | -| Base `R` | [`min(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Extremes) | Minimum | Returns the minimum value of all values in an object `x`. | -| Base `R` | [`sum(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/sum) | Sum | Returns the sum of all values (values must be integer, numeric, or logical) in object `x`. | -| Base `R` | [`mean(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/mean) | Mean | Returns the arithmetic mean of all values (values must be integer or numeric) in object `x` or logical vector `x`. | -| Base `R` | [`log(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/log) | Logarithm | Gives the natural logarithm of object `x`. `log2(x)` can be used to give the logarithm of the object in base 2. Or the base can be specified as an argument. | -| Base `R` | [`head()`](https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/head) | Head | Returns the top 6 rows of an object in the environment by default. You can specify how many rows you want by including the `n = `argument. | -| Base `R` | [`tail()`](https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/head) | Tail | Returns the bottom 6 rows of an object in the environment by default. You can specify how many rows you want by including the `n =` argument. | -| Base `R` | [`factor(x)` or `as.factor(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/factor) | Factor | Coerces object x into a factor (which is used to represent categorical data). This function can be used to coerce object `x` into other data types, i.e., `as.character`, `as.numeric`, `as.data.frame`, `as.matrix`, etc. | -| Base `R` | [`levels(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/levels) | Levels attributes | Returns or sets the value of the levels in an object `x`. | -| Base `R` | [`summary(x)`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/summary) | Object summary | Returns a summary of the values in object `x`. | -| Base `R` | [`data.frame()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/data.frame) | Data Frame | Creates a data frame where the named arguments will be the same length. | -| Base `R` | [`sessionInfo()`](https://www.rdocumentation.org/packages/utils/versions/3.6.2/topics/sessionInfo) | Session Information | Returns the R version information, the OS, and the attached packages in the current R session. | -| Base `R` | [`file.path()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/file.path) | File path | Constructs the path to a desired file. | -| Base `R` | [`dir()`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/list.files.html) | Directory | Lists the names of the files and/or directories in the named directory. | -| Base `R` | [`getwd()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/getwd) | Get working directory | Finds the current working directory. | -| Base `R` | [`setwd()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/getwd) | Set working directory | Changes the current working directory. | -| Base `R` | [`dir.exists()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/files2) | Directory exists | Checks the file path to see if the directory exists there. | -| Base `R` | [`dir.create()`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/files2.html) | Create directory | Creates a directory at the specified file path. | -| Base `R` | [`apply()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/apply) | Apply | Returns a vector or list of values after applying a specified function to values in each row/column of an object. | -| Base `R` | [`round()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/Round) | Round | Rounds the values of an object to the specified number of decimal places (default is 0). | -| Base `R` | [`names()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/names) | Names | Gets or sets the names of an object. | -| Base `R` | [`colnames()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/row%2Bcolnames) | Column names | Gets or sets the column names of a matrix or data frame. | -| Base `R` | [`all.equal()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/all.equal) | All equal | Checks if two R objects are nearly equal. | -| Base `R` | [`all()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/all) | All | Checks if all of the values are `TRUE` in a logical vector. | -| Base `R` | [`t()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/t) | Transpose | Returns the transpose of a matrix or data frame. If given a data frame, returns a matrix. | +| Base `R` | [`library()`](https://rdrr.io/r/base/library.html) | Library | Loads and attaches additional packages to the R environment. | +| Base `R` | [`<-`](https://rdrr.io/r/base/assignOps.html) | Assignment operator | Assigns a name to something in the R environment. | +| Base `R` | [`c()`](https://rdrr.io/r/base/c.html) | Combine | Combines values into a vector or list. | +| Base `R` | [`%in%`](https://rdrr.io/r/base/match.html) | "in" logical operator | Checks if the given value(s) on the left side of the operator are in the vector or other R object defined on the right side of the operator. It returns a logical `TRUE` or `FALSE` statement. [This resource](http://www.datasciencemadesimple.com/in-operator-in-r/) also provides a helpful explanation about its usage. | +| Base `R` | [`rm(x)`](https://rdrr.io/r/base/rm.html) | Remove | Removes object(s) `x` from your environment. | +| Base `R` | [`==, <=, >=, !=`](https://rdrr.io/r/base/Comparison.html) | Relational Operators | These are binary operators which allow for the comparison of values in an object. | +| Base `R` | [`str(x)`](https://rdrr.io/r/utils/str.html) | Object Structure | Gets a summary of the object `x` structure. | +| Base `R` | [`class(x)`](https://rdrr.io/r/base/class.html) | Object Class | Returns the type of the values in object `x`. | +| Base `R` | [`nrow(x)`; `ncol(x)`](https://rdrr.io/r/base/nrow.html) | Number of Rows; Number of Columns | Get the number of rows and the number of columns in an object `x`, respectively. | +| Base `R` | [`length(x)`](https://rdrr.io/r/base/length.html) | Length | Returns how long the object `x` is. | +| Base `R` | [`min(x)`](https://rdrr.io/r/base/Extremes.html) | Minimum | Returns the minimum value of all values in an object `x`. | +| Base `R` | [`sum(x)`](https://rdrr.io/r/base/sum.html) | Sum | Returns the sum of all values (values must be integer, numeric, or logical) in object `x`. | +| Base `R` | [`mean(x)`](https://rdrr.io/r/base/mean.html) | Mean | Returns the arithmetic mean of all values (values must be integer or numeric) in object `x` or logical vector `x`. | +| Base `R` | [`log(x)`](https://rdrr.io/r/base/Log.html) | Logarithm | Gives the natural logarithm of object `x`. `log2(x)` can be used to give the logarithm of the object in base 2. Or the base can be specified as an argument. | +| Base `R` | [`head()`](https://rdrr.io/r/utils/head.html) | Head | Returns the top 6 rows of an object in the environment by default. You can specify how many rows you want by including the `n = `argument. | +| Base `R` | [`tail()`](https://rdrr.io/r/utils/head.html) | Tail | Returns the bottom 6 rows of an object in the environment by default. You can specify how many rows you want by including the `n =` argument. | +| Base `R` | [`factor(x)` or `as.factor(x)`](https://rdrr.io/r/base/factor.html) | Factor | Coerces object x into a factor (which is used to represent categorical data). This function can be used to coerce object `x` into other data types, i.e., `as.character`, `as.numeric`, `as.data.frame`, `as.matrix`, etc. | +| Base `R` | [`levels(x)`](https://rdrr.io/r/base/levels.html) | Levels attributes | Returns or sets the value of the levels in an object `x`. | +| Base `R` | [`summary(x)`](https://rdrr.io/r/base/summary.html) | Object summary | Returns a summary of the values in object `x`. | +| Base `R` | [`data.frame()`](https://rdrr.io/r/base/data.frame.html) | Data Frame | Creates a data frame where the named arguments will be the same length. | +| Base `R` | [`sessionInfo()`](https://rdrr.io/r/utils/sessionInfo.html) | Session Information | Returns the R version information, the OS, and the attached packages in the current R session. | +| Base `R` | [`file.path()`](https://rdrr.io/r/base/file.path.html) | File path | Constructs the path to a desired file. | +| Base `R` | [`dir()`](https://rdrr.io/r/base/list.files.html) | Directory | Lists the names of the files and/or directories in the named directory. | +| Base `R` | [`getwd()`](https://rdrr.io/r/base/getwd.html) | Get working directory | Finds the current working directory. | +| Base `R` | [`setwd()`](https://rdrr.io/r/base/getwd.html) | Set working directory | Changes the current working directory. | +| Base `R` | [`dir.exists()`](https://rdrr.io/r/base/files2.html) | Directory exists | Checks the file path to see if the directory exists there. | +| Base `R` | [`dir.create()`](https://rdrr.io/r/base/files2.html) | Create directory | Creates a directory at the specified file path. | +| Base `R` | [`apply()`](https://rdrr.io/r/base/apply.html) | Apply | Returns a vector or list of values after applying a specified function to values in each row/column of an object. | +| Base `R` | [`round()`](https://rdrr.io/r/base/Round.html) | Round | Rounds the values of an object to the specified number of decimal places (default is 0). | +| Base `R` | [`names()`](https://rdrr.io/r/base/names.html) | Names | Gets or sets the names of an object. | +| Base `R` | [`colnames()`](https://rdrr.io/r/base/colnames.html) | Column names | Gets or sets the column names of a matrix or data frame. | +| Base `R` | [`all.equal()`](https://rdrr.io/r/base/all.equal.html) | All equal | Checks if two R objects are nearly equal. | +| Base `R` | [`all()`](https://rdrr.io/r/base/all.html) | All | Checks if all of the values are `TRUE` in a logical vector. | +| Base `R` | [`t()`](https://rdrr.io/r/base/t.html) | Transpose | Returns the transpose of a matrix or data frame. If given a data frame, returns a matrix. |
### `tidyverse` -Read the `tidyverse` package documentation [**here**](https://www.rdocumentation.org/packages/tidyverse/versions/1.3.0). +Read the `tidyverse` package documentation [**here**](https://tidyverse.tidyverse.org/).
+Read the philosophy behind the `tidyverse` [**here**](https://tidyverse.tidyverse.org/articles/manifesto.html). #### `dplyr` -Read the `dplyr` package documentation [**here**](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8).
-A vignette on the usage of the `dplyr` package can be found [**here**](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/vignettes/dplyr.Rmd). +Read the `dplyr` package documentation [**here**](https://dplyr.tidyverse.org/).
+A vignette on the usage of the `dplyr` package can be found [**here**](https://dplyr.tidyverse.org/articles/dplyr.html). | Library/Package | Piece of code | What it's called | What it does | |-------------------------------------------------|--------------------------------------|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `dplyr` | [`%>%`](https://www.rdocumentation.org/packages/magrittr/versions/1.5/topics/%25%26gt%3B%25) | Pipe operator | Funnels a data.frame through tidyverse operations | -| `dplyr` | [`filter()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/filter) | Filter | Returns a subset of rows matching the conditions of the specified logical argument | -| `dplyr` | [`arrange()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/arrange) | Arrange | Reorders rows in ascending order. `arrange(desc())` would reorder rows in descending order. | -| `dplyr` | [`select()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/select) | Select | Selects columns that match the specified argument | -| `dplyr` | [`mutate()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/mutate) | Mutate | Adds a new column that is a function of existing columns | -| `dplyr` | [`summarize()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/summarize) | Summarize | Summarizes multiple values in an object into a single value. This function can be used with other functions to retrieve a single output value for the grouped values. `summarize` and `summarise` are synonyms in this package. However, note that this function does not work in the same manner as the base R `summary` function. | -| `dplyr` | [`rename()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/select) | Rename | Renames designated columns while keeping all variables of the data.frame | -| `dplyr` | [`group_by()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/group_by) | Group By | Groups data into rows that contain the same specified value(s) | -| `dplyr` | [`inner_join()`](https://www.rdocumentation.org/packages/dplyr/versions/0.7.8/topics/join) | Inner Join | Joins data from two data frames, retaining only the rows that are in both datasets. | +| `dplyr` | [`%>%`](https://rdrr.io/cran/magrittr/man/pipe.html) | Pipe operator | Funnels a data.frame through tidyverse operations | +| `dplyr` | [`filter()`](https://dplyr.tidyverse.org/reference/filter.html) | Filter | Returns a subset of rows matching the conditions of the specified logical argument | +| `dplyr` | [`arrange()`](https://dplyr.tidyverse.org/reference/arrange.html) | Arrange | Reorders rows in ascending order. `arrange(desc())` would reorder rows in descending order. | +| `dplyr` | [`select()`](https://dplyr.tidyverse.org/reference/select.html) | Select | Selects columns that match the specified argument | +| `dplyr` | [`mutate()`](https://dplyr.tidyverse.org/reference/mutate.html) | Mutate | Adds a new column that is a function of existing columns | +| `dplyr` | [`summarize()`](https://dplyr.tidyverse.org/reference/summarise.html) | Summarize | Summarizes multiple values in an object into a single value. This function can be used with other functions to retrieve a single output value for the grouped values. `summarize` and `summarise` are synonyms in this package. However, note that this function does not work in the same manner as the base R `summary` function. | +| `dplyr` | [`rename()`](https://dplyr.tidyverse.org/reference/rename.html) | Rename | Renames designated columns while keeping all variables of the data.frame | +| `dplyr` | [`group_by()`](https://dplyr.tidyverse.org/reference/group_by.html) | Group By | Groups data into rows that contain the same specified value(s) | +| `dplyr` | [`inner_join()`](https://dplyr.tidyverse.org/reference/mutate-joins.html) | Inner Join | Joins data from two data frames, retaining only the rows that are in both datasets. |
#### `ggplot2` -Read the `ggplot2` package documentation [**here**](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0).
-A vignette on the usage of the `ggplot2` package can be found [**here**](https://cran.r-project.org/web/packages/ggplot2/vignettes/ggplot2-specs.html). +Read the `ggplot2` package documentation [**here**](https://ggplot2.tidyverse.org/), as well as an overall reference for `ggplot2` functions [**here**](https://ggplot2.tidyverse.org/reference/index.html).
+A vignette on the usage of the `ggplot2` aesthetics can be found [**here**](https://ggplot2.tidyverse.org/articles/ggplot2-specs.html). +Additional vignettes are available from the "Articles" dropdown menu on this webpage. | Library/Package | Piece of code | What it's called | What it does | |--------------------------------------|-----------------------------------------------------|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------| -| `ggplot2` | [`ggplot()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/ggplot) | GG Plot | Begins a plot that is finished by adding layers. | -| `ggplot2` | [`aes()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/aes) | Aesthetic Mappings | Designates how variables in the data object are mapped to the visual properties of the ggplot. | -| `ggplot2` | [`geom_boxplot()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/geom_boxplot) | Boxplot | Creates a boxplot when added as a layer to a `ggplot()` object. | -| `ggplot2` | [`geom_density()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/geom_density) | Density Plot | Creates a smoothed plot when added as a layer to a `ggplot()` object based on the computed density estimate. | -| `ggplot2` | [`geom_point()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/geom_point) | Scatterplot | Creates a scatterplot when added as a layer to a `ggplot()` object. | -| `ggplot2` | [`geom_line()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/geom_path) | Line plot | Creates a line plot when added as a layer to a `ggplot()` object by connecting the points in order of the x axis variable. | -| `ggplot2` | [`geom_hline()`](https://www.rdocumentation.org/packages/ggplot2/versions/0.9.0/topics/geom_hline) | Horizontal line | Annotates a plot with horizontal lines when added as a layer to a `ggplot()` object with one of the `geom` functions used to draw the plot, for example, `geom_point()`. | -| `ggplot2` | [`theme_classic()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/ggtheme) | Classic Theme | Displays `ggplot` without gridlines. The [`ggtheme` documentation](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/ggtheme) has descriptions on additional themes that can be used. | -| `ggplot2` | [`xlab()`; `ylab()`; `ggtitle()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/labs) | X Axis Labels; Y Axis Labels; GG Title | Modifies the labels on the x axis and on the y axis, and sets the title of a `ggplot`, respectively. | -| `ggplot2` | [`facet_wrap()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/facet_wrap) | Facet Wrap | Plots individual graphs using specified variables to subset the data. | -| `ggplot2` | [`ggsave()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/ggsave) | GG Save | Saves the last plot in working directory. | -| `ggplot2` | [`last_plot()`](https://www.rdocumentation.org/packages/ggplot2/versions/3.3.0/topics/last_plot) | Last plot | Returns the last plot produced. | +| `ggplot2` | [`ggplot()`](https://ggplot2.tidyverse.org/reference/ggplot.html) | GG Plot | Begins a plot that is finished by adding layers. | +| `ggplot2` | [`aes()`](https://ggplot2.tidyverse.org/reference/aes.html) | Aesthetic Mappings | Designates how variables in the data object are mapped to the visual properties of the ggplot. | +| `ggplot2` | [`geom_boxplot()`](https://ggplot2.tidyverse.org/reference/geom_boxplot.html) | Boxplot | Creates a boxplot when added as a layer to a `ggplot()` object. | +| `ggplot2` | [`geom_density()`](https://ggplot2.tidyverse.org/reference/geom_density.html) | Density Plot | Creates a smoothed plot when added as a layer to a `ggplot()` object based on the computed density estimate. | +| `ggplot2` | [`geom_point()`](https://ggplot2.tidyverse.org/reference/geom_point.html) | Scatterplot | Creates a scatterplot when added as a layer to a `ggplot()` object. | +| `ggplot2` | [`geom_line()`](https://ggplot2.tidyverse.org/reference/geom_path.html) | Line plot | Creates a line plot when added as a layer to a `ggplot()` object by connecting the points in order of the x axis variable. | +| `ggplot2` | [`geom_hline()`](https://ggplot2.tidyverse.org/reference/geom_abline.html) | Horizontal line | Annotates a plot with a horizontal line when added as a layer to a `ggplot()` object +| `ggplot2` | [`geom_vline()`](https://ggplot2.tidyverse.org/reference/geom_abline.html) | Vertical line | Annotates a plot with a vertical line when added as a layer to a `ggplot()` object +| `ggplot2` | [`theme_classic()`](https://ggplot2.tidyverse.org/reference/ggtheme.html) | Classic Theme | Displays `ggplot` without gridlines. The [`ggtheme` documentation](https://ggplot2.tidyverse.org/reference/ggtheme.html) has descriptions on additional themes that can be used. | +| `ggplot2` | [`labs()`](https://ggplot2.tidyverse.org/reference/labs.html) | Labels | Modify labels (axis, title, legends) on a `ggplot()` object. | +| `ggplot2` | [`xlab()`; `ylab()`; `ggtitle()`](https://ggplot2.tidyverse.org/reference/labs.html) |X Axis Labels; Y Axis Labels; GG Title | Alternative individual functions to add individual plot labels: x-axis, y-axis, and title, respectively.| +| `ggplot2` | [`facet_wrap()`](https://ggplot2.tidyverse.org/reference/facet_wrap.html) | Facet Wrap | Plots individual graphs using specified variables to subset the data. | +| `ggplot2` | [`ggsave()`](https://ggplot2.tidyverse.org/reference/ggsave.html) | GG Save | Saves the last plot in working directory. | +| `ggplot2` | [`last_plot()`](https://ggplot2.tidyverse.org/reference/last_plot.html) | Last plot | Returns the last plot produced. | #### `readr`, `tibble` and `tidyr` -Read the `readr` package documentation [**here**](https://www.rdocumentation.org/packages/readr/versions/1.3.0) and the package vignette [**here**](https://www.rdocumentation.org/packages/readr/versions/1.3.0/vignettes/readr.Rmd).
-Read the `tibble` package documentation [**here**](https://www.rdocumentation.org/packages/tibble/versions/1.4.2) and the package vignette [**here**](https://www.rdocumentation.org/packages/tibble/versions/1.4.2/vignettes/tibble.Rmd). -Read the `tidyr` package documentation [**here**](https://www.rdocumentation.org/packages/tidyr/versions/1.4.2) and the package vignette [**here**](https://tidyr.tidyverse.org/). +Read the `readr` package documentation [**here**](https://readr.tidyverse.org/) and the package vignette [**here**](https://readr.tidyverse.org/articles/readr.html).
+Read the `tibble` package documentation [**here**](https://tibble.tidyverse.org/) and the package vignette [**here**](https://tibble.tidyverse.org/articles/tibble.html).
+Read the `tidyr` package documentation [**here**](https://tidyr.tidyverse.org/) and the package vignette [**here**](https://tidyr.tidyverse.org/articles/tidy-data.html). | Library/Package | Piece of code | What it's called | What it does | |--------------------------------------|-----------------------------------------------------|---------------------------|-----------------------------------------------------------------------------------------------------------------------------------| -| `readr` | [`read_tsv()`](https://www.rdocumentation.org/packages/readr/versions/1.3.0/topics/read_delim) | Read TSV | Reads in a TSV file from a specified file path. This function can be tailored to read in other common types of files. i.e. read_csv(), read_rds(), etc. | -| `tibble` | [`column_to_rownames()`](https://www.rdocumentation.org/packages/tibble/versions/1.4.2/topics/rownames) | Column to Rownames | Transforms an existing column called by a string into the rownames. | -| `tibble` | [`rownames_to_column()`](https://www.rdocumentation.org/packages/tibble/versions/1.4.2/topics/rownames) | Rownames to Column | Transforms the rownames of a data frame into a column (which is added to the start of the data frame). The string supplied as an argument will be the name of the new column. | +| `readr` | [`read_tsv()`](https://readr.tidyverse.org/reference/read_delim.html) | Read TSV | Reads in a TSV file from a specified file path. This function can be tailored to read in other common types of files, e.g. `read_csv()`, `read_rds()`, etc. | +| `tibble` | [`column_to_rownames()`](https://tibble.tidyverse.org/reference/rownames.html) | Column to Rownames | Transforms an existing column called by a string into the rownames. | +| `tibble` | [`rownames_to_column()`](https://tibble.tidyverse.org/reference/rownames.html) | Rownames to Column | Transforms the rownames of a data frame into a column (which is added to the start of the data frame). The string supplied as an argument will be the name of the new column. | | `tidyr` | [`pivot_longer()`](https://tidyr.tidyverse.org/reference/pivot_longer.html) | Pivot Longer | Lengthens a data frame by increasing the number of rows and decreasing the number of columns. | diff --git a/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.pdf b/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.pdf index 0eb71666..80e98766 100644 Binary files a/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.pdf and b/module-cheatsheets/intro-to-R-tidyverse-cheatsheet.pdf differ diff --git a/module-cheatsheets/scRNA-seq-cheatsheet.md b/module-cheatsheets/scRNA-seq-cheatsheet.md index cb9742a2..793f5cf4 100644 --- a/module-cheatsheets/scRNA-seq-cheatsheet.md +++ b/module-cheatsheets/scRNA-seq-cheatsheet.md @@ -5,55 +5,49 @@ > Please note that these tables are not intended to tell you all the information you need to know about each command. > > The hyperlinks found in each piece of code will take you to the documentation for further information on the usage of each command. +> Please be aware that the documentation will generally provide information about the given function's most current version (or a recent version, depending on how often the documentation site is updated). +This will usually (but not always!) match what you have installed on your machine. +If you have a different version of R or other R packages, the documentation may differ from what you have installed.
### Base `R` -Read the Base `R` documentation [**here**](https://www.rdocumentation.org/packages/base/versions/3.5.1). +Read the Base `R` documentation [**here**](https://rdrr.io/r/). |Library/Package|Piece of Code|What it's called| What it does| |---------------|-------------|----------------|-------------| -| Base `R`| [`rowSums()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/rowSums)| Row sums|Calculates sums for each row| -| Base `R`| [`colSums()`](https://www.rdocumentation.org/packages/base/versions/3.6.2/topics/colSums)| Column sums| Calculates sums for each column| -| Base `R`| [`t()`](https://www.rdocumentation.org/packages/base/versions/3.5.1/topics/t) |Transpose| Returns the transpose of a matrix or data frame| -| Base `R`| [`prcomp()`](https://www.rdocumentation.org/packages/stats/versions/3.5.1/topics/prcomp)| Principal Components Analysis|Executes a principal components analysis on specified matrix or data frame| -| Base `R`| [`<-function(x) { }`](http://adv-r.had.co.nz/Functions.html) | Function | Creates a function that would take the defined parameters as input and execute the commands within the curly braces | +| Base `R`| [`rowSums()`](https://rdrr.io/r/base/colSums.html)| Row sums|Calculates sums for each row| +| Base `R`| [`colSums()`](https://rdrr.io/r/base/colSums.html)| Column sums| Calculates sums for each column| +| Base `R`| [`t()`](https://rdrr.io/r/base/t.html) |Transpose| Returns the transpose of a matrix or data frame| +| Base `R`| [`prcomp()`](https://rdrr.io/r/stats/prcomp.html)| Principal Components Analysis|Executes a principal components analysis on specified matrix or data frame| +| Base `R`| [`<-function(x) { }`](https://adv-r.hadley.nz/functions.html) | Function | Creates a function that would take the defined parameters as input and execute the commands within the curly braces | -### `ggplot2` - -Read the `ggplot2` documentation [**here**](https://ggplot2.tidyverse.org/reference/). - -| Library/Package| Piece of Code| What it's called| What it does | -|----------------|--------------|-----------------|--------------| -| `ggplot2`| [`geom_vline()`](https://ggplot2.tidyverse.org/reference/geom_abline.html)| geom vertical line| Adds ggplot2 layer with a vertical line plotted | - ### `scran`, `scater`, `SingleCellExperiment` -Read the `scran` package documentation [**here**](https://www.rdocumentation.org/packages/scran/versions/1.10.2), and a vignette on its usage [**here**](https://bioconductor.org/packages/devel/bioc/vignettes/scran/inst/doc/scran.html). +Read the `scran` package documentation [**here**](https://rdrr.io/bioc/scran/), and a vignette on its usage [**here**](https://rdrr.io/bioc/scran/f/vignettes/scran.Rmd). -Read the `scater` package documentation [**here**](https://www.rdocumentation.org/packages/scater/versions/1.10.1), and a vignette on its usage [**here**](https://github.com/davismcc/scater/blob/master/vignettes/vignette-intro.Rmd). +Read the `scater` package documentation [**here**](https://rdrr.io/bioc/scater/), and a vignette on its usage [**here**](http://www.bioconductor.org/packages/release/bioc/vignettes/scater/inst/doc/overview.html). -Read the `SingleCellExperiment` package documentation [**here**](https://osca.bioconductor.org/), and a vignette on its usage [**here**](https://bioconductor.org/packages/devel/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html). +Read the `SingleCellExperiment` package documentation (and e-book) [**here**](https://bioconductor.org/books/release/OSCA/), and a vignette on its usage [**here**](https://rdrr.io/bioc/SingleCellExperiment/f/vignettes/intro.Rmd). -In addition to the links above, [Amezquita et al.](https://www.biorxiv.org/content/biorxiv/early/2019/03/27/590562.full.pdf) is a useful paper on the single-cell analysis workflow involving the `SingleCellExperiment` object.
| Library/Package | Piece of Code | What it's called | What it does | |----------------------|----------------------------|--------------------------------------------|--------------------------------------------------------------| -| `SingleCellExperiment` | [`SingleCellExperiment()`](https://bioconductor.org/packages/devel/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#2_creating_singlecellexperiment_instances) | Single Cell Experiment| Creates a `SingleCellExperiment` object | -| `SingleCellExperiment`| [`colData()`](https://bioconductor.org/packages/devel/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#5_extracting_coldata_and_rowdata) | Column Data | Extracts and stores cell-level metadata that describes features of the `SingleCellExperiment` object| -| `SingleCellExperiment`| [`rowData()`](https://bioconductor.org/packages/devel/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#5_extracting_coldata_and_rowdata) | Row Data | Extracts and stores gene-level metadata that describes features of the `SingleCellExperiment` object| -| `SingleCellExperiment`| [`logcounts()`](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html)| Log counts| Stores or extracts log-transformed single-cell experiment count data as an assay of the `SingleCellExperiment` object| -| `SingleCellExperiment`| [`counts()`](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html)| Counts| Stores or extracts raw single-cell experiment count data as an assay of the `SingleCellExperiment` object| -| `scran` | [`quickCluster()`](https://www.rdocumentation.org/packages/scran/versions/1.0.3/topics/Quick%20clustering) | Quick Clustering | Groups similar cells into clusters which are stored in the `SingleCellExperiment` object and are used for the calculation of size factors by `scran::computeSumFactors`| -| `scran` | [`computeSumFactors()`](https://www.rdocumentation.org/packages/scran/versions/1.0.3/topics/Deconvolution%20Methods) | Compute Sum Factors| Returns a numeric vector of computed sum factors for each cell cluster stored in the `SingleCellExperiment` object. The cluster-based size factors are deconvolved into cell-based size factors that are stored in the `SingleCellExperiment` object and used by the `scran::normalize` function for the normalization of each cell's gene expression profile| -| `scater`| [`normalize()`](https://www.rdocumentation.org/packages/scater/versions/1.0.4/topics/normalize)| Normalize | Returns the `SingleCellExperiment` object with normalized expression values for each cell, using the size factors stored in the object | +| `SingleCellExperiment` | [`SingleCellExperiment()`](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html) | Single Cell Experiment| Creates a `SingleCellExperiment` object | +| `SingleCellExperiment`| [`colData()`](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#2_Creating_SingleCellExperiment_instances) | Column Data | Extracts and stores cell-level metadata that describes features of the `SingleCellExperiment` object| +| `SingleCellExperiment`| [`rowData()`](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#2_Creating_SingleCellExperiment_instances) | Row Data | Extracts and stores gene-level metadata that describes features of the `SingleCellExperiment` object| +| `SingleCellExperiment`| [`logcounts()`](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#3_Adding_low-dimensional_representations)| Log counts| Stores or extracts log-transformed single-cell experiment count data as an assay of the `SingleCellExperiment` object| +| `SingleCellExperiment`| [`counts()`](https://bioconductor.org/packages/release/bioc/vignettes/SingleCellExperiment/inst/doc/intro.html#4_Convenient_access_to_named_assays)| Counts| Stores or extracts raw single-cell experiment count data as an assay of the `SingleCellExperiment` object| +| `scran` | [`quickCluster()`](https://rdrr.io/bioc/scran/man/quickCluster.html) | Quick Clustering | Groups similar cells into clusters which are stored in the `SingleCellExperiment` object and are used for the calculation of size factors by `scran::computeSumFactors`| +| `scran` | [`computeSumFactors()`](https://rdrr.io/bioc/scran/man/computeSumFactors.html) | Compute Sum Factors| Returns a numeric vector of computed sum factors for each cell cluster stored in the `SingleCellExperiment` object. The cluster-based size factors are deconvolved into cell-based size factors that are stored in the `SingleCellExperiment` object and used by the `scran::normalize` function for the normalization of each cell's gene expression profile| | `scran`| [`getTopHVGs()`](https://rdrr.io/bioc/scran/man/getTopHVGs.html)| Get top highly variable genes | Identify variable genes in a `SingleCellExperiment` object, based on variance | -| `scran`| [`modelGeneVar()`](https://rdrr.io/github/MarioniLab/scran/man/modelGeneVar.html)| model per gene variance | Model the per gene variance of a `SingleCellExperiment` object | +| `scran`| [`modelGeneVar()`](https://rdrr.io/bioc/scran/man/modelGeneVar.html)| model per gene variance | Model the per gene variance of a `SingleCellExperiment` object | | `scran`| [`findMarkers()`](https://rdrr.io/bioc/scran/man/findMarkers.html)| Find marker genes | Find candidate marker genes for clusters of cells | -| `scater`| [`addPerCellQC()`](https://rdrr.io/bioc/scater/man/addPerCellQC.html)| Add per cell quality control | For a `SingleCellExperiment` object, calculate and add quality control per cell and store in `colData` | +| `scater`| [`logNormCounts()`](https://rdrr.io/bioc/scuttle/man/logNormCounts.html) | Normalize log counts| Returns the `SingleCellExperiment` object with normalized expression values for each cell, using the size factors stored in the object +| `scater`| [`addPerCellQC()`](https://rdrr.io/bioc/scuttle/man/addPerCellQC.html)| Add per cell quality control | For a `SingleCellExperiment` object, calculate and add quality control per cell and store in `colData` | | `scater`| [`addPerFeatureQC()`](https://rdrr.io/bioc/scater/man/addPerCellQC.html)| Add per feature quality control | For a `SingleCellExperiment` object, calculate and add quality control per feature (genes usually) and store in `rowData`| | `scater`| [`calculatePCA()`](https://bioconductor.org/packages/devel/bioc/manuals/scater/man/scater.pdf)| Calculate PCA | Calculates principal components analysis on a `SingleCellExperiment` object | | `scater`| [`calculateUMAP()`](https://bioconductor.org/packages/devel/bioc/manuals/scater/man/scater.pdf)| Calculate UMAP | Calculates uniform manifold approximate projection on a `SingleCellExperiment` object | @@ -73,7 +67,7 @@ Read the `purrr` documentation [**here**](https://purrr.tidyverse.org/). ### `stringr` -Read the `stringr` documentation [**here**](https://stringr.tidyverse.org/index.html) +Read the `stringr` documentation [**here**](https://stringr.tidyverse.org/). | Library/Package| Piece of Code| What it's called| What it does | |----------------|--------------|-----------------|--------------| @@ -85,9 +79,8 @@ Documentation for each of these packages can be accessed by clicking the package | Library/Package|Piece of Code| What it's called| What it does | |----------------|-------------|-----------------|---------------| | [`alevinQC`](http://www.bioconductor.org/packages/devel/bioc//vignettes/alevinQC/inst/doc/alevinqc.html) | [`alevinQCReport()`](http://www.bioconductor.org/packages/devel/bioc//vignettes/alevinQC/inst/doc/alevinqc.html#generate-qc-report) | Alevin QC Report | Produces a QC (quality check) report from the alevin output | -| [`dat`](https://cran.r-project.org/web/packages/dat/index.html)| [`DataFrame()`](https://www.rdocumentation.org/packages/dat/versions/0.5.0/topics/DataFrame)| Data frame | Not to be confused with [`data.frame()` from Base R. This is a slightly different data frame-like object needed for storing information in `SingleCellExperiment` object's `colData()`.| -| [`colorblindr`](https://www.rdocumentation.org/packages/colorblindr/versions/0.1.0)|[`scale_color_OkabeIto()`](https://www.rdocumentation.org/packages/colorblindr/versions/0.1.0/topics/scale_colour_OkabeIto) | OkabeIto Color Scale | When added as a layer to a plot, makes the plot colorblind friendly | -| [`Rtsne`](https://www.rdocumentation.org/packages/Rtsne/versions/0.15)| [`Rtsne()`](https://www.rdocumentation.org/packages/Rtsne/versions/0.15/topics/Rtsne)| T-Distributed Stochastic Neighbor Embedding using a Barnes-Hut Implementation | Reduces the dimensions of the specified matrix or data frame| +| `S4Vectors` | [`DataFrame()`](https://rdrr.io/bioc/S4Vectors/man/DataFrame-class.html)| Data frame | Not to be confused with `data.frame()` from Base R. This is a slightly different data frame-like object needed for storing information in `SingleCellExperiment` object's `colData()`.| +| [`Rtsne`](https://rdrr.io/cran/Rtsne/)| [`Rtsne()`](https://rdrr.io/cran/Rtsne/man/Rtsne.html)| T-Distributed Stochastic Neighbor Embedding using a Barnes-Hut Implementation | Reduces the dimensions of the specified matrix or data frame| | [`tibble`](https://tibble.tidyverse.org/index.html)|[`as_tibble()`](https://tibble.tidyverse.org/reference/as_tibble.html) | As tibble | Coerce data.frame or matrix to a tibble |
diff --git a/module-cheatsheets/scRNA-seq-cheatsheet.pdf b/module-cheatsheets/scRNA-seq-cheatsheet.pdf index da4f5298..3c29a81e 100644 Binary files a/module-cheatsheets/scRNA-seq-cheatsheet.pdf and b/module-cheatsheets/scRNA-seq-cheatsheet.pdf differ