schatzlab / genomescope

Fast genome analysis from unassembled short reads
Apache License 2.0
250 stars 56 forks source link

How to produce vector graph (i.e. pdf), not bitmap image i.e. .png)? #111

Closed sanvva closed 8 months ago

mschatz commented 11 months ago

There isnt a way to do this now, but I agree it would be a useful feature! Let me look into it

On Fri, Oct 20, 2023 at 2:55 AM sanvva @.***> wrote:

— Reply to this email directly, view it on GitHub https://github.com/schatzlab/genomescope/issues/111, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABP347NWIL63WAP7UATN4DYAIN4XAVCNFSM6AAAAAA6IRJ7QGVHI2DSMVQWIX3LMV43ASLTON2WKOZRHE2TGNRVG44TCNI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

sanvva commented 10 months ago

That would be great!

arslan9732 commented 8 months ago

Hi @sanvva, You can achieve this by just changing line 329, and 339 of genomescope.R

Default lines

png(paste(foldername, "/plot.png", sep=""),width=plot_size,height=plot_size, res=resolution) #line329
png(paste(foldername, "/plot.log.png", sep=""),width=plot_size,height=plot_size,res=resolution) #line339

I assume svglite is installed in your R. Replaced lines

svg(paste(foldername, "/plot.svg", sep=""),width=10, height=10) #line329
svg(paste(foldername, "/plot.log.svg", sep=""),width=10, height=10) #line339

But it is for genomescope not for genomescope2.

For genomescope2 you have to change the script report_results.R before installing genomescope locally.

change the line 103: Default plot_size=2000

Replaced plot_size=7

and then change the png() function at line 114, 128, 143, 156, 823 such as: replace png() with svg(), change the file extension from .png to .svg, and remove the res=resolution from the function. Now run the command:

Rscript install.R

Now it will generate all graphs in SVG format.

sanvva commented 8 months ago

Hi @sanvva, You can achieve this by just changing line 329, and 339 of genomescope.R

Default lines

png(paste(foldername, "/plot.png", sep=""),width=plot_size,height=plot_size, res=resolution) #line329
png(paste(foldername, "/plot.log.png", sep=""),width=plot_size,height=plot_size,res=resolution) #line339

I assume svglite is installed in your R. Replaced lines

svg(paste(foldername, "/plot.svg", sep=""),width=10, height=10) #line329
svg(paste(foldername, "/plot.log.svg", sep=""),width=10, height=10) #line339

But it is for genomescope not for genomescope2.

For genomescope2 you have to change the script report_results.R before installing genomescope locally.

change the line 103: Default plot_size=2000

Replaced plot_size=7

and then change the png() function at line 114, 128, 143, 156, 823 such as: replace png() with svg(), change the file extension from .png to .svg, and remove the res=resolution from the function. Now run the command:

Rscript install.R

Now it will generate all graphs in SVG format.

Thank you very much!