Changeset 3648
- Timestamp:
- Aug 9, 2007, 4:28:43 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/core/net/sf/basedb/plugins/BioAssaySetExporter.java
r3645 r3648 102 102 use in MeV (available from http://www.tm4.org). 103 103 - BASEfile. 104 - Plain Matrix 105 106 @author enell, jari, peter 104 105 @author enell, jari 107 106 @version 2.1 108 107 @base.modified $Date$ … … 746 745 747 746 748 public void exportPlainMatrix(BioAssaySet bioassayset, OutputStream os,749 ProgressReporter progress)750 throws IOException, SQLException751 {752 DbControl dc=bioassayset.getDbControl();753 PrintWriter out = new PrintWriter(os);754 List<ExtendedProperty> reporterProperties =755 ExtendedProperties.getProperties("ReporterData");756 757 int nof_bioassays=0;758 nof_bioassays=bioassayset.getBioAssays().list(dc).size();759 760 if (progress != null)761 progress.display(0, "Exporting ... performing database query");762 763 DynamicSpotQuery query=bioassayset.getSpotData();764 query.select(Dynamic.select(VirtualColumn.POSITION));765 query.select(Dynamic.select(VirtualColumn.COLUMN));766 query.select(Dynamic.select(VirtualColumn.channel(1)));767 768 query.order(Orders.asc(Dynamic.column(VirtualColumn.POSITION)));769 query.order(Orders.asc(Dynamic.column(VirtualColumn.COLUMN)));770 771 DynamicResultIterator spotData = query.iterate(dc);772 int column_position=spotData.getIndex(VirtualColumn.POSITION.getName());773 int column_column=spotData.getIndex(VirtualColumn.COLUMN.getName());774 int column_channel=spotData.getIndex(VirtualColumn.channel(1).getName());775 776 int position=-1;777 int column=nof_bioassays;778 //double log2=Math.log(2.0);779 int nof_spots=bioassayset.getNumSpots();780 int progress_spot_interval=nof_spots/10;781 int nof_processed_spots=0;782 while (spotData.hasNext())783 {784 SqlResult item = spotData.next();785 int thisposition=item.getInt(column_position);786 short thiscolumn=item.getShort(column_column);787 788 if (progress != null &&789 (nof_processed_spots%progress_spot_interval == 0))790 {791 progress.display(100 * nof_processed_spots / nof_spots,792 "Exporting ..." + nof_processed_spots + " of " +793 nof_spots + " done.");794 }795 ++nof_processed_spots;796 797 if (position!=thisposition) // new position798 {799 // fill missing values before next spot800 while (column < nof_bioassays) {801 out.write("\t");802 ++column;803 }804 column=1;805 if (position != -1) // no leading newline in output806 {807 out.write("\n");808 }809 position=thisposition;810 }811 812 // fill missing values up to next available column (bioassay)813 while (column < thiscolumn)814 {815 ++column;816 out.write("\t");817 }818 819 // Calculate expression value820 String ch1=item.getString(column_channel);821 out.write(ch1);822 }823 out.flush();824 }825 826 827 747 public About getAbout() 828 748 { … … 1064 984 formats.add(FORMAT_MEV, "MultiExperiment Viewer (MeV)"); 1065 985 formats.add(FORMAT_BASEFILE, "BASEfile"); 1066 formats.add(FORMAT_PLAIN_MATRIX, "Plain Matrix");1067 986 formatParameter = new PluginParameter<String> 1068 987 ( "fileformat", … … 1219 1138 } 1220 1139 } 1221 else if (format.equals(FORMAT_PLAIN_MATRIX))1222 {1223 exportPlainMatrix(bas, out, progress);1224 }1225 1140 else 1226 1141 { … … 1260 1175 "- Tab Delimited, Multiple Sample Files (TDMS Format) for " + 1261 1176 "use in MeV (available from http://www.tm4.org).\n"+ 1262 "- BASEfile , and Plain Matrix",1177 "- BASEfile", 1263 1178 "2.0", 1264 1179 "2006, Base 2 development team", … … 1288 1203 private static final String FORMAT_BASEFILE = "BASEfile"; 1289 1204 private static final String FORMAT_MEV = "MeV"; 1290 private static final String FORMAT_PLAIN_MATRIX = "Plain Matrix"; 1291 1205 1292 1206 1293 1207 public class QueryItem
Note: See TracChangeset
for help on using the changeset viewer.