At some point of your project youy will want to make your data available to the public. This often required to happen in the form of a submission to the Sequence Read Archive (SRA), which can be challenging. mbtools includes helpers to prep a submission for you.

In order to create a submission you will need the following:

  1. A file manifest for all of your sequencing data.
  2. A metadata table describing the sequenced samples.
  3. Some basic information about the study and sequencing.

Number 1 is managed as in all other mbtools steps in that it is a file list such as used in quality control etc. For instance for our example data:

library(mbtools)
## Also loading:
##   - dada2=1.12.1
##   - data.table=1.12.6
##   - ggplot2=3.2.1
##   - magrittr=1.5
##   - phyloseq=1.28.0
##   - ShortRead=1.42.0
##   - yaml=2.2.0
## Found tools:
##   - minimap2=2.17-r941
##   - slimm=0.3.4
##   - samtools=1.9
## 
## Attaching package: 'mbtools'
## The following object is masked _by_ 'package:BiocGenerics':
## 
##     normalize
## The following object is masked from 'package:graphics':
## 
##     layout
fi <- system.file("extdata/shotgun", package = "mbtools") %>% find_read_files()

Which gives you:

fi

The metadata is a data frame describing additional attributes for each of those samples. For instance you could use the sample_data() slot of a phyloseq object. However, this table always needs to have a column specifying the sample ID as in the file manifest and a date column denoting the date of sample extraction. Let’s create one for the three samples in our example data:

metadata <- data.table(
    id = fi$id,
    date = rep("2019-01-01", 3),
    diet = c("vegan", "vegitarian", "flexitarian"),
    age = c(23, 38, 64)
)

For the additional study data mbtools will use a set of presets that will set a lot of the information for you but you will still need to specify additional aspects of your study. This is again managed by configurations and you can see the set of configuration variables by creating one with config_sra:

## $metadata
## NULL
## 
## $id_col
## [1] "id"
## 
## $date_col
## [1] "date"
## 
## $country
## [1] "USA"
## 
## $preset
## [1] "human gut 16S"
## 
## $out_dir
## [1] "sra"
## 
## $title
## NULL
## 
## $platform
## [1] "ILLUMINA"
## 
## $instrument_model
## [1] "Illumina MiSeq"
## 
## $bioproject
## NULL
## 
## $latitude
## [1] 42.36
## 
## $longitude
## [1] -71.0941
## 
## $make_package
## [1] TRUE
## 
## attr(,"class")
## [1] "config"

Except for the bioproject (fill only if you already have a BIOPROJECT ID) variable everything else needs to be specified (or the default values will be used). You can check the the list of available presets with:

names(mbtools:::presets)
## [1] "human gut 16S"        "mouse gut 16S"        "human gut metagenome"
## [4] "mouse gut metagenome" "human gut RNA-Seq"    "mouse gut RNA-Seq"

Let’s fill in the data for the example study:

config <- config_sra(
    title = "Sequencing of the gut metagenome: the effect of age on Bacteroides",
    preset = "human gut metagenome",
    platform = "ILLUMINA",
    instrument = "Illumina HiSeq 2000",
    metadata = metadata
)

You can now proceed building the subsmission data:

sra <- sra_submission(fi, config)
## INFO [2019-11-05 08:22:19] Packing submission files to sra/sra_files.tar.gz.
## INFO [2019-11-05 08:22:20] Writing biosample attributes to sra/05_biosample_attributes.tsv.
## INFO [2019-11-05 08:22:20] Writing file metadata to sra/06_sra_metadata.tsv.
## INFO [2019-11-05 08:22:20] You are now ready for submission. **Please make sure you only upload sequence files where human sequences have been removed and (you can use the `filter_reference` workflow for that)!**Go to https://submit.ncbi.nlm.nih.gov/subs/sra/, log in and click on `New submission`. Fill in the general data for your project in steps 1 through 3. In step 4 choose `Genome, metagenome or marker sequences (MIxS compliant)` and `Environmental/Metagenome Genomic Sequences MIMS`. In step 5 and 6 upload the respective files in sra. In step 7 you can directly upload the `*.tar.gz` submission package. Just click on `continue` another time to have the archive unpacked as indicated.

This told us exactly how to submit the data. We urge you to first check all created files for correctness. This can be done by inspecting the return value. For insatnce:

sra$sra_metadata

When looking in the specified folder (./sra by default) you will see the tables for step 5 and 6:

list.files("sra")
## [1] "05_biosample_attributes.tsv" "06_sra_metadata.tsv"        
## [3] "sra_files.tar.gz"

For larger submission we recommend installing the Aspera client in your browser as this will speed up the upload significantly and allow for larger packages.