Skip to contents

Package Design

The lims2sra package works with common-format LIMS sample reports (one row per aliquot). It is designed to summarize and visualize the samples a cohort has in the LIMS, and to generate Microbe (v1.0) and Metagenome or environmental (v1.0) BioSample submission descriptions to accompany sequence data submission to the NCBI SRA.

It includes:

  • lims_aggregate(), to combine one or more LIMS reports and summarize them by aliquot, collection event (subject, sample type and collection date), subject, sample type, collection date, microbial species or study, or any combination of these
  • lims_timeline(), to plot a cohort’s sampling timeline: one row per subject, one point per collection event or aliquot
  • lims_heatmap(), to plot counts of aliquots, collection events, subjects and more across any two levels (e.g. subjects by sample type), optionally in panels by study, subject or sample type
  • setup_conda_hrrt(), document_conda_hrrt() and hrrt_local(), to mask human reads in local metagenomic FASTQ files with NCBI’s Human Read Removal Tool before an SRA upload (Linux on x86-64 only)
  • prepare_sra_metadata(), to output BioSample and SRA metadata tables, based on a directory containing sequence files and the LIMS system report matching the sequence filenames

See the package website for vignettes on each.

The lims2sra package has been used to support multiple submissions to the NCBI SRA.

Example Workflow

#' load libraries

library(lims2sra)
library(readr)
library(readxl)
library(writexl)
library(dplyr)


#' generates error:
prepare_sra_metadata(input_xlsx = "data/IDSampleByStudy_brendank_Nov-02-2026-04-04-43.xlsx", package = "metagenome", output_dir = "tabs/gol_run1", bioproject_accession = "", geo_loc_name = "USA: Philadelphia, PA", lat_lon = "39.95 N 75.19 W", fastq_dir = "/mnt/d/QUO1022280/Illumina DNA Reads/", library_strategy = "WGS", library_selection = "RANDOM", platform = "ILLUMINA", instrument_model = "Illumina NovaSeq 6000")


#' make sure underscores and hyphens align (may be exchanged, for example per filename requirements of sequencing core) 


#' align sample names
read_xlsx("data/IDSampleByStudy_brendank_Nov-02-2026-04-04-43.xlsx") |>
  mutate(Sample = gsub("-","_", Sample)) |> 
  write_xlsx(path = "data/underscore_IDSampleByStudy_brendank_Nov-02-2026-04-04-43.xlsx")


#' no error:
#' run 1
prepare_sra_metadata(input_xlsx = "data/underscore_IDSampleByStudy_brendank_Nov-02-2026-04-04-43.xlsx", package = "metagenome", output_dir = "tabs/gol_run1", bioproject_accession = "", geo_loc_name = "USA: Philadelphia, PA", lat_lon = "39.95 N 75.19 W", fastq_dir = "/mnt/d/QUO1022280/Illumina DNA Reads/", library_strategy = "WGS", library_selection = "RANDOM", platform = "ILLUMINA", instrument_model = "Illumina NovaSeq 6000")

#' run 2
prepare_sra_metadata(input_xlsx = "data/underscore_IDSampleByStudy_brendank_Nov-02-2026-04-04-43.xlsx", package = "metagenome", output_dir = "tabs/gol_run2", bioproject_accession = "", geo_loc_name = "USA: Philadelphia, PA", lat_lon = "39.95 N 75.19 W", fastq_dir = "/mnt/d/QUO1025236/Illumina DNA Reads/", library_strategy = "WGS", library_selection = "RANDOM", platform = "ILLUMINA", instrument_model = "Illumina NovaSeq 6000")


#' combine output files for SRA submission
bind_rows(read_xlsx("tabs/gol_run1/Metagenome.environmental.1.0_submission.xlsx"), read_xlsx("tabs/gol_run2/Metagenome.environmental.1.0_submission.xlsx")) |> 
  write_xlsx(path = "tabs/combined_gol_sra_submission.xlsx")

bind_rows(read_tsv("tabs/gol_run1/Metagenome.environmental.1.0_sra_metadata.tsv"), read_tsv("tabs/gol_run2/Metagenome.environmental.1.0_sra_metadata.tsv")) |> 
  write_tsv(file = "tabs/combined_gol_sra_metadata.tsv")