Preprint available from bioRxiv
Full text available from Ecology Letters
Supporting data and code is provided under the MIT License.
git clone https://github.com/slhogle/hambiConsumerCompetition.git
R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Pop!_OS 21.04
JAGS: deb jags (4.3.0-3build1)
STAN: 2.21.0
Project R dependencies are managed with pak
and renv
. This allows one to restore the
correct package versions for this project to run with the system and R version
listed above. You will need to also install JAGS. On Ubuntu you can do sudo apt-get install jags
To setup packages to the versions used in this analysis, simply run:
renv::restore()
from the main project directory.
/sh
contains scripts from running analysis on the puhti compute cluster/r
contains R scripts/data_raw
contains unprocessed data/data
contains data that has been processed in some way for from/dataRaw
for downstream use/figs
contains figures generated from R scripts/tables
contains summary tables generated from R scripts/rendered
contains any markdown or HTML that gets rendered in the process of running the scripts.
Install the NCBI SRA Toolkit. You can download a prebuilt binary from here.
Access SRA data following the instructions here.
You will need to setup your configurations, but afterwards you could basically do:
prefetch SRR14323812
fasterq-dump SRR14323812
You will need to do this for all the SRA accessions associated with BioProject: PRJNA725120. For example:
cut -f1 data/sra_records.tsv | while read ID; do
prefetch $ID
fasterq-dump $ID
done
Run these steps on an HPC cluster
amplicon_quality_control.sh
-- Trim and filter readsamplicon_mapping.sh
-- map QC'ed reads to the database indata_raw/16S_amplicon/mapping.tar.gz
Go through these steps in order to reproduce the analysis in the paper. You can also run Rscript R/runeverything.R
which will perform all steps in the analysis automatically.
rpkm2tab.R
-- format bbmap output to tablesformat_raw_data.R
-- format raw density data for downstream use
correct_bias.R
-- applying method from this papernormalize_counts.R
-- normalizing sequencing counts for later
gam_ciliate_density.R
-- fit GAM used in Table S2 and Fig 2gam_OD600_density.R
-- fit GAM used in Table S3 and Fig 2gam_nematode_density.R
-- fit GAM used in Table S4 and Fig 2competitive_LV.R
-- parameterize LV competitive modelfig2.R
-- Reproduces Fig. 2 from the main text
figS1a.R
-- Reproduces Fig. S1A from supplementarycommunity_dissimilarity_plot.R
-- Reproduces Fig. S1B from supplementarycommunity_dissimilarity_regression.R
-- Reproduces Table S5shannon_diversity.R
-- Run divnet estimate of Shannon diversity and save resultshannon_change_point_regression.R
-- Perform multiple change point regression of the shannon diversity estimate. Reproduces Fig. S2.shannon_sort_eq_regression_bayes.R
-- Performs regression using MCMC from Stan on the Shannon estimates in the two experimental phases. Reproduces Fig. S3 and Tables S6 and S7 a.shannon_sort_eq_regression_freq.R
-- Performs frequentist regression. No Stan requiredordination.R
-- Ordination and jump lengths. Generate Fig. 3C and Table S8fig3.R
-- Generate final Fig 3
traits.R
-- Load and format trait data for use with JSDM models
JSDM_format_sort.R
-- formats sorting phase models. Models need to be uploaded to cluster afterwardJSDM_format_qeq.R
-- formats equilibrium phase models. Models need to be uploaded to cluster afterwardpuhti_hmsc_mcmc.sh
-- executespuhti_hmsc_mcmc.R
and fits models using MCMCpuhti_hmsc_crossvaliation.sh
executespuhti_hmsc_crossvaliation.R
and performs 5-fold cross validation to determine predictive performance of the full modelsJSDM_convergence.R
-- Various stats to demonstrate chains have convergedJSDM_inspect.R
-- Produces Table S9 and S10 and main text Fig. 4
fig5.R
-- generates Figure 5 from main textconsumer_feeding_stats.R
-- reproduces Table S11 and S12