Skip to content

Commit

Permalink
Update report.qmd to handle other colours
Browse files Browse the repository at this point in the history
  • Loading branch information
smlmbrt committed Oct 2, 2023
1 parent 5276ae8 commit c4719f4
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions assets/report/report.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,23 @@ if(params$run_ancestry == TRUE){
```{r colour_palette, echo = FALSE, eval=params$run_ancestry}
# source: https://github.com/PGScatalog/PGS_Catalog/blob/master/catalog/static/catalog/pgs.scss#L2493-L2520
# $ancestry_colours
thousand_genomes_colours <- c("#FFD900", "#E41A1C", "#B15928", "#4DAF4A",
"#377EB8", "#00CED1", "#984EA3", "#A6CEE3",
"#FF7F00", "#BBB", "#999")
names(thousand_genomes_colours) <- c("AFR", "AMR", "ASN", "EAS", "EUR", "GME",
"SAS", "MAE", "MAO", "NR", "OTH")
thousand_genomes_palette <- scale_colour_manual(name = "Populations", values = thousand_genomes_colours)
if({params$reference_panel_name} == '1000G'){
thousand_genomes_colours <- c("#FFD900", "#E41A1C", "#B15928", "#4DAF4A",
"#377EB8", "#00CED1", "#984EA3", "#A6CEE3",
"#FF7F00", "#BBB", "#999")
names(thousand_genomes_colours) <- c("AFR", "AMR", "ASN", "EAS",
"EUR", "GME", "SAS", "MAE",
"MAO", "NR", "OTH")
current_population_palette <- scale_colour_manual(name = "Populations", values = thousand_genomes_colours)
} else if({params$reference_panel_name} == 'HGDP+1kGP'){
gnomAD_pop_colours <- c("#97519d", "#e42523", "#f67e1e", "#48b24b",
"#3280bb", "#a65528", "#9a9c9b")
names(gnomAD_pop_colours) <- c("AFR", "AMR", "CSA", "EAS",
"EUR", "MID", "OCE")
current_population_palette <- scale_colour_manual(name = "Populations", values = gnomAD_pop_colours)
} else{
current_population_palette <- scale_colour_brewer(palette="Set3")
}
```

```{r, echo = FALSE, message = FALSE, eval=params$run_ancestry}
Expand All @@ -321,7 +332,7 @@ for(pc in seq.int(1,5,2)){
if (pcX %in% colnames(popsim)){
p_pca <- ggplot(popsim[popsim$REFERENCE == TRUE,], aes(x=!!sym(pcX), y=!!sym(pcY))) + geom_point(aes(colour=SuperPop, shape=slabel), alpha=0.25)
p_pca <- p_pca + geom_point(data=popsim[popsim$REFERENCE != TRUE,], aes(color=MostSimilarPop, shape=slabel))
p_pca <- p_pca + theme_bw() + thousand_genomes_palette + scale_shape_manual(values=map_shapes, name='sampleset')
p_pca <- p_pca + theme_bw() + current_population_palette + scale_shape_manual(values=map_shapes, name='sampleset')
print(p_pca)
}
}
Expand Down Expand Up @@ -492,4 +503,4 @@ For scores from the PGS Catalog, please remember to cite the original publicatio

> PGS Catalog Calculator (in development). PGS Catalog Team. `https://github.com/PGScatalog/pgsc_calc`
> Lambert et al. (2021) The Polygenic Score Catalog as an open database for reproducibility and systematic evaluation. Nature Genetics. 53:420–425 doi:10.1038/s41588-021-00783-5.
> Lambert et al. (2021) The Polygenic Score Catalog as an open database for reproducibility and systematic evaluation. Nature Genetics. 53:420–425 doi:10.1038/s41588-021-00783-5.

0 comments on commit c4719f4

Please sign in to comment.