{"action":"created","issue":{"url":"https://api.github.com/repos/benjjneb/dada2/issues/420","repository_url":"https://api.github.com/repos/benjjneb/dada2","labels_url":"https://api.github.com/repos/benjjneb/dada2/issues/420/labels{/name}","comments_url":"https://api.github.com/repos/benjjneb/dada2/issues/420/comments","events_url":"https://api.github.com/repos/benjjneb/dada2/issues/420/events","html_url":"https://github.com/benjjneb/dada2/issues/420","id":299622569,"number":420,"title":"DADA2: Metadata file and OTU table","user":{"login":"kruttikaphalnikar","id":36756472,"avatar_url":"https://avatars1.githubusercontent.com/u/36756472?v=4","gravatar_id":"","url":"https://api.github.com/users/kruttikaphalnikar","html_url":"https://github.com/kruttikaphalnikar","followers_url":"https://api.github.com/users/kruttikaphalnikar/followers","following_url":"https://api.github.com/users/kruttikaphalnikar/following{/other_user}","gists_url":"https://api.github.com/users/kruttikaphalnikar/gists{/gist_id}","starred_url":"https://api.github.com/users/kruttikaphalnikar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kruttikaphalnikar/subscriptions","organizations_url":"https://api.github.com/users/kruttikaphalnikar/orgs","repos_url":"https://api.github.com/users/kruttikaphalnikar/repos","events_url":"https://api.github.com/users/kruttikaphalnikar/events{/privacy}","received_events_url":"https://api.github.com/users/kruttikaphalnikar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-23T07:31:24Z","updated_at":"2018-02-23T15:41:42Z","closed_at":null,"author_association":"NONE","body":"Hi all,\r\n\r\nI am very new to DADA2/phyloseq, and have some very very basic queries, I apologise in advance!. \r\nI’m familiar with QIIME 1 analysis, however I want to run DADA2 as well.\r\n\r\nI have 16s Miseq data, 250 Paired end. V3-V4 16S\r\nI read the entire tutorial for DADA2 which is very nicely written, thank you!, I could follow most of it. \r\n\r\nQ1: how do I insert metadata? for example, i have 3 insect developmental stages, 5 samples each stage, total 15 samples. how and where do I insert this information? In the MiSeqSOPdata I can see a mouse.dpw. metadata file, but I can't figure out how to insert my own metadata. My entire dataset is actually much more than 15 samples, It would be extremely convenient to use a metadata file.\r\n\r\nQ2: How do i get OTU table? or Taxa table?\r\n\r\nWhen I define \"ps\" and run the command, i get \r\n\r\nphyloseq-class experiment-level object\r\notu_table()   OTU Table:         [ 2230 taxa and 15 samples ]\r\ntax_table()   Taxonomy Table:    [ 2230 taxa by 7 taxonomic ranks ]\r\n\r\nI tried running otu_table(ps) and taxa_table(ps) but i get nucleotide sequences and not the names of taxa\r\nI went through these threads (https://github.com/joey711/phyloseq/issues/407)(https://github.com/benjjneb/dada2/issues/260), but couldn't replicate the output\r\n\r\nI also want to know, how to get a simple OTU table with relative abundances and sample names? something like a biom table? Can I import DADA2 output in QIIME1 (not 2)?\r\n\r\nThank you\r\nKruttika\r\n\r\n\r\nI run these commands to get to \"ps\"\r\nlibrary(\"devtools\")\r\nlibrary(dada2)\r\nlibrary(phyloseq); packageVersion(\"phyloseq\")\r\nlibrary(ggplot2); packageVersion(\"ggplot2\")\r\n\r\nfnFs <- sort(list.files(pattern=\"_R1.fastq\", full.names = TRUE))\r\nfnRs <- sort(list.files(pattern=\"_R2.fastq\", full.names = TRUE))\r\nsample.names <- sapply(strsplit(basename(fnFs), \"_\"), `[`, 1)\r\nsample.names\r\n\r\nplotQualityProfile(fnFs[1:2]) \r\nplotQualityProfile(fnFs[1:2])\r\n\r\nfilt_path <- file.path(\"filtered\") # Place filtered files in filtered/subdirectory\r\nfiltFs <- file.path(filt_path, paste0(sample.names, \"_F_filt.fastq.gz\"))\r\nfiltRs <- file.path(filt_path, paste0(sample.names, \"_R_filt.fastq.gz\"))\r\n\r\nout <- filterAndTrim(fnFs, filtFs, fnRs, filtRs, truncLen=c(240,160),\r\n                     maxN=0, maxEE=c(2,2), truncQ=2, rm.phix=TRUE,\r\n                     compress=TRUE, multithread=TRUE) # On Windows set multithread=FALSE\r\nhead(out)\r\n\r\n\r\nderepFs <- derepFastq(filtFs, verbose=TRUE)\r\nderepRs <- derepFastq(filtRs, verbose=TRUE)\r\nnames(derepFs) <- sample.names\r\nnames(derepRs) <- sample.names\r\nnames(derepFs)\r\nnames(derepRs) \r\n\r\nerrR <- learnErrors(filtRs, multithread=TRUE)\r\nerrF <- learnErrors(filtFs, multithread=TRUE)\r\n\r\nplotErrors(errF, nominalQ=TRUE)\r\n\r\ndadaFs <- dada(derepFs, err=errF, multithread=TRUE)\r\ndadaRs <- dada(derepRs, err=errR, multithread=TRUE)\r\n\r\ndadaFs[[1]]\r\n\r\nmergers <- mergePairs(dadaFs, derepFs, dadaRs, derepRs, verbose=TRUE)\r\n# Inspect the merger data.frame from the first sample\r\nhead(mergers[[1]])\r\n\r\nseqtab <- makeSequenceTable(mergers)\r\ndim(seqtab)\r\ntable(nchar(getSequences(seqtab)))\r\n\r\nseqtab.nochim <- removeBimeraDenovo(seqtab, method=\"consensus\", multithread=TRUE, verbose=TRUE)\r\ndim(seqtab.nochim)\r\n\r\nsum(seqtab.nochim)/sum(seqtab)\r\n\r\ngetN <- function(x) sum(getUniques(x))\r\ntrack <- cbind(out, sapply(dadaFs, getN), sapply(mergers, getN), rowSums(seqtab), rowSums(seqtab.nochim))\r\n# If processing a single sample, remove the sapply calls: e.g. replace sapply(dadaFs, getN) with getN(dadaFs)\r\ncolnames(track) <- c(\"input\", \"filtered\", \"denoised\", \"merged\", \"tabled\", \"nonchim\")\r\nrownames(track) <- sample.names\r\nhead(track)\r\n\r\ntaxa <- assignTaxonomy(seqtab.nochim, \"gg_13_8_train_set_97.fa.gz\", multithread=TRUE)\r\ntaxa <- addSpecies(taxa, \"rdp_species_assignment_14.fa.gz\")\r\n\r\ntaxa.print <- taxa # Removing sequence rownames for display only\r\nrownames(taxa.print) <- NULL\r\nhead(taxa.print)\r\n\r\nps <- phyloseq(otu_table(seqtab.nochim, taxa_are_rows=FALSE), \r\n               sample_names(samdf), \r\n               tax_table(taxa))\r\n\r\n\r\n  \r\n"},"comment":{"url":"https://api.github.com/repos/benjjneb/dada2/issues/comments/368044937","html_url":"https://github.com/benjjneb/dada2/issues/420#issuecomment-368044937","issue_url":"https://api.github.com/repos/benjjneb/dada2/issues/420","id":368044937,"user":{"login":"benjjneb","id":5797204,"avatar_url":"https://avatars3.githubusercontent.com/u/5797204?v=4","gravatar_id":"","url":"https://api.github.com/users/benjjneb","html_url":"https://github.com/benjjneb","followers_url":"https://api.github.com/users/benjjneb/followers","following_url":"https://api.github.com/users/benjjneb/following{/other_user}","gists_url":"https://api.github.com/users/benjjneb/gists{/gist_id}","starred_url":"https://api.github.com/users/benjjneb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benjjneb/subscriptions","organizations_url":"https://api.github.com/users/benjjneb/orgs","repos_url":"https://api.github.com/users/benjjneb/repos","events_url":"https://api.github.com/users/benjjneb/events{/privacy}","received_events_url":"https://api.github.com/users/benjjneb/received_events","type":"User","site_admin":false},"created_at":"2018-02-23T15:41:42Z","updated_at":"2018-02-23T15:41:42Z","author_association":"OWNER","body":"> Q1: how do I insert metadata? for example, i have 3 insect developmental stages, 5 samples each stage, total 15 samples. how and where do I insert this information? In the MiSeqSOPdata I can see a mouse.dpw. metadata file, but I can't figure out how to insert my own metadata. My entire dataset is actually much more than 15 samples, It would be extremely convenient to use a metadata file.\r\n\r\nFor this you'll want to read the metadata file into R. Most commonly metadata is in some sort of comma-separated or tab-separated format, and you'll want to use the `read.table` or `read.csv` R functions. That will return a data.frame, that you can then add to the phyloseq object.\r\n\r\nQ2: How do i get OTU table? or Taxa table?\r\n\r\nThe commands you are using are correct, but the output is being overwhelmed by the long real sequence names being used. For visual inspection, it is often useful to rename the sequence variants to something much shorter. For example (if the phyloseq obejct currently has full sequence names):\r\n\r\n```\r\nnew.names <- paste0(\"ASV\", seq(ntaxa(ps))) # Define new names ASV1, ASV2, ...\r\nseqs <- taxa_names(ps) # Store sequences\r\nnames(seqs) <- new.names # Make map from ASV1 to full sequence\r\ntaxa_names(ps) <- new.names # Rename to human-friendly format\r\n```\r\n\r\nYou can always convert back to the full sequences later using `seqs`. For example, `seqs[\"ASV1\"]` will return the full sequence that was renamed ASV1."}}
{"actor":{"display_login":"benjjneb"}}