YuLab-SMU / ggmsa

:traffic_light: Visualizing publication-quality multiple sequence alignment using ggplot2
http://yulab-smu.top/ggmsa
200 stars 22 forks source link

Seq names are not shown #59

Open Dobrokhotov1989 opened 1 year ago

Dobrokhotov1989 commented 1 year ago

Hi there,

I think I've spotted a bug:

suppressPackageStartupMessages({
  library(ggmsa)
  library(Biostrings)
})
my_letters <- c('A', 'T', 'C', 'G')

(seq_1 <- paste0(sample(my_letters, size = 10, replace = TRUE), collapse = ''))
#> [1] "TTATCAAGGT"

(seq_2 <- paste0(sample(my_letters, size = 10, replace = TRUE), collapse = ''))
#> [1] "CGATTCAGTA"

alignment <- DNAStringSet(x = c(seq_1 = seq_1,
                                seq_2 = seq_2))

ggmsa(alignment,
      seq_name = TRUE)


# Seq names are replaced by numbers if none_bg is true
ggmsa(alignment,
      seq_name = TRUE,
      none_bg = TRUE)


# Seq names are replaced by numbers if highlight position is outside of shown region
ggmsa(alignment,
      start = 1,
      end = 8,
      seq_name = TRUE,
      position_highlight = 10)


# but not if highligh position is withing the shown region
ggmsa(alignment,
      start = 1,
      end = 8,
      seq_name = TRUE,
      position_highlight = 7)

Created on 2023-06-22 with reprex v2.0.2