|
1 |
| -## Function relationships |
2 | 1 |
|
3 |
| - > (of connected functions) |
| 2 | + |
| 3 | + |
| 4 | +## Function relationships |
| 5 | +> (of connected functions) |
4 | 6 |
|
5 | 7 | ```mermaid
|
6 |
| -flowchart LR |
| 8 | + flowchart LR |
7 | 9 |
|
8 |
| - GetGOTerms(GetGOTerms) --> IntersectWithExpressed(IntersectWithExpressed) |
9 |
| - CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) --> FeaturePlotSaveGO(FeaturePlotSaveGO) |
10 |
| - CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) --> GetGOTerms(GetGOTerms) |
11 |
| - CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) --> AddGOScore(AddGOScore) |
12 |
| - GOscoreEvaluation(GOscoreEvaluation) --> CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) |
13 |
| - GOscoreEvaluation(GOscoreEvaluation) --> .convert.GO_term.2.score(.convert.GO_term.2.score) |
14 |
| - GOscoreEvaluation(GOscoreEvaluation) --> CalcClusterAverages_Gruffi(CalcClusterAverages_Gruffi) |
| 10 | + ReassignSmallClusters(ReassignSmallClusters) --> CalculateMedianClusterSize(CalculateMedianClusterSize) |
| 11 | + GetAllGOTermNames(GetAllGOTermNames) --> .convert.score.2.GO_term(.convert.score.2.GO_term) |
| 12 | + FindThresholdsShiny(FindThresholdsShiny) --> PlotNormAndSkew(PlotNormAndSkew) |
| 13 | + PlotNormAndSkew(PlotNormAndSkew) --> CalcStandDevSkewedDistr(CalcStandDevSkewedDistr) |
| 14 | + GrScoreHistogram(GrScoreHistogram) --> GetGruffiClusteringName(GetGruffiClusteringName) |
| 15 | + FindThresholdsAuto(FindThresholdsAuto) --> StressUMAP(StressUMAP) |
| 16 | + FindThresholdsAuto(FindThresholdsAuto) --> PlotNormAndSkew(PlotNormAndSkew) |
| 17 | + FindThresholdsAuto(FindThresholdsAuto) --> GrScoreUMAP(GrScoreUMAP) |
| 18 | + FindThresholdsAuto(FindThresholdsAuto) --> GrScoreHistogram(GrScoreHistogram) |
| 19 | + FindThresholdsAuto(FindThresholdsAuto) --> .round(.round) |
| 20 | + FindThresholdsAuto(FindThresholdsAuto) --> FeaturePlotSaveGO(FeaturePlotSaveGO) |
15 | 21 | FilterStressedCells(FilterStressedCells) --> .convert.GO_term.2.score(.convert.GO_term.2.score)
|
16 | 22 | CustomScoreEvaluation(CustomScoreEvaluation) --> CalcClusterAverages_Gruffi(CalcClusterAverages_Gruffi)
|
| 23 | + GetGOTerms(GetGOTerms) --> IntersectWithExpressed(IntersectWithExpressed) |
| 24 | + FeaturePlotSaveGO(FeaturePlotSaveGO) --> .parse.GO(.parse.GO) |
17 | 25 | AutoFindGranuleResolution(AutoFindGranuleResolution) --> CalculateMedianClusterSize(CalculateMedianClusterSize)
|
| 26 | + CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) --> GetGOTerms(GetGOTerms) |
| 27 | + CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) --> FeaturePlotSaveGO(FeaturePlotSaveGO) |
| 28 | + CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) --> AddGOScore(AddGOScore) |
| 29 | + AssignGranuleAverageScoresFromGOterm(AssignGranuleAverageScoresFromGOterm) --> CalculateAndPlotGoTermScores(CalculateAndPlotGoTermScores) |
| 30 | + AssignGranuleAverageScoresFromGOterm(AssignGranuleAverageScoresFromGOterm) --> CalcClusterAverages_Gruffi(CalcClusterAverages_Gruffi) |
| 31 | + AssignGranuleAverageScoresFromGOterm(AssignGranuleAverageScoresFromGOterm) --> .convert.GO_term.2.score(.convert.GO_term.2.score) |
18 | 32 | AddGOScore(AddGOScore) --> .fix.metad.colname.rm.trailing.1(.fix.metad.colname.rm.trailing.1)
|
19 | 33 | AddGOGeneList.manual(AddGOGeneList.manual) --> IntersectWithExpressed(IntersectWithExpressed)
|
20 | 34 | AddCustomScore(AddCustomScore) --> .fix.metad.colname.rm.trailing.1(.fix.metad.colname.rm.trailing.1)
|
21 |
| -
|
22 |
| - FindThresholdsShiny(FindThresholdsShiny) --> PlotNormAndSkew(PlotNormAndSkew) |
23 |
| - FindThresholdsAuto(FindThresholdsAuto) --> PlotNormAndSkew(PlotNormAndSkew) |
24 |
| - PlotNormAndSkew(PlotNormAndSkew) --> CalcStandDevSkewedDistr(CalcStandDevSkewedDistr) |
25 |
| -
|
26 |
| - GetAllGOTermNames(GetAllGOTermNames) --> .convert.score.2.GO_term(.convert.score.2.GO_term) |
27 |
| -
|
28 | 35 | ```
|
29 |
| - |
30 |
| - *created by `convert_igraph_to_mermaid()`* |
31 |
| - |
32 |
| - |
33 |
| - |
34 |
| -## List of Functions in gruffi.R (31) |
35 |
| - |
36 |
| -Updated: 2024/02/15 00:28 |
37 |
| - |
38 |
| -- #### 1 `ReassignSmallClusters()` |
39 |
| - |
40 |
| - Reassign granules (clusters) smaller than X to nearby granules based on 3D UMAP coordinates. |
41 |
| - |
42 |
| -- #### 2 `CalculateMedianClusterSize()` |
43 |
| - |
44 |
| - Calculate Median Cluster Size. This function calculates and returns the median size of clusters for a given assay and resolution in a Seurat object. It provides an option to display the median size via message. |
45 |
| - |
46 |
| -- #### 3 `GetGOTerms()` |
47 |
| - |
48 |
| - GetGOTerms. Get GO Terms |
49 |
| - |
50 |
| -- #### 4 `GetAllGOTermNames()` |
51 |
| - |
52 |
| - Show All GO Terms in an Object, and retrieve corresponding names using AnnotationDbi. Retrieves and optionally annotates all GO term identifiers present in the metadata of a Seurat object. It identifies columns starting with 'Score.GO', extracts the corresponding GO terms, retrieves tge corresponding term-names using AnnotationDbi, and optionally saving them back into the object. |
53 |
| - |
54 |
| -- #### 5 `AddGOGeneList.manual()` |
55 |
| - |
56 |
| - Add a GO-term gene list under obj@misc$GO$xxxx. |
57 |
| - |
58 |
| -- #### 6 `AddGOScore()` |
59 |
| - |
60 |
| - Add GO Score to a Seurat object |
61 |
| - |
62 |
| -- #### 7 `AddCustomScore()` |
63 |
| - |
64 |
| - Add a custom gene expression score from a set of genes provided to the Seurat single cell object. Calculates Score for gene set. Fixes name. |
65 |
| - |
66 |
| -- #### 8 `GOscoreEvaluation()` |
67 |
| - |
68 |
| - GO-score evaluation for filtering. |
69 |
| - |
70 |
| -- #### 9 `CustomScoreEvaluation()` |
71 |
| - |
72 |
| - Custom gene-set derived score evaluation for filtering. |
73 |
| - |
74 |
| -- #### 10 `FindThresholdsShiny()` |
75 |
| - |
76 |
| - Launch Shiny App for GO Term-based Thresholding. Launches a Shiny application to interactively apply GO term-based thresholding for identifying stressed cells in a Seurat object. This function calculates the "granule average GO-scores" for individual GO terms and updates the object with a combined stress identification based on these thresholds.#' |
77 |
| - |
78 |
| -- #### 11 `FindThresholdsAuto()` |
79 |
| - |
80 |
| - Automated GO Term-based Thresholding without using a Shiny app.. Automatically applies granular GO term-based thresholding to identify stressed cells in a Seurat object without launching a Shiny app. This function calculates the "granule average GO-scores" for individual GO terms and updates the object with a combined stress identification based on these thresholds. |
81 |
| - |
82 |
| -- #### 12 `FilterStressedCells()` |
83 |
| - |
84 |
| - Filter Stressed Cells from a Seurat Object. Identifies and filters stressed cells based on specified GO terms and a quantile threshold. It supports optional plotting of exclusion results and saving of modified datasets. |
85 |
| - |
86 |
| -- #### 13 `CalculateAndPlotGoTermScores()` |
87 |
| - |
88 |
| - Plot GO-term scores. |
89 |
| - |
90 |
| -- #### 14 `FeaturePlotSaveCustomScore()` |
91 |
| - |
92 |
| - Plot and save a Seurat FeaturePlot with a custom score in the meta data. |
93 |
| - |
94 |
| -- #### 15 `FeaturePlotSaveGO()` |
95 |
| - |
96 |
| - Plot and save a Seurat FeaturePlot from a GO-score. |
97 |
| - |
98 |
| -- #### 16 `PlotClustSizeDistr()` |
99 |
| - |
100 |
| - Plot cluster size distribution. |
101 |
| - |
102 |
| -- #### 17 `PlotNormAndSkew()` |
103 |
| - |
104 |
| - Plot normal distribution and skew. |
105 |
| - |
106 |
| -- #### 18 `UMAP3Dcubes()` |
107 |
| - |
108 |
| - UMAP with 3D cubes. |
109 |
| - |
110 |
| -- #### 19 `GrScoreUMAP()` |
111 |
| - |
112 |
| - Wrapper for clUMAP with Thresholding and Plotting. This function applies thresholding to granule scores within a specified object and column, inverts the thresholding if a specific miscellaneous name is provided, and then calls clUMAP for plotting based on the thresholded values. |
113 |
| - |
114 |
| -- #### 20 `GrScoreHistogram()` |
115 |
| - |
116 |
| - Histogram Visualization of Granule Scores with Threshold. Plots a histogram of granule scores from a specified column within a Seurat object, with a vertical line denoting a threshold. The function allows for an optional inversion of filtering logic based on the `miscname` and `auto` parameters. |
117 |
| - |
118 |
| -- #### 21 `ClusterUMAPthresholding()` |
119 |
| - |
120 |
| - clUMAP with threshold value. |
121 |
| - |
122 |
| -- #### 22 `CalcTranscriptomePercentageGO()` |
123 |
| - |
124 |
| - Calculate the percentage of transcriptome, for a given GO-term gene set already stored`in obj@misc$GO[[GO.score]]. |
125 |
| - |
126 |
| -- #### 23 `CalcTranscriptomePercentage()` |
127 |
| - |
128 |
| - Calculate the percentage of transcriptome, for a given gene set. |
129 |
| - |
130 |
| -- #### 24 `CalcStandDevSkewedDistr()` |
131 |
| - |
132 |
| - Calculate Standard Deviation for Skewed Distributions. Computes a modified standard deviation for skewed distributions by mirroring data points about the mean. This approach aims to reflect the skewed part of the distribution to better understand its spread. |
133 |
| - |
134 |
| -- #### 25 `CalcClusterAverages_Gruffi()` |
135 |
| - |
136 |
| - Calculate granule (cluster) averages scores. |
137 |
| - |
138 |
| -- #### 26 `GetGruffiClusteringName()` |
139 |
| - |
140 |
| - Retrieve First Clustering Run or First Matching Pattern Run. Fetches the first clustering run from a Seurat object, optionally filtered by a specific pattern (e.g., ".reassigned"). |
141 |
| - |
142 |
| -- #### 27 `CleanDuplicateScorenames()` |
143 |
| - |
144 |
| - Remove duplicate scorenames from obj@mata.data. |
145 |
| - |
146 |
| -- #### 28 `IntersectWithExpressed()` |
147 |
| - |
148 |
| - Intersect a gene set with the list of expressed genes. |
149 |
| - |
150 |
| -- #### 29 `.convert.GO_term.2.score()` |
151 |
| - |
152 |
| - .convert.GO_term.2.score. Convert a string GO_term-name to Score-name. |
153 |
| - |
154 |
| -- #### 30 `.convert.score.2.GO_term()` |
155 |
| - |
156 |
| - .convert.score.2.GO_term. Convert a string Score-name to GO_term-name. |
157 |
| - |
158 |
| -- #### 31 `.fix.metad.colname.rm.trailing.1()` |
159 |
| - |
160 |
| - .fix.metad.colname.rm.trailing.1. Fix malformed (suffxed) column names in obj@meta.data. When running AddGOScore(), a '1' is added to the end of the column name. It is hereby removed. |
| 36 | +*created by `convert_igraph_to_mermaid()`* |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +- ## List of Functions in gruffi.R (34) |
| 41 | + |
| 42 | + Updated: 2024/03/02 15:19 |
| 43 | + |
| 44 | + - #### 1 `ReassignSmallClusters()` |
| 45 | + |
| 46 | + ReassignSmallClusters. Reassign granules (clusters) smaller than X to nearby granules based on 3D UMAP coordinates. |
| 47 | + |
| 48 | + - #### 2 `CalculateMedianClusterSize()` |
| 49 | + |
| 50 | + Calculate Median Cluster Size. This function calculates and returns the median size of clusters for a given assay and resolution in a Seurat object. It provides an option to display the median size via message. |
| 51 | + |
| 52 | + - #### 3 `GetGOTerms()` |
| 53 | + |
| 54 | + Retrieve Gene Ontology (GO) Terms and Associated Genes. Fetches genes associated with a specified Gene Ontology (GO) term and optionally opens the GO term page. The genes are retrieved using either the Ensembl database via biomaRt or from precomputed GO_genes results stored in the Seurat object. |
| 55 | + |
| 56 | + - #### 4 `GetAllGOTermNames()` |
| 57 | + |
| 58 | + Show All GO Terms in an Object, and retrieve corresponding names using AnnotationDbi. Retrieves and optionally annotates all GO term identifiers present in the metadata of a Seurat object. It identifies columns starting with 'Score.GO', extracts the corresponding GO terms, retrieves tge corresponding term-names using AnnotationDbi, and optionally saving them back into the object. |
| 59 | + |
| 60 | + - #### 5 `CalculateAndPlotGoTermScores()` |
| 61 | + |
| 62 | + Calculate and Plot GO Term Scores. Automates the process of obtaining and calculating of Gene Ontology (GO) term-based gene set scores and it's visualization through UMAP plots. |
| 63 | + |
| 64 | + - #### 6 `AssignGranuleAverageScoresFromGOterm()` |
| 65 | + |
| 66 | + Assign granule average scores from Gene Ontology (GO) terms.. Calculates and assigns granule average scores from Gene Ontology (GO) term in a Seurat object. It can compute new GO term scores, plot gene expressions, and save UMAP visualizations. The function updates the Seurat object with cluster average scores for the specified GO term. |
| 67 | + |
| 68 | + - #### 7 `AddGOGeneList.manual()` |
| 69 | + |
| 70 | + AddGOGeneList.manual. Add a GO-term gene list under obj@misc$gruffi$GO$xxxx. |
| 71 | + |
| 72 | + - #### 8 `AddGOScore()` |
| 73 | + |
| 74 | + AddGOScore. Add GO Score to a Seurat object |
| 75 | + |
| 76 | + - #### 9 `AddCustomScore()` |
| 77 | + |
| 78 | + AddCustomScore. Add a custom gene expression score from a set of genes provided to the Seurat single cell object. Calculates Score for gene set. Fixes name. |
| 79 | + |
| 80 | + - #### 10 `CustomScoreEvaluation()` |
| 81 | + |
| 82 | + CustomScoreEvaluation. Custom gene-set derived score evaluation for filtering. |
| 83 | + |
| 84 | + - #### 11 `FindThresholdsShiny()` |
| 85 | + |
| 86 | + Launch Shiny App for GO Term-based Thresholding. Launches a Shiny application to interactively apply GO term-based thresholding for identifying stressed cells in a Seurat object. This function calculates the "granule average GO-scores" for individual GO terms and updates the object with a combined stress identification based on these thresholds.#' |
| 87 | + |
| 88 | + - #### 12 `FindThresholdsAuto()` |
| 89 | + |
| 90 | + Automated GO Term-based Thresholding without using a Shiny app.. Automatically applies granular GO term-based thresholding to identify stressed cells in a Seurat object without launching a Shiny app. This function calculates the "granule average GO-scores" for individual GO terms and updates the object with a combined stress identification based on these thresholds. |
| 91 | + |
| 92 | + - #### 13 `FeaturePlotSaveCustomScore()` |
| 93 | + |
| 94 | + FeaturePlotSaveCustomScore. Plot and save a Seurat FeaturePlot with a custom score in the meta data. |
| 95 | + |
| 96 | + - #### 14 `FeaturePlotSaveGO()` |
| 97 | + |
| 98 | + FeaturePlotSaveGO. Plot and save a Seurat FeaturePlot from a GO-score. |
| 99 | + |
| 100 | + - #### 15 `PlotClustSizeDistr()` |
| 101 | + |
| 102 | + PlotClustSizeDistr. Plot cluster size distribution. |
| 103 | + |
| 104 | + - #### 16 `PlotNormAndSkew()` |
| 105 | + |
| 106 | + PlotNormAndSkew. Plot normal distribution and skew. |
| 107 | + |
| 108 | + - #### 17 `GrScoreUMAP()` |
| 109 | + |
| 110 | + Wrapper for clUMAP with Thresholding and Plotting. This function applies thresholding to granule scores within a specified object and column, inverts the thresholding if a specific miscellaneous name is provided, and then calls clUMAP for plotting based on the thresholded values. |
| 111 | + |
| 112 | + - #### 18 `GrScoreHistogram()` |
| 113 | + |
| 114 | + Histogram Visualization of Granule Scores with Threshold. Plots a histogram of granule scores from a specified column within a Seurat object, with a vertical line denoting a threshold. The function allows for an optional inversion of filtering logic based on the `miscname` and `auto` parameters. |
| 115 | + |
| 116 | + - #### 19 `ClusterUMAPthresholding()` |
| 117 | + |
| 118 | + ClusterUMAPthresholding. clUMAP with threshold value. |
| 119 | + |
| 120 | + - #### 20 `StressUMAP()` |
| 121 | + |
| 122 | + Plot Stress Assignment UMAP. Plot Stress Assignment UMAP after running the gruffi pipeline |
| 123 | + |
| 124 | + - #### 21 `StressBarplotPerCluster()` |
| 125 | + |
| 126 | + Stress Barplot Per Cluster. This function generates a bar plot for cell fractions, filled by stress status across clusters. It utilizes the first clustering run for grouping and applies a custom color scale. |
| 127 | + |
| 128 | + - #### 22 `CalcTranscriptomePercentageGO()` |
| 129 | + |
| 130 | + CalcTranscriptomePercentageGO. Calculate the percentage of transcriptome, for a given GO-term gene set already stored`in obj@misc$gruffi$GO[[GO.score]]. |
| 131 | + |
| 132 | + - #### 23 `CalcTranscriptomePercentage()` |
| 133 | + |
| 134 | + CalcTranscriptomePercentage. Calculate the percentage of transcriptome, for a given gene set. |
| 135 | + |
| 136 | + - #### 24 `CalcStandDevSkewedDistr()` |
| 137 | + |
| 138 | + Calculate Standard Deviation for Skewed Distributions. Computes a modified standard deviation for skewed distributions by mirroring data points about the mean. This approach aims to reflect the skewed part of the distribution to better understand its spread. |
| 139 | + |
| 140 | + - #### 25 `CalcClusterAverages_Gruffi()` |
| 141 | + |
| 142 | + Calculate Cluster Averages for Granules in a Seurat Object. Calculates the central tendency (mean or median) of specified scores for clusters (granules) within a Seurat object and optionally plots these averages. |
| 143 | + |
| 144 | + - #### 26 `GetGruffiClusteringName()` |
| 145 | + |
| 146 | + Retrieve First Clustering Run or First Matching Pattern Run. Fetches the first clustering run from a Seurat object, optionally filtered by a specific pattern (e.g., ".reassigned"). |
| 147 | + |
| 148 | + - #### 27 `ParseGruffiGranuleScoreName()` |
| 149 | + |
| 150 | + Generate Gruffi Granule Score Name. This function creates a standardized score name using granule resolution and a Gene Ontology (GO) identifier. |
| 151 | + |
| 152 | + - #### 28 `CleanDuplicateScorenames()` |
| 153 | + |
| 154 | + CleanDuplicateScorenames. Remove duplicate scorenames from obj meta.data (same score, different numeric suffix). |
| 155 | + |
| 156 | + - #### 29 `IntersectWithExpressed()` |
| 157 | + |
| 158 | + IntersectWithExpressed. Intersect a gene set with the list of expressed genes. |
| 159 | + |
| 160 | + - #### 30 `ClearGruffi()` |
| 161 | + |
| 162 | + Remove gruffi results from the Seurat object. Removes corresponding metadata columns and clear @misc$gruffi slot |
| 163 | + |
| 164 | + - #### 31 `.convert.GO_term.2.score()` |
| 165 | + |
| 166 | + .convert.GO_term.2.score. Convert a string GO_term-name to Score-name. |
| 167 | + |
| 168 | + - #### 32 `.convert.score.2.GO_term()` |
| 169 | + |
| 170 | + .convert.score.2.GO_term. Convert a string Score-name to GO_term-name. |
| 171 | + |
| 172 | + - #### 33 `.fix.metad.colname.rm.trailing.1()` |
| 173 | + |
| 174 | + .fix.metad.colname.rm.trailing.1. Fix malformed (suffxed) column names in obj@meta.data. When running AddGOScore(), a '1' is added to the end of the column name. It is hereby removed. |
| 175 | + |
| 176 | + - #### 34 `.parse.GO()` |
| 177 | + |
| 178 | + Parse GO Term from Granule-score Name. Splits a Granule-score column name into its clustering resolution and GO term, and returns the 2nd part, the GO Term. |
161 | 179 |
|
0 commit comments