Example #1
0
 @Test
 public void testUserFriendlyList() {
   Assert.assertTrue(
       manager.userFriendlyListOfAvailableFeatures().length() > 0,
       "Expected at least one codec to be listed");
   Assert.assertTrue(
       manager.userFriendlyListOfAvailableFeatures().split(",").length > 0,
       "Expected at least two codecs, but only saw one");
 }
Example #2
0
  @Test
  public void testCodecCreation() {
    FeatureManager.FeatureDescriptor descriptor = manager.getByName("vcf");
    Assert.assertNotNull(descriptor, "Couldn't find VCF feature descriptor!");

    FeatureCodec c = manager.createCodec(descriptor, "foo", genomeLocParser);
    Assert.assertNotNull(c, "Couldn't create codec");
    Assert.assertEquals(c.getClass(), descriptor.getCodecClass());
    Assert.assertEquals(c.getFeatureType(), descriptor.getFeatureClass());
  }
Example #3
0
  @Test(dataProvider = "tests")
  public void testGetters(FMTest params) {
    params.assertExpected(manager.getByCodec(params.codec));
    params.assertExpected(manager.getByName(params.name));
    params.assertExpected(manager.getByName(params.name.toLowerCase()));
    params.assertExpected(manager.getByName(params.name.toUpperCase()));

    Collection<FeatureManager.FeatureDescriptor> descriptors = manager.getByFeature(params.feature);
    Assert.assertTrue(descriptors.size() > 0, "Look up by FeatureClass failed");
  }
Example #4
0
 @Test
 public void testGetByFileNoMatch() {
   FeatureManager.FeatureDescriptor byFile = manager.getByFiletype(RANDOM_FILE);
   Assert.assertNull(
       byFile,
       "Found type " + byFile + " associated with RANDOM, non-Tribble file " + RANDOM_FILE);
 }
  public void train(int startingIndex, ModelManager modelInfo, List data) {
    Assert.a(allFeatureTypes.size() > 0, "No features types have been assigned.");
    Assert.a(startIndexes == null, "FeatureManager has already been trained.");
    startIx = startingIndex;

    // Train each of the individual FeatureManagers and calculate offsets
    startIndexes = new int[allFeatureTypes.size()];
    totalFeatures = 0;
    for (int i = 0; i < startIndexes.length; ++i) {
      startIndexes[i] = totalFeatures + startIx;
      FeatureManager fm = allFeatureTypes.get(i);
      List compData =
          fm.getInputComponent() == null ? data : new ComponentList(data, fm.getInputComponent());
      fm.train(totalFeatures, modelInfo, compData);
      totalFeatures += fm.getNumFeatures();
    }
  }
Example #6
0
 @Test(dataProvider = "tests")
 public void testGetByFile(FMTest params) {
   if (params.associatedFile != null) {
     FeatureManager.FeatureDescriptor byFile = manager.getByFiletype(params.associatedFile);
     Assert.assertNotNull(
         byFile, "Couldn't find any type associated with file " + params.associatedFile);
     params.assertExpected(byFile);
   }
 }
  public void addFeatureManager(String name, String inputParams, FeatureManager fm) {
    Assert.a(startIndexes == null, "Attempted to add a new FeatureManager after training.");

    if (name != null) fm.setInputComponent(name);
    allFeatureTypes.add(fm);

    // Add each feature type into the right list for evalution
    if (fm instanceof FeatureManagerNode) {
      nodeFeatureTypes.add((FeatureManagerNode) fm);
    }
    if (fm instanceof FeatureManagerEdge) {
      edgeFeatureTypes.add((FeatureManagerEdge) fm);
    }
    if (fm instanceof FeatureManagerNodeExplicitLength) {
      explicitLengthNodeFeatureTypes.add((FeatureManagerNodeExplicitLength) fm);
    }
    if (fm instanceof FeatureManagerEdgeExplicitLength) {
      explicitLengthEdgeFeatureTypes.add((FeatureManagerEdgeExplicitLength) fm);
    }
  }
Example #8
0
 @Test
 public void testManagerCreation() {
   Assert.assertTrue(manager.getFeatureDescriptors().size() > 0);
 }