Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this user
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
fdabbagh
/
shiny-app
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
bb7881e
app
functions
check_project.r
combat_batch_effect.r
convert_to_link.r
extract_metadata.r
inserted_chr_list.r
inserted_ui.r
list_experiments.r
matrix_summary_table.r
pie_chart.r
plot_correlation.r
plot_pca_labels.r
sample_summary.r
score_matrix_annotations.r
score_matrix_tiling_regions.r
sva_batch_effect.r
server
www
.gitignore
README.md
Breadcrumbs
shiny-app
/
functions
/
plot_pca_labels.r
Copy path
Blame
Blame
Latest commit
fawaz-dabbaghieh
updates and fixex 23/January
Jan 23, 2018
bb7881e
·
Jan 23, 2018
History
History
48 lines (41 loc) · 1.91 KB
Breadcrumbs
shiny-app
/
functions
/
plot_pca_labels.r
Top
File metadata and controls
Code
Blame
48 lines (41 loc) · 1.91 KB
Raw
#Plotting the score matrix with the relevant metadata with it plot_pca_labels <- function(experiments_info_meta,filtered_score_matrix,project, color_by = "biosource_name", first_pc="1", second_pc="2", epigenetic_mark = "Not Selected", legend_position = "right", legend_direction = "vertical", show_legend = TRUE){ #calculating PCA pca <- prcomp(filtered_score_matrix, center = TRUE, scale. = TRUE) #preparing the plot data by taking the PCAs and adding metadata plot.data <- as.data.frame(pca$rotation) %>% tibble::rownames_to_column(var = "experiment") %>% dplyr::left_join(experiments_info_meta, by=c("experiment")) #Getting colour pallet colourCount <- 9 getPalette <- colorRampPalette(brewer.pal(colourCount, "Set1")) if(project == "DEEP"){ label <- "DEEP_SAMPLE_ID" }else{ label <- "experiment" } plot <- ggplot(plot.data, aes_string(x = paste0("PC",first_pc), y = paste0("PC",second_pc), label = label, color = color_by))+ geom_point(size = 5, alpha = 0.5)+ # geom_label_repel(data = plot.data)+ theme_bw() + ggtitle(paste("Tiling Regions", epigenetic_mark)) + theme(plot.title = element_text(hjust = 0)) + theme(legend.position = legend_position,legend.direction = legend_direction, legend.box.just = "right", legend.justification = c("right", "top"))+ xlab(paste(paste0("PC", first_pc," ", "("), round(pca$sdev[as.integer(first_pc)]^2/sum(pca$sdev^2), 2) * 100, "%)")) + ylab(paste(paste0("PC", second_pc," ", "("), round(pca$sdev[as.integer(second_pc)]^2/sum(pca$sdev^2), 2) * 100, "%)")) if(show_legend){ return(plot) } return(plot + theme(legend.position = "none")) }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
You can’t perform that action at this time.