Пример #1
0
  @Test
  public void testLoadSIF() throws Exception {
    String filepath = TestUtils.DATA_DIR + "sample/BRCA_sif.txt";
    List<String> expectedAttributeNames =
        Arrays.asList(
            "TCGA_EXPERIMENT",
            "TCGA_BATCH",
            "TUMOR_NORMAL",
            "BIRDSEED_GENDER",
            "LEVEL2_NOISE",
            "LEVEL3_SEGMENT_COUNT",
            "PURITY	PLOIDY",
            "DELTA",
            "CANCER_DNA_FRACTION",
            "SUBCLONAL_GENOME_FRACTION");

    tstLoadFi(filepath, 0, false); // Sample information file, shouldn't have tracks.

    Set<String> attrNames = new HashSet<String>(AttributeManager.getInstance().getAttributeNames());

    assertTrue(
        attrNames.size()
            >= expectedAttributeNames.size()); // Can be larger because of default attributes
    for (String name : expectedAttributeNames) {
      assertTrue(expectedAttributeNames.contains(name));
    }
  }
Пример #2
0
  /**
   * Test loading sample information file from a sql database, using a profile
   *
   * @throws Exception
   */
  @Test
  public void testLoadSampleInfoProfile() throws Exception {

    AttributeManager.getInstance().clearAllAttributes();
    String path = TestUtils.DATA_DIR + "sql/sampleinfo_brca_sif_profile.dbxml";

    int expectedTracks = 0;
    List<Track> tracks = trackLoader.load(new ResourceLocator(path), genome);
    assertEquals(expectedTracks, tracks.size());

    String[] attrNames =
        "TCGA_EXPERIMENT	TCGA_BATCH	TUMOR_NORMAL	BIRDSEED_GENDER	LEVEL2_NOISE	LEVEL3_SEGMENT_COUNT	PURITY	PLOIDY	DELTA	CANCER_DNA_FRACTION	SUBCLONAL_GENOME_FRACTION"
            .split("\\s+");
    Set<String> expAttrNames = new HashSet<String>(Arrays.asList(attrNames));
    List<String> actAttrNames = AttributeManager.getInstance().getAttributeNames();
    actAttrNames.remove("NAME");
    actAttrNames.remove("DATA TYPE");
    actAttrNames.remove("DATA FILE");
    assertEquals(actAttrNames.size(), expAttrNames.size());
    for (String attrName : actAttrNames) {
      assertTrue(expAttrNames.contains(attrName));
    }
  }