Search in sources :

Example 1 with ResourceLocator

use of org.broad.igv.util.ResourceLocator in project ASCIIGenome by dariober.

the class TrackWiggles method getAttributesFromTDF.

private String getAttributesFromTDF(String attr) {
    String path = this.getWorkFilename();
    try {
        ResourceLocator resourceLocator = new ResourceLocator(path);
        TDFReader reader = new TDFReader(resourceLocator);
        TDFGroup rootGroup = reader.getGroup("/");
        return rootGroup.getAttribute(attr);
    } catch (Exception e) {
        return null;
    }
}
Also used : TDFGroup(org.broad.igv.tdf.TDFGroup) TDFReader(org.broad.igv.tdf.TDFReader) InvalidColourException(exceptions.InvalidColourException) InvalidRecordException(exceptions.InvalidRecordException) SQLException(java.sql.SQLException) IOException(java.io.IOException) InvalidGenomicCoordsException(exceptions.InvalidGenomicCoordsException) ResourceLocator(org.broad.igv.util.ResourceLocator)

Example 2 with ResourceLocator

use of org.broad.igv.util.ResourceLocator in project ASCIIGenome by dariober.

the class TrackWiggles method getChromosomeNames.

@Override
public List<String> getChromosomeNames() {
    if (this.getTrackFormat().equals(TrackFormat.TDF)) {
        ResourceLocator resourceLocator = new ResourceLocator(this.getWorkFilename());
        TDFReader reader = new TDFReader(resourceLocator);
        List<String> chroms = new ArrayList<String>(reader.getChromosomeNames());
        if (chroms.get(0).equals("All")) {
            chroms.remove(0);
        }
        return chroms;
    // chroms.addAll();
    }
    if (this.getTrackFormat().equals(TrackFormat.BEDGRAPH)) {
        TabixIndex tbi = (TabixIndex) IndexFactory.loadIndex(this.getWorkFilename() + TabixUtils.STANDARD_INDEX_EXTENSION);
        return tbi.getSequenceNames();
    }
    if (this.getTrackFormat().equals(TrackFormat.BIGWIG)) {
        return this.bigWigReader.getChromosomeNames();
    }
    return null;
}
Also used : ArrayList(java.util.ArrayList) MakeTabixIndex(sortBgzipIndex.MakeTabixIndex) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) TDFReader(org.broad.igv.tdf.TDFReader) ResourceLocator(org.broad.igv.util.ResourceLocator)

Aggregations

TDFReader (org.broad.igv.tdf.TDFReader)2 ResourceLocator (org.broad.igv.util.ResourceLocator)2 InvalidColourException (exceptions.InvalidColourException)1 InvalidGenomicCoordsException (exceptions.InvalidGenomicCoordsException)1 InvalidRecordException (exceptions.InvalidRecordException)1 TabixIndex (htsjdk.tribble.index.tabix.TabixIndex)1 IOException (java.io.IOException)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 TDFGroup (org.broad.igv.tdf.TDFGroup)1 MakeTabixIndex (sortBgzipIndex.MakeTabixIndex)1