Changeset 1044


Ignore:
Timestamp:
Apr 23, 2009, 7:09:51 PM (14 years ago)
Author:
Jari Häkkinen
Message:

Addresses #118 and #206. If no assay data is given use the average of all assays as reference ... fixed create_target for this case.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/base2/net.sf.basedb.normalizers/trunk/src/c++/bin/qQN.cc

    r1043 r1044  
    5656{
    5757  CommandLine cmd;
    58   OptionInFile assay(cmd, "assay-data", "assay annotations", true);
     58  OptionInFile assay(cmd, "assay-data", "assay annotations");
    5959  OptionInFile indata(cmd, "in-data", "data to be normalized");
    6060  OptionOutFile outdata(cmd, "out-data", "normalized data");
     
    159159  for (size_t row=0; row<m.rows(); ++row) {
    160160    t[row]=0;
     161    size_t column_contribs=0;
    161162    for (size_t column=0; column<m.columns(); ++column)
    162       t[row]+=m(row,column).data();
    163     t[row]/=m.columns();
     163      if (m(row,column).weight()) { // weight either 0 or 1
     164        t[row]+=m(row,column).data();
     165        ++column_contribs;
     166      }
     167    if (!column_contribs)
     168      throw std::runtime_error("At least one row with no valid reference");
     169    t[row]/=column_contribs;
    164170  }
    165171}
Note: See TracChangeset for help on using the changeset viewer.