Changeset 4978


Ignore:
Timestamp:
Sep 24, 2018, 10:51:24 AM (5 years ago)
Author:
Nicklas Nordborg
Message:

References #1054: Even more functionality in the Flagged alignment wizard

Sorting items in order from Specimen->Lysate->RNA->Library to make results predictable in the case that two or more items from the same parent-child chain are selected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/net.sf.basedb.reggie/trunk/resources/flaggedalignment/search.js

    r4976 r4978  
    10901090          if (okToUse.value == 'ok-rna')
    10911091          {
    1092             item = {'type': 'EXTRACT', 'id': aligned.rna.id, 'okToUse': true };
     1092            item = {'type': 'EXTRACT', 'id': aligned.rna.id, 'okToUse': true, 'sort': 5 };
    10931093          }
    10941094          else if (okToUse.value == 'ok-library')
    10951095          {
    1096             item = {'type': 'EXTRACT', 'id': aligned.lib.id, 'okToUse': true };
     1096            item = {'type': 'EXTRACT', 'id': aligned.lib.id, 'okToUse': true, 'sort': 6 };
    10971097          }
    10981098        }
    10991099        else if (doNotUse.value == 'specimen')
    11001100        {
    1101           item = {'type': 'SAMPLE', 'id': aligned.specimen.id, 'doNotUse': 'Specimen' };
     1101          item = {'type': 'SAMPLE', 'id': aligned.specimen.id, 'doNotUse': 'Specimen', 'sort': 1 };
    11021102        }
    11031103        else if (doNotUse.value == 'lysate')
    11041104        {
    1105           item = {'type': 'EXTRACT', 'id': aligned.lysate.id, 'doNotUse': 'Lysate' };
     1105          item = {'type': 'EXTRACT', 'id': aligned.lysate.id, 'doNotUse': 'Lysate', 'sort': 2 };
    11061106        }
    11071107        else if (doNotUse.value == 'rna')
    11081108        {
    1109           item = {'type': 'EXTRACT', 'id': aligned.rna.id, 'doNotUse': 'RNA' };
     1109          item = {'type': 'EXTRACT', 'id': aligned.rna.id, 'doNotUse': 'RNA', 'sort': 3 };
    11101110        }
    11111111        else if (doNotUse.value == 'library')
    11121112        {
    1113           item = {'type': 'EXTRACT', 'id': aligned.lib.id, 'doNotUse': 'Library' };
     1113          item = {'type': 'EXTRACT', 'id': aligned.lib.id, 'doNotUse': 'Library', 'sort': 4 };
    11141114        }
    11151115        else if (aligned.flagged && doNotUse.classList.contains('required'))
     
    11791179      url += '&highHetFilter=1';
    11801180    }
     1181   
     1182    // Sort items in the "correct" order. All DoNotUse items before OkToUse
     1183    // and Specimen -> Lysate -> RNA -> Library
     1184    // This will prevent prevent problems with non-deterministic result if
     1185    // selecting, for example, "Specimen" and "RNA" from the same parent-child chain
     1186    // With sorting the highest level (Specimen) wins
     1187    items.sort(Sort.sortDoNotUseItems);
    11811188   
    11821189    var submitInfo = {};
     
    12701277  }
    12711278 
     1279  // Sort items that are sent for "DoNotUse" or "OkToUse" by the 'sort' propert.
     1280  sort.sortDoNotUseItems = function(a, b)
     1281  {
     1282    return a.sort == b.sort ? a.id - b.id : a.sort - b.sort;
     1283  }
     1284 
    12721285  return sort;
    12731286}();
Note: See TracChangeset for help on using the changeset viewer.