Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally ignore errors #324

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions sqanti3_qc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ def run(args):
## Generating report
if args.report != 'skip':
print("**** Generating SQANTI3 report....", file=sys.stderr)
cmd = RSCRIPTPATH + " {d}/{f} {c} {j} {p} {d} {a} {b}".format(d=utilitiesPath, f=RSCRIPT_REPORT, c=outputClassPath, j=outputJuncPath, p=args.doc, a=args.saturation, b=args.report)
cmd = RSCRIPTPATH + " {d}/{f} {c} {j} {p} {d} {a} {b} {i}".format(d=utilitiesPath, f=RSCRIPT_REPORT, c=outputClassPath, j=outputJuncPath, p=args.doc, a=args.saturation, b=args.report, i=args.ignore_report_errors)
if subprocess.check_call(cmd, shell=True)!=0:
print("ERROR running command: {0}".format(cmd), file=sys.stderr)
sys.exit(-1)
Expand Down Expand Up @@ -2384,7 +2384,7 @@ def combine_split_runs(args, split_dirs):

if args.report != 'skip':
print("**** Generating SQANTI3 report....", file=sys.stderr)
cmd = RSCRIPTPATH + " {d}/{f} {c} {j} {p} {d} {a} {b}".format(d=utilitiesPath, f=RSCRIPT_REPORT, c=outputClassPath, j=outputJuncPath, p=args.doc, a=args.saturation, b=args.report)
cmd = RSCRIPTPATH + " {d}/{f} {c} {j} {p} {d} {a} {b} {i}".format(d=utilitiesPath, f=RSCRIPT_REPORT, c=outputClassPath, j=outputJuncPath, p=args.doc, a=args.saturation, b=args.report, i=args.ignore_report_errors)
if subprocess.check_call(cmd, shell=True)!=0:
print("ERROR running command: {0}".format(cmd), file=sys.stderr)
sys.exit(-1)
Expand Down Expand Up @@ -2423,6 +2423,7 @@ def main():
parser.add_argument("-v", "--version", help="Display program version number.", action='version', version='SQANTI3 '+str(__version__))
parser.add_argument("--saturation", action="store_true", default=False, help='\t\tInclude saturation curves into report')
parser.add_argument("--report", choices=['html', 'pdf', 'both', 'skip'], default='html', help='\t\tselect report format\t\t--html\t\t--pdf\t\t--both\t\t--skip')
parser.add_argument("--ignore-report-errors", action="store_true", help='\t\tignore errors during the rendering of of the report')
parser.add_argument('--isoAnnotLite' , help='\t\tRun isoAnnot Lite to output a tappAS-compatible gff3 file',required=False, action='store_true' , default=False)
parser.add_argument('--gff3' , help='\t\tPrecomputed tappAS species specific GFF3 file. It will serve as reference to transfer functional attributes',required=False)
parser.add_argument('--short_reads', help='\t\tFile Of File Names (fofn, space separated) with paths to FASTA or FASTQ from Short-Read RNA-Seq. If expression or coverage files are not provided, Kallisto (just for pair-end data) and STAR, respectively, will be run to calculate them.', required=False)
Expand Down
13 changes: 11 additions & 2 deletions utilities/report_qc/SQANTI3_report.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ junc.file <- args[2]
utilities.path <- args[4]
saturation.curves <- args[5]
report.format <- args[6]
ignore.errors <- args[7]

if (length(args) < 6) {
stop("Incorrect number of arguments! Script usage is: [classification file] [junction file] [utilities directory path] [True/False for saturation curves] [pdf|html|both]. Abort!")
if (length(args) != 7) {
stop("Incorrect number of arguments! Script usage is: [classification file] [junction file] [utilities directory path] [True/False for saturation curves] [pdf|html|both] [True/False to ignore errors]. Abort!")
}

if (!(saturation.curves %in% c('True', 'False'))) {
Expand All @@ -28,6 +29,14 @@ if (!(report.format %in% c('pdf', 'html', 'both'))) {
stop("Report format needs to be: pdf, html, or both. Abort!")
}

if (!(ignore.errors %in% c('True', 'False'))) {
stop("Ignore errors needs to be 'True' or 'False'. Abort!")
}

if (ignore.errors == "True") {
options(error = function(){})
}

source(paste(utilities.path, "/report_qc/generatePDFreport.R", sep = "/"))

if (saturation.curves=='True'){
Expand Down
2 changes: 1 addition & 1 deletion utilities/report_qc/SQANTI3_report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The code contains several parts:
<!---Basic setting-->

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, cache = FALSE, warning = FALSE, results = 'asis', echo=FALSE)
knitr::opts_chunk$set(cache = FALSE, warning = FALSE, results = 'asis', echo = FALSE, error = ignore.errors)

has_data <- function(df) {
if (!is.null(df) && length(df) > 0 && is.data.frame(df) && nrow(df) > 0) {
Expand Down