Changeset 5653


Ignore:
Timestamp:
Jun 13, 2011, 12:47:21 PM (10 years ago)
Author:
Nicklas Nordborg
Message:

References #1153: Handling short read transcript sequence data

Added link between DerivedBioAssay and Extract so that we know were the data is coming from. Item overview loading has been updated to handle this link.

Location:
trunk/src
Files:
17 edited

Legend:

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

    r5652 r5653  
    2828import net.sf.basedb.core.data.AnnotationSetData;
    2929import net.sf.basedb.core.data.DerivedBioAssayData;
     30import net.sf.basedb.core.data.MeasuredBioMaterialData;
    3031import net.sf.basedb.core.data.SharedData;
    3132import net.sf.basedb.core.query.Hql;
     
    5657      permission checking and database access.
    5758    @param bioAssaySet The bioassayset the bioassay belongs to
     59    @param bioMaterial The biomaterial that this bioassay is related to
    5860    @return The new <code>DerivedBioAssay</code> item
    5961    @throws PermissionDeniedException If the logged in user
     
    6264    @throws BaseException If there is an error
    6365  */
    64   static DerivedBioAssay getNew(DbControl dc, DerivedBioAssaySet bioAssaySet)
     66  static DerivedBioAssay getNew(DbControl dc, DerivedBioAssaySet bioAssaySet, MeasuredBioMaterial bioMaterial)
    6567    throws PermissionDeniedException, InvalidDataException, BaseException
    6668  {
     
    6870    ba.setName("New bioassay");
    6971    ba.getData().setBioAssaySet(bioAssaySet.getData());
     72    if (bioMaterial != null)
     73    {
     74      ba.getData().setBioMaterial((MeasuredBioMaterialData)bioMaterial.getData());
     75    }
    7076    return ba;
    7177  }
     
    244250  }
    245251
     252  public MeasuredBioMaterial getBioMaterial()
     253  {
     254    return getDbControl().getItem(MeasuredBioMaterial.class, getData().getBioMaterial());
     255  }
    246256 
    247257  public ItemQuery<RawBioAssay> getRawBioAssays()
  • trunk/src/core/net/sf/basedb/core/DerivedBioAssaySet.java

    r5652 r5653  
    354354  }
    355355
     356  /**
     357    Check if this bioassay set is derived from a physical bioassay or from another
     358    bioassay set.
     359    @return TRUE if this is a root bioassay set derived form a physical bioassay
     360  */
     361  public boolean isRoot()
     362  {
     363    return getData().getParent() == null;
     364  }
     365 
    356366  public ItemQuery<DerivedBioAssaySet> getChildren()
    357367  {
     
    366376  }
    367377
     378  /**
     379    Create a new bioassay that is part of the bioassay set. The
     380    biomaterial is optional. If given, it should be one of the
     381    biomaterials that was part of the physical bioassay that this
     382    bioassay set is derived from. It is only possible to create
     383    one bioassay for each biomaterial.
    368384   
    369   public DerivedBioAssay newBioAssay()
     385    @param bioMaterial The biomaterial this bioassay is related to
     386    @return A new child bioassay
     387  */
     388  public DerivedBioAssay newBioAssay(MeasuredBioMaterial bioMaterial)
    370389  {
    371390    checkPermission(Permission.WRITE);
    372     return DerivedBioAssay.getNew(getDbControl(), this);
     391    // TODO - Check if the biomaterial is a source to the parent physical bioassay
     392   
     393    return DerivedBioAssay.getNew(getDbControl(), this, bioMaterial);
    373394  }
    374395 
  • trunk/src/core/net/sf/basedb/core/data/DerivedBioAssayData.java

    r5652 r5653  
    102102  private DerivedBioAssaySetData bioAssaySet;
    103103  /**
    104     Get the physical bioassay that is the direct or indirect parent of this event.
    105     @hibernate.many-to-one column="`bioassayset_id`" not-null="true" update="false" outer-join="false"
     104    Get the parent bioassay set that this bioassay belongs to.
     105    @hibernate.many-to-one outer-join="false" update="false"
     106    @hibernate.column name="`bioassayset_id`" not-null="true" unique-key="uniquebioassay"
    106107  */
    107108  public DerivedBioAssaySetData getBioAssaySet()
     
    113114    this.bioAssaySet = bioAssaySet;
    114115  }
     116 
     117  private MeasuredBioMaterialData bioMaterial;
     118  /**
     119    Get the biomaterial that is related to the data in this bioassay.
     120    @hibernate.many-to-one outer-join="false" update="false"
     121    @hibernate.column name="`biomaterial_id`" not-null="false" unique-key="uniquebioassay"
     122  */
     123  public MeasuredBioMaterialData getBioMaterial()
     124  {
     125    return bioMaterial;
     126  }
     127  public void setBioMaterial(MeasuredBioMaterialData bioMaterial)
     128  {
     129    this.bioMaterial = bioMaterial;
     130  }
     131
    115132
    116133}
  • trunk/src/core/net/sf/basedb/util/overview/loader/DerivedBioAssayLoader.java

    r5652 r5653  
    2525import net.sf.basedb.core.DerivedBioAssay;
    2626import net.sf.basedb.core.DerivedBioAssaySet;
     27import net.sf.basedb.core.Extract;
    2728import net.sf.basedb.core.Item;
    2829import net.sf.basedb.core.ItemQuery;
     
    3031import net.sf.basedb.core.PermissionDeniedException;
    3132import net.sf.basedb.core.RawBioAssay;
     33import net.sf.basedb.core.query.Hql;
     34import net.sf.basedb.core.query.Restrictions;
    3235import net.sf.basedb.util.overview.Node;
    3336import net.sf.basedb.util.overview.OverviewContext;
    3437import net.sf.basedb.util.overview.cache.IndexedCacheKey;
     38import net.sf.basedb.util.overview.filter.ItemTypeFilter;
    3539import net.sf.basedb.util.overview.node.ChildNodeDirection;
    3640import net.sf.basedb.util.overview.node.NameableNameGenerator;
     
    4953  {
    5054    super(Item.DERIVEDBIOASSAY, DENY_ROOT_NODE,
    51         new NameableNameGenerator<DerivedBioAssay>("parent", "Parent"));
     55        new NameableNameGenerator<DerivedBioAssay>("bioassay", "Bioassay"));
    5256  }
    5357 
     
    5963    Create forward-loading bioassay nodes from a given bioassay set node.
    6064    The returned node is a folder-type node containing item nodes for
    61     each bioassay that is part of the set
     65    each bioassay that is part of the set or a single bioassay node that is
     66    related to the first found parent extract.
    6267    @return The folder node for the bioassays
    6368  */
     
    6772    NodeFactory<DerivedBioAssay> nf = getNodeFactory(dc, context);
    6873    Node folderNode = null;
     74    Node bioAssayNode = null;
    6975    DerivedBioAssaySet dbas = (DerivedBioAssaySet)bioAssaySetNode.getItem(dc);
    7076    ItemQuery<DerivedBioAssay> bioAssayQuery = context.initQuery(dbas.getBioAssays(), "name");
    7177 
    72     int arrayIndex = 0;
    73     /*
    74     // If we have a labeled extract as parent we need to know the array number
    75     // to be able to load the correct raw bioassays later -- The same hyb may have
    76     // other raw bioassays that are NOT related to the same labeled extract
    77     Node labeledExtractNode = hybridizationNode.getFirstParent(new ItemTypeFilter(Item.EXTRACT));
    78     int arrayIndex = 0;
    79     if (labeledExtractNode != null)
     78    // If we have an extract as parent we only load the bioassay that is related
     79    // to that extract
     80    Node extractNode = bioAssaySetNode.getFirstParent(new ItemTypeFilter(Item.EXTRACT));
     81    boolean useFolderNode = true;
     82    if (extractNode != null)
    8083    {
    81       Extract extract = (Extract)labeledExtractNode.getItem();
    82       arrayIndex = hyb.getCreationEvent().getSourceGroup(extract);
     84      Extract extract = (Extract)extractNode.getItem();
     85      bioAssayQuery.restrict(Restrictions.eq(Hql.property("bioMaterial"), Hql.entity(extract)));
     86      useFolderNode = false;
    8387    }
    84     */
    8588 
    8689    ItemResultIterator<DerivedBioAssay> it = bioAssayQuery.iterate(dc);
     
    8891    {
    8992      DerivedBioAssay bioAssay = it.next();
    90       if (folderNode == null)
     93      if (folderNode == null && useFolderNode)
    9194      {
    9295        folderNode = new Node("bioassays", "Bioassays", bioAssaySetNode, ChildNodeDirection.FORWARD);
    9396      }
    94       Object cacheKey = arrayIndex == 0 ? bioAssay : new IndexedCacheKey(bioAssay, arrayIndex);
    95       createItemNode(nf, bioAssay, cacheKey, false, folderNode, ChildNodeDirection.FORWARD);
     97      bioAssayNode = createItemNode(nf, bioAssay, bioAssay, false, useFolderNode ? folderNode : bioAssaySetNode, ChildNodeDirection.FORWARD);
    9698    }
    9799    postValidateFolder(nf, folderNode, bioAssaySetNode, false);
    98     return folderNode;
     100    return useFolderNode ? folderNode : bioAssayNode;
    99101  }
    100102 
     
    153155  {
    154156    getNodeLoader(context, Item.RAWBIOASSAY).createForwardNode(dc, context, bioAssayNode);
     157    getNodeLoader(context, Item.EXTRACT).createReverseNode(dc, context, bioAssayNode);
    155158  }
    156159 
     
    163166  {
    164167    getNodeLoader(context, Item.DERIVEDBIOASSAYSET).createReverseNode(dc, context, bioAssayNode);
     168    getNodeLoader(context, Item.EXTRACT).createReverseNode(dc, context, bioAssayNode);
    165169  }
    166170  // ---------------------------------------
  • trunk/src/core/net/sf/basedb/util/overview/loader/DerivedBioAssaySetLoader.java

    r5652 r5653  
    2222package net.sf.basedb.util.overview.loader;
    2323
     24import net.sf.basedb.core.BioSource;
    2425import net.sf.basedb.core.DbControl;
    2526import net.sf.basedb.core.DerivedBioAssay;
     
    3233import net.sf.basedb.core.PhysicalBioAssay;
    3334import net.sf.basedb.core.RawBioAssay;
     35import net.sf.basedb.core.Sample;
     36import net.sf.basedb.core.query.Hql;
     37import net.sf.basedb.core.query.Restrictions;
    3438import net.sf.basedb.util.overview.Node;
    3539import net.sf.basedb.util.overview.OverviewContext;
    3640import net.sf.basedb.util.overview.cache.IndexedCacheKey;
     41import net.sf.basedb.util.overview.filter.ItemTypeFilter;
    3742import net.sf.basedb.util.overview.node.ChildNodeDirection;
    3843import net.sf.basedb.util.overview.node.NameableNameGenerator;
     
    112117    return folderNode;
    113118    */
    114     return null;
    115   }
    116  
    117   /**
    118     Create a reverse-loading bioassay node from the raw bioassay node.
    119     @return A bioassay node, or null if the raw bioassay doesn't have a parent bioassay
    120   */
    121   @Override
    122   public Node createReverseNode(DbControl dc, OverviewContext context, Node rawBioAssayNode)
    123   {
     119    return returnNode;
     120  }
     121 
     122  /**
     123    Create a reverse-loading bioassay node from a bioassay node or a child
     124    bioassay set.
     125    @return A bioassayset node, or null if the raw bioassay doesn't have a parent bioassay
     126  */
     127  @Override
     128  public Node createReverseNode(DbControl dc, OverviewContext context, Node parentNode)
     129  {
     130    Node returnNode = null;
     131    Item parentType = parentNode.getItemType();
     132    if (parentType == Item.DERIVEDBIOASSAY)
     133    {
     134      returnNode = createReverseNode((DerivedBioAssay)parentNode.getItem(dc), dc, context, parentNode);
     135    }
     136    else if (parentType == Item.DERIVEDBIOASSAYSET)
     137    {
     138      returnNode = createReverseNode((DerivedBioAssaySet)parentNode.getItem(dc), dc, context, parentNode);
     139    }
     140   
    124141    /*
    125142    NodeFactory<DerivedBioAssay> nf = getNodeFactory(dc, context);
     
    142159    return scanNode;
    143160    */
    144     return null;
     161    return returnNode;
    145162  }
    146163  // --------------------------------
     
    188205  */
    189206  @Override
    190   protected void loadReverseChildNodes(DbControl dc, OverviewContext context, Node bioAssayNode)
    191   {
    192     getNodeLoader(context, Item.PHYSICALBIOASSAY).createReverseNode(dc, context, bioAssayNode);
    193     getNodeLoader(context, Item.DERIVEDBIOASSAYSET).createReverseNode(dc, context, bioAssayNode);
     207  protected void loadReverseChildNodes(DbControl dc, OverviewContext context, Node bioAssaySetNode)
     208  {
     209    DerivedBioAssaySet dbas = (DerivedBioAssaySet)bioAssaySetNode.getItem(dc);
     210    if (dbas.isRoot())
     211    {
     212      getNodeLoader(context, Item.PHYSICALBIOASSAY).createReverseNode(dc, context, bioAssaySetNode);
     213    }
     214    else
     215    {
     216      getNodeLoader(context, Item.DERIVEDBIOASSAYSET).createReverseNode(dc, context, bioAssaySetNode);
     217    }
    194218  }
    195219  // ---------------------------------------
     
    203227  {
    204228    NodeFactory<DerivedBioAssaySet> nf = getNodeFactory(dc, context);
     229    int cacheIndex = getCacheIndex(parentNode);
     230 
    205231    Node folderNode = null;
    206232    ItemQuery<DerivedBioAssaySet> query = context.initQuery(bioAssay.getRootDerivedBioAssaySets(), "name");
     
    213239        folderNode = new Node("bioassaysets", "Bioassay sets", parentNode, ChildNodeDirection.FORWARD);
    214240      }
    215       createItemNode(nf, bioAssaySet, bioAssaySet, false, folderNode, ChildNodeDirection.FORWARD);
     241      Object cacheKey = cacheIndex == 0 ? bioAssaySet : new IndexedCacheKey(bioAssaySet, cacheIndex);
     242      createItemNode(nf, bioAssaySet, cacheKey, false, folderNode, ChildNodeDirection.FORWARD);
    216243    }
    217244    postValidateFolder(nf, folderNode, parentNode, false);
     
    227254    NodeFactory<DerivedBioAssaySet> nf = getNodeFactory(dc, context);
    228255    Node folderNode = null;
     256    int cacheIndex = getCacheIndex(parentNode);
    229257    ItemQuery<DerivedBioAssaySet> query = context.initQuery(parent.getChildren(), "name");
    230258    ItemResultIterator<DerivedBioAssaySet> it = query.iterate(dc);
     
    236264        folderNode = new Node("bioassaysets", "Child bioassay sets", parentNode, ChildNodeDirection.FORWARD);
    237265      }
    238       createItemNode(nf, bioAssaySet, bioAssaySet, false, folderNode, ChildNodeDirection.FORWARD);
     266      Object cacheKey = cacheIndex == 0 ? bioAssaySet : new IndexedCacheKey(bioAssaySet, cacheIndex);
     267      createItemNode(nf, bioAssaySet, cacheKey, false, folderNode, ChildNodeDirection.FORWARD);
    239268    }
    240269    postValidateFolder(nf, folderNode, parentNode, false);
     
    242271  }
    243272
    244  
     273  private Node createReverseNode(DerivedBioAssay child, DbControl dc, OverviewContext context, Node parentNode)
     274  {
     275    NodeFactory<DerivedBioAssaySet> nf = getNodeFactory(dc, context);
     276    DerivedBioAssaySet bioAssaySet = null;
     277    boolean denied = false;
     278    try
     279    {
     280      bioAssaySet = child.getBioAssaySet();
     281    }
     282    catch (PermissionDeniedException ex)
     283    {
     284      denied = true;
     285    }
     286    Node bioAssaySetNode = createItemNode(nf, bioAssaySet, bioAssaySet, denied,
     287        parentNode, ChildNodeDirection.REVERSE);
     288    return bioAssaySetNode;
     289  }
     290
     291  private Node createReverseNode(DerivedBioAssaySet child, DbControl dc, OverviewContext context, Node parentNode)
     292  {
     293    NodeFactory<DerivedBioAssaySet> nf = getNodeFactory(dc, context);
     294    DerivedBioAssaySet bioAssaySet = null;
     295    boolean denied = false;
     296    try
     297    {
     298      bioAssaySet = child.getParent();
     299    }
     300    catch (PermissionDeniedException ex)
     301    {
     302      denied = true;
     303    }
     304    Node bioAssaySetNode = createItemNode(nf, bioAssaySet, bioAssaySet, denied,
     305        parentNode, ChildNodeDirection.REVERSE);
     306    return bioAssaySetNode;
     307  }
     308
     309  /**
     310    If we have an extract in the parent chaing we need to keep track of that
     311    so that we can later load the correct raw bioassays and/or child bioassays
     312  */
     313  private int getCacheIndex(Node parentNode)
     314  {
     315    Node extractNode = parentNode.getFirstParent(new ItemTypeFilter(Item.EXTRACT));
     316    return extractNode == null ? 0 : extractNode.getItem().getId();
     317  }
    245318}
  • trunk/src/core/net/sf/basedb/util/overview/loader/ExtractLoader.java

    r5651 r5653  
    2323
    2424import net.sf.basedb.core.DbControl;
     25import net.sf.basedb.core.DerivedBioAssay;
    2526import net.sf.basedb.core.Extract;
     27import net.sf.basedb.core.PermissionDeniedException;
    2628import net.sf.basedb.core.PhysicalBioAssay;
    2729import net.sf.basedb.core.Item;
     
    106108      returnNode = createReverseNode((Extract)parentNode.getItem(dc), dc, context, parentNode);
    107109    }
     110    else if (parentItem == Item.DERIVEDBIOASSAY)
     111    {
     112      returnNode = createReverseNode((DerivedBioAssay)parentNode.getItem(dc), dc, context, parentNode);
     113    }
    108114    return returnNode;
    109115  }
     
    237243  }
    238244
     245  private Node createReverseNode(DerivedBioAssay bioAssay, DbControl dc, OverviewContext context, Node parentNode)
     246  {
     247    NodeFactory<Extract> nf = getNodeFactory(dc, context);
     248    Extract extract = null;
     249    boolean denied = false;
     250    try
     251    {
     252      extract = (Extract)bioAssay.getBioMaterial();
     253    }
     254    catch (PermissionDeniedException ex)
     255    {
     256      denied = true;
     257    }
     258    Node extractNode = createItemNode(nf, extract, extract, denied,
     259        parentNode, ChildNodeDirection.REVERSE);
     260    return extractNode;
     261  }
     262 
    239263  /**
    240264    Create forward-loading extract nodes for the extracts that has a given
  • trunk/src/core/net/sf/basedb/util/overview/validator/HardwareValidator.java

    r5652 r5653  
    7272  public boolean preMissingItem(DbControl dc, OverviewContext context, Node parentNode)
    7373  {
    74     BasicItem parentItem = parentNode.getItem();
     74    BasicItem parentItem = parentNode.getItem(dc);
    7575    ItemSubtype expectedSubtype = getExpectedHardwareSubtype(dc, parentItem);
    7676    if (expectedSubtype != null)
     
    9191  {
    9292    super.postValidate(dc, context, node, parentNode);
    93     Hardware hardware = (Hardware)node.getItem();
     93    Hardware hardware = (Hardware)node.getItem(dc);
    9494   
    95     BasicItem parentItem = parentNode.getItem();
     95    BasicItem parentItem = parentNode.getItem(dc);
    9696    ItemSubtype expectedSubtype = getExpectedHardwareSubtype(dc, parentItem);
    9797    try
  • trunk/src/core/net/sf/basedb/util/overview/validator/ProtocolValidator.java

    r5652 r5653  
    7272  public boolean preMissingItem(DbControl dc, OverviewContext context, Node parentNode)
    7373  {
    74     BasicItem parentItem = parentNode.getItem();
     74    BasicItem parentItem = parentNode.getItem(dc);
    7575    ItemSubtype expectedSubtype = getExpectedProtocolSubtype(dc, parentItem);
    7676    if (expectedSubtype != null)
     
    9191  {
    9292    super.postValidate(dc, context, node, parentNode);
    93     Protocol protocol = (Protocol)node.getItem();
     93    Protocol protocol = (Protocol)node.getItem(dc);
    9494   
    9595    // Validate the subtype of the protocol
    96     BasicItem parentItem = parentNode.getItem();
     96    BasicItem parentItem = parentNode.getItem(dc);
    9797    ItemSubtype expectedSubtype = getExpectedProtocolSubtype(dc, parentItem);
    9898    try
  • trunk/src/core/net/sf/basedb/util/overview/validator/SoftwareValidator.java

    r5652 r5653  
    7272  {
    7373    super.postValidate(dc, context, node, parentNode);
    74     Software software = (Software)node.getItem();
     74    Software software = (Software)node.getItem(dc);
    7575   
    7676    // Validate the subtype of the software
    77     BasicItem parentItem = parentNode.getItem();
     77    BasicItem parentItem = parentNode.getItem(dc);
    7878    ItemSubtype expectedSubtype = getExpectedSoftwareSubtype(dc, parentItem);
    7979    try
  • trunk/src/test/TestDerivedBioAssaySet.java

    r5652 r5653  
    4343    write_header();
    4444   
    45     int hybridizationId = TestPhysicalBioAssay.test_create(0, 0, false);
     45    int extractId1 = TestExtract.test_create(0, "Extract #1", 0, 0, false);
     46    int extractId2 = TestExtract.test_create(0, "Extract #2", 0, 0, false);
     47   
     48    int hybridizationId = TestPhysicalBioAssay.test_create(0, "Test hyb", 0, 2, extractId1, extractId2);
    4649    int scannerId = TestHardware.test_create(SystemItems.getId(Hardware.SCANNER), null, false);
    4750    int protocolId = TestProtocol.test_create(SystemItems.getId(Protocol.SCANNING), null, false);
     
    5457    int child1 = test_create_child("Child #1", id, 0, 0, 0, 0);
    5558    int child2 = test_create_child("Child #2", id, 0, 0, 0, 0);
    56     int bioAssay1 = test_add_bioassay(id, "Bioassay #1");
    57     int bioAssay2 = test_add_bioassay(id, "Bioassay #2");
     59    int bioAssay1 = test_add_bioassay(id, extractId1, "Bioassay #1");
     60    int bioAssay2 = test_add_bioassay(id, extractId2, "Bioassay #2");
    5861
    5962    // Listing
     
    319322    {
    320323      System.out.println(i+":\t"+ba.getId()+"\t"+ba.getName()+"\t"+
    321         ba.getDescription()+"\t"+ba.getBioAssaySet());
     324        ba.getDescription()+"\t"+ba.getBioAssaySet()+"\t"+ba.getBioMaterial());
    322325    }
    323326  }
     
    329332  }
    330333 
    331   static int test_add_bioassay(int bioAssaySetid, String name)
     334  static int test_add_bioassay(int bioAssaySetid, int bioMaterialId, String name)
    332335  {
    333336    if (bioAssaySetid == 0) return 0;
     
    338341      dc = TestUtil.getDbControl();
    339342      DerivedBioAssaySet dbas = DerivedBioAssaySet.getById(dc, bioAssaySetid);
    340       DerivedBioAssay ba = dbas.newBioAssay();
     343      MeasuredBioMaterial bioMaterial = null;
     344      if (bioMaterialId != 0) bioMaterial = (MeasuredBioMaterial)BioMaterial.getById(dc, bioMaterialId);
     345      DerivedBioAssay ba = dbas.newBioAssay(bioMaterial);
    341346      ba.setName(name);
    342347      ba.setDescription("Added at "+new Date());
  • trunk/src/test/TestExtract.java

    r5642 r5653  
    8484      dc = TestUtil.getDbControl();
    8585      Extract e = Extract.getNew(dc);
     86      e.setName(name);
    8687      if (setAll)
    8788      {
    88         e.setName("Test extract");
    8989        e.setDescription("Added at "+new Date());
    9090        e.setExternalId("XCV-455-EXTRACT");
     
    9898          Sample s = (Sample)parent;
    9999          e.setSample(s, 200.0f);
    100           e.setName(s.getName() + ".e");
    101100        }
    102101        else
  • trunk/src/test/TestGenericOverview.java

    r5652 r5653  
    9696    // Biomaterial
    9797    int biosource = TestBioSource.test_create("Test GO", false);
    98     int sample1 = TestSample.test_create(biosource, "Test GO #1", false);
    99     int sample2 = TestSample.test_create(biosource, "Test GO #2", false);
    100     int extract1 = TestExtract.test_create(sample1, "Test GO #1", 0, 0, false);
    101     int extract2 = TestExtract.test_create(sample2, "Test GO #2", 0, 0, false);
     98    int sample1 = TestSample.test_create(biosource, "Sample GO #1", false);
     99    int sample2 = TestSample.test_create(biosource, "Sample GO #2", false);
     100    int extract1 = TestExtract.test_create(sample1, "Extract GO #1", 0, 0, false);
     101    int extract2 = TestExtract.test_create(sample2, "Extract GO #2", 0, 0, false);
    102102    int extractPooled = TestExtract.test_create_pooled(extract1, extract2);
    103103   
     
    121121   
    122122    // Hybridization
    123     int hyb = TestPhysicalBioAssay.test_create(arraySlide, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), false);
     123    int hyb = TestPhysicalBioAssay.test_create(arraySlide, "Hyb GO #1", SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), 2);
    124124    TestPhysicalBioAssay.test_add_extract(hyb, labeledExtract1, 1, null);
    125125    TestPhysicalBioAssay.test_add_extract(hyb, labeledExtract1Ref, 1, null);
     
    131131        SystemItems.getId(DerivedBioAssaySet.SCAN), scanningProtocol, scanner, 0);
    132132    TestAnnotation.test_annotatate(Item.DERIVEDBIOASSAYSET, scan, scanPower, 0, 15.0f);
    133     int scannedAssayId1 = TestDerivedBioAssaySet.test_add_bioassay(scan, "Scanned GO #1");
    134     int scannedAssayId2 = TestDerivedBioAssaySet.test_add_bioassay(scan, "Scanned GO #2");
     133    int scannedAssayId1 = TestDerivedBioAssaySet.test_add_bioassay(scan, labeledExtract1, "Scanned GO #1");
     134    int scannedAssayId2 = TestDerivedBioAssaySet.test_add_bioassay(scan, labeledExtract2, "Scanned GO #2");
    135135   
    136136    // Raw bioassay #1
     
    151151   
    152152    // Flow cell
    153     int flowCell = TestPhysicalBioAssay.test_create(0, SystemItems.getId(PhysicalBioAssay.FLOW_CELL), false);
     153    int flowCell = TestPhysicalBioAssay.test_create(0, "Flow cell GO #1", SystemItems.getId(PhysicalBioAssay.FLOW_CELL), 2);
    154154    TestPhysicalBioAssay.test_add_extract(flowCell, library1, 1, null);
    155155    TestPhysicalBioAssay.test_add_extract(flowCell, library2, 2, null);
     
    160160    int assembly = TestDerivedBioAssaySet.test_create_child("Assembly GO", sequencing,
    161161      SystemItems.getId(DerivedBioAssaySet.ASSEMBLY), 0, 0, alignmentSoftware);
    162     int alignedAssayId1 = TestDerivedBioAssaySet.test_add_bioassay(assembly, "Aligned GO #1");
    163     int alignedAssayId2 = TestDerivedBioAssaySet.test_add_bioassay(assembly, "Aligned GO #2");
     162    int alignedAssayId1 = TestDerivedBioAssaySet.test_add_bioassay(assembly, library1, "Aligned GO #1");
     163    int alignedAssayId2 = TestDerivedBioAssaySet.test_add_bioassay(assembly, library2, "Aligned GO #2");
    164164    TestDataFileType.test_set_file(Item.DERIVEDBIOASSAY, alignedAssayId1, DataFileType.SAM, samFile);
    165165    TestDataFileType.test_set_file(Item.DERIVEDBIOASSAY, alignedAssayId2, DataFileType.SAM, samFile);
     
    171171    // **** Experiment ******
    172172    int experiment = TestExperiment.test_create("genepix", false);
    173     TestExperiment.test_add_rawbioassay(experiment, rawBioAssay1, rawBioAssay2);
     173    TestExperiment.test_add_rawbioassay(experiment, rawBioAssay1, rawBioAssay2, seqRaw1, seqRaw2);
    174174    TestExperiment.test_add_experimental_factors(experiment, scanPower, annotationType);
    175175
  • trunk/src/test/TestIlluminaImporter.java

    r5652 r5653  
    4343    TestReporter.test_import_from_file("data/test.illumina.reporters.txt", "Search_key,Target,ProbeId.*", ",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))", 1, 1);
    4444    int fileId = TestFile.test_create("data/test.illumina.rawdata.txt", false, false);
    45     int hybId = TestPhysicalBioAssay.test_create(0, 0, false);
     45    int hybId = TestPhysicalBioAssay.test_create(0, "Test hyb", 0, 1);
    4646    //int scanId = TestScan.test_create(hybId, 0, 0, false);
    4747    int scanId = 0;
  • trunk/src/test/TestMetadata.java

    r5652 r5653  
    9191    int labelId = TestTag.test_create("Test label", SystemItems.getId(Tag.LABEL), true);
    9292    int labeledExtractId = TestExtract.test_create(0, "Test extract", SystemItems.getId(Extract.LABELED), labelId, true);
    93     int hybId = TestPhysicalBioAssay.test_create(slideId, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), true, labeledExtractId);
     93    int hybId = TestPhysicalBioAssay.test_create(slideId, "Test hyb", SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), 1, labeledExtractId);
    9494//    int scanId = TestScan.test_create(hybId, 0, 0, true);
    9595int scanId = 0;
  • trunk/src/test/TestPhysicalBioAssay.java

    r5652 r5653  
    4343    write_header();
    4444    // Standard tests: create, load, list
    45     int id = test_create(0, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), true);
    46     int id2 = test_create(0, SystemItems.getId(PhysicalBioAssay.FLOW_CELL), false);
     45    int id = test_create(0, "Hyb #1",SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), 1);
     46    int id2 = test_create(0,"Flow cell #2",  SystemItems.getId(PhysicalBioAssay.FLOW_CELL), 1);
    4747   
    4848    test_load(id);
     
    5151    int arrayBatchId = TestArrayBatch.test_create(arrayDesignId, false);
    5252    int arraySlideId = TestArraySlide.test_create(arrayBatchId, false);
    53     int id3 = test_create(arraySlideId, 0, false);
     53    int id3 = test_create(arraySlideId, "Test #3", 0, 1);
    5454   
    5555    int cy3 = TestTag.test_load("cy3");
     
    5858    int labeledExtractId1 = TestExtract.test_create(0, "Labeled #1", labeledExtract, cy3, false);
    5959    int labeledExtractId2 = TestExtract.test_create(0, "Labeled #2", labeledExtract, cy5, false);
    60     int id4 = test_create(0, SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), false, labeledExtractId1, labeledExtractId2);
     60    int id4 = test_create(0, "Hyb #4", SystemItems.getId(PhysicalBioAssay.HYBRIDIZATION), 1, labeledExtractId1, labeledExtractId2);
    6161   
    6262    test_list(-1);
     
    8282  }
    8383
    84   static int test_create(int arraySlideId, int subtypeId, boolean setAll, int... extractIds)
     84  static int test_create(int arraySlideId, String name, int subtypeId, int size, int... extractIds)
    8585  {
    8686    if (!TestUtil.hasPermission(Permission.CREATE, Item.PHYSICALBIOASSAY)) return 0;
     
    9191      dc = TestUtil.getDbControl();
    9292      PhysicalBioAssay h = PhysicalBioAssay.getNew(dc);
    93       if (setAll)
    94       {
    95         h.setName("Test physical bioassay");
    96         h.setDescription("Added at "+new Date());
    97       }
     93      h.setName(name);
     94      h.setSize(size);
     95      h.setDescription("Added at "+new Date());
    9896      if (subtypeId != 0)
    9997      {
  • trunk/src/test/TestProject.java

    r5650 r5653  
    8787    test_activate_project(id, pp);
    8888    int sampleId = TestSample.test_create(0, "Sample (shared)", false);
    89     int hybId = TestPhysicalBioAssay.test_create(0, 0, false);
     89    int hybId = TestPhysicalBioAssay.test_create(0, "Test hyb", 0, 1);
    9090    test_list_items(id, pp, 2);
    9191    test_noactive_project();
  • trunk/src/test/TestRawBioAssay.java

    r5652 r5653  
    5454    write_header();
    5555   
    56     int hybridizationId = TestPhysicalBioAssay.test_create(0, 0, false);
     56    int hybridizationId = TestPhysicalBioAssay.test_create(0, "Test hyb", 0, 1);
    5757    int bioAssaySetId = TestDerivedBioAssaySet.test_create_root("Scan", hybridizationId,
    5858      SystemItems.getId(DerivedBioAssaySet.SCAN), 0, 0, 0);
    59     int bioAssayId = TestDerivedBioAssaySet.test_add_bioassay(bioAssaySetId, "Bioassay 1");
     59    int bioAssayId = TestDerivedBioAssaySet.test_add_bioassay(bioAssaySetId, 0, "Bioassay 1");
    6060    int arrayDesignId = TestArrayDesign.test_create(Platform.GENERIC, false);
    6161    int arrayDesignId2 = TestArrayDesign.test_create(Platform.GENERIC, false);
Note: See TracChangeset for help on using the changeset viewer.