BioinfoUSAL / D3GB

D3 Genome Browser
http://d3gb.usal.es
0 stars 1 forks source link

Issue plotting M smegmatics genome #1

Open phisanti opened 2 months ago

phisanti commented 2 months ago

It is my first time using the D3GB library and I am trying to make a simple data browser with the genome for Mycobacterium smegmatis. I tried taking the data from different sources but I keep getting an error. Here is my code for the first attempt:

library(D3GB)
library(magrittr)
library(ape)

# Read genome
# Data from https://mycobrowser.epfl.ch/releases
gb <- getAssemblyFromFasta("./data/genomes/Mycobacterium_smegmatis_MC2-155_genome_v5.fasta") %>%
    genomebrowser()
genome_addSequence(gb,fast)

# Data from https://mycobrowser.epfl.ch/releases
genome_addGFF(gb, "./data/genomes/Mycobacterium_smegmatis_MC2-155_gff_v5.gff")

plot(gb)

This code triggers the following error:

Error in if (dim(x)[1] > 0 && dim(x)[2] > 0) aux <- toJSON(x[1, 1]) else aux <- "" : 
  missing value where TRUE/FALSE needed

Then, I tried using a genebank file from https://www.ncbi.nlm.nih.gov/datasets/genome/?taxon=246196. This code looks like:

library(D3GB)
library(magrittr)
library(ape)

gb <- gbk2genomebrowser("./data/genomes/genomic.gbff")
plot(gb)

But got the same error:

Error in if (dim(x)[1] > 0 && dim(x)[2] > 0) aux <- toJSON(x[1, 1]) else aux <- "" : 
  missing value where TRUE/FALSE needed

I suspect the error might come from the fact that M. smegmatis only have one chromosome, but I am not sure. Any help will be highly appreciated.

Here is my session:

sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.5

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Europe/Zurich
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] ape_5.8        magrittr_2.0.3 D3GB_2.0      

loaded via a namespace (and not attached):
 [1] digest_0.6.36   base64enc_0.1-3 fastmap_1.2.0   bit_4.0.5       lattice_0.21-9  cachem_1.1.0    blob_1.2.4      parallel_4.3.2 
 [9] pkgconfig_2.0.3 memoise_2.0.1   bit64_4.0.5     cli_3.6.3       RSQLite_2.3.7   grid_4.3.2      vctrs_0.6.5     DBI_1.2.3      
[17] renv_1.0.7      compiler_4.3.2  tools_4.3.2     nlme_3.1-163    Rcpp_1.0.12     rlang_1.1.4     jsonlite_1.8.8 
phisanti commented 2 months ago

If it helps, I have found that if force the gb to have more than one chromosome via:

gb$assembly <- data.frame(chr = c("NC_008596.1", "test"), start = 0, end = 6988209)

It works without issue, but, non-surprisingly, it shows two chromosomes.