jonathancrabtree / Circleator

Flexible circular visualization of genome-associated data with BioPerl and SVG.
Other
46 stars 8 forks source link

Can't use string ("") as a subroutine ref while "strict refs" in use #31

Closed annaallueg closed 7 years ago

annaallueg commented 7 years ago

Hi, It is my first time using Circleator and I am having some trouble when running it, so I could use some help. My goal is to use Circleator to draw a figure showing the snps in a set of 20 bacterial strains. Based on the log file (please, see attached the file), there are some invalid characters and also this message pops up: "Can't use string ("") as a subroutine ref while "strict refs" in use at /cm/shared/apps/Circleator/1.0.0/lib/Circleator/Config/Standard.pm line 222, line 4." I am not sure what that means or how can I fix it.

As input for the job script I took the configuration file for figure 5 in the supplementary material (http://fast.hevs.ch/images/imagesets/pubmedcentral-current/6f/0f/Bioinformatics_2014_Nov_1_30(21)_3125-3127/supp_btu505_circleator-supplementary.pdf) of the Circleator manuscript as template, with some minor changes (find attached) so I am not sure why the invalid fields. I also used a merged snp table in the format described in https://github.com/jorvis/ergatis/blob/master/lib/SNP/MergedTable.pm

Please, find attached the configuration file and the merged snp table. snp_merged_table_circleator_pandemic_cI.txt Conf_file_circleator_snp_VP_pandemic_cI.txt

I would really appreciate any insights on how to proceed.

Thank you!

Anna Allue, University of Texas at San Antonio

annaallueg commented 7 years ago

Sorry, I forgot to attach the log file! circleator_VP_pandemic_cI-33376.txt

jonathancrabtree commented 7 years ago

Hi Anna,

I see only a couple of issues with the configuration and SNP files that you attached. The first is that there seems to be something amiss with the newlines, as both files contain embedded control-M characters and in the configuration file, in particular, some of the lines have been combined, which is causing problems for the parser. I used the following Perl command to replace the control-Ms with newlines:

perl -pi.bak -e 's/\cM/\n/g;' snp*.txt Conf*.txt

The second is that the merged SNP table file must be a slightly earlier version of the format that the current program accepts, because Circleator complains about missing columns in the input. To fix that I ran the following commands to add the missing columns to the SNP file (here is a link to the script: add_snp_merged_table_columns.pl):

mv snp_merged_table_circleator_pandemic_cI.txt snp_merged_table_circleator_pandemic_cI.txt.bak   
./add_snp_merged_table_columns.pl < snp_merged_table_circleator_pandemic_cI.txt.bak >snp_merged_table_circleator_pandemic_cI.txt

Finally, I made a few minor edits to the configuration file:

  1. Fixed a couple of lines that had been split with "\\\\" at the end.
  2. Changed "label-text-anchor" to "text-anchor"
  3. Changed scale factor from 18000 to 1000
  4. Commented out a duplicate definition of "miniscule-cgap"

Only 1 and 4 were fatal errors. Here's the updated configuration file I used:

Conf_file_circleator_snp_VP_pandemic_cI.new.txt

And the rewritten SNP file:

snp_merged_table_circleator_pandemic_cI.txt

And the resulting PNG image:

fig1

Jonathan

annaallueg commented 7 years ago

Hi Jonathan,

Awesome! Thanks a lot for your help and for fixing all the issues my files had. I'll try to apply all these fixes to make new circleator figures.

I have one more question: is there a way for circleator to automatically use all the space available to draw the circles? Or should I always provide a number for the inner and outer circle?

Thanks again for everything!

Best regards,

Anna

2017-08-08 12:09 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

I see only a couple of issues with the configuration and SNP files that you attached. The first is that there seems to be something amiss with the newlines, as both files contain embedded control-M characters and in the configuration file, in particular, some of the lines have been combined, which is causing problems for the parser. I used the following Perl command to replace the control-Ms with newlines:

perl -pi.bak -e 's/\cM/\n/g;' snp.txt Conf.txt

The second is that the merged SNP table file must be a slightly earlier version of the format that the current program accepts, because Circleator complains about missing columns in the input. To fix that I ran the following commands to add the missing columns to the SNP file (here is a link to the script: add_snp_merged_table_columns.pl https://github.com/jonathancrabtree/Circleator/blob/master/util/add_snp_merged_table_columns.pl ):

mv snp_merged_table_circleator_pandemic_cI.txt snp_merged_table_circleator_pandemic_cI.txt.bak ./add_snp_merged_table_columns.pl < snp_merged_table_circleator_pandemic_cI.txt.bak >snp_merged_table_circleator_pandemic_cI.txt

Finally, I made a few minor edits to the configuration file:

  1. Fixed a couple of lines that had been split with "\\" at the end.
  2. Changed "label-text-anchor" to "text-anchor"
  3. Changed scale factor from 18000 to 1000
  4. Commented out a duplicate definition of "miniscule-cgap"

Only 1 and 4 were fatal errors. Here's the updated configuration file I used:

Conf_file_circleator_snp_VP_pandemic_cI.new.txt https://github.com/jonathancrabtree/Circleator/files/1208937/Conf_file_circleator_snp_VP_pandemic_cI.new.txt

And the rewritten SNP file:

snp_merged_table_circleator_pandemic_cI.txt https://github.com/jonathancrabtree/Circleator/files/1208938/snp_merged_table_circleator_pandemic_cI.txt

And the resulting PNG image:

[image: fig1] https://user-images.githubusercontent.com/5394345/29084149-1c14f0ae-7c39-11e7-9885-2e242b65a372.png

Jonathan

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-321020534, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEjsTOGoezUVmIqwFCuVednCVe3inks5sWJYsgaJpZM4Ou6-J .

jonathancrabtree commented 7 years ago

Hi Anna,

Unfortunately there's no way to automatically divide the available radial space among the tracks, although in this particular case you only have to increase one or two of the "heightf" values to make better use of the space:

Conf_file_circleator_snp_VP_pandemic_cI.new.v2.txt

fig1-max-diffs-4

fig1-min-diffs-5

annaallueg commented 7 years ago

Thanks!

Mmm I tried to send you an e-mail with a couple of attached images (png and svg compressed, total ~6 MB) but apparently it failed because it says file size is too big (?)... So now I am not sure if you got my previous e-mail. I was sending those files because something's wrong with the png figure, although the svg file seems fine. I guess there is some issue with the conversion (I used the rasterize-svg command in my job script), but cannot figure out what it is. Let me know if you got the previous e-mail with the attachments. If not, I can try to send again.

Thank you!

Anna

2017-08-09 15:21 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

Unfortunately there's no way to automatically divide the available radial space among the tracks, although in this particular case you only have to increase one or two of the "heightf" values to make better use of the space:

Conf_file_circleator_snp_VP_pandemic_cI.new.v2.txt https://github.com/jonathancrabtree/Circleator/files/1212746/Conf_file_circleator_snp_VP_pandemic_cI.new.v2.txt

[image: fig1-max-diffs-4] https://user-images.githubusercontent.com/5394345/29142059-a62751d4-7d1e-11e7-8594-5ccea8626578.png

[image: fig1-min-diffs-5] https://user-images.githubusercontent.com/5394345/29142066-af8db56a-7d1e-11e7-8d86-7e07e720359c.png

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-321370325, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEoeU1aGJkdUAMWZGL0a-LyzS91Wnks5sWhS4gaJpZM4Ou6-J .

jonathancrabtree commented 7 years ago

I didn't get the previous e-mail, but I assume you're talking about artifacts like these?

fig1-max-diffs-4

I don't think there's anything wrong with the SVG per se, since the SVG seems to render fine (in Chrome, at least) and the issue seems to be with certain versions of the Apache Batik rasterizer. On a Ubuntu machine with libbatik-java 1.8-3ubuntu1 I see the artifacts, but on another machine with Batik 1.7 the images look clean. The problem has to do with drawing features that cover the entire circle, and commenting out the following line in the configuration file should make the artifacts disappear regardless of which Batik version you're using:

# highlight every other track, regardless of target genome:
#new SNPC rectangle innerf=same,outerf=same,feat-type=contig,color1=#0000ff,opacity=0.15,skip-track=<LOOP_EVEN>

Let me know if that fails to fix it.

annaallueg commented 7 years ago

Yes, that is exactly what I was talking about!

Ok, so I commented out that line you told me, but now the highlight every other track disappeared and there are still some artifacts remaining right under the reference genome circle...

I tried to attach the image but didn't allow me to send...

Thanks,

Anna

2017-08-10 14:05 GMT-05:00 Jonathan Crabtree notifications@github.com:

I didn't get the previous e-mail, but I assume you're talking about artifacts like these?

[image: fig1-max-diffs-4] https://user-images.githubusercontent.com/5394345/29186882-ca2a76de-7ddb-11e7-80ba-597741b48dc7.png

I don't think there's anything wrong with the SVG per se, since the SVG seems to render fine (in Chrome, at least) and the issue seems to be with certain versions of the Apache Batik rasterizer. On a Ubuntu machine with libbatik-java 1.8-3ubuntu1 I see the artifacts, but on another machine with Batik 1.7 the images look clean. The problem has to do with drawing features that cover the entire circle, and commenting out the following line in the configuration file should make the artifacts disappear regardless of which Batik version you're using:

highlight every other track, regardless of target genome:

new SNPC rectangle innerf=same,outerf=same,feat-type=contig,color1=#0000ff,opacity=0.15,skip-track=

Let me know if that fails to fix it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-321644341, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEg5Aum1MS1RkqB7P-5UWF-Xh-nRyks5sW1RegaJpZM4Ou6-J .

annaallueg commented 7 years ago

Hi Jonathan,

I am not sure how to proceed to fix the issue, as commenting out that line didn't work. Should I try with a different version of Batik or change something else in the configuration file? I still want to keep the highlight every other track. I thought to just open the svg file in adobe or gimp and then export in png from there, but none of this programs seem to recognize the text...

Thank you!

Anna

2017-08-10 14:39 GMT-05:00 Anna Allué Guardia aallueg@gmail.com:

Yes, that is exactly what I was talking about!

Ok, so I commented out that line you told me, but now the highlight every other track disappeared and there are still some artifacts remaining right under the reference genome circle...

I tried to attach the image but didn't allow me to send...

Thanks,

Anna

2017-08-10 14:05 GMT-05:00 Jonathan Crabtree notifications@github.com:

I didn't get the previous e-mail, but I assume you're talking about artifacts like these?

[image: fig1-max-diffs-4] https://user-images.githubusercontent.com/5394345/29186882-ca2a76de-7ddb-11e7-80ba-597741b48dc7.png

I don't think there's anything wrong with the SVG per se, since the SVG seems to render fine (in Chrome, at least) and the issue seems to be with certain versions of the Apache Batik rasterizer. On a Ubuntu machine with libbatik-java 1.8-3ubuntu1 I see the artifacts, but on another machine with Batik 1.7 the images look clean. The problem has to do with drawing features that cover the entire circle, and commenting out the following line in the configuration file should make the artifacts disappear regardless of which Batik version you're using:

highlight every other track, regardless of target genome:

new SNPC rectangle innerf=same,outerf=same,feat-type=contig,color1=#0000ff,opacity=0.15,skip-track=

Let me know if that fails to fix it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-321644341, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEg5Aum1MS1RkqB7P-5UWF-Xh-nRyks5sW1RegaJpZM4Ou6-J .

jonathancrabtree commented 7 years ago

Hi Anna,

Sorry about the delay replying. I'd recommend trying with a different version of Batik. You can download the binary versions from here (pick a mirror and then navigate into the "binaries" subdirectory):

http://www.apache.org/dyn/closer.cgi/xmlgraphics/batik

I just tested with a clean download of the 1.7, 1.8, and 1.9 versions (i.e., using the binary downloads from the Apache site rather than the Ubuntu-bundled 1.8-based version) and they all seemed to work OK. All you'll need to do is edit the "rasterize-svg" script in Circleator - there's a single line that references the Apache Batik jar file that needs to be changed, that's all.

As for the artifact under the genome circle, I think you're referring to this:

screen shot 2017-08-15 at 3 35 47 pm

It looks like the problem is a bug in the function that labels the SNP deserts with their length. There's one SNP desert that spans the coordinate origin (i.e. at the top of the circle) and the label for that region is incorrect (it shows a negative length) and in the wrong location (at the bottom of the image instead of the top). Here's a different view that shows what's going on:

screen shot 2017-08-15 at 3 36 25 pm

Fixing this properly will require a new Circleator release but until then there are workarounds that could be used if you care about these features. In this particular case I think raising the minimum desert length to 25kb would filter out the problem region, for example.

annaallueg commented 7 years ago

Hi Jonathan,

No problem! Thanks for your reply! I'll try with a different version of Batik and see how it goes. As for the artifacts yes, I noticed the negative number for the SNP deserts. I was not planning on labeling the desert lengths but I will increase the length anyway.

Thank you!

Anna

2017-08-15 14:54 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

Sorry about the delay replying. I'd recommend trying with a different version of Batik. You can download the binary versions from here (pick a mirror and then navigate into the "binaries" subdirectory):

http://www.apache.org/dyn/closer.cgi/xmlgraphics/batik

I just tested with a clean download of the 1.7, 1.8, and 1.9 versions (i.e., using the binary downloads from the Apache site rather than the Ubuntu-bundled 1.8-based version) and they all seemed to work OK. All you'll need to do is edit the "rasterize-svg" script in Circleator - there's a single line that references the Apache Batik jar file that needs to be changed, that's all.

As for the artifact under the genome circle, I think you're referring to this:

[image: screen shot 2017-08-15 at 3 35 47 pm] https://user-images.githubusercontent.com/5394345/29333021-3a9eea1a-81d0-11e7-9286-f7055135ca22.png

It looks like the problem is a bug in the function that labels the SNP deserts with their length. There's one SNP desert that spans the coordinate origin (i.e. at the top of the circle) and the label for that region is incorrect (it shows a negative length) and in the wrong location (at the bottom of the image instead of the top). Here's a different view that shows what's going on:

[image: screen shot 2017-08-15 at 3 36 25 pm] https://user-images.githubusercontent.com/5394345/29333105-934d156a-81d0-11e7-9ac9-73379915b761.png

Fixing this properly will require a new Circleator release but until then there are workarounds that could be used if you care about these features. In this particular case I think raising the minimum desert length to 25kb would filter out the problem region, for example.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-322570793, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEgMkVSZqAej6vniWdBPVCIpok8PGks5sYfdrgaJpZM4Ou6-J .

annaallueg commented 7 years ago

Hi Jonathan,

Sorry to bother you again but I still cannot get the right png image. So I tried with older versions of batik, like 1.8, but I got the artifacts again. I am currently using a centos 7.2 server to run circleator and rasterizer, with stock batik versions 1.8 and 1.9 installed from the default repository. Not sure why rasterizer is not working properly...

I tried several other things with no luck: I downloaded the Squiggle app to do the conversion to png using the svg file generated by circleator, but it cannot open the file although it is only 6 MB (I tried using the svg generated with the test data provided in the circleator package that is 2 MB and it works, so not sure what the problem might be with my file). I also tried to open my svg file in adobe illustrator and in GIMP to later export in pdf or png, but the text is flattened when importing the file, so I don't have the complete figure either... I thought there were maybe multiple layers and could fix the text, but apparently there is only one, so I don't know how to get back the text.

I am not sure what else to do... Any other ideas?

Thank you!!

Anna

2017-08-17 14:44 GMT-05:00 Anna Allué Guardia aallueg@gmail.com:

Hi Jonathan,

No problem! Thanks for your reply! I'll try with a different version of Batik and see how it goes. As for the artifacts yes, I noticed the negative number for the SNP deserts. I was not planning on labeling the desert lengths but I will increase the length anyway.

Thank you!

Anna

2017-08-15 14:54 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

Sorry about the delay replying. I'd recommend trying with a different version of Batik. You can download the binary versions from here (pick a mirror and then navigate into the "binaries" subdirectory):

http://www.apache.org/dyn/closer.cgi/xmlgraphics/batik

I just tested with a clean download of the 1.7, 1.8, and 1.9 versions (i.e., using the binary downloads from the Apache site rather than the Ubuntu-bundled 1.8-based version) and they all seemed to work OK. All you'll need to do is edit the "rasterize-svg" script in Circleator - there's a single line that references the Apache Batik jar file that needs to be changed, that's all.

As for the artifact under the genome circle, I think you're referring to this:

[image: screen shot 2017-08-15 at 3 35 47 pm] https://user-images.githubusercontent.com/5394345/29333021-3a9eea1a-81d0-11e7-9286-f7055135ca22.png

It looks like the problem is a bug in the function that labels the SNP deserts with their length. There's one SNP desert that spans the coordinate origin (i.e. at the top of the circle) and the label for that region is incorrect (it shows a negative length) and in the wrong location (at the bottom of the image instead of the top). Here's a different view that shows what's going on:

[image: screen shot 2017-08-15 at 3 36 25 pm] https://user-images.githubusercontent.com/5394345/29333105-934d156a-81d0-11e7-9ac9-73379915b761.png

Fixing this properly will require a new Circleator release but until then there are workarounds that could be used if you care about these features. In this particular case I think raising the minimum desert length to 25kb would filter out the problem region, for example.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-322570793, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEgMkVSZqAej6vniWdBPVCIpok8PGks5sYfdrgaJpZM4Ou6-J .

annaallueg commented 6 years ago

Hi Jonathan,

Not sure if you had a chance to read my previous e-mail. I have not been able to solve the artifacts problem, even when using previous versions of batik. You'll find the specs of the server I am using in my previous e-mail.

My last resort is to use the svg file in GIMP to export in png (without text) and then add the text (strain labels and Mb in the ticks) manually. Not sure what else I can try at this point.

Do you have any other ideas on how to fix the issue?

Thanks a lot for your time!

Best,

Anna

2017-08-18 14:51 GMT-05:00 Anna Allué Guardia aallueg@gmail.com:

Hi Jonathan,

Sorry to bother you again but I still cannot get the right png image. So I tried with older versions of batik, like 1.8, but I got the artifacts again. I am currently using a centos 7.2 server to run circleator and rasterizer, with stock batik versions 1.8 and 1.9 installed from the default repository. Not sure why rasterizer is not working properly...

I tried several other things with no luck: I downloaded the Squiggle app to do the conversion to png using the svg file generated by circleator, but it cannot open the file although it is only 6 MB (I tried using the svg generated with the test data provided in the circleator package that is 2 MB and it works, so not sure what the problem might be with my file). I also tried to open my svg file in adobe illustrator and in GIMP to later export in pdf or png, but the text is flattened when importing the file, so I don't have the complete figure either... I thought there were maybe multiple layers and could fix the text, but apparently there is only one, so I don't know how to get back the text.

I am not sure what else to do... Any other ideas?

Thank you!!

Anna

2017-08-17 14:44 GMT-05:00 Anna Allué Guardia aallueg@gmail.com:

Hi Jonathan,

No problem! Thanks for your reply! I'll try with a different version of Batik and see how it goes. As for the artifacts yes, I noticed the negative number for the SNP deserts. I was not planning on labeling the desert lengths but I will increase the length anyway.

Thank you!

Anna

2017-08-15 14:54 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

Sorry about the delay replying. I'd recommend trying with a different version of Batik. You can download the binary versions from here (pick a mirror and then navigate into the "binaries" subdirectory):

http://www.apache.org/dyn/closer.cgi/xmlgraphics/batik

I just tested with a clean download of the 1.7, 1.8, and 1.9 versions (i.e., using the binary downloads from the Apache site rather than the Ubuntu-bundled 1.8-based version) and they all seemed to work OK. All you'll need to do is edit the "rasterize-svg" script in Circleator - there's a single line that references the Apache Batik jar file that needs to be changed, that's all.

As for the artifact under the genome circle, I think you're referring to this:

[image: screen shot 2017-08-15 at 3 35 47 pm] https://user-images.githubusercontent.com/5394345/29333021-3a9eea1a-81d0-11e7-9286-f7055135ca22.png

It looks like the problem is a bug in the function that labels the SNP deserts with their length. There's one SNP desert that spans the coordinate origin (i.e. at the top of the circle) and the label for that region is incorrect (it shows a negative length) and in the wrong location (at the bottom of the image instead of the top). Here's a different view that shows what's going on:

[image: screen shot 2017-08-15 at 3 36 25 pm] https://user-images.githubusercontent.com/5394345/29333105-934d156a-81d0-11e7-9ac9-73379915b761.png

Fixing this properly will require a new Circleator release but until then there are workarounds that could be used if you care about these features. In this particular case I think raising the minimum desert length to 25kb would filter out the problem region, for example.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-322570793, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEgMkVSZqAej6vniWdBPVCIpok8PGks5sYfdrgaJpZM4Ou6-J .

jonathancrabtree commented 6 years ago

Hi Anna,

I was able to reproduce the problem on Centos 7.2 and I see what you mean about it not working with the 1.8 and 1.9 Batik releases either. I'm not sure why some versions of Batik work and some do not, and it's possible that I made a mistake when I was testing different releases on Ubuntu. However, I believe I've found a glitch in the SVG that's causing all the trouble. Some of the "rect" elements generated by Circleator have an "r" (radius) attribute, which they should not. As a temporary workaround I'd recommend removing these attributes from any Circleator-generated SVG, which you can do with a command like the following Perl one-liner:

perl -pi.bak -e 's/^(\s*\<rect.* )r=\"[0-9\.]+" (.*)$/$1$2/;' fig1.svg

When I remove these attributes I'm able to rasterize the SVG cleanly on Centos 7.2 and, as far as I can tell, everything else looks OK too. Let me know if you find otherwise.

Jonathan

annaallueg commented 6 years ago

Hi Jonathan,

Thanks for your response! I ran the Perl command and used the bak file to rasterize the figure, but I still get the same artifacts in the png... No idea why it doesn't work for me...

Anna

2017-09-05 13:33 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

I was able to reproduce the problem on Centos 7.2 and I see what you mean about it not working with the 1.8 and 1.9 Batik releases either. I'm not sure why some versions of Batik work and some do not, and it's possible that I made a mistake when I was testing different releases on Ubuntu. However, I believe I've found a glitch in the SVG that's causing all the trouble. Some of the "rect" elements generated by Circleator have an "r" (radius) attribute, which they should not. As a temporary workaround I'd recommend removing these attributes from any Circleator-generated SVG, which you can do with a command like the following Perl one-liner:

perl -pi.bak -e 's/^(\s\<rect. )r=\"[0-9.]+" (.*)$/$1$2/;' fig1.svg

When I remove these attributes I'm able to rasterize the SVG cleanly on Centos 7.2 and, as far as I can tell, everything else looks OK too. Let me know if you find otherwise.

Jonathan

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-327264009, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEnRa36uxKPP4G3tzVLb84iq8it0lks5sfZQSgaJpZM4Ou6-J .

jonathancrabtree commented 6 years ago

Hi Anna,

I was just testing the supposed fix against the original files earlier today and discovered the same thing. Circleator was placing invalid attributes in some of the SVG elements, but that is not the reason for the PNG artifacts. It is actually a bug in the Batik package which was supposed to have been fixed, but has not been completely fixed. It can be replicated with a very simple SVG file that contains nothing more than a circle masked by another circle. Here's one of the relevant bug reports (in particular note the recent activity at the bottom of the page):

https://issues.apache.org/jira/browse/BATIK-1170

The good news is that I have a couple of possible workarounds for you. The first is to use an earlier version of Java with the Batik 1.9 package. In particular, I was able to get it to work on Centos 7.2 with the java-1.6.0-openjdk (but not more recent versions of that JDK.) First I installed the package:

yum install java-1.6.0-openjdk

Then I tested rasterizing with both this package and a newer one. This command, using a newer JDK, generated a PNG file with the errors:

/usr/lib/jvm/jre-1.8.0-openjdk/bin/java -jar batik-1.9/batik-rasterizer-1.9.jar fig1-min-diffs-5.svg

But this command, using the 1.6 JDK, gave me clean output (on Centos 7.2):

/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java -jar batik-1.9/batik-rasterizer-1.9.jar fig1-min-diffs-5.svg

Another less elegant workaround is to use Chrome to do the SVG to PNG conversion, if you have a version of Chrome that renders the SVG correctly. On my Ubuntu machine the default Apache Batik rasterizer doesn't work correctly, but Chrome can be use to view SVG without errors. The technique is described here:

https://gist.github.com/mbostock/6466603

Basically you make a small HTML file that references the SVG, then you can load the HTML file in Chrome using the file: URL and finally right click the image and choose "Save As". I'll attach an example of this.

As for the other problems we came across, namely the negative length labels on the SNP desert features, and the fact that those labels don't appear in the right place, I've fixed those problems in Circleator and will be making a new release in the next day or so. Hopefully Apache Batik will also come out with a new release that works on all possible Java versions, since as things stand now your mileage will vary significantly depending on which Java you have installed.

Jonathan

jonathancrabtree commented 6 years ago

It looks like HTML files can't be attached here directly, so I've added the Chrome conversion script to the source code here:

https://github.com/jonathancrabtree/Circleator/tree/master/misc/convert_svg_to_png_with_chrome

annaallueg commented 6 years ago

Great! Thanks for the updates. I'll try these workarounds and see if I can get the figure!

Best,

Anna

2017-09-11 14:57 GMT-05:00 Jonathan Crabtree notifications@github.com:

It looks like HTML files can't be attached here directly, so I've added the Chrome conversion script to the source code here:

https://github.com/jonathancrabtree/Circleator/ tree/master/misc/convert_svg_to_png_with_chrome

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-328641033, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEilwc0-VjlMEl5DH94u7PIkP0XrFks5shZCZgaJpZM4Ou6-J .

jonathancrabtree commented 6 years ago

No problem. Hope it finally works out this time! Here's the release (1.0.1) that should fix the other labeling issues:

https://github.com/jonathancrabtree/Circleator/releases

annaallueg commented 6 years ago

Hi Jonathan,

I tried the first workaround you proposed and I tested rasterizing one of my last svg files using batik 1.9 with java 1.6. But I got this error:

About to transcode 1 SVG file(s)

Converting VP_pandemic_cI_final_v1_test_to_rasterize.svg to VP_pandemic_cI_final_v1_test_to_rasterize.png ... org.apache.batik.transcoder.TranscoderException: null

Enclosed Exception:

The prefix "xlink" for attribute "xlink:href" associated with an element type "textPath" is not bound.

at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:136)

at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)

at org.apache.batik.apps.rasterizer.SVGConverter.transcode(SVGConverter.java:1001)

at org.apache.batik.apps.rasterizer.SVGConverter.execute(SVGConverter.java:717)

at org.apache.batik.apps.rasterizer.Main.execute(Main.java:938)

at org.apache.batik.apps.rasterizer.Main.main(Main.java:992)

... error (SVGConverter.error.while.rasterizing.file)

Not sure what the problem is, it seems something related to the svg. Would this be fixed if I use the last release of Circleator 1.0.1? The svg I used was created with the previous version, I have not updated to the new version yet.

I will also try the Chrome workaround as an alternative.

Thanks,

Anna

2017-09-11 15:15 GMT-05:00 Jonathan Crabtree notifications@github.com:

No problem. Hope it finally works out this time! Here's the release (1.0.1) that should fix the other labeling issues:

https://github.com/jonathancrabtree/Circleator/releases

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jonathancrabtree/Circleator/issues/31#issuecomment-328645771, or mute the thread https://github.com/notifications/unsubscribe-auth/AbmaEsQY_zdkbvMIfTIEDJr-HUyYukSwks5shZTzgaJpZM4Ou6-J .

jonathancrabtree commented 6 years ago

Hi Anna,

I don't think that changing the Circleator version will have any impact on this problem, but it might. I don't think I've seen this error before and, as you said, it looks like it might be something related to the SVG version or the Perl module that writes out the SVG. Have you confirmed or can you confirm that this exact same SVG file rasterizes successfully (with or without artifacts) using a newer JVM?

It looks like errors like this can occur if the opening SVG element lacks a "xmlns:xlink" definition, but your SVG file should have that, as in this example:

<svg height="3200" printerror="1" raiseerror="0" width="3200" xml_xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">

Do you have any way to send me the SVG file so I can try the same thing on my Centos 7.2 install? (And compare it against what I get from your config file.)

Jonathan

annaallueg commented 6 years ago

Hi Jonathan,

Yes, I used this same file in the past with newer Java versions and I could get the png figure (with artifacts). I will try to attach the file (it is ~ 5-6 MB). Let me know if that works. If not I can try to send a Dropbox link with the file. Do you also need the config file and the snp table?

Anna

2017-09-13 8:47 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

I don't think that changing the Circleator version will have any impact on this problem, but it might. I don't think I've seen this error before and, as you said, it looks like it might be something related to the SVG version or the Perl module that writes out the SVG. Have you confirmed or can you confirm that this exact same SVG file rasterizes successfully (with or without artifacts) using a newer JVM?

It looks like errors like this can occur if the opening SVG element lacks a "xmlns:xlink" definition, but your SVG file should have that, as in this example:

Do you have any way to send me the SVG file so I can try the same thing on my Centos 7.2 install? (And compare it against what I get from your config file.) Jonathan — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .
annaallueg commented 6 years ago

Ok, I think attaching the file didn't work. Here is the Dropbox link: https://www.dropbox.com/sh/jp4b3ihr3brqofp/AAD52Ej97U2LSpd2MP2kCKlqa?dl=0

2017-09-13 10:17 GMT-05:00 Anna Allué Guardia aallueg@gmail.com:

Hi Jonathan,

Yes, I used this same file in the past with newer Java versions and I could get the png figure (with artifacts). I will try to attach the file (it is ~ 5-6 MB). Let me know if that works. If not I can try to send a Dropbox link with the file. Do you also need the config file and the snp table?

Anna

2017-09-13 8:47 GMT-05:00 Jonathan Crabtree notifications@github.com:

Hi Anna,

I don't think that changing the Circleator version will have any impact on this problem, but it might. I don't think I've seen this error before and, as you said, it looks like it might be something related to the SVG version or the Perl module that writes out the SVG. Have you confirmed or can you confirm that this exact same SVG file rasterizes successfully (with or without artifacts) using a newer JVM?

It looks like errors like this can occur if the opening SVG element lacks a "xmlns:xlink" definition, but your SVG file should have that, as in this example:

Do you have any way to send me the SVG file so I can try the same thing on my Centos 7.2 install? (And compare it against what I get from your config file.) Jonathan — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub , or mute the thread .