Skip to content

Commit f7fa11d

Browse files
committed
Add reporting of read counts (e.g. not assigned etc.) in HABs final Rscript
1 parent 4cd1773 commit f7fa11d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

01_scripts/read_counts_to_annotations_HABs.R

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Connect read counts to the annotations and plot
22
# Input: output of obitab (read counts per sample) and MEGAN (taxonomy ID per amplicon)
33

4-
#rm(list=ls())
4+
# rm(list=ls())
55

66
# Choose dataset
77
#datatype <- "HAB_16S"
@@ -107,6 +107,9 @@ head(data.df)
107107
# View species that are present in dataset
108108
unique(data.df$taxon)
109109
length(unique(data.df$taxon))
110+
unique.taxa <- unique(data.df$taxon)
111+
# number unique taxa - (no hits, Not assigned) # i.e. subtract 2 from this number
112+
length(unique.taxa) - 2
110113

111114
#### 1.3 Set location information ####
112115
locations <- list()
@@ -142,6 +145,17 @@ unannot.df <- round(x = unannot.df, digits = 2)
142145

143146
# write.csv(x = unannot.df, file = table.filename)
144147

148+
#### Reporting ####
149+
rownames(unannot.df)
150+
total.reads.in.megan <- sum(unannot.df["all.hits", ])
151+
total.reads.in.megan
152+
total.reads.not.assigned <- sum(unannot.df["not.assigned", ]) # number of reads that were given annotation by BLAST but not assigned by MEGAN
153+
total.reads.not.assigned
154+
total.reads.no.hits <- sum(unannot.df["no.hits", ]) # number of reads that were not annotated by BLAST
155+
total.reads.no.hits
156+
157+
# Reads assigned
158+
total.reads.in.megan - total.reads.not.assigned - total.reads.no.hits
145159

146160
# Set species to remove (e.g. humans)
147161
#remove.from.all <- c("Not assigned", "No hits")

0 commit comments

Comments
 (0)