Skip to content

Commit

Permalink
Add resources table
Browse files Browse the repository at this point in the history
  • Loading branch information
mblue9 committed Sep 26, 2024
1 parent e8ca9f5 commit edd7245
Show file tree
Hide file tree
Showing 3 changed files with 125 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ website:
left:
- text: "Home"
href: index.qmd
- text: "Resources"
href: resources/resources.qmd
- text: "Carpentries"
menu:
- text: "Overview"
Expand Down
23 changes: 23 additions & 0 deletions resources/resources-table.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Category Resource Acquire the Fundamentals (novice R) Acquire the Fundamentals (experienced R) Analyze Your Data Connect with the Community Train Others Develop a Package URL
Bioconductor Carpentry bioc-intro X X X https://carpentries-incubator.github.io/bioc-intro
Bioconductor Carpentry Topic specific (e.g. *bioc-rnaseq*) X X X https://carpentries-incubator.github.io/bioc-rnaseq
Bioconductor Carpentry bioc-project X X X X https://carpentries-incubator.github.io/bioc-project
Bioconductor Conferences Keynotes/Talks X X X
Bioconductor Conferences Package Demos/Workshops X X X X X X
Bioconductor Conferences Networking X
Other Workshops Longer courses (e.g. CSAMA, CSHL) X X X https://csama2024.bioconductor.eu
Other Workshops Everything else (e.g. local, GTN, Carpentries, commercial offerings) X X X X
Packages Help pages X X
Packages Vignettes X X X
Packages Workflows X X https://www.bioconductor.org/packages/release/workflows
Packages Datasets X X X
Packages GitHub Issues X X
Books R for Data Science X X https://r4ds.hadley.nz
Books Bioconductor Books X X https://bioconductor.org/help/bioconductor-books
Books R packages/Advanced R X X https://adv-r.hadley.nz/
Books Bioconductor contributor guide X https://contributions.bioconductor.org
Community Support Site X X X X X https://support.bioconductor.org
Community Slack X X X X X X https://slack.bioconductor.org
Community Developer Mailing List X X https://stat.ethz.ch/mailman/listinfo/bioc-devel
Community Bioconductor YouTube channel X X https://www.youtube.com/user/bioconductor
Community Special Interest Groups (e.g. R-Ladies, R User Groups) X
100 changes: 100 additions & 0 deletions resources/resources.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
title: "Resources"
format: html
editor: visual
execute:
message: false
warning: false
echo: false
---

The table below lists various resources for learning and teaching Bioconductor. If you're looking for more information or have updates, feel free to suggest changes via issues or contact us as described [here](index.qmd).

```{r}
# Load necessary libraries
library(readr)
library(dplyr)
library(htmltools)
# Function to read resources data
read_resources <- function(file_path) {
tryCatch({
resources <- read_tsv(file_path,
col_types = cols(.default = "c"),
na = c("", "NA", "N/A"))
resources
}, error = function(e) {
stop("Error reading the TSV file: ", e$message)
})
}
# Load the data from the TSV file
resources_data <- read_resources("resources-table.tsv")
# Function to replace NA with empty strings
replace_na_with_empty <- function(x) {
if (is.na(x)) "" else x
}
# Define styles for category and resource rows with reduced padding and smaller font
category_style <- "background-color: #f0f0f0; font-weight: bold; border-bottom: 2px solid #ddd; font-size: 12px;" # Lighter grey and smaller font
resource_style <- "background-color: #ffffff !important; border-bottom: 1px solid #ddd; font-size: 12px;" # Smaller font size for rows
# Create the HTML table with categories as headings
html_table <- paste0(
"<table data-quarto-disable-processing='true' style='border-collapse: collapse; width: 100%; border: 1px solid #ddd;'>", # Add data-quarto-disable-processing attribute
"<thead>",
"<tr style='background-color: #f6f8fa; font-weight: bold; border-bottom: 2px solid #ddd; font-size: 12px;'>", # Reduced font size for headers
"<th style='border-right: 1px solid #ddd; padding: 4px;'>Resource</th>",
"<th style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>Acquire the Fundamentals (novice R)</th>",
"<th style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>Acquire the Fundamentals (experienced R)</th>",
"<th style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>Analyze Your Data</th>",
"<th style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>Connect with the Community</th>",
"<th style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>Train Others</th>",
"<th style='padding: 4px; text-align: center;'>Develop a Package</th>",
"</tr>",
"</thead><tbody>",
# Iterate over the categories and their corresponding resources
resources_data %>%
group_by(Category) %>%
group_split() %>%
lapply(function(category_group) {
category_name <- unique(category_group$Category)
paste0(
# Lightly shaded category row
"<tr style='", category_style, "'>",
"<td colspan='7' style='padding: 4px;'>",
category_name,
"</td></tr>",
# Resource rows with white background and centered X
apply(category_group, 1, function(row) {
# Create resource link if URL is available
resource_link <- if (!is.na(row["URL"]) && row["URL"] != "") {
paste0("<a href='", row["URL"], "' target='_blank'>", row["Resource"], "</a>")
} else {
row["Resource"]
}
# Construct the resource row with white background and centered X
paste0("<tr style='", resource_style, "'>",
"<td style='border-right: 1px solid #ddd; padding: 4px;'>", resource_link, "</td>",
"<td style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>", replace_na_with_empty(row[3]), "</td>",
"<td style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>", replace_na_with_empty(row[4]), "</td>",
"<td style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>", replace_na_with_empty(row[5]), "</td>",
"<td style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>", replace_na_with_empty(row[6]), "</td>",
"<td style='border-right: 1px solid #ddd; padding: 4px; text-align: center;'>", replace_na_with_empty(row[7]), "</td>",
"<td style='padding: 4px; text-align: center;'>", replace_na_with_empty(row[8]), "</td>",
"</tr>")
}) %>% paste0(collapse = "")
)
}) %>%
paste0(collapse = ""),
"</tbody></table>"
)
# Output the HTML table using htmltools::HTML()
HTML(html_table)
```

0 comments on commit edd7245

Please sign in to comment.