Changeset 6994


Ignore:
Timestamp:
Nov 3, 2015, 9:47:41 AM (7 years ago)
Author:
Nicklas Nordborg
Message:

References #1958: Add Kit item

Kits can now be selected for physical bioassays.

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/net/sf/basedb/core/Install.java

    r6993 r6994  
    480480      ItemSubtypeData libraryPrepKit = createItemSubtype(Item.KIT, Kit.LIBRARY_PREPARATION,
    481481          "Library preparation", "Kits used for creating libraries.");
     482      ItemSubtypeData hybKit = createItemSubtype(Item.KIT, Kit.HYBRIDIZATION,
     483          "Hybridization", "Kits used for creating hybridizations.");
     484      ItemSubtypeData clusterKit = createItemSubtype(Item.KIT, Kit.CLUSTER_GENERATION,
     485          "Cluster generation", "Kits used for cluster generation in a flow cell");
    482486
    483487      // Hardware subtypes
     
    518522      ItemSubtypeData hybridization = createItemSubtype(Item.PHYSICALBIOASSAY, PhysicalBioAssay.HYBRIDIZATION,
    519523        "Hybridization", "A bioassay representing a microarray slide with labeled extracts.",
    520         hybProtocol, hybStation, labeledExtract);
     524        hybProtocol, hybStation, hybKit, labeledExtract);
    521525      ItemSubtypeData clonalAmplification = createItemSubtype(Item.PHYSICALBIOASSAY, PhysicalBioAssay.CLONAL_AMPLIFICATION,
    522         "Clonal amplification", "A bioassay representing extracts that has been amplified in preparation for sequencing.", clusterProtocol, clusterGenerator, library);
     526        "Clonal amplification", "A bioassay representing extracts that has been amplified in preparation for sequencing.",
     527        clusterProtocol, clusterGenerator, clusterKit, library);
    523528     
    524529      // Derived bioassay set subtypes
  • trunk/src/core/net/sf/basedb/core/Kit.java

    r6993 r6994  
    7272  public static final String LIBRARY_PREPARATION = "net.sf.basedb.core.KitType.LIBRARY_PREPARATION";
    7373 
     74  /**
     75    The ID for the hybridization kit type, for example a kit
     76    used when creating a {@link PhysicalBioAssay} from a set of
     77    (labeled) {@link Extract}:s.
     78  */
     79  public static final String HYBRIDIZATION = "net.sf.basedb.core.KitType.HYBRIDIZATION";
     80 
     81  /**
     82    The ID for the cluster generation (in a flow cell) kit type, for example
     83    a protocol used when creating a {@link PhysicalBioAssay}.
     84  */
     85  public static final String CLUSTER_GENERATION = "net.sf.basedb.core.KitType.CLUSTER_GENERATION";
     86
     87  /**
     88    Get the system id for the kit subtype that should be used on an item
     89    that doesn't have a subtype. This includes {@link Subtypable} items with a
     90    null {@link ItemSubtype} and all other non-subtypable items which can be
     91    linked to a kit.
     92    @param itemType The item type
     93    @return The system id of the default kit type or null
     94  */
     95  public static String getDefaultSystemId(Item itemType)
     96  {
     97    String defaultId = null;
     98    if (itemType == Item.SAMPLE)
     99    {
     100      defaultId = SAMPLING;
     101    }
     102    else if (itemType == Item.EXTRACT)
     103    {
     104      defaultId = EXTRACTION;
     105    }
     106    return defaultId;
     107  }
     108
    74109  /**
    75110    Create a new <code>Kit</code> item.
  • trunk/src/core/net/sf/basedb/core/PhysicalBioAssay.java

    r6881 r6994  
    197197  @Override
    198198  @SupportsPushAnnotations
    199   @SubtypableRelatedItems({Item.HARDWARE, Item.PROTOCOL, Item.EXTRACT})
     199  @SubtypableRelatedItems({Item.HARDWARE, Item.PROTOCOL, Item.KIT, Item.EXTRACT})
    200200  public ItemSubtype getItemSubtype()
    201201  {
  • trunk/www/views/physicalbioassays/bioassays.js

    r6947 r6994  
    5656      Buttons.addClickHandler('hardware_id.select', bioassays.selectHardware);
    5757      Events.addEventHandler('hardware_id', 'base-selected', bioassays.setHardwareCallback);
     58
     59      // Kit
     60      Buttons.addClickHandler('kit_id.select', bioassays.selectKit);
     61      Events.addEventHandler('kit_id', 'base-selected', bioassays.setKitCallback);
    5862     
    5963      // Array slide
     
    238242  }
    239243 
     244  bioassays.selectKit = function()
     245  {
     246    var frm = document.forms['bioassay'];
     247    var url = '&resetTemporary=1';
     248    url += '&tmpfilter:BOOLEAN:inactive=0';
     249    url += ItemSubtype.createRelatedFilter('subtype_id', 'KIT');
     250    if (frm.kit_id.length > 1)
     251    {
     252      var id = Math.abs(parseInt(frm.kit_id[1].value));       
     253      url += '&item_id='+id;
     254    }
     255    Dialogs.selectItem('KIT', 'kit_id', 0, url);
     256  }
     257 
     258  bioassays.setKitCallback = function(event)
     259  {
     260    var frm = document.forms['bioassay'];
     261    var list = frm.kit_id;
     262    if (list.length < 2 || list[1].value == '0')
     263    {
     264      Forms.addListOption(list, 1, new Option());
     265    }
     266    list[1].value = event.detail.id;
     267    list[1].text = event.detail.name;
     268    list.selectedIndex = 1;
     269  }
     270
    240271  bioassays.subtypeOnChange = function()
    241272  {
  • trunk/www/views/physicalbioassays/edit_bioassay.jsp

    r6947 r6994  
    3838  import="net.sf.basedb.core.ItemSubtype"
    3939  import="net.sf.basedb.core.ArraySlide"
     40  import="net.sf.basedb.core.Kit"
    4041  import="net.sf.basedb.core.Protocol"
    4142  import="net.sf.basedb.core.Project"
     
    101102  boolean readCurrentHardware = true;
    102103  Hardware currentHardware = null;
     104 
     105  boolean readCurrentKit = true;
     106  Kit currentKit = null;
    103107
    104108  if (itemId == 0)
     
    113117    {
    114118      currentHardware = Base.getFirstMatching(dc, Hardware.getQuery(), "name", cc.getPropertyFilter("creationEvent.hardware.name"));
     119    }
     120    if (cc.getPropertyFilter("creationEvent.kit.name") != null)
     121    {
     122      currentKit = Base.getFirstMatching(dc, Kit.getQuery(), "name", cc.getPropertyFilter("creationEvent.kit.name"));
    115123    }
    116124    if (cc.getPropertyFilter("arraySlide.name") != null)
     
    213221      readCurrentHardware = false;
    214222    }
     223    try
     224    {
     225      currentKit = creationEvent.getKit();
     226    }
     227    catch (PermissionDeniedException ex)
     228    {
     229      readCurrentKit = false;
     230    }
    215231   
    216232    // Query to retrieve source extracts
     
    237253  List<Protocol> recentProtocols = (List<Protocol>)cc.getRecent(dc, Item.PROTOCOL, currentSubtype);
    238254  List<Hardware> recentHardware = (List<Hardware>)cc.getRecent(dc, Item.HARDWARE, currentSubtype);
     255  List<Kit> recentKits = (List<Kit>)cc.getRecent(dc, Item.KIT, currentSubtype);
    239256 
    240257  // Query to retrieve item types
     
    391408            recent="<%=recentHardware%>"
    392409            defaultitems="<%=defaultHardware%>"
     410            newitem="<%=pba == null%>"
     411          />
     412        </td>
     413        <td></td>
     414      </tr>
     415      <tr>
     416        <th>Kit</th>
     417        <td>
     418          <base:select
     419            id="kit_id"
     420            clazz="selectionlist"
     421            required="false"
     422            current="<%=currentKit%>"
     423            denied="<%=!readCurrentKit%>"
     424            recent="<%=recentKits%>"
    393425            newitem="<%=pba == null%>"
    394426          />
  • trunk/www/views/physicalbioassays/index.jsp

    r6813 r6994  
    3434  import="net.sf.basedb.core.BioMaterialEventSource"
    3535  import="net.sf.basedb.core.Extract"
     36  import="net.sf.basedb.core.Kit"
    3637  import="net.sf.basedb.core.Protocol"
    3738  import="net.sf.basedb.core.Hardware"
     
    233234      }
    234235     
     236      int kitId = Values.getInt(request.getParameter("kit_id"), -1);
     237      if (kitId >= 0) // < 0 = denied or unchanged
     238      {
     239        Kit kit = kitId == 0 ? null : Kit.getById(dc, kitId);
     240        creationEvent.setKit(kit);
     241        if (kit != null) cc.setRecent(kit, subtype, maxRecent);
     242      }
     243     
    235244      // Extracts
    236245      String[] modifiedExtracts = Values.getString(request.getParameter("+EXTRACT")).split(",");
  • trunk/www/views/physicalbioassays/list_bioassays.jsp

    r6834 r6994  
    262262        title="Hardware"
    263263        sortable="true"
     264        filterable="true"
     265        exportable="true"
     266      />
     267      <tbl:columndef
     268        id="kit"
     269        property="creationEvent.kit.name"
     270        datatype="string"
     271        title="Kit"
     272        sortable="true"
    264273        filterable="true"
    265274        exportable="true"
     
    721730                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
    722731                  /></tbl:cell>
     732                <tbl:cell column="kit"
     733                  ><base:propertyvalue
     734                    item="<%=creationEvent%>"
     735                    property="kit"
     736                    enableEditLink="<%=mode.hasEditLink()%>"
     737                    enablePropertyLink="<%=mode.hasPropertyLink()%>"
     738                  /></tbl:cell>
    723739                <tbl:cell column="eventDate" value="<%=creationEvent.getEventDate()%>" />
    724740                <tbl:cell column="entryDate" value="<%=creationEvent.getEntryDate()%>" />
  • trunk/www/views/physicalbioassays/view_bioassay.jsp

    r6605 r6994  
    274274        <th>Hardware</th>
    275275        <td><base:propertyvalue item="<%=creationEvent%>" property="hardware" /></td>
     276      </tr>
     277      <tr>
     278        <th>Kit</th>
     279        <td><base:propertyvalue item="<%=creationEvent%>" property="kit" /></td>
    276280      </tr>
    277281      <tr>
Note: See TracChangeset for help on using the changeset viewer.