-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove assignment * removed update from function, some spacing. Moved color assignment to a function * added small docstring to function * Update program/shinyApp/R/sample_correlation/server.R Co-authored-by: Lea Seep <[email protected]> --------- Co-authored-by: Lea Seep <[email protected]>
- Loading branch information
1 parent
26b0058
commit 415519a
Showing
5 changed files
with
55 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
assign_colors_SampleCorr <- function(annotation_df){ | ||
# Assign more complex colors to annotation. | ||
# Parameters: | ||
# annotation_df: data.frame with annotation | ||
# Returns: | ||
# list with colors for each annotation | ||
palletteOrder <- c("Paired","Pastel2","Dark2") | ||
anno_colors <- list() | ||
for (i in 1:(ncol(annotation_df))) { | ||
if (i > 3) { | ||
break | ||
} | ||
if (length(unique(annotation_df[,i])) == 2){ | ||
colors_tmp <- c("navy","orange") | ||
names(colors_tmp) <- unique(annotation_df[,i]) | ||
anno_colors[[colnames(annotation_df)[i]]] <- colors_tmp | ||
} else if (length(unique(annotation_df[,i])) <= 8) { | ||
colors_tmp <- RColorBrewer::brewer.pal( | ||
n = length(unique(annotation_df[,i])), | ||
name = palletteOrder[i] | ||
) | ||
names(colors_tmp) <- unique(annotation_df[,i]) | ||
anno_colors[[colnames(annotation_df)[i]]] <- colors_tmp | ||
} | ||
} | ||
return(anno_colors) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters