use of org.cytoscape.tableimport.internal.reader.TextTableReader in project cytoscape-impl by cytoscape.
the class LoadTableReaderTask method loadAnnotation.
private void loadAnnotation(TaskMonitor tm) {
tm.setProgress(0.0);
TextTableReader reader = this.reader;
AttributeMappingParameters readerAMP = (AttributeMappingParameters) reader.getMappingParameter();
String primaryKey = readerAMP.getAttributeNames()[readerAMP.getKeyIndex()];
tm.setProgress(0.1);
final CyTableFactory tableFactory = serviceRegistrar.getService(CyTableFactory.class);
final CyTable table = tableFactory.createTable("AttrTable " + inputName.substring(inputName.lastIndexOf('/') + 1) + " " + Integer.toString(numImports++), primaryKey, String.class, true, true);
cyTables = new CyTable[] { table };
tm.setProgress(0.3);
try {
this.reader.readTable(table);
} catch (IOException e) {
e.printStackTrace();
}
tm.setProgress(1.0);
}
use of org.cytoscape.tableimport.internal.reader.TextTableReader in project cytoscape-impl by cytoscape.
the class ImportAttributeTableReaderTask method loadAnnotation.
private void loadAnnotation(TaskMonitor tm) {
tm.setProgress(0.0);
final TextTableReader reader = this.reader;
final AttributeMappingParameters readerAMP = (AttributeMappingParameters) reader.getMappingParameter();
final String primaryKey = readerAMP.getAttributeNames()[readerAMP.getKeyIndex()];
final AttributeDataType dataType = readerAMP.getDataTypes()[readerAMP.getKeyIndex()];
final Class<?> keyType;
switch(dataType) {
case TYPE_INTEGER:
keyType = Integer.class;
break;
case TYPE_LONG:
keyType = Long.class;
break;
default:
keyType = String.class;
}
tm.setProgress(0.1);
final CyTable table = serviceRegistrar.getService(CyTableFactory.class).createTable("AttrTable " + inputName.substring(inputName.lastIndexOf('/') + 1) + " " + Integer.toString(numImports++), primaryKey, keyType, true, true);
cyTables = new CyTable[] { table };
tm.setProgress(0.3);
try {
this.reader.readTable(table);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
tm.setProgress(1.0);
}
Aggregations