Last updated: 2021-07-02

Checks: 7 0

Knit directory: wildlife-haemoprotozoa/

This reproducible R Markdown analysis was created with workflowr (version 1.6.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20210212) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.

The results in this page were generated with repository version 8a0681f. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .DS_Store
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    analysis/.DS_Store
    Ignored:    analysis/.Rhistory
    Ignored:    analysis/_footer.html
    Ignored:    data/.DS_Store
    Ignored:    output/.DS_Store

Untracked files:
    Untracked:  ENA_submission/
    Untracked:  NCBI_submission/
    Untracked:  Rplot02.pdf
    Untracked:  data/NGS_18S_kinet/
    Untracked:  data/Sanger-piroplasm/
    Untracked:  data/haemoprotozoa.csv
    Untracked:  data/haemoprotozoa.xlsx
    Untracked:  data/tryp-phyloseq/count_data_QC.xlsx
    Untracked:  data/tryp-phyloseq/count_data_raw.csv
    Untracked:  data/tryp-phyloseq/sampledata.xlsx
    Untracked:  melt.csv
    Untracked:  melt.xlsx
    Untracked:  microscopy/
    Untracked:  output/plots/

Unstaged changes:
    Modified:   analysis/_site.yml
    Modified:   analysis/misc-dataviz.Rmd
    Deleted:    analysis/phylogeny.Rmd

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/tryp-01-NGS-bioinfo.Rmd) and HTML (docs/tryp-01-NGS-bioinfo.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html a36fbcb siobhon-egan 2021-07-02 Build site.
Rmd 8e3850e siobhon-egan 2021-07-02 Major update

1. USEARCH

Analysis of illumina MiSeq pair-end reads using USEARCH v11 pipeline

Set up

Bash script

Full script available at code/usearchv11_18S_Kineto.sh

To execute run $ ./usearchv11_18S_Kineto.sh from your terminal with raw data saved in directory called raw_data.

#!/bin/bash
# author: Siobhon L. Egan
# License: MIT
# Date: Jan 2021
##########################################################################################
##########################################################################################
############################# USEARCH v11 complete pipeline ##############################
##########################################################################################
##########################################################################################
#   Requirements: usearch11 must be installed on the PATH as "usearch11".
# Remeber if you have a large dataset you will need the 64 bit version.
#   This script will work in unix and linux environments.
#
#   This script taked raw MiSeq demultiplexed .fastq files for input and performs the following tasks:
#
# 1) Merge paired reads
#   2) Retrieve sequences matching primers
#   3) Quality filtering of `.fastq` sequence data and removal of short dimer seqs to generate `.fasta` sequence files
#   4) Removal low abundant sequences & singletons
#   5) Perform clustering sequences with
#   5a) UPARSE - to produce otus (using 97% similarity threshold)
#       5b) UNOISE3 - to produce zotus (i.e. zero-radius operational taxonomic units)
##########################################################################################
#   Input raw unmerged filenames must be named "sample_id_SXXX_L001_R1.fastq" (read 1)
#   and "sample_id_SXXX_L001_R2.fastq" (read 2) and all deposited in a directory specified
#   by the "$raw_data" variable. "SXXX" is the sample number given by the MiSeq
#   in the order you entered them in the Sample Sheet.
#
#   Before use: $chmod 775 this_script.sh
#   To run: $./this_script.sh
#   This script will read any input directory specified by the "raw_data" variable, but will deposit all
#   output into the current working diretory.
##########################################################################################

# Enter raw data directorry
raw_data="raw_data"
# Enter directory for merged output
merged_data="1.merged_data"
# Enter max diff for merging - default 5 but should increase for paired end
maxdiffs="15"
# Enter minimum merge overlap - default is 16 bp
overlap="20"
# Enter directory for sequences that are matched to primers
primer_matched="2a.primer_matches"
# Enter directory for sequences that do not match primers
primer_not_matched="2b.primer_not_matched"
# Enter forward sequences (5'-3'). Wildcard letters indicating degenerate positions in the primer are supported. See IUPAC(https://drive5.com/usearch/manual/IUPAC_codes.html) codes for details.
fwd_primer="ACCGTTTCGGCTTTTGTTGG" #18S kinetoplastid 825F Maslov et al. Biochem Parasitol (1996) 75(2): 197-205
rev_primer="GACTACAATGGTCTCTAATC" #18S kinetoplastid 662R Maslov et al. Biochem Parasitol (1996) 75(2): 197-205
# Enter directory for quality filtered output
QF="3.quality_filtered"
# Enter max error rate. Natural choice is 1, however may want to decrease to 0.5 or 0.25 for more stringent filtering.
max_ee="1"
# Enter min length of sequence for trimming in bp (eg. to keep all seqs above 200 bp enter "200")
minlen="150"
# Enter directory for labeled data
labeled_data="4.labeled_data"
# Enter directory for dereplicated sequences
derep_dir="5.derep_data"
# Enter directory for singlteton filter data
SF="6.singleton_filtered"
# Enter directory for singlteton sequences
low_abund_seqs="7.singleton_sequences"
# Enter max size to discard i.e. to discard singletons = 1, duplicates = 2
maxsize="1"
# Enter directory for sequence clustering
cluster="8.cluster"
# Enter sub-directory for uparse_otu clustering
uparse_otus="8a.otus"
# Enter sub-directory for unoise_zotu clustering
unoise_zotus="8b.zotus"


##########################################################################################
# DO NOT EDIT BELOW THIS LINE
##########################################################################################

# unzip raw_data

gunzip ${raw_data}/*.fastq.gz

##########################################################################################

##########################################################################################

echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo Merging paried illumina fastq sequences
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Merge paired-end reads using `-fastq_mergepairs` command, and rename sequences. This would be done before primers are trimmed.

mkdir ${merged_data}
mkdir working1

#*****************************************************************************************
# Part 1: merge reads

for file1 in ${raw_data}/*R1.fastq
  do
    echo ""
        echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        echo Merging paired reads
        echo forward reads are:
        echo $(basename ${file1})
        echo reverse reads are:
        echo $(basename ${file1} R1.fastq)R2.fastq

    usearch11.0.667_i86osx64 -fastq_mergepairs ${file1} -reverse "${raw_data}/$(basename -s R1.fastq ${file1})R2.fastq" -fastqout "working1/$(basename "$file1")" -fastq_maxdiffs ${maxdiffs} -fastq_minovlen ${overlap} -report ${merged_data}/2a_merging_seqs_report.txt -tabbedout ${merged_data}/2b_tabbedout.txt
done

#*****************************************************************************************
# Part 2: Remove "_L001_R1" from filenames

for file2 in working1/*.fastq
    do
        rename="$(basename ${file2} _L001_R1.fastq).fastq"
    mv ${file2} ${merged_data}/${rename}
done

#*****************************************************************************************
# Removing working directory

rm -r working1

##########################################################################################

echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo Triming primers and distal bases
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# The `-search_pcr2` command searches for matches to a primer pair and outputs the sequence in between (i.e. amplicon with primers removed) into `primer_matched` file

mkdir ${primer_matched}
mkdir ${primer_not_matched}

for file3 in ${merged_data}/*.fastq
    do

    usearch11.0.667_i86osx64 -search_pcr2 ${file3} -fwdprimer ${fwd_primer} \
    -revprimer ${rev_primer} \
    -strand both -fastqout "${primer_matched}/$(basename ${file3})" -notmatchedfq "${primer_not_matched}/$(basename ${file3})" -tabbedout ${primer_matched}pcr2_output.txt
done

##########################################################################################

echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo Quality control and removing dimer seqs
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Quality filtering of fastq files using the `-fastq_filter` command, output gives fasta files.

mkdir ${QF}

for file4 in ${primer_matched}/*.fastq
    do
        echo ""
        echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        echo Quality control and removing dimer seqs
        echo input is:
        echo ${file4}

    usearch11.0.667_i86osx64 -fastq_filter ${file4} -fastaout "${QF}/$(basename "$file4" .fastq).fasta" -fastq_maxee ${max_ee} -fastq_minlen ${minlen}
done

##########################################################################################

echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo Renameing sequences with ">barcodelabel=sample_id;sequence_id"
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# For this script to run correctly input fasta label must be formatted >sequence_id and filename must be sample_id.fasta.
# Result will be ">barcodelabel=sample_id;sequenceid"

mkdir ${labeled_data}
mkdir working2

#*****************************************************************************************
# Part 1: Remove ">" from start of sequence_ID

for file5 in ${QF}/*.fasta
    do
        sed -e 's/>/>barcodelabel=;/g' ${file5} > working2/$(basename "$file5" .fasta).txt
done

#*****************************************************************************************
# Part 2: Add sample_ID (should be filename) to produce ">barcodelabel=sample_ID;sequence_ID"

for file6 in working2/*.txt
    do
        sample_id=$(basename ${file6} .txt)
        echo ${sample_id}

    sed -e "s/;/${sample_id};/g" ${file6} > "${labeled_data}/$(basename "$file6" .txt).fasta"
done

#*****************************************************************************************
# Remove working directories

rm -r working2

################################################################################################

echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo Removing low abundant seqs singletons per sample
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Remove low abundant sequences (e.g. singletons) in samples using the `-fastx_uniques` command

mkdir ${derep_dir}
mkdir ${SF}
mkdir ${low_abund_seqs}

#*****************************************************************************************
# Part 1: Dereplicating

for file7 in ${labeled_data}/*.fasta
    do
        echo ""
        echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        echo Removing singletons step 1: derep_fulllength
        echo input is:
        echo ${file7}

        usearch11.0.667_i86osx64 -fastx_uniques ${file7} -fastaout "${derep_dir}/$(basename "$file7" .fasta).fasta" -sizeout
done

#*****************************************************************************************
# Part 2: Filtering low abundant seqs {maxsize}

for file8 in ${derep_dir}/*.fasta
    do
        echo ""
        echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        echo Removing singletons step 2: sorting uniques
        echo input is:
        echo ${file8}

        usearch11.0.667_i86osx64 -sortbysize ${file8} -fastaout "${low_abund_seqs}/$(basename "$file8" .fasta).fasta" -maxsize ${maxsize}
done

#*****************************************************************************************
# Step 3: Mapping reads

for file9 in ${labeled_data}/*.fasta
    do
      echo ""
      echo ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      echo Removing singletons step 3: mapping reads to low abundant uniques
      echo input is:
      echo ${file9}

      usearch11.0.667_i86osx64 -search_exact ${file9} -db "${low_abund_seqs}/$(basename "$file9" .fasta).fasta" -strand plus -notmatched "${SF}/$(basename "$file9" .fasta).fasta"
done

################################################################################################
################################################################################################

echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo CLUSTERING
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

# Concatenate all singleton filter sequences into a single fasta file
# Find the set of unique sequences in an input file, also called dereplication using `-fastx_uniques` command

mkdir ${cluster}

cat ${SF}/*.fasta > ${cluster}/all_SF.fasta

cd ${cluster}

usearch11.0.667_i86osx64 -fastx_uniques all_SF.fasta -fastaout all_SF_DR.fasta -sizeout

#*****************************************************************************************

echo ----------------------------------------------------------------------------
echo Part a - Generating UPARSE OTUs
echo ----------------------------------------------------------------------------

# Cluster sequences in 97% operational taxonomic units (OTUs) using UPARSE algorithm `-cluster_otus` command and generate an OTU table

mkdir ${uparse_otus}
cd ${uparse_otus}

    usearch11.0.667_i86osx64 -cluster_otus ../all_SF_DR.fasta -otus uparse_otus.fasta -relabel OTU

  usearch11.0.667_i86osx64 -usearch_global ../all_SF.fasta -db uparse_otus.fasta -strand both -id 0.97 -otutabout uparse_otu_tab.txt -biomout uparse_otu_biom.biom

  # The next two lines are options - they produce a distance matrix file and then a tree (newick format)
  # Current parameters are a guide only and you will need to optimse them for your data
  # Large datasets can take a long time, so you can skip this part for now to speed up analysis

#  usearch11.0.667_i86osx64 -calc_distmx uparse_otus.fasta -tabbedout uparse_otus_distmx.txt -maxdist 0.2 -termdist 0.3

#   usearch11.0.667_i86osx64 -cluster_aggd uparse_otus_distmx.txt -treeout uparse_otus_clusters.tree -clusterout uparse_otus_clusters.txt \
#     -id 0.80 -linkage min
cd ..

#*****************************************************************************************

echo ----------------------------------------------------------------------------
echo Part b - Generating UNOISE ZOTUs
echo ----------------------------------------------------------------------------

# Cluster sequences in zero-radius operational taxonomic units (ZOTUs) using `-unoise3` command and generate a ZOTU table

mkdir ${unoise_zotus}
cd ${unoise_zotus}

  usearch11.0.667_i86osx64 -unoise3 ../all_SF_DR.fasta -zotus unoise_zotus.fasta -tabbedout unoise_tab.txt

    usearch11.0.667_i86osx64 -fastx_relabel unoise_zotus.fasta -prefix Otu -fastaout unoise_zotus_relabeled.fasta -keep_annots

    usearch11.0.667_i86osx64 -otutab ../all_SF.fasta -zotus unoise_zotus_relabeled.fasta -otutabout unoise_otu_tab.txt -biomout unoise_otu_biom.biom -mapout unoise_map.txt -notmatched unoise_notmatched.fasta -dbmatched dbmatches.fasta -sizeout

  # The next two lines are options - they produce a distance matrix file and then a tree (newick format)
  # Current parameters are a guide only and you will need to optimse them for your data
  # Large datasets can take a long time, so you can skip this part for now to speed up analysis

#  usearch11.0.667_i86osx64 -calc_distmx unoise_zotus.fasta -tabbedout unoise_zotus_distmx.txt -maxdist 0.2 -termdist 0.3

#  usearch11.0.667_i86osx64 -cluster_aggd unoise_zotus_distmx.txt -treeout unoise_zotus_clusters.tree -clusterout unoise_zotus_clusters.txt \
#    -id 0.80 -linkage min
cd ..
cd ..

################################################################################################
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo ANALYSIS COMPLETE
echo %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
################################################################################################

2. Sequence info

Subject zOTUs to blast search against nucleotide database and downloaded detailed output (including top 100 hits).

Filtered tops hit by evalue, percentage identity and query coverage to retrieve the top hit.

Using the top hit nucleotide accession number I then retrieved the taxonid using the following:

for ACC in A00002 X53307 BB145968 CAA42669 V00181 AH002406 HQ844023
do
   echo -n -e "$ACC\t"
   curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=${ACC}&rettype=fasta&retmode=xml" |\
   grep TSeq_taxid |\
   cut -d '>' -f 2 |\
   cut -d '<' -f 1 |\
   tr -d "\n"
   echo
 done

To get sequence description information use the following:

for ACC in A00002 X53307 BB145968 CAA42669 V00181 AH002406 HQ844023
do
   echo -n -e "$ACC\t"
   curl -s "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=nuccore&id=${ACC}&rettype=fasta&retmode=xml" |\
   grep TSeq_defline |\
   cut -d '>' -f 2 |\
   cut -d '<' -f 1 |\
   tr -d "\n"
   echo
 done

Use TaxonKit to get lineage information. Documentation here, GitHub repo here

Install - for linux, other platforms available here

wget https://github.com/shenwei356/taxonkit/releases/download/v0.7.1/taxonkit_linux_amd64.tar.gz
wget https://github.com/shenwei356/csvtk/releases/download/v0.22.0/csvtk_linux_amd64.tar.gz
#unzip
tar -zxvf *.tar.gz

Download and decompress taxdump

wget -c ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz
tar -zxvf taxdump.tar.gz

mkdir -p $HOME/.taxonkit
cp names.dmp nodes.dmp delnodes.dmp merged.dmp $HOME/.taxonkit

Show lineage consisting of taxids:

taxonkit lineage -t  taxids.txt \
    | csvtk pretty -t

Write lineage information to text file

taxonkit lineage taxids.txt | awk '$2!=""' > lineage.txt

Reformat lineage file to the following output: {k};{p};{c};{o};{f};{g};{s}

taxonkit reformat lineage.txt | tee lineage.txt.reformat
cut -f 1,3 lineage.txt.reformat

Align output to show taxonomic classification clearly

 \lineage.txt \
    | taxonkit reformat \
    | csvtk -H -t cut -f 1,3 \
    | csvtk -H -t sep -f 2 -s ';' -R \
    | csvtk add-header -t -n taxid,kindom,phylum,class,order,family,genus,species \
    | csvtk pretty -t

3. QC of data from phyloseq

Note this was run using R version 4.0.3 and RStudo version 1.4. See R info for full details of R session.

Load libraries

Install libraries if required

Only need to run this code once.

if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
# phyloseq
source('http://bioconductor.org/biocLite.R')
biocLite('phyloseq')
#tidyverse
install. packages("tidyverse")
#ampvis2
install.packages("remotes")
remotes::install_github("MadsAlbertsen/ampvis2")
#ampvis2extras
install.packages("BiocManager")
BiocManager::install("kasperskytte/ampvis2extras")
#ggpubr
install.packages("ggpubr")
#agricolae
install.packages("agricolae")
install.packages("remotes")
remotes::install_github("DanielSprockett/reltools")
devtools::install_github('jsilve24/philr')
#decontam
BiocManager::install("decontam")
library(decontam)
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("Biostrings")

Load libraries

pkgs <- c( "qiime2R", "phyloseq", "tidyverse", "ampvis2",
          "ampvis2extras", "ggpubr", "agricolae", "plotly",
          "viridis", "cowplot", "MicrobeR", "microbiome", 
          "reshape", "decontam", "data.table", "ape", "DESeq2", 
          "vegan","microbiomeutilities", "knitr", "tibble", "dplyr",
          "patchwork","Biostrings")

lapply(pkgs, require, character.only = TRUE)
# set theme
theme_set(theme_bw())

Create QC phyloseq object

Generate phyloseq object from spreadsheets.

Import ASV/OTU count data

count_data <- read_csv("data/tryp-phyloseq/count_data_raw.csv")
# use first column as label for rows
count_data_lab = column_to_rownames(count_data, var = "#Zotu ID")
# Make matrix
otumat <- as.matrix(count_data_lab)

Import taxonomy data

taxonomy <- read_csv("data/tryp-phyloseq/taxonomy.csv", 
    col_types = cols(Accession_description = col_skip(), 
        `Accession no.` = col_skip(), evalue = col_skip(), 
        `per. Ident` = col_skip(), taxid = col_skip()))
# use first column as label for rows
taxonomy_lab = column_to_rownames(taxonomy, var = "#Zotu ID")
taxmat <- as.matrix(taxonomy_lab)

Check the class of the otumat and taxmat objects, they MUST be in matrix format. Then we can great a phyloseq object called physeq from the otu and taxonomy tables and check the sample names.

class(otumat)
class(taxmat)
OTU = otu_table(otumat, taxa_are_rows = TRUE)
TAX = tax_table(taxmat)
physeq = phyloseq(OTU, TAX)
physeq
sample_names(physeq)

Add metadata and sequence data

Add sequences to phyloseq object

# read sequence file
rep.seqs <- Biostrings::readDNAStringSet("data/tryp-phyloseq/unoise_zotus.fasta", format = "fasta")

Add metadata, importing gDNAID as factor to be able to merge later on

metadata <- read_csv("data/tryp-phyloseq/sampledata.csv")
metadata_lab = column_to_rownames(metadata, var = "SampleID")
sampledata = sample_data(data.frame(metadata_lab))
sampledata

Create final phyloseq object

Now you can merge your data to create a final phyloseq object

ps_raw_tryp = merge_phyloseq(physeq, sampledata, rep.seqs)

Filter out negative controls and after identifying threshold for positive reads, transform otu count data

ps_raw_tryp@otu_table [, 1:580][ps_raw_tryp@otu_table [, 1:580] < 150] <- 0
QC_otu = ps_raw_tryp@otu_table
write.csv(QC_otu, "data/tryp_phyloseq/count_data_QC.csv")


sessionInfo()

Project website by Siobhon Egan, 2021. This R Markdown site was created with workflowr