Changeset 1563


Ignore:
Timestamp:
Mar 16, 2012, 9:42:01 AM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #366: Import annotations and other information from Caliper output

Handle values in brackets by replacing them with negative values. Eg. [8.0] --> -8.0. A warning message is displayed for the user after the import.

Location:
extensions/net.sf.basedb.reggie/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/css/reggie.css

    r1546 r1563  
    109109  list-style-image: url('../images/ok.png');
    110110}
     111
     112li.warning
     113{
     114  list-style-image: url('../images/warning.png');
     115}
     116
    111117.failure ul
    112118{
  • extensions/net.sf.basedb.reggie/trunk/resources/rnaqc_plate_import.jsp

    r1561 r1563  
    209209    for (var i = 0; i < response.messages.length; i++)
    210210    {
    211       msg += '<li>' + response.messages[i];
     211      var msgLine = response.messages[i];
     212      if (msgLine.indexOf('[Warning]') >= 0)
     213      {
     214        msg += '<li class="warning">' + msgLine.replace('[Warning]', '');
     215      }
     216      else
     217      {
     218        msg += '<li>' + msgLine;
     219      }
    212220    }
    213221    msg += '</ul>';
  • extensions/net.sf.basedb.reggie/trunk/src/net/sf/basedb/reggie/plugins/CaliperPlateImporter.java

    r1561 r1563  
    4141  private final Map<String, AnnotationType> annotations;
    4242  private final List<String> errorMessages;
     43  private final List<String> warningMessages;
     44 
    4345  private int numImported;
    4446  private BioPlate plate;
     
    4850    this.annotations = new HashMap<String, AnnotationType>();
    4951    this.errorMessages = new ArrayList<String>();
     52    this.warningMessages = new ArrayList<String>();
    5053  }
    5154 
     
    8083  }
    8184 
     85  public boolean hasWarning()
     86  {
     87    return warningMessages.size() > 0;
     88  }
     89 
     90  public List<String> getWarningMessages()
     91  {
     92    return warningMessages;
     93  }
     94 
    8295 
    8396  public boolean hasError()
     
    92105  }
    93106 
     107 
     108  protected void addWarningMessage(String msg)
     109  {
     110    this.warningMessages.add(msg);
     111  }
    94112 
    95113  protected void addErrorMessage(String msg)
     
    227245         
    228246          String sval = m.getValue(data);
     247          if (at.getValueType().isNumerical())
     248          {
     249            // Replace numbers in [] with a negative value
     250            // Eg. [8.0] --> -8.0
     251            if (sval != null && sval.startsWith("[") && sval.endsWith("]"))
     252            {
     253              addWarningMessage("[Warning] Line " + lineNo + ": Location '" + location + "' with extract '" +
     254                  extractName + "' has flagged '" + col + "': " + sval);
     255              sval = "-"+sval.substring(1, sval.length()-1);
     256            }
     257          }
     258         
    229259          Object val = at.getValueType().parseString(sval);
    230          
    231260          as.getAnnotation(at).setValue(val);
    232261        }
Note: See TracChangeset for help on using the changeset viewer.