public void update(Long pos, Object readpos, HashMap<Long, ArrayList<String>> map) { // USE BUECKTS ReadPos rp = (ReadPos) readpos; Long Buck = new Long(((Long) pos).longValue() / BUCKET_SIZE); ArrayList<String> reads = map.get(Buck); if (reads == null) { reads = new ArrayList<String>(); } // also add read START and END to the list String spos = rp.toString(); if (!reads.contains(spos)) { reads.add(spos); // p("Adding rp "+spos+" to bucket "+Buck); } map.put(Buck, reads); }
private void updateLine(HashMap<Long, ArrayList<String>> map, String line) { int tab = line.indexOf("\t"); if (tab < 1) { warn("err or in readloc, no tab on line " + nrrows + ":" + line); } else { String a = line.substring(0, tab).trim(); Long pos = Long.parseLong(a); // bunch of reads... line = line.substring(tab + 1).trim(); ArrayList<String> readposlist = StringTools.parseList(line, "\t"); for (String rpline : readposlist) { ReadPos rp = ReadPos.fromString(rpline); if (rp != null) update(pos, rp, map); } } }