Java Examples for de.uni_luebeck.inb.krabbenhoeft.eQTL.server.helpers.persistence.StreamingEntityRead
The following java examples will help you to understand the usage of de.uni_luebeck.inb.krabbenhoeft.eQTL.server.helpers.persistence.StreamingEntityRead. These source code samples are taken from different open source projects.
Example 1
Project: eQTL-GWT-Cassandra-master File: DataRetrievalService.java View source code |
public ExpressionQtlTrackEntry[] work(Transaction transaction, Session session) throws Exception { DataSetLayer dsl = (DataSetLayer) session.load(DataSetLayer.class, dataSetLayerKey); ColumnForDataSetLayer[] columns = dsl.getColumns().toArray(new ColumnForDataSetLayer[0]); ColumnForDataSetLayer lodColumn = null; ColumnForDataSetLayer locationColumn = null; for (ColumnForDataSetLayer col : columns) { if (col.getName().equals("lodScore")) lodColumn = col; if (col.getName().equals(locationColumnName)) locationColumn = col; } CassandraSession cassandra = new CassandraSession(); StreamingEntityRead read = new StreamingEntityRead(cassandra, dsl); final List<ExpressionQtlTrackEntry> output = new ArrayList<ExpressionQtlTrackEntry>(); final Iterator<HajoEntity> reader = read.getEntitiesFromGeoboxRange(locationColumnName, genomeRange.chromosome, genomeRange.fromBP, genomeRange.toBP); while (reader.hasNext()) { final HajoEntity entity = reader.next(); final ExpressionQtlTrackEntry addme = new ExpressionQtlTrackEntry(); addme.locusId = entity.getName("locusId"); addme.traitId = entity.getName("traitId"); addme.lodScore = entity.getNumerical("lodScore"); addme.lodScoreInMinMaxRange = (addme.lodScore - lodColumn.getMin()) / (lodColumn.getMax() - lodColumn.getMin()); addme.positionStart = entity.getLocation(locationColumnName); final String indexRangeEndField = locationColumn.getIndexRangeEndField(); if (indexRangeEndField == null) addme.positionEnd = addme.positionStart; else addme.positionEnd = entity.getLocation(indexRangeEndField); output.add(addme); if (output.size() >= 25) break; } cassandra.close(); return output.toArray(new ExpressionQtlTrackEntry[0]); }