Changeset 3554
- Timestamp:
- Jul 12, 2007, 4:28:12 PM (16 years ago)
- Location:
- trunk/src
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java
r3545 r3554 1154 1154 ffp.setHeaderRegexp(Pattern.compile("(.*?)\\t(.*)")); 1155 1155 ffp.setDataHeaderRegexp(Pattern.compile("%")); 1156 ffp.setDataFooterRegexp(Pattern.compile("^$")); 1156 1157 ffp.setDataSplitterRegexp(Pattern.compile("\\t")); 1158 ffp.setUseNullIfEmpty(false); 1157 1159 1158 1160 ffp.setInputStream(stream, Config.getCharset()); -
trunk/src/plugins/core/net/sf/basedb/plugins/BioAssaySetExporter.java
r3545 r3554 312 312 } 313 313 out.println("columns\tid\tname" + annotationString); 314 out.println("annotationColumns" + annotationString);314 out.println("annotationColumns" + (annotationString.length() == 0 ? "\t" : annotationString)); 315 315 out.println("%"); 316 316 for (BioAssay ba : bas.getBioAssays().list(dc)) … … 339 339 out.println("section\t"+parameters.get("section")); 340 340 keys = keys.subList(1, keys.size()); 341 } 342 else 343 { 344 out.println("section\tsettings"); 341 345 } 342 346 if (keys.contains("section")) … … 451 455 } 452 456 out.println(); 453 out.println("count\t" + bas.getNumReporters()); //TODO: count number of column/position457 out.println("count\t" + query.count(dc)); //TODO: count number of column/position 454 458 out.println("%"); 455 459 … … 481 485 Integer prevPos = null; 482 486 HashMap<Short, String> spotValues = new HashMap<Short, String>(); 483 String reporter = null;484 487 while (iterator.hasNext()) 485 488 { … … 487 490 Integer currentPos = r.getInt(posIndex); 488 491 489 if (prevPos != null && !currentPos.equals(prevPos)) 490 { 492 if (!currentPos.equals(prevPos)) 493 { 494 // Print spot fields 495 if (!spotValues.isEmpty()) 496 { 497 String separator = ""; 498 for (Short col : columnNo) 499 { 500 String spot = spotValues.get(col); 501 if (spot != null) 502 { 503 out.print(separator); 504 out.print(spot); 505 } 506 else 507 { 508 out.print(tabs); 509 } 510 separator = "\t"; 511 } 512 out.println(); 513 spotValues.clear(); 514 } 515 491 516 //Print reporter fields 492 out.print(reporter);493 494 //Print spot fields495 String separator = "";496 for (Short col : columnNo)497 {498 String spot = spotValues.get(col);499 if (spot != null)500 {501 out.print(separator);502 out.print(spot);503 }504 else505 {506 out.print(tabs);507 }508 separator = "\t";509 }510 out.println();511 512 reporter = null;513 spotValues = new HashMap<Short, String>();514 }515 516 if (reporter == null)517 {518 reporter = "";519 517 for (int i = 0; i < reporterIndex.size(); ++i) 520 518 { 521 519 String field = r.getString(reporterIndex.get(i)); 522 reporter += field == null ? "" : field; 523 reporter += "\t"; 520 out.print((field == null ? "" : field) + "\t"); 524 521 } 525 522 } … … 533 530 } 534 531 spotValues.put(r.getShort(colIndex), spot); 535 prevPos = r.getInt(posIndex); 532 prevPos = currentPos; 533 } 534 535 // Print the last spot fields 536 if (!spotValues.isEmpty()) 537 { 538 String separator = ""; 539 for (Short col : columnNo) 540 { 541 String spot = spotValues.get(col); 542 if (spot != null) 543 { 544 out.print(separator); 545 out.print(spot); 546 } 547 else 548 { 549 out.print(tabs); 550 } 551 separator = "\t"; 552 } 553 out.println(); 554 spotValues.clear(); 536 555 } 537 556 } … … 842 861 List<QueryItem> items = new ArrayList<QueryItem>(); 843 862 items.add(new QueryItem("rep.id", "Reporter (internal id)", "reporter", "rep('id')")); 863 items.add(new QueryItem("rep.position", "Position", "position", "pos()")); 844 864 items.add(new QueryItem("rep.name", "Reporter Name", "name", "rep('name')")); 845 865 items.add(new QueryItem("rep.externalId", "Reporter ID", "externalId", "rep('externalId')")); … … 859 879 { 860 880 List<QueryItem> items = new ArrayList<QueryItem>(); 861 items.add(new QueryItem("position", "Position", "position", "pos()"));862 881 int channels = bas.getRawDataType().getChannels(); 863 882 for (int channel = 1; channel <= channels; ++channel) -
trunk/src/test/TestFlatFileParser.java
r2992 r3554 8 8 import net.sf.basedb.util.parser.FlatFileParser; 9 9 import net.sf.basedb.util.parser.Mapper; 10 import net.sf.basedb.util.parser.FlatFileParser.Line; 10 11 11 12 /* … … 197 198 } 198 199 } 200 201 public static void testHeaderLine(Line line, String name, String value) throws Exception 202 { 203 if (!line.type().equals(FlatFileParser.LineType.HEADER)) 204 throw new Exception("Line is no header: "+line.toString()); 205 if (!line.name().equals(name)) 206 throw new Exception("Cant find name '"+name+"' in line '"+line.line()+"'"); 207 if (!line.value().equals(value)) 208 throw new Exception("Cant find value '"+value+"' in line '"+line.line()+"'"); 209 } 210 211 public static void testLine(Line line, String name) throws Exception 212 { 213 if (!line.line().equals(name)) 214 throw new Exception("Line '"+line.line()+"' doesnt match '"+name+"'"); 215 } 216 217 public static void testSection(Line line, String name) throws Exception 218 { 219 if (!line.type().equals(FlatFileParser.LineType.SECTION)) 220 throw new Exception("Line is no section: "+line.toString()); 221 if (!line.name().equals(name)) 222 throw new Exception("Cant find sectionname '"+name+"' in line '"+line.line()+"'"); 223 } 199 224 }
Note: See TracChangeset
for help on using the changeset viewer.