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

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

Closed
mmokrejs opened this issue Jun 11, 2019 · 13 comments · Fixed by #1068
Closed

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

mmokrejs opened this issue Jun 11, 2019 · 13 comments · Fixed by #1068

Comments

@mmokrejs
Copy link

mmokrejs commented Jun 11, 2019

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

@valeriuo
Copy link
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
Copy link
Author

mmokrejs commented Jun 17, 2019

$ 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
Copy link
Member

pd3 commented Jun 18, 2019

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
Copy link
Author

mmokrejs commented Jun 19, 2019

@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
Copy link
Member

pd3 commented Jun 24, 2019

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
Copy link
Author

Right, I do:
plot.stat.txt

@pd3
Copy link
Member

pd3 commented Jun 25, 2019

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
Copy link
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
Copy link
Author

mmokrejs commented Jun 26, 2019

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
Copy link
Member

Try doing the same thing for the second matrix.

@mmokrejs
Copy link
Author

mmokrejs commented Jun 26, 2019

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.

@daviesrob
Copy link
Member

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

@pd3
Copy link
Member

pd3 commented Jun 28, 2019

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants