Hi, does anyone know of a parser, preferably in R, for the Tiled Data File (TDF) format that is used by the Broad's IGV Browser?
The TDF format is binary, but appears to be poorly documented. It looks like it is mostly intended as an intermediate file format to speed up IGV, and the Broad's igvtools can generate TDF files from other sources. Unfortunately, there is no method for converting/dumping TDFs into, say, plain text.
As a follow up to my own question, I've found that Java class org.broad.igv.tdf.TDFUtils part of IGV to some extent can be used to parse TDF files. For instance, one can convert a TDF to a BED file from within R as:
Unfortunately, multi-track TDF files cannot be represented as BED files, so this won't work in all cases. There are other methods in the TDFUtils Java class that could be used to parse the TDF file, but that would probably require some additional work in order to coerce Java objects into R objects.
However, for my immediate needs, conversion to BED will probably suffice.
Do you know if this trick still works, Henrik? I can't get it working on my machine but the combination of rJava, a conda-installed igvtools, and an the general lack of documentation on TDF makes me unsure where the fault lies.
library(rJava)
.jinit(classpath="~/miniconda3/share/igvtools-2.3.93-0/igvtools.jar")
TDFUtils <- .jnew("org/broad/igv/tdf/TDFUtils")
#> Error in .jnew("org/broad/igv/tdf/TDFUtils"): java.lang.ClassNotFoundException
Do you know if this trick still works, Henrik? I can't get it working on my machine but the combination of rJava, a conda-installed igvtools, and an the general lack of documentation on TDF makes me unsure where the fault lies.
Don't know, haven't tried for a long time. But, try to use a path without
~
, e.g. normalize it withnormalizePath(...)
.I think this means TDFUtils exists in the .jar file, but I'm pretty outside my knowledge here.