Class CompositeSequenceFactory

java.lang.Object
ubic.gemma.core.util.test.fixture.CompositeSequenceFactory

@Component public class CompositeSequenceFactory extends Object
Typed factory for persistent CompositeSequence (probe) test fixtures.

Phase 3 split-out from the inline CS construction inside ArrayDesignFactory.Builder.build(). Use this factory when a test needs an isolated, persistent CompositeSequence (e.g. gene-expression-vector tests that need probes independent of an AD-wide build, or to attach an extra probe to an existing AD after the AD is persisted).

Usage:

  // Default: fresh CS on a freshly-built one-color AD, with attached BioSequence
  CompositeSequence cs = compositeSequenceFactory.builder().build();

  // CS attached to a specific AD, with no biosequence
  CompositeSequence cs = compositeSequenceFactory.builder()
                             .withArrayDesign(ad)
                             .withBioSequence(false)
                             .build();

  // Named CS
  CompositeSequence cs = compositeSequenceFactory.builder()
                             .withName("probe_001")
                             .build();

Design notes (HB6-relevant):

  • The CS mapping does NOT cascade from CompositeSequence to biologicalCharacteristic. The BS is therefore persisted through BioSequenceService#findOrCreate(BioSequence) BEFORE CompositeSequenceService.create(CompositeSequence) runs. Skipping this caused HB5→HB6 breakage; doing it explicitly is the safe pattern.
  • The ArrayDesign is created via ArrayDesignFactory (default: oneColor()) when not supplied. The CS is added to ad.getCompositeSequences() via add(...) on the managed collection - never via setCompositeSequences(new HashSet<>(...)).
  • Taxon on the BS is resolved via TaxonFactory (default: mouse).
  • The attached BioSequence carries a GenBank DatabaseEntry so tests filtering on the sequence-database link have something sensible to find. Override via CompositeSequenceFactory.Builder.withBioSequence(boolean) to skip.
Author:
Phase 3 (Vision section 3 - test-fixture rewrite)
  • Constructor Details

    • CompositeSequenceFactory

      public CompositeSequenceFactory()
  • Method Details