Skip to content

samtools-1.6 and 1.9: plot-bamstats generates broken gnuplot script #1065

Closed
@mmokrejs

Description

@mmokrejs

Hi Peter,
I am getting errors when gnuplot is executed on the script generated by plot-bamstats on Linux.

$ plot-bamstats -p ./html/sample2/plot ./html/sample2/plot.stat

end
^
"./html/sample2/plot-quals-hm.gp" line 128: invalid command

The command exited with non-zero status 256:
	gnuplot ./html/sample2/plot-quals-hm.gp

 at /apps/all/SAMtools/1.9-intel-2017a/bin/plot-bamstats line 51.
	main::error('The command exited with non-zero status 256:\x{a}\x{9}gnuplot ./html/...') called at /apps/all/SAMtools/1.9-intel-2017a/bin/plot-bamstats line 317
	main::plot('./html/sample2/plot-quals-hm.gp') called at /apps/all/SAMtools/1.9-intel-2017a/bin/plot-bamstats line 818
	main::plot_qualities('HASH(0x1b69420)') called at /apps/all/SAMtools/1.9-intel-2017a/bin/plot-bamstats line 33

I tried also samtools-1.6 but it breaks on the same error (extraneous end commands in two places). It seems they are printed by the perl code due to some missing checks somewhere for some sections.

I see in issue #183 that there is (or used to be) some develop branch, I will test it later.

plot-quals-hm.gp.txt

Activity

valeriuo

valeriuo commented on Jun 17, 2019

@valeriuo
Contributor

I successfully ran gnuplot (5.2) on your file and got the attached image. What version of gnuplot/OS are you using?

plot-quals-hm

mmokrejs

mmokrejs commented on Jun 17, 2019

@mmokrejs
Author
$ gnuplot -version

	G N U P L O T
	Version 5.2 patchlevel 7    last modified 2019-05-29 

I am on Centos7 Linux.

pd3

pd3 commented on Jun 18, 2019

@pd3
Member

Looks like this behavior is specific to the most recent versions of gnuplot. @mmokrejs can you try if the script works after removing the extra end? If so, that will be easy to fix :-)

mmokrejs

mmokrejs commented on Jun 19, 2019

@mmokrejs
Author

@pd3 Sorry, I forgot to mention that explicitly, I did that already on the two places and it helped. That is actually why I wrote that supposedly the perl code does not output the if part due to failing condition but just always outputs the end. I do not remember what I saw in the figure, but the crash was gone for sure.

pd3

pd3 commented on Jun 24, 2019

@pd3
Member

Thanks. You don't happen to have the source file that was used to generate the stats by any chance? I failed to reproduce the problem with gnuplot 5.2 patchlevel 6.

mmokrejs

mmokrejs commented on Jun 24, 2019

@mmokrejs
Author

Right, I do:
plot.stat.txt

pd3

pd3 commented on Jun 25, 2019

@pd3
Member

I can confirm this is a problem with 5.2.7 but not with 5.2.6.

Unfortunately, versions prior to 5.2.7 require the two end statements to finish the matrix data section whereas 5.2.7 requires one end.

daviesrob

daviesrob commented on Jun 26, 2019

@daviesrob
Member

This is probably related to this fix in 5.2.7 (from the release notes) :

FIX prevent extra read past the end of a datablock holding matrix data

In 5.2.2 I can get it to work by putting a blank line between the end of the matrix and a single end, like this:

	0	0	3	0	0	0	0	0	0	0	0	0	0	0	0	1	1	1	0	1	0	0	0	1	1	0	4	2	0	4	0	0	10	10	22	10	4	0	0	0

end
                set origin 0,0.03
                ...

Does that work in 5.2.7 as well?

mmokrejs

mmokrejs commented on Jun 26, 2019

@mmokrejs
Author

You mean this?

$ diff -u ./html/sample2/plot-quals-hm.gp.ori ./html/sample2/plot-quals-hm.gp
--- ./html/sample2/plot-quals-hm.gp.ori	2019-06-26 11:37:59.546303314 +0200
+++ ./html/sample2/plot-quals-hm.gp	2019-06-26 12:49:54.233036830 +0200
@@ -124,7 +124,7 @@
 	0	0	14	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	3	0	3	1	2	0	46	13	6	22	12	44	16	20	6	0
 	0	0	24	0	0	1	0	0	3	0	0	0	2	0	1	1	0	6	1	3	3	3	0	2	10	1	7	0	0	16	5	14	5	29	19	21	4	0	0
 	0	0	3	0	0	0	0	0	0	0	0	0	0	0	0	1	1	1	0	1	0	0	0	1	1	0	4	2	0	40	0	10	10	22	10	4	0	0	0
-end
+
 end
 
                 set origin 0,0.03
$ gnuplot ./html/sample2/plot-quals-hm.gp

end
^
"./html/sample2/plot-quals-hm.gp" line 244: invalid command

$ gnuplot -V
gnuplot 5.2 patchlevel 7
$
daviesrob

daviesrob commented on Jun 26, 2019

@daviesrob
Member

Try doing the same thing for the second matrix.

mmokrejs

mmokrejs commented on Jun 26, 2019

@mmokrejs
Author

Right.

$ diff -u ./html/sample2/plot-quals-hm.gp.ori ./html/sample2/plot-quals-hm.gp
--- ./html/sample2/plot-quals-hm.gp.ori	2019-06-26 11:37:59.546303314 +0200
+++ ./html/sample2/plot-quals-hm.gp	2019-06-26 14:54:10.004372915 +0200
@@ -124,7 +124,7 @@
 	0	0	14	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	3	0	3	1	2	0	46	13	6	22	12	44	16	20	6	0
 	0	0	24	0	0	1	0	0	3	0	0	0	2	0	1	1	0	6	1	3	3	3	0	2	10	1	7	0	0	16	5	14	5	29	19	21	4	0	0
 	0	0	3	0	0	0	0	0	0	0	0	0	0	0	0	1	1	1	0	1	0	0	0	1	1	0	4	2	0	40	0	10	10	22	10	4	0	0	0
-end
+
 end
 
                 set origin 0,0.03
@@ -240,5 +240,5 @@
 	0	0	28	0	0	0	0	0	0	0	0	1	1	0	1	0	0	0	2	0	0	0	0	0	3	0	0	4	1	36	2	7	12	12	32	5	13	0	0
 	0	0	34	0	0	0	2	0	0	0	5	2	0	0	1	6	0	0	2	1	0	6	4	0	2	0	0	2	2	36	0	2	18	7	16	8	4	0	0
 	0	0	5	0	0	0	0	0	0	0	0	0	0	1	0	0	2	0	1	0	1	0	0	1	1	0	0	1	0	32	1	1	2	10	5	1	0	0	0
-end
+
 end
$

Actually that is why I mentioned initially extraneous (or out-of-order) end statements.

added a commit that references this issue on Jun 27, 2019
ed9713e
daviesrob

daviesrob commented on Jun 27, 2019

@daviesrob
Member

@mmokrejs Could you confirm that #1068 fixes this, please?

pd3

pd3 commented on Jun 28, 2019

@pd3
Member

It works in 5.0.0 and 5.2.7, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @pd3@daviesrob@mmokrejs@valeriuo

      Issue actions

        samtools-1.6 and 1.9: plot-bamstats generates broken gnuplot script · Issue #1065 · samtools/samtools