Path with spaces does not work when controlling IGV through a port

22 views
Skip to first unread message

Philipp

unread,
May 26, 2017, 11:10:26 AM5/26/17
to igv-help
I'm trying to control IGV through port with VB.NET and the following code:

Using client As New TcpClient()
    client
.Connect("127.0.0.1", 60151)

   
Using stream = client.GetStream()
       
Using writer As New StreamWriter(stream)
            writer
.AutoFlush = True
            writer
.WriteLine("new")
            writer
.WriteLine("genome ""C:\Folder with spaces\test.fasta""")
            writer
.WriteLine("load ""C:\Folder with spaces\test.bam""")

            stream
.Close()
            client
.Close()        
        End Using
   
End Using
End Using

When I execute this, nothing happens.
This is the line that causes the problem:

writer.WriteLine("genome ""C:\Folder with spaces\test.fasta""")

If I do any of the following, it works:
  • No quotes and only file name (if the file would be in the IGV viewer directory) -> writer.WriteLine("genome test.fasta")
  • No quotes and full file path. That works of course only if I don't have any spaces in the path. -> writer.WriteLine("genome C:\Folder_without_spaces\test.fasta")
  • Load the fasta file via the GUI and omit the loading genome step in the code
Unfortunately I cannot use any of those solutions.
The files will not be in the same folder as the IGV viewer and I will have file paths with spaces inside.

Interestingly this is only a problem when loading the genome. Loading the bam file works fine, even with the quotes.

IGV Version: 2.3.93 (151)
OS: Windows 7 SP1

In the log file you can see first the failed loading.
Afterwards a loading that succeeded, although there seems to be an error when closing the connection.

Is this a bug or am I doing something wrong here?


Thanks
Philipp
igv.log

James Robinson

unread,
May 26, 2017, 11:55:08 AM5/26/17
to igv-help
I'm not familiar with visual basic,  but in most languages the quotes would need to be escaped.    If you change writer.WriteLine and print to the console what do you see?

--

---
You received this message because you are subscribed to the Google Groups "igv-help" group.
To unsubscribe from this group and stop receiving emails from it, send an email to igv-help+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/igv-help/8fd57614-8f61-40af-8b27-63d605903a2c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Philipp

unread,
May 28, 2017, 7:28:03 AM5/28/17
to igv-help
When I print to the console, I get this:

new

genome "C:\Folder with spaces\test.fasta"
load "C:\Folder with spaces\test.bam"

James Robinson

unread,
May 28, 2017, 11:23:05 AM5/28/17
to igv-help
Thanks for checking.

I've confirmed this is an IGV bug.  I opened a git issue for it here:  https://github.com/igvteam/igv/issues/423.

In the meantime,  the following might help as a workaround.




If double quotes do not solve the issue then try e.g.

dir /X ~1 c:\

to get a list of alternative file or directory names. Example output:

11/09/2014 12:54 AM             8,065  DEFAUL~1.XML Default Desktop Policy.xml
06/12/2014  03:49 PM    <DIR>          PROGRA~1     Program Files 
10/12/2014  12:46 AM    <DIR>          PROGRA~2     Program Files (x86)
07/11/2014  03:10 PM    <DIR>                       servers

Now us the short 8 character file or folder name in the 5th column, e.g. PROGRA~1 or DEFAUL~1.XML, in your commands. For instance:

set JAVA_HOME=c:\PROGRA~1\Java\jdk1.6.0_45 




Philipp

unread,
May 28, 2017, 2:11:21 PM5/28/17
to igv-help
Thanks a lot for the quick answer.
Using short names works for me as workaround.

Just to be sure:
Do I have to worry about that java.net.SocketException that shows up in my log when closing the client connection?
Reply all
Reply to author
Forward
0 new messages