-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathr.json
More file actions
472 lines (464 loc) · 22.9 KB
/
r.json
File metadata and controls
472 lines (464 loc) · 22.9 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
{
// R VS code snippets file
// Place your snippets for r here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Assignment operator": {
"prefix": "Assignment operator",
"body": " <- "
},
"magrittr pipe": {
"prefix": "magrittr pipe",
"body": " %>% "
},
"danio_to_mouse_snippet": {
"prefix": "danio_to_mouse_snippet",
"body": [
"# Basic function to convert zebrafish to mouse gene names",
"zgGenes <- \"${1:ENSDARG00000102750}\"",
"",
"# This function uses biomaRt to convert zebrafish gene names to mouse gene names. ",
"# This is done by using the zebrafish and mouse ensembl mart datasets. ",
"# The function takes a vector of zebrafish gene names as input and returns ",
"# a data frame of zebrafish and mouse gene names.",
"",
"convertDanioGeneList_Mouse <- function(x){ ",
" require(\"biomaRt\") # load biomaRt package",
" mouse = useMart(\"ensembl\", dataset = \"mmusculus_gene_ensembl\", host = \"https://dec2021.archive.ensembl.org/\" ) # use mouse mart",
" danio = useMart(\"ensembl\", dataset = \"drerio_gene_ensembl\", host = \"https://dec2021.archive.ensembl.org/\") # use zebrafish mart",
"",
" genesV2 = getLDS(attributes = c(\"ensembl_gene_id\", \"zfin_id_symbol\"), ",
" filters = \"ensembl_gene_id\", # get zebrafish gene names",
" values = x , # use the zebrafish gene names",
" mart = danio, # use the zebrafish mart",
" attributesL = c(\"mgi_symbol\", \"ensembl_gene_id\", \"description\"), # get mouse gene names",
" martL = mouse, uniqueRows=T) # use the mouse mart",
"",
" colnames(genesV2)[colnames(genesV2)== \"Gene.stable.ID\"] <- \"EnsmblID_Zebrafish\" # rename columns",
" colnames(genesV2)[colnames(genesV2)== \"Gene.stable.ID.1\"] <- \"EnsmblID_Mouse\" # rename columns",
"",
" # Check if the gene is not found",
" if (length(genesV2) == 0) {",
" print(\"No gene found for this input\")",
" } else { ",
" return(genesV2) # return the genes",
" }",
"}",
"",
"# Run the function",
"Mouse_Genes <- convertDanioGeneList_Mouse(zgGenes)",
"# print the first 6 genes",
"print(head(Mouse_Genes))"
],
"description": "Converts zebrafish gene names to mouse gene names using biomaRt"
},
"GO_function_snippet": {
"prefix": "GO_function_snippet",
"body": [
"GO_function <- function(gene_list, pval = 0.05, onto = \"MF\", prefix = \"\", org = \"mouse\") {",
" if (org == \"mouse\") {",
" orgdb <- \"org.Mm.eg.db\"",
" org_reactome <- \"mouse\"",
" } else if (org == \"human\") {",
" orgdb <- \"org.Hs.eg.db\"",
" org_reactome <- \"human\"",
" } else {",
" message(\"Please enter a valid organism (mouse or human)\")",
" }",
"",
" if (onto %in% c(\"MF\", \"CC\", \"BP\")) {",
" compGO <- enrichGO(gene = gene_list, pvalueCutoff = pval, keyType = \"SYMBOL\",",
" pAdjustMethod = \"BH\", OrgDb = orgdb, ont = onto)",
" } else if (onto == \"reactome\") {",
" gene_list <- bitr(gene_list, fromType = \"SYMBOL\", toType = \"ENTREZID\", OrgDb = orgdb)",
" gene_list <- gene_list$$ENTREZID",
" compGO <- enrichPathway(gene = gene_list, pvalueCutoff = 0.05, organism = org_reactome, readable = TRUE)",
" } else {",
" message(\"Please enter a valid GO term\")",
" }",
"",
" if (is.null(compGO)) {",
" message(paste0(\"No GO:\", onto, \" obtained\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" } else {",
" compGO_df <- as.data.frame(compGO)",
" compGO_df$$GeneRatio_decimal <- compGO_df$$GeneRatio",
" compGO_df$$GeneRatio_decimal <- sapply(compGO_df$$GeneRatio_decimal,",
" function(x) (eval(parse(text = as.character(x)))))",
" compGO_df$$BgRatio_decimal <- compGO_df$$BgRatio",
" compGO_df$$BgRatio_decimal <- sapply(compGO_df$$BgRatio_decimal,",
" function(x) (eval(parse(text = as.character(x)))))",
" compGO_df <- compGO_df %>% tidyr::separate_rows(geneID, sep = \"/\", convert = FALSE) %>%",
" arrange(desc(GeneRatio_decimal))",
" compGO_df %>% head",
"",
" if (nrow(compGO_df) == 0) {",
" message(paste0(\"No GO:\", onto, \" obtained\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" } else {",
" write.csv(compGO_df, paste0(prefix, \"_GO_\", onto, \"_pathways.csv\"))",
"",
" full_name = switch(onto,",
" MF = \"Moleuclar Function\",",
" CC = \"Cellular Components\",",
" BP = \"Biological Pathways\",",
" reactome = \"Reactome Pathways\"",
" )",
"",
" print(dotplot(compGO, showCategory = 15, title = paste0(\"GO Pathway Enrichment Analysis \\n\", full_name),",
" font.size = 12))",
" dev.copy(",
" pdf,",
" file = paste0(prefix, \"_GO_\", onto, \"_pathways.pdf\"),",
" width = 10,",
" height = 12",
" )",
" dev.off ()",
"",
" message(paste0(\"Pathway analysis GO:\", onto, \" done\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" }",
" }",
"}"
],
"description": "Function for Gene Ontology (GO) analysis with enrichment analysis and plotting"
},
"GSEA_function_single_cell_snippet": {
"prefix": "GSEA_function_single_cell_snippet",
"body": [
"GSEA_function <- function(df, cell_type, pval_deg = 0.05, pval_enrich = 0.2, onto = \"MF\", prefix = \"\") {",
" gene_list_df <- df[df$$cell_type == cell_type & df$$p_val <= pval_deg, ]",
" gene_list_df <- gene_list_df %>% arrange(desc(avg_logFC))",
" gene_list_df <- gene_list_df[!is.na(gene_list_df$$gene), ]",
" gene_list_df <- gene_list_df[!duplicated(gene_list_df$$gene), ]",
" gene_list <- gene_list_df %>% pull(avg_logFC)",
" names(gene_list) <- gene_list_df %>% pull(gene)",
"",
" gene_list <- gene_list[!duplicated(gene_list)]",
" print(head(gene_list))",
"",
" compGO <- gseGO(gene = gene_list, pvalueCutoff = pval_enrich, keyType = \"SYMBOL\",",
" pAdjustMethod = \"BH\", OrgDb = \"org.Mm.eg.db\", ont = onto)",
" if (is.null(compGO) | nrow(compGO@result) == 0) {",
" message(paste0(\"No GP:\", onto, \" obtained for Cell Type : \", cell_type, \" done\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" } else {",
" compGO_df <- as.data.frame(compGO)",
" compGO_df <- compGO_df %>% tidyr::separate_rows(core_enrichment, sep = \"/\", convert = FALSE) %>% arrange((p.adjust))",
"",
" if (nrow(compGO_df) == 0) {",
" message(paste0(\"No GP:\", onto, \" obtained for Cell Type : \", cell_type, \" done\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" } else {",
" write.csv(compGO_df, paste0(prefix, cell_type, \"_GO_\", onto, \"_pathways.csv\"))",
"",
" full_name = switch(onto,",
" MF = \"Moleuclar Function\",",
" CC = \"Cellular Components\",",
" BP = \"Biological Pathways\"",
" )",
"",
" print(dotplot(compGO, showCategory = 15, title = paste0(\"DEG GO Pathway Enrichment Analysis \\n\", full_name, \" for \", cell_type, \" Cells\"),",
" font.size = 12) + facet_grid(.~.sign))",
" dev.copy(",
" svg,",
" file = paste0(prefix, cell_type, \"_GO_\", onto, \"_pathways.svg\"),",
" width = 10,",
" height = 8",
" )",
" dev.off ()",
"",
" message(paste0(\"DEG Pathway analysis GO:\", onto, \" for Cell Type : \", cell_type, \" done\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" }",
" }",
"}",
"",
"dir.create(\"GSEA_subcluster\", showWarnings = FALSE)",
"dir.create(\"GSEA_subcluster/Molecular_function\", showWarnings = FALSE)",
"dir.create(\"GSEA_subcluster/Cellular_component\", showWarnings = FALSE)",
"dir.create(\"GSEA_subcluster/Biological_pathways\", showWarnings = FALSE)",
"",
"cell_type <- DEG_Libra_edger_lrt$$cell_type %>% unique %>% sort %>% as.character",
"cell_type",
"lapply(X = cell_type, function(x) {",
" GSEA_function(df = DEG_Libra_edger_lrt, x, onto = \"MF\", prefix = \"GSEA_subcluster/Molecular_function/\")",
"})"
],
"description": "Function for Gene Set Enrichment Analysis (GSEA) with directory creation and function calls"
},
"GSEA_function_bulk_snippet": {
"prefix": "GSEA_function_bulk_snippet",
"body": [
"GSEA_function_bulk <- function(df, pval_deg = 0.05, pval_enrich = 0.2, onto = \"MF\", prefix = \"\") {",
" gene_list_df <- df[df$$p_val <= pval_deg, ]",
" gene_list_df <- gene_list_df %>% arrange(desc(avg_logFC))",
" gene_list_df <- gene_list_df[!is.na(gene_list_df$$gene), ]",
" gene_list_df <- gene_list_df[!duplicated(gene_list_df$$gene), ]",
" gene_list <- gene_list_df %>% pull(avg_logFC)",
" names(gene_list) <- gene_list_df %>% pull(gene)",
"",
" gene_list <- gene_list[!duplicated(gene_list)]",
" print(head(gene_list))",
"",
" compGO <- gseGO(gene = gene_list, pvalueCutoff = pval_enrich, keyType = \"SYMBOL\",",
" pAdjustMethod = \"BH\", OrgDb = \"org.Mm.eg.db\", ont = onto)",
" if (is.null(compGO) | nrow(compGO@result) == 0) {",
" message(paste0(\"No GP:\", onto, \" obtained for the provided dataset\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" } else {",
" compGO_df <- as.data.frame(compGO)",
" compGO_df <- compGO_df %>% tidyr::separate_rows(core_enrichment, sep = \"/\", convert = FALSE) %>% arrange((p.adjust))",
"",
" if (nrow(compGO_df) == 0) {",
" message(paste0(\"No GP:\", onto, \" obtained for the provided dataset\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" } else {",
" write.csv(compGO_df, paste0(prefix, \"_GO_\", onto, \"_pathways.csv\"))",
"",
" full_name = switch(onto,",
" MF = \"Molecular Function\",",
" CC = \"Cellular Components\",",
" BP = \"Biological Pathways\"",
" )",
"",
" print(dotplot(compGO, showCategory = 15, title = paste0(\"DEG GO Pathway Enrichment Analysis \\n\", full_name, \" for the provided dataset\"),",
" font.size = 12) + facet_grid(.~.sign))",
" dev.copy(",
" svg,",
" file = paste0(prefix, \"_GO_\", onto, \"_pathways.svg\"),",
" width = 10,",
" height = 8",
" )",
" dev.off ()",
"",
" message(paste0(\"DEG Pathway analysis GO:\", onto, \" for the provided dataset done\"))",
" message(paste0(\"****************************************************************************************\"))",
" message(paste0(\"\\n\"))",
" }",
" }",
"}"
],
"description": "Function for Gene Set Enrichment Analysis (GSEA) without cell type dependency"
},
"symbol_to_ensmbl_human_snippet": {
"prefix": "symbol_to_ensmbl_human_snippet",
"body": [
"symbol_to_ensmbl_human <- function(x) {",
" require(biomaRt) # load biomaRt package",
" ensembl = useMart(biomart = \"ensembl\", dataset = \"hsapiens_gene_ensembl\", host = \"useast.ensembl.org\") # use the ensembl mart",
" results <- getBM(attributes = c(\"ensembl_gene_id\", \"hgnc_symbol\"),",
" filters = \"hgnc_symbol\",",
" values = x,",
" mart = ensembl)",
" results",
"}"
],
"description": "Convert gene symbol to Ensembl ID for human"
},
"symbol_to_ensmbl_danio": {
"prefix": "symbol_to_ensmbl_danio",
"body": [
"symbol_to_ensmbl_danio <- function(x) {",
" require(biomaRt) # load biomaRt package",
" zf_mart <- useMart(biomart = \"ensembl\", dataset = \"drerio_gene_ensembl\") # use the ensembl mart",
" results <- getBM(attributes = c(\"ensembl_gene_id\", \"zfin_id_symbol\"),",
" filters = \"zfin_id_symbol\",",
" values = x,",
" mart = zf_mart)",
" results",
"}"
],
"description": "Convert gene symbol to Ensembl ID for zebrafish"
},
"symbol_to_ensmbl_mouse": {
"prefix": "symbol_to_ensmbl_mouse",
"body": [
"symbol_to_ensmbl_mouse <- function(x) {",
" require(biomaRt) # load biomaRt package",
" mart <- useMart(biomart = \"ensembl\", dataset = \"mmusculus_gene_ensembl\") # use the ensembl mart",
" results <- getBM(attributes = c(\"ensembl_gene_id\", \"mgi_symbol\"),",
" filters = \"mgi_symbol\",",
" values = x,",
" mart = mart)",
" results",
"}"
],
"description": "Convert gene symbol to Ensembl ID for mouse"
},
"heatmap_annotated_snippet": {
"prefix": "heatmap_annotated_snippet",
"body": [
"# Load required libraries",
"library(ComplexHeatmap)",
"# Define Genotypes and Colors",
"genotypes <- c(\"${Genotype1}\", \"${Genotype2}\")",
"genotype_colors <- c(\"${Color1}\", \"${Color2}\")",
"# genotype_colors <- paletteer::paletteer_d(\"ggsci::nrc\")",
"# Heatmap annotation settings",
"ha = HeatmapAnnotation(",
" Genotype = rep(genotypes, each = ${ReplicationCount}),",
" col = list(Genotype = genotype_colors),",
" annotation_name_gp = grid::gpar(fontsize = 5),",
" annotation_legend_param = list(",
" title_gp = gpar(fontsize = 5),",
" labels_gp = gpar(fontsize = 5),",
" grid_width = unit(5, \"point\"),",
" grid_height = unit(5, \"point\")",
" )",
")",
"# Create Heatmap",
"Heatmap(",
" heatmap_mat,",
" name = \"Expression Levels\",",
" cluster_columns = FALSE,",
" cluster_rows = FALSE,",
" row_dend_width = unit(0, \"cm\"),",
" show_column_names = FALSE,",
" top_annotation = ha,",
" row_split = factor(${metadata}$${ColumnToSplit}, levels = unique(${metadata}$${ColumnToSplit})),",
" gap = unit(2, \"point\"),",
" border = TRUE,",
" border_gp = gpar(col = \"grey40\"),",
" row_title_gp = gpar(fontsize = 5),",
" row_title_rot = 0,",
" bottom_annotation = ha,",
" heatmap_legend_param = list(",
" title = \"Expression Levels\",",
" title_gp = gpar(fontsize = 5),",
" labels_gp = gpar(fontsize = 5),",
" grid_width = unit(5, \"point\"),",
" grid_height = unit(5, \"point\")",
" ),",
" row_names_gp = grid::gpar(fontsize = 3)",
")",
"# Save Heatmap as PDF",
"dev.copy(pdf, file = \"${PDFFileName}.pdf\", width = 12, height = 12)",
"dev.off()"
],
"description": "Generalized custom settings for Heatmap visualization"
},
"volcano_plot_snippet": {
"prefix": "volcano_plot_snippet",
"body": [
"require(ggplot2)",
"require(ggrepel)",
"require(clusterProfiler)",
"require(tidyverse)",
"draw_volcano <- function(fileinput, title) {",
" ggplot(data = fileinput , aes(x = logFoldChange, y = -log10(padj))) +",
" geom_hline(yintercept = -log10(0.05), linetype = \"dashed\", col = \"chartreuse4\") +",
" geom_hline(yintercept = -log10(0.05), linetype = \"dotted\", col = \"darkgoldenrod\") +",
" geom_vline(xintercept = 0, linetype = \"dashed\") +",
" geom_point(x = fileinput$$logFoldChange, y = -log10(fileinput$$padj),alpha = 0.5, size = 2,color=\"grey51\") +",
" geom_point(data = fileinput[which(fileinput$$padj < 0.05 & fileinput$$logFoldChange < -1),],",
" aes(x=logFoldChange, y = -log10(padj)), shape = 21, color = \"royalblue3\", fill = \"royalblue3\",",
" alpha = 0.5, size = 2) +",
" geom_point(data = fileinput[which(fileinput$$padj < 0.05 & fileinput$$logFoldChange > 1),],",
" aes(x=logFoldChange, y = -log10(padj)), shape = 21, color = \"red3\", fill = \"red3\",",
" alpha = 0.5, size = 2) +",
" scale_x_continuous(breaks = seq(round(min(fileinput$$logFoldChange)- 0.5),",
" round(max(fileinput$$logFoldChange)+ 0.5),by = 1),",
" limits = c(round(min(fileinput$$logFoldChange)-1),round(max(fileinput$$logFoldChange)+1))) +",
" scale_y_continuous(breaks = seq(0,round(-log10(min(fileinput$$padj))+1),by = 4),",
" limits = c(0,round(-log10(min(fileinput$$padj))+1))) +",
" ggtitle(title) +",
" theme_bw() +",
" theme(plot.title = element_text(hjust = 0.5), axis.text = element_text(size = 10),",
" axis.title.x = element_text(size = 10), axis.title.y = element_text(size = 10))",
"}",
"# Usage Example:",
"b = draw_volcano(your_data_frame_variable, \"${YourPlotTitle:Volcano Plot}\")",
"# # Example: Add labels for significant genes:",
"gene_name <- c(\"${your_significant_genes}\")",
"c = b + geom_text_repel(data = ${your_significant_genes_data_frame}, aes(label = gene_name),",
" nudge_x = 0.5, nudge_y = 0.5, segment.size = 0.1)",
"# Save the plot with labels:",
"print(c)",
"dev.copy(pdf, file = \"${PDFFileName}.pdf\", width = 12, height = 12)",
"dev.off()"
],
"description": "Generalized Volcano Plot function and customization steps"
},
"PCA_snippet": {
"prefix": "PCA_snippet",
"body": [
"PCA <- function(mat, color_pca = \"\", shape_pca = \"\", label_pca = \"\", save_plot = \"no\", name_of_plot = \"PCA\", comp1 = 1, comp2 = 2, pdf_height=12, pdf_width=12) {",
" dt <- mat",
" pca_dt <- prcomp(t(dt))",
" cat(\"PCA running...\\n\")",
" percentVar_dt <- pca_dt$$sdev^2 / sum(pca_dt$$sdev^2)",
" cat(\"Percents calculated...\\n\")",
" dt_f <- data.frame(PC1 = pca_dt$$x[, comp1],",
" PC2 = pca_dt$$x[, comp2],",
" color_pca = color_pca,",
" shape_pca = shape_pca,",
" label_pca = label_pca)",
" cat(\"Data frame built...\\n\")",
" cat(\"Plotting...\\n\")",
" require(ggplot2)",
" require(ggrepel)",
" if (save_plot == \"no\") {",
" pca_p <- ggplot(data = dt_f, aes_string(x = paste0(\"PC1\"),",
" y = paste0(\"PC2\"),",
" color = \"color_pca\",",
" shape = \"shape_pca\", label = \"label_pca\")) +",
" geom_point(size = 3) +",
" geom_text_repel(size = 3, max.overlaps = 50,",
" box.padding = 1.5, point.padding = 0.5, force = 50) +",
" xlab(paste0(\"PC\", comp1, \": \", round(percentVar_dt[comp1] * 100), \"% variance\")) +",
" ylab(paste0(\"PC\", comp2, \": \", round(percentVar_dt[comp2] * 100), \"% variance\")) +",
" NULL",
" }",
" if (save_plot == \"yes\") {",
" pdf(filename = paste0(name_of_plot, \".pdf\"), width = pdf_width, height = pdf_height)",
" cat(\"Saving plot as: \", paste0(name_of_plot, \"...\\n\"))",
" pca_p <- ggplot(data = dt_f, aes_string(x = paste0(\"PC\", comp1),",
" y = paste0(\"PC\", comp2),",
" color = \"color_pca\",",
" shape = \"shape_pca\", label = \"label_pca\")) +",
" geom_text_repel(size = 3, max.overlaps = 50,",
" box.padding = 1.5,",
" point.padding = 0.5, force = 50) +",
" geom_point(size = 3) +",
" xlab(paste0(\"PC\", comp1, \": \", round(percentVar_dt[comp1] * 100), \"% variance\")) +",
" ylab(paste0(\"PC\", comp2, \": \", round(percentVar_dt[comp2] * 100), \"% variance\")) +",
" NULL",
" print(pca_p)",
" dev.off()",
" }",
" cat(\"Done\")",
" print(pca_p)",
"}"
],
"description": "Generalized PCA function with parameterized settings for plotting"
},
"clear_memory_functions": {
"prefix": "clear_memory_functions",
"body": [
"rm(list = ls())",
"gc()",
"setwd(\"${working_directory}\")",
"getwd()"
],
"description": "Clear memory and set working directory in R"
}
}