Skip to content

Commit

Permalink
update vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
sdgamboa committed Mar 11, 2024
1 parent dbb8ddd commit a1627d1
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 65 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ Suggests:
MicrobiomeBenchmarkData,
mia,
stats,
limma
limma,
readr
URL: https://github.com/waldronlab/bugphyzz
BugReports: https://github.com/waldronlab/bugphyzz/issues
110 changes: 49 additions & 61 deletions vignettes/articles/attributes.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "Data about Attributes and Sources"
title: "Sources and Attributes"
output:
rmarkdown::html_vignette:
toc: true
Expand All @@ -26,23 +26,50 @@ library(dplyr)
library(purrr)
```

```{r}
bp <- importBugphyzz(version = 'devel')
## Sources

```{r, echo=FALSE}
sources_fname <- system.file(
"extdata", "attribute_sources.tsv", package = "bugphyzz", mustWork = TRUE
)
sources <- readr::read_tsv(sources_fname, show_col_types = FALSE) |>
dplyr::rename(
Source = Attribute_source,
`Confidence in curation` = Confidence_in_curation,
`Full source` = full_source
)
```

The `r nrow(sources)` sources of annotations in bugphyzz:

```{r, echo=FALSE}
DT::datatable(
data = sources, rownames = FALSE,
options = list(iDisplayLength = nrow(sources), scrollX = TRUE)
)
```

## Attributes

Definition of attributes and attribute values.
Ontology terms can be searched at [OSLv3](https://www.ebi.ac.uk/ols/index) and
[OSLv4](https://www.ebi.ac.uk/ols4).

```{r, echo = FALSE}
## Import bugphyzz and summmarize number of annotations per attribute
## and source.
bp <- importBugphyzz()
x <- map(bp, ~ {
.x |>
select(Attribute, Attribute_source) |>
count(Attribute, Attribute_source, name = "N_annotations") |>
dplyr::count(Attribute, Attribute_source, name = "N_annotations") |>
distinct()
}) |>
bind_rows() |>
filter(!is.na(Attribute_source)) |> # Attribute source with NAs means it was obtained through ASR or TAX
relocate(Attribute_source, Attribute, N_annotations)
```

## Attributes

Ontology terms can be searched at [OSLv3](https://www.ebi.ac.uk/ols/index) and
[OSLv4](https://www.ebi.ac.uk/ols4).

```{r}
regex <- paste0(
Expand All @@ -51,34 +78,16 @@ regex <- paste0(
fname <- system.file('extdata/attributes.tsv', package = 'bugphyzz')
attributes <- read.table(fname, header = TRUE, sep = '\t') |>
filter(grepl(regex, attribute_group))
colnames(attributes) <- c(
'Attribute', 'Attribute group', 'Validity', 'Ontoloty', 'Description'
)
caption1 <- paste0(
'Table 1. Attributes that could be found in bugphyzz.'
DT::datatable(
data = attributes,
options = list(scrollX = TRUE)
)
datt <- datatable(
data = attributes,
filter = "top",
extensions = c("Buttons","KeyTable"),
caption = htmltools::tags$caption(
style = 'caption-side: top; text-align: left;',
caption1
),
options = list(
dom = '<"top"B>lfrtip',
buttons = list('copy', 'print'),
iDisplayLength = 10,
keys = TRUE,
scrollX = TRUE,
autoWidth = FALSE
)
)
datt
```

## Sources
## Sources x Attributes

```{r}
fname2 <- system.file(
Expand All @@ -88,38 +97,17 @@ fname2 <- system.file(
src <- read.table(
fname2, header = TRUE, sep = '\t', quote = ""
)
xsrc <- left_join(x, src, by = 'Attribute_source') |>
rename(Full_source = full_source)
caption2 <- paste0(
'Table 2. Sources of attribute annotations in bugphyzz. ',
'* Evidence codes: exp = experimental evidence, igc = inferred from genomic context, ',
'tas = traceable author statement, nas = non-traceable author statement; ',
'more information at http://geneontology.org/docs/guide-go-evidence-codes/. ',
'** The number in parenthesis indacates the number of annotations per',
' attribute group.'
)
src_dt <- datatable(
data = xsrc,
filter = "top",
extensions = c("Buttons","KeyTable"),
# caption = caption2,
caption = htmltools::tags$caption(
style = 'caption-side: top; text-align: left;',
caption2
),
options = list(
dom = '<"top"B>lfrtip',
buttons = list('copy', 'print'),
iDisplayLength = 10,
keys = TRUE,
# scrollX = TRUE,
autoWidth = TRUE
xsrc <- dplyr::left_join(x, src, by = 'Attribute_source') |>
dplyr::rename(
`Full source` = full_source,
`Confidence in curation` = Confidence_in_curation,
`Number of annotations` = N_annotations,
Source = Attribute_source
)
)
src_dt
DT::datatable(
data = xsrc,
options = list(scrollX = TRUE)
)
```

## Session info
Expand Down
6 changes: 3 additions & 3 deletions vignettes/bugphyzz.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ knitr::opts_chunk$set(
[Bugphyzz](https://github.com/waldronlab/bugphyzzExports)
is an electronic resource of harmonized microbial annotations from
different sources. These annotations can be used to create signatures of
microbes sharing attributes, and used for bug set enrichment analysis.
microbes sharing attributes and used for bug set enrichment analysis.

## Data schema

Annotations in bugphyzz represent the link between a taxon (Bacteria/Archaea)
and an attribute (see the data schema and description below).
and an attribute as described in the data schema below.

<center>

Expand All @@ -50,7 +50,7 @@ superkingdom, kingdom, phylum, class, order, family, genus, species, strain.

Attribute data was harmonized with a controlled vocabulary based on
available ontology terms. Attributes, ontology terms, and ontology libraries
can be found [here]().
can be found in the 'Attribute and sources' vignette.

4. _Attribute_. A character string describing the name of a trait that can be
observed or measured.
Expand Down

0 comments on commit a1627d1

Please sign in to comment.