Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
538715d
Fixing license
Ashastry2 Dec 14, 2022
1978f25
Changed branch to main from master
Ashastry2 Dec 15, 2022
ae607f0
Adding remotes field and missing repo
Ashastry2 Dec 21, 2022
6bdcf0d
Removing version from toast
Ashastry2 Dec 21, 2022
bf89b24
Updated tests
Ashastry2 Dec 21, 2022
e61c38c
Fixing check errors
Ashastry2 Dec 27, 2022
62821c3
Missing files added
Ashastry2 Dec 27, 2022
4d44c11
Fixed NAMESPACE and DESC issues that were throwing errors in RMD chec…
Ashastry2 Dec 28, 2022
ab91369
Testing to see if this removes the error. Revert this to heatmap or t…
Ashastry2 Dec 28, 2022
e6e9744
Changing example data compression
Ashastry2 Dec 29, 2022
aaffbcb
Merge branch 'compbiomed:main' into main
Ashastry2 Jun 28, 2023
67dc914
Adding example data files and vignette
Ashastry2 Jun 24, 2023
199952a
Fixing heatmap colors, adding scale input option and col_fun to make …
Ashastry2 Jun 27, 2023
6d2376b
removed unwatned files
Ashastry2 Jun 28, 2023
501dfd5
resolving stash issue
Ashastry2 Jun 28, 2023
5f0eba2
remove projdir
Ashastry2 Jun 28, 2023
a9b75d4
update gitignore to ignore projdir
Ashastry2 Jun 28, 2023
ca4bc9f
update dependency version to v2 to see if this corrects RMD check fails
Ashastry2 Jun 28, 2023
b2b4750
update BioC checks
Ashastry2 Jun 28, 2023
b3a2f89
Added options to reset the color scheme of heatmap and some bug fixes
Ashastry2 Jul 3, 2023
a32f8dd
removing redundant knit options
Ashastry2 Jul 5, 2023
52462bb
Update README.md
Ashastry2 Jul 5, 2023
df01120
Adding report to namespace
Ashastry2 Jul 5, 2023
b77a16f
adding reportMusicAll to namespace
Ashastry2 Jul 5, 2023
1e0eec7
adding reportMusicAll to namespace
Ashastry2 Jul 5, 2023
ab2b369
fixing roxygen issue for documentation of multiple report functions i…
Ashastry2 Jul 5, 2023
e4d5f41
adding reportMusicAll
Ashastry2 Jul 5, 2023
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
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
^SingleCellTKPlus\.Rproj$
^singleCellTKPlus\.Rproj$
^\.github$
6 changes: 3 additions & 3 deletions .github/workflows/BioC-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [master, devel]
branches: [main, devel]
pull_request:
branches: [master, devel]
branches: [main, devel]

name: BioC-check

Expand All @@ -29,7 +29,7 @@ jobs:

- uses: r-lib/actions/setup-pandoc@v1

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [master, devel]
branches: [main, devel]
pull_request:
branches: [master, devel]
branches: [main, devel]

name: R-CMD-check

Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
which python
shell: bash

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
Expand All @@ -71,7 +71,7 @@ jobs:
if: runner.os == 'macOS'
run: brew install fftw

- uses: r-lib/actions/setup-r-dependencies@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: rcmdcheck

Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ vignettes/*.pdf
# R Environment Variables
.Renviron
.Rproj.user

# proj env

singleCellTK.Rproj


28 changes: 23 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,36 @@ Version: 0.0.0.9000
Authors@R:
c(person(given ="Amulya", family = "Shastry", email = "shastrya@bu.edu", role = c("aut", "cre")), person(given=c("Joshua", "David"), family="Campbell", email="camp@bu.edu", role=c("aut")))
Depends:
R (>= 4.0),
R (>= 4.2.0),
SummarizedExperiment,
SingleCellExperiment,
DelayedArray,
Biobase,
singleCellTK,
ggplot2,
dplyr,
MuSiC,
magrittr
Description: Deconvolution of bulk data from single cell datasets by MuSiC tool using singleCellTKExtra package
TOAST,
magrittr,
tibble,
S4Vectors,
tidyr
Suggests:
testthat
Description: "The Single Cell Toolkit (SCTK) in the singleCellTK package provides an interface to popular tools for importing, quality control, analysis, and visualization of single cell RNA-seq data. The singleCellTKPlus package adds functionality to the singleCellTK ecosystem by incorporating tools that are not installable from CRAN, Bioconductor, or Python. These tools are generally located in GitHub repositories and can be installed with "remotes". The Shiny graphical user interface (GUI) in singleCellTK will check for the installation of singleCellTKPlus and, if available, will make these tools available for use."
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.1
RoxygenNote: 7.2.3
Remotes: xuranw/MuSiC
LazyData: FALSE
Imports:
methods,
rlang,
rmarkdown
Collate:
'data.R'
'descriptions.R'
'plotMusicResults.R'
'reportMusic.R'
'runMusic.R'
'utils-pipe.R'
23 changes: 22 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# MIT License

Copyright (c) 2022 singleCellTKPlus authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
YEAR: 2022
COPYRIGHT HOLDER: SingleCellTKPlus authors
COPYRIGHT HOLDER: singleCellTKPlus authors
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

15 changes: 14 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
# Generated by roxygen2: do not edit by hand

export("%>%")
export()
export(description_runMusic)
export(getMusicResults)
export(plotMusicResults)
export(reportMusic)
export(reportMusicAll)
export(reportMusicResults)
export(runMusic)
importFrom(MuSiC,music_prop)
importFrom(MuSiC,music_prop.cluster)
importFrom(S4Vectors,DataFrame)
importFrom(S4Vectors,metadata)
importFrom(SummarizedExperiment,colData)
importFrom(dplyr,left_join)
importFrom(magrittr,"%>%")
importFrom(stats,dist)
importFrom(stats,hclust)
importFrom(tibble,column_to_rownames)
importFrom(tibble,rownames_to_column)
importFrom(tidyr,gather)
22 changes: 22 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#' @name musicBulkexample
#' @title example bulk data for this package
#' @docType data
#' @format matrix
#' @source Processed RNA-seq data from bulk kidney in healthy and APOL1 mouse (Beckerman et al.)
#' @keywords datasets
#' @usage data("musicBulkexample")
#' @examples
#' data("mouseBrainSubsetSCE")
"musicBulkexample"


#' @name musicSCEexample
#' @title example single cell data for this package
#' @docType data
#' @format SingleCellExperiment
#' @source Subset of single cell RNA-seq data of mouse kidney (Park et al.)
#' @keywords datasets
#' @usage data("musicSCEexample")
#' @examples
#' data("musicSCEexample")
"musicSCEexample"
6 changes: 5 additions & 1 deletion R/descriptions.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#' @export
#' @description prints music desc
#' @name description_runMusic
#' @title prints description of music wrapper parameters


description_runMusic <- function() {
return(list(
Expand All @@ -11,7 +15,7 @@ description_runMusic <- function() {
samples = "default is sampleID character,the colData of single cell dataset used as samples",
preClusterlist = "pre grouped cluster list" ,
DEmarkers = "list of group marker",
groups = "roups passes the column name of higher-cluster in phenoData",
groups = "groups passes the column name of higher-cluster in phenoData",
selectCt = "vector of cell types, default as NULL. If NULL, then use all cell types provided by single cell dataset", #same as select.ct
cellSize = "data.frame of cell sizes. 1st column contains the names of cell types, 2nd column has the cell sizes per cell type. Default as NULL. If NULL, then estimate cell size from data", #same as cell_size
ctCov = "logical. If TRUE, use the covariance across cell types", #same as ctCov
Expand Down
52 changes: 30 additions & 22 deletions R/plotMusicResults.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#' plotMusicResults function
#'
#' @title Plotting function of runMusic.R
#' @description A wrapper that plots heatmap and cluster plots for results from runMusic.R
#' @param inSCE A \link[SingleCellExperiment]{SingleCellExperiment} object.
Expand All @@ -6,18 +8,18 @@
#' @param heatmapTitle Character. Title for heatmap; Default is NULL
#' @param analysisName Character. User-defined analysis name.
#' This will be used as the slot name and results can be stored and retrived from SCE object using this name
#' @param colDataName The column name(s) in \code{colData} that need
#' to be added to the annotation. See plotSCEHeatmap from SingleCellTK for more info
#' @param rowDataName The column name(s) in \code{rowData} that need
#' to be added to the annotation
#' @param useAssay Choose the assay to be plotted with the heatmap.
#' @param scale scale input assay if set to TRUE. Default is FALSE
#' @return SingleCellExperiment object containing the outputs of the
#' specified algorithms in the \link{colData}
#' of \code{inSCE}.
#'
#' @export

require(singleCellTK)
require(ggplot2)
require(dplyr)
require(S4Vectors)
require(SingleCellExperiment)


plotMusicResults<- function(inSCE,
analysisType = c("EstCellProp","PreGroupedClustProp","SingleCellClust"),
Expand Down Expand Up @@ -57,18 +59,24 @@ plotMusicResults<- function(inSCE,




col_fun<-colorRamp2(c(0,0.2,0.4,0.6,0.8,1), hcl_palette = "RdBu")
testBulk<-metadata(inSCE)[["sctk"]][["music"]][[analysisName]][[useAssay]]
bulkinSCE<-SingleCellExperiment(assays = list(EstProps = testBulk))
names(assays(bulkinSCE))<-useAssay
heatmap<-plotSCEHeatmap(bulkinSCE, # Check version
useAssay = useAssay,
rowLabel = T,
colLabel = T,
rowTitle = "Subjects",
colTitle = "CellType",
title = heatmapTitle,
scale = scale)
heatmap<-singleCellTK::plotSCEHeatmap(bulkinSCE, # Check version
useAssay = useAssay,
rowLabel = T,
colLabel = T,
rowTitle = "Subjects",
colTitle = "CellType",
rowLabelSize = 10,
colLabelSize = 10,
colorScheme = col_fun,
colDataName = colDataName,
rowDataName = rowDataName,
trim = c(0,1),
title = heatmapTitle,
scale = scale)
return(heatmap)
}

Expand All @@ -78,25 +86,25 @@ plotMusicResults<- function(inSCE,

if(analysisType == "SingleCellClust"){
plots<-.musicPlotclusters(inSCE,analysisName = analysisName)
# metadata(inSCE)$sctk$music[[analysisName]][["Clusters"]]<- temp_results
# metadata(inSCE)$sctk$music[[analysisName]][["Clusters"]]<- temp_results
}
else if(analysisType == "EstCellProp"){

plots<-.plotHeatmap(inSCE,heatmapTitle = heatmapTitle,useAssay = "Est.prop.weighted" ,analysisName = analysisName )
plots<-.plotHeatmap(inSCE,heatmapTitle = heatmapTitle,useAssay = "Est.prop.weighted" ,analysisName = analysisName, colDataName = colDataName, rowDataName = rowDataName,scale = scale )
# Do if else for pulling the assay data and have one single call for the sce heatmap

#metadata(inSCE)$sctk$music[[analysisName]][["Heatmap"]]<- temp_results

}

else if(analysisType == "PreGroupedClustProp"){
plots<- .plotHeatmap(inSCE,heatmapTitle = heatmapTitle,useAssay = "Est.prop.weighted.cluster",analysisName = analysisName )

plots<- .plotHeatmap(inSCE,heatmapTitle = heatmapTitle,useAssay = "Est.prop.weighted.cluster",analysisName = analysisName, colDataName = colDataName, rowDataName = rowDataName,scale = scale )
#metadata(inSCE)$sctk$music[[analysisName]][["Heatmap"]]<- temp_results

}


return(plots)
}

29 changes: 19 additions & 10 deletions R/reportMusic.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

# Report render functions for music

#' @title Deconvolution of RNASeq data using single cell data
#' @description A wrapper that performs deconvolution and clustering using MuSiC tool and
#' SingleCellExperiment object
Expand All @@ -19,19 +18,26 @@
#' @param ctCov logical. If TRUE, use the covariance across cell types; #same as ctCov in MuSiC
#' @param preClusterlist list of cell types. The list identify groups of similar cell types.
#' @param verbose logical, default as TRUE.
#' @param iter.max numeric, maximum iteration number. Default 1000
#' @param iterMax numeric, maximum iteration number, same as iter.max in MuSiC. Default 1000
#' @param nu regulation parameter, take care of weight when taking reciprocal 1e-04,
#' @param eps Threshold of convergence. Default 0.01,
#' @param centered logic, subtract avg of Y and D. Default FALSE
#' @param normalize logic, divide Y and D by their standard deviation. Default FALSE
#' @param bulkData matrix of bulk RNASeq data
#' @param nonZero logical, default as TRUE. If true, remove all gene with zero expression, same as non.zero.
#' @param groups grouping labels, character, the colData of single cell data used as groups
#' @param output_file name of the output file
#' @param DEmarkers list of gene names. The list include differential expressed genes within groups. List name must be the same as group.markers.
#' @param output_dir name of output marker
#' @return SingleCellExperiment object containing the outputs of the specified algorithms in the \link{colData} of \code{inSCE}.
#' @export reportMusicAll
#' @export
#' @examples
#' data(scExample, package = "singleCellTK")
#' Add bulk data here
#' \dontrun{
#' reportMusic(inSCE = Mouse.sce,
#' bulkData = mouse_bulk,
#' data("musicSCEexample")
#' data("musicBulkexample")
#' music_sce <- reportMusicAll(inSCE = musicSCEexample,
#' bulkData = musicBulkexample,
#' analysisName = "test1",
#' analysisType = "EstCellProp",
#' markers = NULL,
Expand All @@ -53,11 +59,10 @@
#' output_file = ,
# ' output_dir = NULL)
#' }

#' \dontrun{
#' reportMusicResults(inSCE= new_sce_with_music_basis2,
#' reportMusicAll(inSCE= music_sce,
#' analysisName = "test2",
#' analysisType = "SingleCellClust",
#' analysisType = "EstCellProp",
#' heatmapTitle = "test")


Expand Down Expand Up @@ -121,7 +126,8 @@ reportMusic <- function(inSCE = inSCE,

}


#' reportMusicResults
#' @export

reportMusicResults<- function(inSCE,
analysisName,
Expand All @@ -146,6 +152,9 @@ reportMusicResults<- function(inSCE,

}

#' reportMusicAll
#' @export


reportMusicAll<-function(inSCE = inSCE,
bulkData = bulkData,
Expand Down
Loading