Author: mes
Date: 2010-09-05 16:45:22 -0700 (Sun, 05 Sep 2010)
New Revision: 21708
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/expression/ExpressionData.java
Log:
changes to support the concept of primary key in CyDataTable
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
2010-09-05 23:45:12 UTC (rev 21707)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/datatable/TextDataTableReader.java
2010-09-05 23:45:22 UTC (rev 21708)
@@ -39,13 +39,12 @@
public void run(TaskMonitor tm) throws IOException {
try {
- final CyDataTable table =
tableFactory.createTable(tableName, true);
String line;
final BufferedReader br = new BufferedReader(new
InputStreamReader(inputStream));
line = br.readLine();
- createColumns(table, line);
+ final CyDataTable table = createTable(line);
while ((line = br.readLine()) != null)
processLine(table, line);
@@ -62,16 +61,20 @@
tm.setProgress(1.0);
}
- private void createColumns(CyDataTable table, String line) throws
IOException {
+ private CyDataTable createTable(String line) throws IOException {
if (line == null)
throw new IllegalStateException("Column names cannot be
null");
columnNames = line.split(delimiter);
checkForDuplicates( columnNames );
+ final CyDataTable table = tableFactory.createTable(tableName,
columnNames[0],
+
String.class, true);
for ( String col : columnNames )
table.createColumn(col, String.class, false);
+
+ return table;
}
private void checkForDuplicates(String[] names) throws IOException {
@@ -101,7 +104,7 @@
return;
}
- CyRow row = table.addRow();
+ CyRow row = table.getRow(buffer[0]);
for(int i = 0; i<buffer.length; i++)
row.set(columnNames[i], buffer[i]);
Modified:
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/expression/ExpressionData.java
===================================================================
---
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/expression/ExpressionData.java
2010-09-05 23:45:12 UTC (rev 21707)
+++
core3/io-impl/trunk/src/main/java/org/cytoscape/io/internal/read/expression/ExpressionData.java
2010-09-05 23:45:22 UTC (rev 21708)
@@ -1067,8 +1067,8 @@
// now create the rows and populate
for (int i = 0; i < geneNames.size(); i++) {
- CyRow row = table.addRow();
String canName = geneNames.get(i);
+ CyRow row = table.getRow(canName);
for (int condNum = 0; condNum < condNames.length;
condNum++) {
String condName = condNames[condNum];
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.