ohlerlab / RiboseQC

Pipeline for Quality Control of Ribo-Seq data, selection of P-site offsets, and codon usage statistics.
15 stars 14 forks source link

Error during creating final report #16

Closed Jelinek-J closed 2 years ago

Jelinek-J commented 3 years ago

Hi, I'm getting a weird error, when using the current version of the program (the same data and command work, if I use an old installation from June 2020). Do you have any idea, what could be a problem? I tested it in WSL2 Ubuntu 20.04; virtual machine Ubuntu 20.04; and Debian 10.

> RiboseQC_analysis("Homo_sapiens.GRCh38.104.gtf_Rannot", c("input.bam"), read_subset = T, readlength_choice_method = "max_coverage", dest_names = c("input-RiboseQC"), rescue_all_rls = F, fast_mode = T, create_report = T, report_file = "output-RiboseQC", extended_report = F, pdf_plots = T, stranded = T, normalize_cov = T)
Loading annotation files in Homo_sapiens.GRCh38.104.gtf_Rannot ... Fri Oct 22 13:45:44 2021
assigning FaFile_Circ object Homo_sapiens.GRCh38.dna.primary_assembly.fa to the global workspace as genome_seq
assigning GTF_annotation object GTF_annotation to parent workspace
Loading annotation files --- Done! Fri Oct 22 13:45:54 2021
Extracting read lengths from input.bam ... Fri Oct 22 13:46:04 2021
Extracting read lengths --- Done! Fri Oct 22 13:46:37 2021
Analyzing BAM file: input.bam ... Fri Oct 22 13:46:37 2021
Analyzing BAM file --- Done! Fri Oct 22 13:52:27 2021
Building aggregate 5' profiles ... Fri Oct 22 13:52:27 2021
Building aggregate 5' profiles --- Done! Fri Oct 22 13:55:16 2021
Calculating P-sites offsets ... Fri Oct 22 13:55:16 2021
Calculating P-sites offsets --- Done! Fri Oct 22 13:55:25 2021
Calculating P-sites positions and junctions ... Fri Oct 22 13:55:25 2021
Calculating P-sites positions and junctions --- Done! Fri Oct 22 13:56:24 2021
Building aggregate P-sites profiles ... Fri Oct 22 13:56:24 2021
Building aggregate P-sites profiles --- Done! Fri Oct 22 13:56:49 2021
Exporting files ... Fri Oct 22 13:56:49 2021
Writing results to input-RiboseQC_results_RiboseQC
Exporting files --- Done! Fri Oct 22 13:57:25 2021

Creating html report in output-RiboseQC ... Fri Oct 22 13:57:25 2021

processing file: riboseqc_template.Rmd
Quitting from lines 4-13 (riboseqc_template.Rmd)
Quitting from lines NA-39 (riboseqc_template.Rmd)
Error in parse(text = x, srcfile = src) :
  attempt to use zero-length variable name

Btw. what is a difference/relationship between ohlerlab/RiboseQC and lcalviell/Ribo-seQC?

Sobhan04 commented 2 years ago

This error is because of the new version of the "knitr" package (1.36). Install the older version of this package (1.33) and it should work.

`

library("RiboseQC") install.packages("https://cran.r-project.org/src/contrib/markdown_1.1.tar.gz",repos = NULL, type = "source") install.packages("https://cran.r-project.org/src/contrib/Archive/knitr/knitr_1.33.tar.gz",repos = NULL, type = "source") packageVersion("knitr") [1] ‘1.33’ RiboseQC_analysis(annotation_file, bam_files,report_file,write_tmp_files = F)`

Jelinek-J commented 2 years ago

Hi Sobhan04,

thanks for the suggestion, however it does not solve it. Actually, I even had knitr 1.33 on the working machine. To check, I tried it on completelly new installation of Ubuntu 20.04 (Hyper-V virtual machine) and result was still the same (for clarity, I ommited outputs except last three commands):

# to have all up to date; gparted just to enlarge disc space, it should not affect anything else
$ sudo apt-get update; sudo apt-get upgrade; sudo apt-get autoremove; sudo apt-get install gparted

# prerequisities
$ sudo apt-get install r-base libxml2-dev libssl-dev libcurl4-openssl-dev pandoc

# installation
$ rsync -aP rsync://hgdownload.soe.ucsc.edu/genome/admin/exe/linux.x86_64/faToTwoBit .
$ chmod 744 faToTwoBit
$ sudo R
> install.packages("devtools")
> install.packages("https://cran.r-project.org/src/contrib/markdown_1.1.tar.gz",repos = NULL, type = "source")
> install.packages("https://cran.r-project.org/src/contrib/Archive/knitr/knitr_1.33.tar.gz",repos = NULL, type = "source")
> library("devtools")
> install_github(repo = "ohlerlab/RiboseQC")
> packageVersion("knitr")
> q()

# download data to work with
$ wget  ftp://ftp.ensembl.org/pub/release-104/fasta/homo_sapiens/dna/Homo_sapiens.GRCh38.dna.primary_assembly.fa.gz
$ wget  ftp://ftp.ensembl.org/pub/release-104/gtf/homo_sapiens/Homo_sapiens.GRCh38.104.gtf.gz
$ gunzip Homo_sapiens.GRCh38.*.gz
$ wget http://rpredictor.ms.mff.cuni.cz/test.bam # short excerpt to quick check

# preprocessing & processing
$ ./faToTwoBit Homo_sapiens.GRCh38.dna.primary_assembly.fa Homo_sapiens.GRCh38.dna.primary_assembly.2bit
$ R
> library("RiboseQC")
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: ‘BiocGenerics’

The following objects are masked from ‘package:parallel’:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from ‘package:stats’:

    IQR, mad, sd, var, xtabs

The following objects are masked from ‘package:base’:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: ‘S4Vectors’

The following object is masked from ‘package:base’:

    expand.grid

Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector

Attaching package: ‘Biostrings’

The following object is masked from ‘package:base’:

    strsplit

Loading required package: rmarkdown
Loading required package: rtracklayer
Loading required package: GenomicAlignments
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: DelayedArray
Loading required package: matrixStats

Attaching package: ‘matrixStats’

The following objects are masked from ‘package:Biobase’:

    anyMissing, rowMedians

Loading required package: BiocParallel

Attaching package: ‘DelayedArray’

The following objects are masked from ‘package:matrixStats’:

    colMaxs, colMins, colRanges, rowMaxs, rowMins, rowRanges

The following objects are masked from ‘package:base’:

    aperm, apply, rowsum

Loading required package: BSgenome
Loading required package: GenomicFiles
Loading required package: devtools
Loading required package: usethis
Loading required package: reshape2
Loading required package: ggplot2
Loading required package: knitr
Loading required package: DT
Loading required package: gridExtra

Attaching package: ‘gridExtra’

The following object is masked from ‘package:Biobase’:

    combine

The following object is masked from ‘package:BiocGenerics’:

    combine

Loading required package: ggpubr
Loading required package: viridis
Loading required package: viridisLite
Loading required package: GenomicFeatures
Loading required package: AnnotationDbi
Loading required package: jsonlite
Warning messages:
1: replacing previous import ‘BiocGenerics::combine’ by ‘gridExtra::combine’ when loading ‘RiboseQC’ 
2: replacing previous import ‘BiocGenerics::Position’ by ‘ggplot2::Position’ when loading ‘RiboseQC’

> prepare_annotation_files(".", "Homo_sapiens.GRCh38.dna.primary_assembly.2bit", "Homo_sapiens.GRCh38.104.gtf", annotation_name="GRCh38", genome_seq="Homo_sapiens.GRCh38.dna.primary_assembly.fa")
Creating the TxDb object ... Fri Nov 12 18:17:02 2021
Import genomic features from the file as a GRanges object ... OK
Prepare the 'metadata' data frame ... OK
Make the TxDb object ... OK
Creating the TxDb object --- Done! Fri Nov 12 18:18:06 2021
Extracting genomic regions ... Fri Nov 12 18:18:06 2021
Extracting ids and biotypes ... Fri Nov 12 18:20:41 2021
Defining most common start/stop codons ... Fri Nov 12 18:22:20 2021
Rannot object created!   Fri Nov 12 18:24:35 2021
Exporting annotation tables ... Fri Nov 12 18:24:35 2021
Exporting annotation tables --- Done! Fri Nov 12 18:24:37 2021
[1] "/home/riboseqc/Homo_sapiens.GRCh38.104.gtf_Rannot"
Warning message:
In .get_cds_IDX(mcols0$type, mcols0$phase) :
  The "phase" metadata column contains non-NA values for features of type
  stop_codon. This information was ignored.

> RiboseQC_analysis("Homo_sapiens.GRCh38.104.gtf_Rannot", c("test.bam"), read_subset = T, readlength_choice_method = "max_coverage", dest_names = c("test-RiboseQC"), rescue_all_rls = F, fast_mode = T, create_report = T, report_file = "output", extended_report = F, pdf_plots = T, stranded = T, normalize_cov = T, write_tmp_files = F)
Loading annotation files in Homo_sapiens.GRCh38.104.gtf_Rannot ... Fri Nov 12 18:26:47 2021
assigning FaFile_Circ object Homo_sapiens.GRCh38.dna.primary_assembly.fa to the global workspace as genome_seq
assigning GTF_annotation object GTF_annotation to parent workspace
Loading annotation files --- Done! Fri Nov 12 18:26:53 2021
Extracting read lengths from test.bam ... Fri Nov 12 18:26:55 2021
Extracting read lengths --- Done! Fri Nov 12 18:26:55 2021
Analyzing BAM file: test.bam ... Fri Nov 12 18:26:55 2021 
Analyzing BAM file --- Done! Fri Nov 12 18:26:59 2021 
Building aggregate 5' profiles ... Fri Nov 12 18:26:59 2021 
Building aggregate 5' profiles --- Done! Fri Nov 12 18:26:59 2021 
Calculating P-sites offsets ... Fri Nov 12 18:26:59 2021 
Calculating P-sites offsets --- Done! Fri Nov 12 18:26:59 2021 
Calculating P-sites positions and junctions ... Fri Nov 12 18:26:59 2021 
Calculating P-sites positions and junctions --- Done! Fri Nov 12 18:27:01 2021 
Building aggregate P-sites profiles ... Fri Nov 12 18:27:01 2021 
[1] "Not enough signal or low frame preference, skipped P-sites & codon occupancy calculation. \n Set 'all' in the 'choose_readlengths' choice to ignore this warning and get P-sites positions in a new run"
Building aggregate P-sites profiles --- Done! Fri Nov 12 18:27:01 2021 
Exporting files ... Fri Nov 12 18:27:01 2021 
Writing results to test-RiboseQC_results_RiboseQC
Exporting files --- Done! Fri Nov 12 18:27:05 2021 

Creating html report in output ... Fri Nov 12 18:27:05 2021

processing file: riboseqc_template.Rmd
Error in file(con, "w") : cannot open the connection
Sobhan04 commented 2 years ago

Hi, Well, I think if you first load "RiboseQC" package and then load the "knitr" package it can solve the problem. Moreover, the error you posted is different from the previous one. Have a look at this link: https://github.com/ramnathv/slidify/issues/299#issuecomment-175370731

Jelinek-J commented 2 years ago

Hi, good point. Actually, your first answer solved it. There was just another problem, I created for it new issue #17. Thank you very much for your help.