Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael-Geuenich committed May 19, 2021
2 parents 971f092 + f990841 commit d2b8f85
Show file tree
Hide file tree
Showing 29 changed files with 223 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.Rproj.user
*.Rproj
*.Rhistory
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
language: r
bioc_check: true
26 changes: 18 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,37 @@ Title: Tools for spAtial PROteOmics
Version: 0.1.0
Depends: R (>= 3.6)
Authors@R:
person(given = "First",
family = "Last",
person(given = "Ehsan",
family = "Karimiara",
role = c("aut", "cre"),
email = "first.last@example.com",
email = "e.karimiara@gmail.com",
comment = c(ORCID = "YOUR-ORCID-ID"))
Description: What the package does (one paragraph).
License: What license it uses
License: file LICENSE
Encoding: UTF-8
LazyData: true
Imports:
yaml,
scater,
SingleCellExperiment,
BiocGenerics,
SummarizedExperiment,
plyr,
stringr,
MASS,
broom,
dplyr,
tibble
tibble,
utils,
cowplot,
stats,
viridis,
ComplexHeatmap,
ggplot2,
wesanderson,
Suggests:
crayon
RoxygenNote: 7.1.0
crayon,
knitr,
rmarkdown
RoxygenNote: 7.1.1
biocViews: Proteomics, CellBiology, Software
VignetteBuilder: knitr
Empty file added LICENSE
Empty file.
11 changes: 11 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
# Generated by roxygen2: do not edit by hand

export(astir_paper_theme)
export(cohort_colours)
export(createHeatmap)
export(get_celltypes)
export(imc_exclusive_marker_score)
export(jackson_basel_colours)
export(patient_clinSubtype_colours)
export(patient_clinSubtype_colours_wagner)
export(patient_response_colours)
export(plotSpatial)
export(print_marker_info)
export(read_markers)
export(tidy_rownames_jackson)
export(to_csv)
export(winsorize)
import(cowplot)
import(ggplot2)
importFrom(BiocGenerics,rownames)
importFrom(ComplexHeatmap,Heatmap)
importFrom(ComplexHeatmap,HeatmapAnnotation)
importFrom(MASS,rlm)
importFrom(SummarizedExperiment,"assay<-")
importFrom(SummarizedExperiment,"colData<-")
importFrom(SummarizedExperiment,assay)
importFrom(SummarizedExperiment,colData)
importFrom(broom,tidy)
Expand All @@ -24,9 +32,12 @@ importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(plyr,mapvalues)
importFrom(scater,plotColData)
importFrom(stats,quantile)
importFrom(stringr,str_locate)
importFrom(stringr,str_sub)
importFrom(tibble,tibble)
importFrom(utils,data)
importFrom(utils,write.csv)
importFrom(viridis,viridis)
importFrom(wesanderson,wes_palette)
importFrom(yaml,read_yaml)
2 changes: 2 additions & 0 deletions R/cleaning.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
#' @param sce An input \code{SummarizedExperiment} or \code{SingleCellExperiment}
#' @param marker_1 The name of the first marker (normally keratin)
#' @param marker_2 The name of the second marker (normally CD45/PTPRC)
#' @param assay_name Type of SingleCellExperiment
#'
#' @importFrom MASS rlm
#' @importFrom SummarizedExperiment assay
#' @importFrom broom tidy
#'
#' @examples counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
imc_exclusive_marker_score <- function(sce,
marker_1 = "pan Cytokeratin",
Expand Down
13 changes: 12 additions & 1 deletion R/colours.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

#' Celltype colours for Jackson Basel 2020
#' @examples colors <-jackson_basel_colours()
#' @export
jackson_basel_colours <- function() {
pal <- c("#8B5B42", "#AF4EA9", "#FFB60A", "#0AC694", "#0024DD", "#6CC1FF",
Expand Down Expand Up @@ -28,6 +29,9 @@ jackson_basel_colours <- function() {
celltype_colours
}

#' Color maps of patient clinical subtypes
#'
#' @examples patient_clinSubtype_colours()
#' @export
patient_clinSubtype_colours <- function(){
pal <- c("#648FFF", "#785EF0", "#DC267F", "#FE6100", "#FFB000")
Expand All @@ -41,6 +45,8 @@ patient_clinSubtype_colours <- function(){
clinSubtype_colours
}

#' Set Wagner colour maps to patient clinical subtypes
#' @examples patient_clinSubtype_colours_wagner()
#' @export
patient_clinSubtype_colours_wagner <- function(){
pal <- c("#648FFF", "#785EF0", "#DC267F", "#FE6100", "#FFB000")
Expand All @@ -55,6 +61,8 @@ patient_clinSubtype_colours_wagner <- function(){
clinSubtype_colours
}

#' Colour maps of patient responses
#' @examples patient_response_colours()
#' @export
patient_response_colours <- function(){
pal <- c("#648FFF", "#785EF0", "#DC267F", "#FE6100", "#FFB000")
Expand All @@ -67,7 +75,10 @@ patient_response_colours <- function(){
clinSubtype_colours
}

#' @export
#' Group colors
#' @importFrom wesanderson wes_palette
#' @examples counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
cohort_colours <- function(){
pal <- wes_palette("Darjeeling2", 4, type = c("discrete"))

Expand Down
1 change: 1 addition & 0 deletions R/jackson.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#' @importFrom dplyr left_join mutate case_when filter
#' @importFrom tibble tibble
#'
#' @examples counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
tidy_rownames_jackson <- function(sce) {

Expand Down
4 changes: 4 additions & 0 deletions R/markers.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#'
#' @param path Input file path (yaml file)
#'
#' @examples
#' counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
#'
#' @return A marker list including cell type and state markers
Expand Down Expand Up @@ -37,6 +39,8 @@ read_markers <- function(path) {
#'
#' @return Prints marker information
#'
#' @examples
#' counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
#'
print_marker_info <- function(markers) {
Expand Down
14 changes: 11 additions & 3 deletions R/plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
#' @param colour_by Either a feature name or column of \code{colData(sce)}
#' @param x_str The column of \code{colData(sce)} that codes for the x coordinate
#' @param y_str The column of \code{colData(sce)} that codes for the Y coordinate
#' @param winsorize IDK ????
#' @param w_limits Range of probabilities to use in quantile()
#' @param exprs_values Type of SingleCellExperiment
#' @param ... Additional arguments to pass to \code{plotColData}
#'
#' @importFrom scater plotColData
#' @importFrom SummarizedExperiment colData
#'
#' @importFrom SummarizedExperiment assay colData colData<-
#' @importFrom stats quantile
#'
#' @examples
#' counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
plotSpatial <- function(sce,
colour_by = NULL,
Expand Down Expand Up @@ -61,7 +67,9 @@ plotSpatial <- function(sce,
#' @param thresh The threshold to winsorize expression values at
#'
#' @return A heatmap of class \code{ComplexHeatmap::Heatmap}
#'
#'
#' @examples
#' counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
#'
#' @importFrom SummarizedExperiment assay colData
Expand Down
4 changes: 4 additions & 0 deletions R/theme.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#' Create a theme for all plot for the astir paper
#'
#' @import cowplot
#' @import ggplot2
#' @examples astir_paper_theme()
#' @export
astir_paper_theme <- function() {
cowplot::theme_cowplot(font_size = 12) +
Expand Down
14 changes: 13 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ winsorize_one <- function(y,
}

#' Winsorize the (log) counts
#' @param sce An input \code{SummarizedExperiment} or \code{SingleCellExperiment}
#' @param exprs_values Type of input?
#' @param w_limits cut off limits?
#' @importFrom SummarizedExperiment assay<- assay
#'
#' @examples counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
winsorize <- function(sce,
exprs_values = "logcounts",
Expand Down Expand Up @@ -40,7 +45,11 @@ winsorize <- function(sce,
#' @param file The output file to write to
#' @param include_xy Logical: should spatial location be written as first two
#' columns?
#'
#' @param exprs_values The type of the SingleCellExperiment?
#'
#' @importFrom utils write.csv
#'
#' @examples counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
to_csv <- function(sce,
file,
Expand All @@ -64,7 +73,10 @@ to_csv <- function(sce,
}

#' Get cell type assignments given probability matrix
#' @param prob_mat A probability matrix?
#' @param thresh A measure for cell type assignment?
#'
#' @examples counts <- matrix(rpois(100, lambda = 10), ncol=10, nrow=10)
#' @export
get_celltypes <- function(prob_mat, thresh = 0.5) {
if(is.data.frame(prob_mat)) {
Expand Down
14 changes: 14 additions & 0 deletions man/astir_paper_theme.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/cohort_colours.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/createHeatmap.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions man/get_celltypes.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/imc_exclusive_marker_score.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/jackson_basel_colours.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/patient_clinSubtype_colours.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/patient_clinSubtype_colours_wagner.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions man/patient_response_colours.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions man/plotSpatial.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d2b8f85

Please sign in to comment.