Changeset 2485
- Timestamp:
- Aug 3, 2006, 1:03:02 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/Base1PluginExecuter.java
r2481 r2485 52 52 import net.sf.basedb.core.ProgressReporter; 53 53 import net.sf.basedb.core.RawBioAssay; 54 import net.sf.basedb.core.Reporter; 54 55 import net.sf.basedb.core.RequestInformation; 55 56 import net.sf.basedb.core.SpotBatcher; … … 702 703 throws IOException 703 704 { 705 int posCnt = 0; 706 704 707 BioAssaySet bas = null; 705 708 SpotBatcher spotBatcher = null; 706 PositionBatcher posBatcher = null; 709 PositionBatcher posBatcher = null; 707 710 708 711 HashMap<String, BioAssay> idMap = new HashMap<String, BioAssay>(); 712 HashMap<PosRep, Integer> posMap = new HashMap<PosRep, Integer>(); 709 713 710 714 FlatFileParser ffp = getInitializedFlatFileParser(new FileInputStream(new java.io.File(getExecDirectory(), "stdout.txt"))); … … 756 760 else if (section.name().equals("spots")) 757 761 { 762 posBatcher = bas.getPositionBatcher(); // TODO: BioAssaySet can be null 758 763 spotBatcher = bas.getSpotBatcher(); // TODO: BioAssaySet can be null 759 764 List<String> columns = Arrays.asList(ffp.getHeader("columns").split("\\t")); … … 762 767 763 768 ffp.setMinDataColumns(columns.size() - 1 + assays.size() * assayFields.size()); 764 ffp.setUseNullIfEmpty(false);765 769 766 770 int posCol = columns.indexOf("position"); … … 778 782 { 779 783 intCols = true; 780 int1Col += dataCol;781 int2Col += dataCol;782 784 } 783 785 else if (mCol > -1 && aCol > -1) 784 786 { 785 787 intCols = false; 786 mCol += dataCol;787 aCol += dataCol;788 788 } 789 789 else … … 798 798 } 799 799 800 int1Col += dataCol; 801 int2Col += dataCol; 802 aCol += dataCol; 803 mCol += dataCol; 804 800 805 while (ffp.hasMoreData()) 801 806 { … … 804 809 { 805 810 BioAssay ba = idMap.get(assayId); 806 807 float int1;808 float int2;809 810 811 try 811 812 { 812 int position = Integer.parseInt(dataline.get(posCol)); 813 Float int1; 814 Float int2; 815 Integer reporter = dataline.get(repCol) == null ? null : new Integer(dataline.get(repCol)); 816 Integer position = dataline.get(posCol) == null ? null : new Integer(dataline.get(posCol)); 817 813 818 if (intCols) 814 819 { 815 int1 = Float.parseFloat(dataline.get(int1Col));816 int2 = Float.parseFloat(dataline.get(int2Col));820 int1 = dataline.get(int1Col) == null ? Float.NaN : new Float(dataline.get(int1Col)); 821 int2 = dataline.get(int2Col) == null ? Float.NaN : new Float(dataline.get(int2Col)); 817 822 } 818 823 else 819 824 { 820 double a = Double.parseDouble(dataline.get(aCol));821 double m = Double.parseDouble(dataline.get(mCol));825 float a = dataline.get(aCol) == null ? Float.NaN : new Float(dataline.get(aCol)); 826 float m = dataline.get(mCol) == null ? Float.NaN : new Float(dataline.get(mCol)); 822 827 823 828 // int2 = 10^a / 2^(0.5*m) 824 829 // int1 = int2 * 2^m 825 int2 = (float) (Math.pow(10, a) / Math.pow(2, 0.5 * m)); 826 int1 = (float) (int2 * Math.pow(2, m)); 830 int2 = new Float(Math.pow(10, a) / Math.pow(2, 0.5 * m)); 831 int1 = new Float(int2 * Math.pow(2, m)); 832 } 833 834 PosRep pr = new PosRep(position, reporter); 835 position = posMap.get(pr); 836 if (position == null) 837 { 838 if (posMap.values().contains(position)) 839 { 840 position = pr.getPosition(); 841 if (position > posCnt) 842 { 843 posCnt = position; 844 } 845 } 846 else 847 { 848 posCnt++; 849 position = posCnt; 850 } 851 posMap.put(pr, position); 827 852 } 828 853 … … 830 855 { 831 856 spotBatcher.insert(ba.getDataCubeColumnNo(), position, int1, int2); 857 if (reporter != null) 858 { 859 posBatcher.insert(position, Reporter.getById(dc, reporter)); 860 } 861 else 862 { 863 posBatcher.insert(position, null); 864 } 832 865 } 833 866 } … … 1182 1215 } 1183 1216 } 1217 1218 1219 private class PosRep 1220 { 1221 Integer position; 1222 1223 Integer reporter; 1224 1225 PosRep(Integer position, Integer reporter) 1226 { 1227 this.position = position; 1228 this.reporter = reporter; 1229 } 1230 1231 public final Integer getPosition() 1232 { 1233 return position; 1234 } 1235 1236 public final Integer getReporter() 1237 { 1238 return reporter; 1239 } 1240 1241 @Override 1242 public boolean equals(Object o) 1243 { 1244 if (this == o) 1245 { 1246 return true; 1247 } 1248 else if (o instanceof PosRep) 1249 { 1250 PosRep pr = (PosRep) o; 1251 return position.equals(pr.getPosition()) && (reporter == pr.getReporter() || reporter.equals(pr.getReporter())); 1252 } 1253 return false; 1254 } 1255 1256 } 1184 1257 }
Note: See TracChangeset
for help on using the changeset viewer.