A APPENDICES
A.2 IMAP repos
Repo | Description | Status |
---|---|---|
IMAP-OVERVIEW | IMAP project overview | In-progress |
IMAP-PART 01 | Software requirement for microbiome data analysis with Snakemake workflows | In-progress |
IMAP-PART 02 | Downloading and exploring microbiome sample metadata from SRA Database | In-progress |
IMAP-PART 03 | Downloading and filtering microbiome sequencing data from SRA database | In-progress |
IMAP-PART 04 | Quality Control of Microbiome Next Generation Sequencing Reads | In-progress |
IMAP-PART 05 | Microbial profiling using MOTHUR and Snakemake workflows | In-progress |
IMAP-PART 06 | Microbial profiling using QIIME2 and Snakemake workflows | In-progress |
IMAP-PART 07 | Processing Output from 16S-Based microbiome bioinformatics pipelines | In-progress |
IMAP-PART 08 | Exploratory Analysis of 16S-Based Microbiome Processed Data | In-progress |
IMAP-SUMMARY | Summary of snakemake workflows for microbiome data analysis | In-progress |
A.3 Convert PNG2GIFF
library(gifski)
png_path <- "figures/"
if (!dir.exists("gifski")) {dir.create("gifski")}
png_files <- list.files(path = png_path, pattern = "\\.png$", full.names = TRUE)
cat("\nThere are", length(png_files), "PNG files in the figures directory\n\n")
There are 45 PNG files in the figures directory
# Create a gifski object
gifski(png_files, gif_file = "gifski/PNG_animation.gif", loop = 2, delay = 3)
[1] "/Users/tmbmacbookair/Dropbox/2024/bs4_book/gifski/PNG_animation.gif"
A.5 Extract session package names
# R script to extract package names from sessionInfo() and create a YAML file
session_info <- sessionInfo()
attached_packages <- session_info$otherPkgs
package_names <- names(attached_packages)
writeLines(package_names, "workflow/scripts/package_names.txt")
package_names
[1] "gifski" "scales" "lubridate" "forcats" "stringr" "dplyr"
[7] "purrr" "readr" "tidyr" "tibble" "ggplot2" "tidyverse"
A.6 Demo installing multiple packages in R
R script
packages <- readLines(“package_names.txt”) install.packages(packages, repos = “https://cloud.r-project.org”)
Write installation status to a file
installed_packages <- rownames(installed.packages()) writeLines(installed_packages, “installed_packages.txt”)
Python script
import subprocess
with open(“package_names.txt”, “r”) as f: packages = f.read().splitlines()
for package in packages: subprocess.run([“pip”, “install”, package])
Write installation status to a file
installed_packages = subprocess.run([“pip”, “freeze”], capture_output=True, text=True).stdout with open(“installed_packages.txt”, “w”) as f: f.write(installed_packages)
Creating YAML file for R packages
library(yaml)
channels <- c(“conda-forge”, “r”, “defaults”) # Add all potential channels here yaml_data <- list(name = “rpackages”, dependencies = paste0(“r-”, package_names))
write_yaml(yaml_data, “environment.yml”)
Snakemake rule to install packages rule install_packages: input: “package_names.txt”, “environment.yml” output: “installed_packages.txt” conda: “environment.yml” shell: ““” Rscript install_packages.R python install_packages.py ““” params: use_conda=“–use-conda”