Skip to content

Commit

Permalink
warning fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
nfancy committed Apr 4, 2023
1 parent 117daeb commit ffaaa9c
Show file tree
Hide file tree
Showing 41 changed files with 56 additions and 835 deletions.
16 changes: 0 additions & 16 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ export(integrate_with_DIABLO)
export(integrate_with_MBPLS)
export(integrate_with_MEIFESTO)
export(integrate_with_MOFA)
export(integrate_with_iCluster)
export(integrate_with_sMBPLS)
export(integrative_results_clustering)
export(integrative_results_supervised)
export(integrative_results_unsupervised)
export(interactive_network)
Expand Down Expand Up @@ -50,14 +48,6 @@ export(volcano_plot_limma)
import(ggplot2)
import(igraph)
importFrom(AnnotationDbi,mapIds)
importFrom(ClassDiscovery,distanceMatrix)
importFrom(ComplexHeatmap,"%v%")
importFrom(ComplexHeatmap,Heatmap)
importFrom(ComplexHeatmap,HeatmapAnnotation)
importFrom(ComplexHeatmap,anno_mark)
importFrom(ComplexHeatmap,draw)
importFrom(ComplexHeatmap,ht_opt)
importFrom(ComplexHeatmap,rowAnnotation)
importFrom(DESeq2,DESeq)
importFrom(DESeq2,DESeqDataSetFromMatrix)
importFrom(DESeq2,counts)
Expand Down Expand Up @@ -95,7 +85,6 @@ importFrom(WGCNA,cor)
importFrom(WGCNA,moduleEigengenes)
importFrom(WGCNA,orderMEs)
importFrom(basetheme,num2col)
importFrom(circlize,colorRamp2)
importFrom(cli,cli_alert_danger)
importFrom(cli,cli_alert_info)
importFrom(cli,cli_alert_success)
Expand Down Expand Up @@ -127,9 +116,6 @@ importFrom(ggplot2,ggsave)
importFrom(ggplot2,ggtitle)
importFrom(ggpubr,ggscatter)
importFrom(ggrepel,geom_text_repel)
importFrom(grDevices,colorRampPalette)
importFrom(grDevices,dev.off)
importFrom(grDevices,pdf)
importFrom(httr,POST)
importFrom(jsonlite,fromJSON)
importFrom(limma,contrasts.fit)
Expand Down Expand Up @@ -161,15 +147,13 @@ importFrom(purrr,map)
importFrom(purrr,map_chr)
importFrom(purrr,map_dfr)
importFrom(purrr,possibly)
importFrom(readr,parse_number)
importFrom(reshape2,melt)
importFrom(slingshot,as.SlingshotDataSet)
importFrom(slingshot,slingshot)
importFrom(stats,as.formula)
importFrom(stats,model.matrix)
importFrom(stats,prcomp)
importFrom(stats,reorder)
importFrom(stringr,str_split)
importFrom(stringr,str_wrap)
importFrom(tibble,enframe)
importFrom(tidyr,pivot_wider)
Expand Down
3 changes: 1 addition & 2 deletions R/DE_formating.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ format_res_limma <- function(dt,
gene_id_conversion = NULL,
log2FoldChange = 0,
n_label = 20,
padj = 0.05,
...) {
padj = 0.05) {
if (!is.null(gene_id_conversion)) {
dt$gene_name <- gene_id_conversion$gene_name[
match(dt$Identifier, gene_id_conversion$uniprot_id)]
Expand Down
2 changes: 1 addition & 1 deletion R/clusters_DE.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#' Performs differential expression between clusters
#'
#' @param normalized_data Normalized rna/protein data
#' @param colData The coldadata variable
#' @param dependent The dependent variable
#' @param covariates The covariates
#' @param levels Levels to compare
#' @param log2FoldChange logFC cutoff
#'
Expand Down
5 changes: 4 additions & 1 deletion R/enrichment.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
#'
#' Performs impacted pathway analysis with a list of genes.
#'
#' @param interest_genes vector containing genes of interest
#' @param interest_gene vector containing genes of interest
#' Column names should be gene, logFC, pval and padj respectively.
#' @param project_name The name of the project to save.
#' @param enrichment_database Name of the database for enrichment. User can
#' specify one or more database names from [enrichR::listEnrichrDbs()].
#' @param is_output If TRUE a folder will be created and results of enrichment
#' analysis will be saved otherwise a R list will be returned. Default FALSE
#' @param output_dir Path for the output directory. Default is current dir.
#' @param min_overlap minimum overlap between genes and genesets to keep.
#' @param plot_n number of genesets to plot
#'
#' @return enrichment_result a list of data.frames containing enrichment output
#' and a list of plots of top 10 significant genesets.
Expand Down
67 changes: 10 additions & 57 deletions R/integrative_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
#' integration are `cor`(strength of correlation between PC1 of omics layers)
#' or `full` (The strength of all relationships between dataframes is
#' maximised (= 1) – a “fully connected” design)
#' @param range
#' @param range a named list specifying the number of rna and protein.
#' @param list.keepX list to keep rows
#'
#' @return a list object with `multimodal_object` and `model` slots
#'
Expand All @@ -27,7 +28,7 @@ integrate_with_DIABLO <- function(multimodal_omics,
mRNA = seq(5, 100, by = 10),
proteins = seq(5, 100, by = 10)
),
list.keepX, ...) {
list.keepX) {
multimodal_omics <- lapply(multimodal_omics, t)
X <- list(
mRNA = multimodal_omics[[1]],
Expand Down Expand Up @@ -117,8 +118,8 @@ integrate_with_sMBPLS <- function(multimodal_omics,
design,
ncomp,
list.keepX = list(mRNA = c(50),
proteins = c(50)),
...) {
proteins = c(50))
) {
multimodal_omics <- lapply(multimodal_omics, t)
X <- list(
mRNA = multimodal_omics[[1]],
Expand Down Expand Up @@ -192,7 +193,7 @@ integrate_with_sMBPLS <- function(multimodal_omics,
integrate_with_MBPLS <- function(multimodal_omics,
Y,
design,
ncomp, ...) {
ncomp) {
multimodal_omics <- lapply(multimodal_omics, t)
X <- list(
mRNA = multimodal_omics[[1]],
Expand Down Expand Up @@ -248,7 +249,7 @@ integrate_with_MBPLS <- function(multimodal_omics,
#' @param multimodal_omics multimodal_object generated by `get_multimodal_object`
#' @param num_factors Number of factors
#' @param scale_views Logical whether to scale omics layers
#' @param metadata
#' @param metadata sample metadata
#'
#' @return a list object with `multimodal_object` and `model` slots
#'
Expand All @@ -261,7 +262,7 @@ integrate_with_MBPLS <- function(multimodal_omics,
integrate_with_MOFA <- function(multimodal_omics,
num_factors = 5,
scale_views = TRUE,
metadata, ...) {
metadata) {
python_path <- Sys.which("python")
reticulate::use_python(python_path, required = NULL)

Expand Down Expand Up @@ -323,8 +324,8 @@ integrate_with_MEIFESTO <- function(multimodal_omics,
num_factors = 5,
scale_views = TRUE,
metadata,
time = "pseudotime",
...) {
time = "pseudotime"
) {
# python_path <- Sys.which("python")
# reticulate::use_python(python_path, required = NULL)

Expand Down Expand Up @@ -372,51 +373,3 @@ integrate_with_MEIFESTO <- function(multimodal_omics,
model = model
))
}


#' Vertical integration with iCluster
#'
#' @param multimodal_omics multimodal_object generated by `get_multimodal_object`
#' @param try.N.clust Range of number of potential clusters in the optimisation step
#'
#' @return a list object with `multimodal_object` and `model` slots
#'
#' @family Multi-omic integration
#'
#'
#' @export



integrate_with_iCluster <- function(multimodal_omics,
try.N.clust = 2:4) {
cli::cli_alert_success("Optimising the number of cluster
(this make take a while")

optk.i <- MOVICS::getClustNum(
data = multimodal_omics,
is.binary = c(FALSE, FALSE),
try.N.clust = try.N.clust,
fig.name = "Cluster number tuning"
)


optimal_n <- optk.i$N.clust

cli::cli_alert_success("Integration in progress (this make take a while)")
model <- MOVICS::getiClusterBayes(
data = multimodal_omics,
N.clust = optimal_n,
type = c("gaussian", "gaussian"),
n.burnin = 1800,
n.draw = 1200,
prior.gamma = c(0.5, 0.5),
sdev = 0.05,
thin = 3
)

return(list(
multimodal_object = multimodal_omics,
model = model
))
}
Loading

0 comments on commit ffaaa9c

Please sign in to comment.