minion_qc icon indicating copy to clipboard operation
minion_qc copied to clipboard

Script fails to finish creating plots

Open avantonder opened this issue 5 years ago • 9 comments

Hi,

I'm trying to run MinIONQC.R on some nanopore data I basecalled using albacore (with and without the --barcoding option. The script runs and creates some of the plots and then falls over with the following error:

INFO [2018-07-26 08:17:33] Loading input file: sequencing_summary.txt INFO [2018-07-26 08:17:53] .: creating output directory:. INFO [2018-07-26 08:17:53] .: summarising input file for flowcell INFO [2018-07-26 08:17:54] .: plotting length histogram INFO [2018-07-26 08:17:59] .: plotting mean Q score histogram INFO [2018-07-26 08:18:04] .: plotting flowcell overview INFO [2018-07-26 08:19:01] .: plotting flowcell yield over time INFO [2018-07-26 08:19:18] .: plotting flowcell yield by read length INFO [2018-07-26 08:19:31] .: plotting sequence length over time Error in ans[!test & ok] <- rep(no, length.out = length(ans))[!test & : replacement has length zero Calls: single.flowcell ... expand_range4 -> expand_range -> <Anonymous> -> f -> ifelse Execution halted

Thanks,

Andries

avantonder avatar Jul 26 '18 08:07 avantonder

Hi Andries,

If you are able to send me your sequencing_summary.txt file off-list, (or just the first couple of thousand lines is usually enough), I will take a look and see if I can help. It looks to me like there may be some issue with the way my code deals with the time values in your file, but unless I can reproduce the error it's very hard to say much more than that.

Cheers,

Rob

roblanf avatar Jul 26 '18 21:07 roblanf

Hi @roblanf, I am experiencing very similar error to one that @avantonder posted:

INFO [2020-04-13 13:22:27] Loading input file: 0_basecalled/sequencing_summary.txt
INFO [2020-04-13 13:22:32] MinION flowcell detected
INFO [2020-04-13 13:22:34] 0_basecalled: creating output directory:0_MinIONQC/0_basecalled
INFO [2020-04-13 13:22:34] 0_basecalled: summarising input file for flowcell
INFO [2020-04-13 13:22:35] 0_basecalled: plotting length histogram
INFO [2020-04-13 13:22:37] 0_basecalled: plotting mean Q score histogram
INFO [2020-04-13 13:22:38] 0_basecalled: plotting flowcell overview
INFO [2020-04-13 13:22:49] 0_basecalled: plotting flowcell yield over time
INFO [2020-04-13 13:22:52] 0_basecalled: plotting flowcell yield by read length
INFO [2020-04-13 13:22:55] 0_basecalled: plotting sequence length over time
Error in ans[test & ok] <- rep(yes, length.out = length(ans))[test & ok] :
  replacement has length zero
Calls: single.flowcell ... expand_range4 -> expand_range -> <Anonymous> -> f -> ifelse
Execution halted

Please see the sequencing_summary.txt in hope you can figure out where does the code fail.

DeniRibicic avatar Apr 13 '20 11:04 DeniRibicic

Hi @DeniRibicic,

Taking a look now. Will update!

Rob

roblanf avatar Apr 14 '20 01:04 roblanf

@DeniRibicic I couldn't reproduce your error using your input file, which suggests it's a difference in our environments.

Have you updated all the required packages recently? If so, can you paste in as much information as possible on your environment, packge versions, etc?

To update all the relevant packages you can do this:

install.packages(c("data.table", 
                   "futile.logger",
                   "ggplot2",
                   "optparse",
                   "plyr",
                   "readr",
                   "reshape2",
                   "scales",
                   "viridis",
                   "yaml"))

roblanf avatar Apr 14 '20 03:04 roblanf

@roblanf all the packages were up-to-date, but R was an older version R version 3.5.1 (2018-07-02) -- "Feather Spray" Updating to recent version solved the problem R version 3.6.3 (2020-02-29) -- "Holding the Windsock".

DeniRibicic avatar Apr 14 '20 10:04 DeniRibicic

Thanks for the update @DeniRibicic. I wish I had any idea at all about what the issue was. I'll leave this open in the hopes that I can recreate it by installing R 3.5.1 first.

roblanf avatar Apr 14 '20 22:04 roblanf

@roblanf something interesting is happening. When I run the script directly in my shell everything works fine. However, I have incorporated the MinIONQC.R in my workflow through a bash script and now getting the same error as previously. Would you have any idea why this would happen?

On the side note, I have noticed when activating conda environment in my bash workflows with regular conda activate comand it wouldn't work- maybe it is somehow related?

DeniRibicic avatar Apr 17 '20 08:04 DeniRibicic

Interesting. My bet (and I'm clutching at straws, tbh) is that you're right that these are related.

You could try different ways of calling your bash script, e.g. with -i (suggested here: https://github.com/conda/conda/issues/7980#issuecomment-550410546), with sh or bash.

What's most odd to me is that whatever is breaking is buried fairly deep down in MinIONQC.R. But I'll give it a shot with a bash script to see if I can recreate the issue. If you can provide any more details on your environment and shell, that might be useful.

roblanf avatar Apr 20 '20 00:04 roblanf

@roblanf sorry for the late reply. Here is some info:

SHELL=/bin/bash
SSH_CLIENT=10.218.129.55 55285 22
CONDA_SHLVL=1
CONDA_PROMPT_MODIFIER=(base)
LC_NUMERIC=nb_NO.UTF-8
SSH_TTY=/dev/pts/23
CONDA_EXE=/home/denir/anaconda3/bin/conda
DESKTOP_MODE=1
_CE_CONDA=
CONDA_BACKUP_JAVA_HOME=
MAIL=/var/mail/denir
PATH=/home/denir/bin:/home/denir/anaconda3/bin:/home/denir/anaconda3/condabin
CONDA_PREFIX=/home/denir/anaconda3
SHLVL=1
HOME=/home/denir

Ubuntu 16.04

Not sure how helpful is this, but thanks for the effort tho.

DeniRibicic avatar Apr 26 '20 11:04 DeniRibicic