KasperSkytte / ampvis2

Tools for visualising microbial community amplicon data
https://kasperskytte.github.io/ampvis2/
GNU General Public License v3.0
66 stars 23 forks source link

amp_heatmap drops the first "s" in a species name #102

Closed hmaru closed 3 years ago

hmaru commented 3 years ago

Hi,

When I make a heatmap with amp_heatmap(), it seems to always drop the first letter "s" in a species name. For example, "(Nitrospira) sublineage I" becomes "ublineage I". The above example occurred with the minimal example data indicated in the turorial.

Other examples seen with my own data include,

I tried to make a reproducible example with reprex, but couldn't figure out how to make it with read.csv() reading local files, so I just copy my script below. Here I'm just reading the minimal example csv files downloaded to my computer.

library(ampvis2)

myotutable <- read.csv("example_otutable.csv", check.names = FALSE)
mymetadata <- read.csv("example_metadata.csv", check.names = FALSE)

d <- amp_load(otutable = myotutable,
              metadata = mymetadata)

amp_heatmap(d, 
            tax_aggregate = "Species",
            tax_add = "Genus", 
            tax_empty = "OTU", 
            )

This is the output image, with a missing "s". heatmap_missing_s


sessionInfo() R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 17134) Matrix products: default locale: [1] LC_COLLATE=Japanese_Japan.932 LC_CTYPE=Japanese_Japan.932
[3] LC_MONETARY=Japanese_Japan.932 LC_NUMERIC=C
[5] LC_TIME=Japanese_Japan.932
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] ampvis2_2.6.4 ggplot2_3.3.2

KasperSkytte commented 3 years ago

Hi there

That is a bug. A bad regular expression, you have to reinstall.

library(ampvis2)
#> Loading required package: ggplot2

d <- amp_load(otutable = example_otutable,
              metadata = example_metadata)

amp_heatmap(d,
            tax_aggregate = "Species",
            tax_add = "Genus",
            tax_empty = "OTU",
)
#> Warning: Transformation introduced infinite values in discrete y-axis

Created on 2020-09-01 by the reprex package (v0.3.0)

hmaru commented 3 years ago

Thanks a lot for the quick update! I get the desired output and it saved me a lot of time to make the figures!