dariober / ASCIIGenome

Text Only Genome Viewer!
http://asciigenome.readthedocs.io/en/latest/description.html
MIT License
206 stars 14 forks source link

Cannot run ASCIIGenome on windows #83

Closed sunnysean closed 6 years ago

sunnysean commented 6 years ago

Hi @dariober

I tried to use ASCIIGenome on windows 10, but it failed with an error:

java -jar ASCIIGenome.jar adjacent.bam Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 3 ^~\ ^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source)

Then I tried it on Windows Subsystem for Linux, it worked! So I guess it is the problem of Windows Java. How can I use ASCIIGenome on Windows 10?

dariober commented 6 years ago

Hi- Thanks for reporting this issue. This is annoying since Java is supposed to be cross-platform and free from this sort of problems.

A google search for Unexpected internal error near index windows returns a few hits which give me some clues. I'll try to reproduce and fix it even if I don't have access to a windows machine.

Could you post your version of Java on both your Windows 10 and Windows Subsystem, please (java -version)? If Windows 10 runs Java 1.7, could you try to upgrade to 1.8? Also, could you post the entire error stack trace so I can see where the problem occurs?

Dario

sunnysean commented 6 years ago

Java version on Windows: java version "1.8.0_162" Java(TM) SE Runtime Environment (build 1.8.0_162-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

Java version on Windows Subsystem for Linux: openjdk version "1.8.0_162" OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-0ubuntu0.16.04.2-b12) OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode)

Run error on Windows: Exception in thread "main" java.util.regex.PatternSyntaxException: Unexpected internal error near index 3 ^~\ ^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.lang.String.replaceAll(Unknown Source) at samTextViewer.Utils.tildeToHomeDir(Utils.java:1652) at coloring.Config.getConfigFileAsString(Config.java:94) at coloring.Config.(Config.java:33) at samTextViewer.Main.main(Main.java:67)

dariober commented 6 years ago

Hi- thanks for this. The problem seems the same as this question. Basically, the file separator in Windows is a single backslash "\". When this is plugged in a regex, it is interpreted as the escape character causing problems.

The fix should be simple. Either escape the File.separator itself, like String fsep= File.separator + File.separator or (better) do not interpret the pattern as a regex unless necessary. E.g. use .replace() instead of .replaceAll().

I'll keep you posted, it shouldn't take long to fix (main problem from my side is to get hold of a Windows machine to test...)

sunnysean commented 6 years ago

Thanks. Looking forward to Windows ASCIIGenome.

dariober commented 6 years ago

Hello- I put here on Dropbox a fix to this issue https://www.dropbox.com/s/tyuwpkreg4wq03s/ASCIIGenome.jar it would be great if you could give it a try and see what happens. Let me know if you have problems downloading it.

I should point out that, as you have probably realized, I haven't tested ASCIIGenome on Windows much, if at all.

sunnysean commented 6 years ago

Thanks. It works perfectly.

dariober commented 6 years ago

Hi- About colours, if you download this new jar file from dropbox (https://www.dropbox.com/s/hys9kuvcg31z79e/ASCIIGenome.jar) you can set the background colour via the interactive command setConfig. Like setConfig background grey, see also setConfig -h for options and colorTrack -h for available colours.

If you want to make some changes your new default, you can put in your home directory a file called .asciigenome_config. You can use the file metal.conf, just copy it to ~/.asciigenome_config and edit as you like. ASCIIGenome will use these settings when you start it.

On the machines where I use ASCIIGenome (MacOS and various flavours of Linux), the default colour settings should look quite alright, like this https://raw.githubusercontent.com/dariober/ASCIIGenome/master/docs/screenshots/print_highlight.png.

Is yours much different?

Best Dario

sunnysean commented 6 years ago

Thanks. The interface is more beautiful after setConfig.

sunnysean commented 6 years ago

Hi. Here is another issue. New Windows version can display bam file very well, but cannot display gtf or bed, e.g. hg19_genes.gtf.gz in test_data. However, Windows Subsystem on Linux can do it. Sorry that this new issue may disturb you a while.

dariober commented 6 years ago

Hi- Thanks for your patience! When you say that you cannot display bed or gtf, do you mean you see nothing or you get an error. If you get an error, can you post the stack trace?

Does the problem occur also for files already bgzipped and indexed. E.g. what if you try

ASCIIGenome test_data/hg19.gencode_genes_v19.gtf.gz

I suspect this has to do with creating temp files on windows...

(Probably you know, you can bgzip and index with bgzip a.bed; tabix a.bed.gz, bgzip and tabix are from htslib)

PS: Please post new problems as a new issue rather than replying to an existing issue so I can keep things organized.

sunnysean commented 6 years ago

Yes, it is the problem of indexing. ASCIIgenome can work on hg19.gencode_genes_v19.gtf.gz and all other file with tbi. But "tabix -p gff hg19_gene.gtf.gz" doesn't work, and tabix doesn't accept "-p gtf".

dariober commented 6 years ago

Hi- tabix hg19_genes.gtf.gz doesn't work because hg19_genes.gtf.gz is gzipped, not bgzipped (this is intentional, for testing). Also, usually with tabix you don't need to specify -p since the format is auto-detected. If your input is already coordinate sorted, bgzip my.input; tabix my.input.gz should do.

sunnysean commented 6 years ago

Thank you so much. My issue is done. ASCIIgenome is really convenient to make a quick check on those bioinformatic files.

dariober commented 6 years ago

Hi- @sunnysean the issue with reading uncompressed or unindexed files on Windows should be resolved in version 1.14.0 I just uploaded. I'm going to close this issue but feel free to re-open or submit a new one.