SamDeMario-lab / NanoBlot

NanoBlot is an open source R package that generates northern blot and RT-PCR like images from long-read sequencing data.
MIT License
7 stars 3 forks source link

Install issue #36

Closed a-bio90 closed 1 year ago

a-bio90 commented 1 year ago

Hello,

when trying to install NanoBlot in R after following the instructions I get the following error after running [devtools](devtools::install(build_vignettes = TRUE)):

devtools::install(build_vignettes = TRUE) Skipping 6 packages not available: Rsubread, GenomicRanges, GenomicAlignments, DESeq2, Rsamtools, BiocGenerics ── R CMD build ────────────────────────────────────────────────────────────────────── ✔ checking for file ‘/Users/bernarda/NanoBlot-main/NanoBlotPackage/DESCRIPTION’ (591ms) ─ preparing ‘NanoBlotPackage’: ✔ checking DESCRIPTION meta-information ... ─ installing the package to build vignettes

ERROR: dependencies ‘BiocGenerics’, ‘Rsamtools’, ‘DESeq2’, ‘GenomicAlignments’, ‘GenomicRanges’, ‘Rsubread’ are not available for package ‘NanoBlotPackage’ ─ removing ‘/private/var/folders/w4/8rfmgzmd3z37fmtbg1y3bkrnhj31tj/T/RtmpNcPOJH/Rinst110c35007a4cb/NanoBlotPackage’

ERROR: package installation failed Error in "(function (command = NULL, args = character(), error_on_status = TRUE, …": ! System command 'R' failed Exit status: 1 stdout & stderr:

Those packages are listed in conda list in the nanoblot conda environment. Running system2("samtools") works. It is probably something very stupid, any suggestion? Thanks

SamDeMario-lab commented 1 year ago

Hello! There's 2 things that are immediately coming to mind.

The first is that it might be an R version issue. Can you run: version
and send the output? I'm thinking that those packages might not be available for your version of R.

The second is that BioManager might not be installed. I would run: if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") and the try installing again.

KevinXu264 commented 1 year ago

Hey @a-bio90 adding on to the suggestion here. I think the build error could be a result of the R environment not being able to find the dependencies listed, namely ‘BiocGenerics’, ‘Rsamtools’, ‘DESeq2’, ‘GenomicAlignments’, ‘GenomicRanges’, ‘Rsubread’

Did you install these dependencies using Bioconductor already? Samtools, as you mentioned was working in your post, is only one of the many dependencies required for NanoBlot to run. If you havent installed these packages, you can either install them individually in R or install the conda environment using the provided .yml file, making sure that the conda environment is included in the R environment path.

a-bio90 commented 1 year ago

Thank for you quick answers! This is the R version I have:

> version
               _                           
platform       x86_64-apple-darwin20       
arch           x86_64                      
os             darwin20                    
system         x86_64, darwin20            
status                                     
major          4                           
minor          3.1                         
year           2023                        
month          06                          
day            16                          
svn rev        84548                       
language       R                           
version.string R version 4.3.1 (2023-06-16)
nickname       Beagle Scouts 

I have also run if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") But still, running the command devtools::install(build_vignettes = TRUE) I still get the same error (packages not found).

Regarding the conda environment I run these commands to set the folder containing the NanoBlot environment set by using your .yml file old_path <- Sys.getenv("PATH") Sys.setenv(PATH = paste(old_path, "/Users/bernarda/anaconda3/envs/nanoblotenv", sep = ":"))

If I run conda env list in my terminal the nanoblot environment is listed:

# conda environments:
#
base                     /Users/bernarda/anaconda3
nanoblotenv           *  /Users/bernarda/anaconda3/envs/nanoblotenv
                         /Users/bernarda/opt/anaconda3/envs/deepblink
                         /Users/bernarda/opt/anaconda3/envs/fq-segmentation

Also, if I run conda list after having activated the NanoBlot environment I get the following packages list:

# packages in environment at /Users/bernarda/anaconda3/envs/nanoblotenv:
#
# Name                    Version                   Build  Channel
_r-mutex                  1.0.1               anacondar_1    conda-forge
bedtools                  2.30.0               h0e31d98_3    bioconda
bioconductor-annotate     1.72.0            r41hdfd78af_0    bioconda
bioconductor-annotationdbi 1.56.2            r41hdfd78af_0    bioconda
bioconductor-apeglm       1.16.0            r41hb890f52_2    bioconda
bioconductor-biobase      2.54.0            r41h3be46a4_2    bioconda
bioconductor-biocgenerics 0.40.0            r41hdfd78af_0    bioconda
bioconductor-biocio       1.4.0             r41hdfd78af_0    bioconda
bioconductor-biocparallel 1.28.3            r41hb890f52_1    bioconda
bioconductor-biostrings   2.62.0            r41h3be46a4_2    bioconda
bioconductor-delayedarray 0.20.0            r41h3be46a4_2    bioconda
bioconductor-deseq2       1.34.0            r41hb890f52_3    bioconda
bioconductor-genefilter   1.76.0            r41h238a2e4_2    bioconda
bioconductor-geneplotter  1.72.0            r41hdfd78af_0    bioconda
bioconductor-genomeinfodb 1.30.1            r41hdfd78af_0    bioconda
bioconductor-genomeinfodbdata 1.2.7             r41hdfd78af_2    bioconda
bioconductor-genomicalignments 1.30.0            r41h3be46a4_2    bioconda
bioconductor-genomicranges 1.46.1            r41h3be46a4_1    bioconda
bioconductor-iranges      2.28.0            r41h3be46a4_2    bioconda
bioconductor-keggrest     1.34.0            r41hdfd78af_0    bioconda
bioconductor-matrixgenerics 1.6.0             r41hdfd78af_0    bioconda
bioconductor-rhtslib      1.26.0            r41h3be46a4_2    bioconda
bioconductor-rsamtools    2.10.0            r41hb890f52_2    bioconda
bioconductor-rsubread     2.8.1             r41haba8685_0    bioconda
bioconductor-rtracklayer  1.54.0            r41h68a2ddb_0    bioconda
bioconductor-s4vectors    0.32.4            r41h3be46a4_0    bioconda
bioconductor-summarizedexperiment 1.24.0            r41hdfd78af_0    bioconda
bioconductor-xvector      0.34.0            r41h3be46a4_2    bioconda
bioconductor-zlibbioc     1.40.0            r41h3be46a4_2    bioconda
bwidget                   1.9.14               h694c41f_1    conda-forge
bzip2                     1.0.8                h0d85af4_4    conda-forge
c-ares                    1.19.1               h0dc2134_0    conda-forge
ca-certificates           2023.7.22            h8857fd0_0    conda-forge
cairo                     1.16.0            h09dd18c_1016    conda-forge
cctools_osx-64            973.0.1             ha1c5b94_14    conda-forge
clang                     16.0.6               hc177806_1    conda-forge
clang-16                  16.0.6          default_h762fdd7_1    conda-forge
clang_osx-64              16.0.6               h8787910_1    conda-forge
clangxx                   16.0.6          default_h762fdd7_1    conda-forge
clangxx_osx-64            16.0.6               h1b7723c_1    conda-forge
compiler-rt               16.0.6               he1888fc_0    conda-forge
compiler-rt_osx-64        16.0.6               he1888fc_0    conda-forge
curl                      8.2.1                h5f667d7_0    conda-forge
expat                     2.5.0                hf0c8a7f_1    conda-forge
font-ttf-dejavu-sans-mono 2.37                 hab24e00_0    conda-forge
font-ttf-inconsolata      3.000                h77eed37_0    conda-forge
font-ttf-source-code-pro  2.038                h77eed37_0    conda-forge
font-ttf-ubuntu           0.83                 hab24e00_0    conda-forge
fontconfig                2.14.2               h5bb23bf_0    conda-forge
fonts-conda-ecosystem     1                             0    conda-forge
fonts-conda-forge         1                             0    conda-forge
freetype                  2.12.1               h3f81eb7_1    conda-forge
fribidi                   1.0.10               hbcb3906_0    conda-forge
gettext                   0.21.1               h8a4c099_0    conda-forge
gfortran_impl_osx-64      12.3.0               h54fd467_1    conda-forge
gfortran_osx-64           12.3.0               h18f7dce_1    conda-forge
gmp                       6.2.1                h2e338ed_0    conda-forge
graphite2                 1.3.13            h2e338ed_1001    conda-forge
gsl                       2.7                  h93259b0_0    conda-forge
harfbuzz                  7.3.0                h413ba03_0    conda-forge
htslib                    1.17                 h365c357_2    bioconda
icu                       72.1                 h7336db1_0    conda-forge
isl                       0.25                 hb486fe8_0    conda-forge
krb5                      1.21.2               hb884880_0    conda-forge
ld64_osx-64               609                 ha20a434_14    conda-forge
lerc                      4.0.0                hb486fe8_0    conda-forge
libblas                   3.9.0           17_osx64_openblas    conda-forge
libcblas                  3.9.0           17_osx64_openblas    conda-forge
libclang-cpp16            16.0.6          default_h762fdd7_1    conda-forge
libcurl                   8.2.1                h5f667d7_0    conda-forge
libcxx                    16.0.6               hd57cbcb_0    conda-forge
libdeflate                1.18                 hac1461d_0    conda-forge
libedit                   3.1.20191231         h0678c8f_2    conda-forge
libev                     4.33                 haf1e3a3_1    conda-forge
libexpat                  2.5.0                hf0c8a7f_1    conda-forge
libffi                    3.4.2                h0d85af4_5    conda-forge
libgfortran               5.0.0           12_3_0_h97931a8_1    conda-forge
libgfortran-devel_osx-64  12.3.0               h0b6f5ec_1    conda-forge
libgfortran5              12.3.0               hbd3c1fe_1    conda-forge
libglib                   2.76.4               hc62aa5d_0    conda-forge
libiconv                  1.17                 hac89ed1_0    conda-forge
libjpeg-turbo             2.1.5.1              hb7f2c08_0    conda-forge
liblapack                 3.9.0           17_osx64_openblas    conda-forge
libllvm16                 16.0.6               he4b1e75_2    conda-forge
libnghttp2                1.52.0               he2ab024_0    conda-forge
libopenblas               0.3.23          openmp_h429af6e_0    conda-forge
libpng                    1.6.39               ha978bb4_0    conda-forge
libssh2                   1.11.0               hd019ec5_0    conda-forge
libtiff                   4.5.1                hf955e92_0    conda-forge
libwebp-base              1.3.1                h0dc2134_0    conda-forge
libxml2                   2.11.5               hd95e348_0    conda-forge
libzlib                   1.2.13               h8a1eda9_5    conda-forge
llvm-openmp               16.0.6               hff08bdf_0    conda-forge
llvm-tools                16.0.6               he4b1e75_2    conda-forge
make                      4.3                  h22f3db7_1    conda-forge
mpc                       1.3.1                h81bd1dd_0    conda-forge
mpfr                      4.2.0                h4f9bd69_0    conda-forge
ncurses                   6.4                  hf0c8a7f_0    conda-forge
openssl                   3.1.2                h8a1eda9_0    conda-forge
pango                     1.50.14              hbce5e75_1    conda-forge
pcre2                     10.40                h1c4e4bc_0    conda-forge
pixman                    0.40.0               hbcb3906_0    conda-forge
r-ashr                    2.2_54            r41h49197e3_1    conda-forge
r-askpass                 1.1               r41h815d134_3    conda-forge
r-base                    4.1.3               had2b78c_10    conda-forge
r-bbmle                   1.0.25            r41hc72bb7e_1    conda-forge
r-bdsmatrix               1.3_6             r41h815d134_1    conda-forge
r-bh                      1.81.0_1          r41hc72bb7e_0    conda-forge
r-biocmanager             1.30.21           r41hc72bb7e_0    conda-forge
r-bit                     4.0.5             r41h815d134_0    conda-forge
r-bit64                   4.0.5             r41h815d134_1    conda-forge
r-bitops                  1.0_7             r41h815d134_1    conda-forge
r-blob                    1.2.4             r41hc72bb7e_0    conda-forge
r-cachem                  1.0.8             r41h6dc245f_0    conda-forge
r-cli                     3.6.1             r41h49197e3_0    conda-forge
r-coda                    0.19_4            r41hc72bb7e_1    conda-forge
r-colorspace              2.1_0             r41h815d134_0    conda-forge
r-cpp11                   0.4.3             r41hc72bb7e_0    conda-forge
r-crayon                  1.5.2             r41hc72bb7e_1    conda-forge
r-curl                    4.3.3             r41h0100ac3_2    conda-forge
r-dbi                     1.1.3             r41hc72bb7e_1    conda-forge
r-dplyr                   1.1.2             r41hac7d2d5_0    conda-forge
r-ellipsis                0.3.2             r41h815d134_1    conda-forge
r-emdbook                 1.3.12            r41hc72bb7e_2    conda-forge
r-etrunct                 0.1             r41hc72bb7e_1004    conda-forge
r-fansi                   1.0.4             r41h815d134_0    conda-forge
r-farver                  2.1.1             r41h49197e3_1    conda-forge
r-fastmap                 1.1.1             r41h49197e3_0    conda-forge
r-formatr                 1.14              r41hc72bb7e_0    conda-forge
r-futile.logger           1.4.3           r41hc72bb7e_1004    conda-forge
r-futile.options          1.0.1           r41hc72bb7e_1003    conda-forge
r-generics                0.1.3             r41hc72bb7e_1    conda-forge
r-ggplot2                 3.4.2             r41hc72bb7e_0    conda-forge
r-ggridges                0.5.4             r41hc72bb7e_1    conda-forge
r-glue                    1.6.2             r41h815d134_1    conda-forge
r-gtable                  0.3.3             r41hc72bb7e_0    conda-forge
r-httr                    1.4.6             r41hc72bb7e_0    conda-forge
r-invgamma                1.1               r41hc72bb7e_2    conda-forge
r-irlba                   2.3.5.1           r41hce01bf1_0    conda-forge
r-isoband                 0.2.7             r41h49197e3_1    conda-forge
r-jsonlite                1.8.5             r41h6dc245f_0    conda-forge
r-labeling                0.4.2             r41hc72bb7e_2    conda-forge
r-lambda.r                1.2.4             r41hc72bb7e_2    conda-forge
r-lattice                 0.21_8            r41h815d134_0    conda-forge
r-lifecycle               1.0.3             r41hc72bb7e_1    conda-forge
r-locfit                  1.5_9.7           r41h815d134_0    conda-forge
r-magrittr                2.0.3             r41h815d134_1    conda-forge
r-mass                    7.3_58.3          r41h815d134_0    conda-forge
r-matrix                  1.5_4.1           r41hc46c21c_0    conda-forge
r-matrixstats             1.0.0             r41h6dc245f_0    conda-forge
r-memoise                 2.0.1             r41hc72bb7e_1    conda-forge
r-mgcv                    1.8_42            r41h40f944a_0    conda-forge
r-mime                    0.12              r41h815d134_1    conda-forge
r-mixsqp                  0.3_48            r41hf5e6a41_0    conda-forge
r-munsell                 0.5.0           r41hc72bb7e_1005    conda-forge
r-mvtnorm                 1.2_2             r41hfe07776_0    conda-forge
r-nlme                    3.1_162           r41h1e4e481_0    conda-forge
r-numderiv                2016.8_1.1        r41hc72bb7e_4    conda-forge
r-openssl                 2.0.6             r41hfeb9312_0    conda-forge
r-pillar                  1.9.0             r41hc72bb7e_0    conda-forge
r-pkgconfig               2.0.3             r41hc72bb7e_2    conda-forge
r-plogr                   0.2.0           r41hc72bb7e_1004    conda-forge
r-plyr                    1.8.8             r41h49197e3_0    conda-forge
r-png                     0.1_8             r41hbf2103b_0    conda-forge
r-r6                      2.5.1             r41hc72bb7e_1    conda-forge
r-rcolorbrewer            1.1_3             r41h785f33e_1    conda-forge
r-rcpp                    1.0.10            r41h49197e3_0    conda-forge
r-rcpparmadillo           0.12.4.0.0        r41he9b8800_0    conda-forge
r-rcppeigen               0.3.3.9.3         r41h4f1a15b_0    conda-forge
r-rcppnumerical           0.5_0             r41h49197e3_0    conda-forge
r-rcurl                   1.98_1.12         r41h0100ac3_1    conda-forge
r-restfulr                0.0.15            r41h5aaf88b_0    bioconda
r-rjson                   0.2.21            r41h49197e3_2    conda-forge
r-rlang                   1.1.1             r41hac7d2d5_0    conda-forge
r-rsqlite                 2.3.1             r41h49197e3_0    conda-forge
r-scales                  1.2.1             r41hc72bb7e_1    conda-forge
r-snow                    0.4_4             r41hc72bb7e_1    conda-forge
r-squarem                 2021.1            r41hc72bb7e_1    conda-forge
r-survival                3.5_5             r41h815d134_0    conda-forge
r-sys                     3.4.2             r41h6dc245f_0    conda-forge
r-tibble                  3.2.1             r41h815d134_1    conda-forge
r-tidyselect              1.2.0             r41hbe3e9c8_0    conda-forge
r-truncnorm               1.0_9             r41h815d134_0    conda-forge
r-utf8                    1.2.3             r41h815d134_0    conda-forge
r-vctrs                   0.6.2             r41hac7d2d5_0    conda-forge
r-viridislite             0.4.1             r41hc72bb7e_1    conda-forge
r-withr                   2.5.0             r41hc72bb7e_1    conda-forge
r-xml                     3.99_0.14         r41hb8526f4_1    conda-forge
r-xtable                  1.8_4             r41hc72bb7e_4    conda-forge
r-yaml                    2.3.7             r41h815d134_0    conda-forge
readline                  8.2                  h9e318b2_1    conda-forge
samtools                  1.17                 h25dfcfb_1    bioconda
sigtool                   0.1.3                h88f4db0_0    conda-forge
tapi                      1100.0.11            h9ce4665_0    conda-forge
tk                        8.6.12               h5dbffcc_0    conda-forge
tktable                   2.10                 h49f0cf7_3    conda-forge
xz                        5.2.6                h775f41a_0    conda-forge
zlib                      1.2.13               h8a1eda9_5    conda-forge
zstd                      1.5.2                h829000d_7    conda-forge

So it looks like those packages are listed in the conda environment. I am quite new in dealing with command line installations, so there might be something I did wrong. Thanks for the support!

KevinXu264 commented 1 year ago

@a-bio90

Are you building NanoBlot using Rstudio? If so, your conda environment is installed correctly, and you have set the R path to correctly include the conda environment path. I think this might have been an error on our end when we were building the Rstudio package dependencies, I don't think Rstudio correctly loads the packages in from the conda environment when pathed this way. Regardless, while we're figuring out this fix, can you try running this in the meantime in your Rstudio console?

BiocManager::install(c("BiocGenerics", "Rsamtools", "DESeq2", "GenomicAlignments", "GenomicRanges", "Rsubread"))

This should install all the missing dependencies in your Rstudio. Make sure you're still following the steps for the other packages (not native to Rstudio such as samtools, bedtools, etc.) Let us know if this works, and we'll follow-up with a more permanent solution to the original problem.

a-bio90 commented 1 year ago

Yes, I am using Rstudio. I installed the packages with the command you suggested. Then by running again devtools::install(build_vignettes = TRUE) to build NanoBlot I get the following error, where it says that the package rtracklayer is missing.

> devtools::install(build_vignettes = TRUE)
Skipping 6 packages not available: Rsubread, GenomicRanges, GenomicAlignments, DESeq2, Rsamtools, BiocGenerics
── R CMD build ──────────────────────────────────────────────────────────
✔  checking for file ‘/Users/bernarda/NanoBlot-main/NanoBlotPackage/DESCRIPTION’ (435ms)
─  preparing ‘NanoBlotPackage’:
✔  checking DESCRIPTION meta-information ...
─  installing the package to build vignettes
E  creating vignettes (9.3s)
   --- re-building ‘NanoBlotPackage.Rmd’ using rmarkdown

   Program: samtools (Tools for alignments in the SAM format)
   Version: 1.17 (using htslib 1.17)

   Usage:   samtools <command> [options]

   Commands:
     -- Indexing
        dict           create a sequence dictionary file
        faidx          index/extract FASTA
        fqidx          index/extract FASTQ
        index          index alignment

     -- Editing
        calmd          recalculate MD/NM tags and '=' bases
        fixmate        fix mate information
        reheader       replace BAM header
        targetcut      cut fosmid regions (for fosmid pool only)
        addreplacerg   adds or replaces RG tags
        markdup        mark duplicates
        ampliconclip   clip oligos from the end of reads

     -- File operations
        collate        shuffle and group alignments by name
        cat            concatenate BAMs
        consensus      produce a consensus Pileup/FASTA/FASTQ
        merge          merge sorted alignments
        mpileup        multi-way pileup
        sort           sort alignment file
        split          splits a file by read group
        quickcheck     quickly check if SAM/BAM/CRAM file appears intact
        fastq          converts a BAM to a FASTQ
        fasta          converts a BAM to a FASTA
        import         Converts FASTA or FASTQ files to SAM/BAM/CRAM
        reference      Generates a reference from aligned data
        reset          Reverts aligner changes in reads

     -- Statistics
        bedcov         read depth per BED region
        coverage       alignment depth and percent coverage
        depth          compute the depth
        flagstat       simple stats
        idxstats       BAM index stats
        cram-size      list CRAM Content-ID and Data-Series sizes
        phase          phase heterozygotes
        stats          generate stats (former bamcheck)
        ampliconstats  generate amplicon specific stats

     -- Viewing
        flags          explain BAM flags
        head           header viewer
        tview          text alignment viewer
        view           SAM<->BAM<->CRAM conversion
        depad          convert padded BAM to unpadded BAM
        samples        list the samples in a set of SAM/BAM/CRAM files

     -- Misc
        help [cmd]     display this help message or help for [cmd]
        version        detailed version information

   Quitting from lines 52-58 [unnamed-chunk-4] (NanoBlotPackage.Rmd)
   Error: processing vignette 'NanoBlotPackage.Rmd' failed with diagnostics:
   there is no package called 'rtracklayer'
   --- failed re-building ‘NanoBlotPackage.Rmd’

   SUMMARY: processing the following file failed:
     ‘NanoBlotPackage.Rmd’

   Error: Vignette re-building failed.
   Execution halted
Error in `(function (command = NULL, args = character(), error_on_status = TRUE, …`:
! System command 'R' failed
---
Exit status: 1
stdout & stderr: <printed>
---

So I installed rtracklayer using BiocManager::install("rtracklayer"). Then running devtools::install(build_vignettes = TRUE) works with no errors, saying DONE (NanoBlotPackage). Now I can try to use you examples. But just to be sure, when I open a new R project (in a different folder than the NanoBlot package) it will suffice to simply run library(NanoBlotPackage) to activate it or should I make other steps before?

I am very thankful for your suggestions and time I and hope to manage to use your cool tool in my research soon.

KevinXu264 commented 1 year ago

That's great to hear. I forgot to mention the rtracklayer dependency as its used for one of the other tests. Running library(NanoBlotPackage) will suffice, there is no need to reinstall the package unless there is an update to the source code.

a-bio90 commented 1 year ago

Thank, the examples ran smoothly now. In case I have unsolved issued with my analysis I might come back for a technical suggestion. Thanks a again for this resource.