public static void dumpRootAttributes(String ibfFile) { TDFReader reader = TDFReader.getReader(ibfFile); System.out.println("Track line = " + reader.getTrackLine()); TDFGroup group = reader.getGroup("/"); for (Map.Entry<String, String> entries : group.attributes.entrySet()) { System.out.println(entries.getKey() + " = " + entries.getValue()); } System.out.println(reader.getTrackLine()); }
for (String name : reader.getGroupNames()) { System.out.println(name); TDFGroup group = reader.getGroup(name);
private Double getValue(WindowFunction wf) { if (!valueCache.containsKey(wf)) { TDFGroup rootGroup = getGroup("/"); String maxString = rootGroup.getAttribute(wf.getValue()); try { valueCache.put(wf, Double.parseDouble(maxString)); } catch (Exception e) { log.info("Warning: value '" + wf.toString() + "' not found in tdf value " + getPath()); valueCache.put(wf, null); } } return valueCache.get(wf); }
private Double getValue(WindowFunction wf) { if (!valueCache.containsKey(wf)) { TDFGroup rootGroup = getGroup("/"); String maxString = rootGroup.getAttribute(wf.getDisplayName()); try { valueCache.put(wf, Double.parseDouble(maxString)); } catch (Exception e) { log.info("Warning: value '" + wf.toString() + "' not found in tdf value " + getPath()); valueCache.put(wf, null); } } return valueCache.get(wf); }
TDFGroup rootGroup = reader.getGroup(TDFWriter.ROOT_GROUP); chromosomeNames = rootGroup.getAttribute(TDFWriter.CHROMOSOMES); fileChromos = new ArrayList<String>(Arrays.asList(chromosomeNames.split(",")));
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; } }
this.availableFunctions = reader.getWindowFunctions(); TDFGroup rootGroup = reader.getGroup("/"); try { maxPrecomputedZoom = Integer.parseInt(rootGroup.getAttribute("maxZoom"));
private void init() { this.availableFunctions = reader.getWindowFunctions(); if(this.availableFunctions != null) { this.availableFunctions.add(WindowFunction.none); // Always available => raw data } TDFGroup rootGroup = reader.getGroup("/"); try { maxPrecomputedZoom = Integer.parseInt(rootGroup.getAttribute("maxZoom")); } catch (Exception e) { log.error("Error reading attribute 'maxZoom'", e); } try { String dataGenome = rootGroup.getAttribute("genome"); // TODO -- throw exception if data genome != current genome } catch (Exception e) { log.error("Unknown genome " + rootGroup.getAttribute("genome")); throw new RuntimeException("Unknown genome " + rootGroup.getAttribute("genome")); } try { String totalCountString = rootGroup.getAttribute("totalCount"); if (totalCountString != null) { totalCount = Integer.parseInt(totalCountString); } } catch (Exception e) { log.error("Error reading attribute 'totalCount'", e); } intChrMap(); boolean normalizeCounts = PreferencesManager.getPreferences().getAsBoolean(Constants.NORMALIZE_COVERAGE); setNormalize(normalizeCounts); }
/** * Test of createGroup method, of class IBFWriter. */ @Test public void testCreateGroup() { File testFile = new File("test1.tdf"); testFile.deleteOnExit(); String groupName = "/chr1"; TDFWriter writer = new TDFWriter(testFile, "hg18", type, trackLine, trackNames, wfs, false); TDFGroup group = writer.createGroup(groupName); group.setAttribute("attKey", "attValue"); group.setAttribute("attKey2", "attValue2"); writer.closeFile(); TDFReader reader = TDFReader.getReader(testFile.getAbsolutePath()); group = reader.getGroup(groupName); assertEquals(groupName, group.getName()); assertEquals(2, group.attributes.size()); assertEquals("attValue", group.attributes.get("attKey")); assertEquals("attValue2", group.attributes.get("attKey2")); reader.close(); }