Exemplo n.º 1
0
def test_init_index__creates_set_indices(get_args, validate_index):
    """Verify `init_index` can create the saved set indices correctly."""
    args = get_args("--index", "case_set", "file_set", "gene_set", "ssm_set",
                    "--prefix", "test_set")
    init_index.init_index(args)

    validate_index(
        index_name="test_set_case_set",
        mapping_resource="es-models/case_set/case_set.mapping.yaml",
        settings_resource="es-models/case_set/settings.yaml",
    )
    validate_index(
        index_name="test_set_file_set",
        mapping_resource="es-models/file_set/file_set.mapping.yaml",
        settings_resource="es-models/file_set/settings.yaml",
    )
    validate_index(
        index_name="test_set_gene_set",
        mapping_resource="es-models/gene_set/gene_set.mapping.yaml",
        settings_resource="es-models/gene_set/settings.yaml",
    )
    validate_index(
        index_name="test_set_ssm_set",
        mapping_resource="es-models/ssm_set/ssm_set.mapping.yaml",
        settings_resource="es-models/ssm_set/settings.yaml",
    )
Exemplo n.º 2
0
def test_init_index__creates_graph_indices(get_args, validate_index):
    """Verify `init_index` can create the active graph indices correctly.

    Expect the names to be ``test_gdc_from_graph...`` because that's how the init logic
    works, even though it's not how we'd normally name the indices. We don't normally
    use this init script to create the graph index anyway (we let esbuild do it).
    """
    args = get_args("--index", "gdc_from_graph", "--prefix", "test")
    init_index.init_index(args)

    validate_index(
        index_name="test_gdc_from_graph_annotation",
        mapping_resource="es-models/gdc_from_graph/annotation.mapping.yaml",
        settings_resource="es-models/gdc_from_graph/settings.yaml",
        descriptions_resource="es-models/gdc_from_graph/descriptions.yaml",
    )
    validate_index(
        index_name="test_gdc_from_graph_case",
        mapping_resource="es-models/gdc_from_graph/case.mapping.yaml",
        settings_resource="es-models/gdc_from_graph/settings.yaml",
        descriptions_resource="es-models/gdc_from_graph/descriptions.yaml",
    )
    validate_index(
        index_name="test_gdc_from_graph_file",
        mapping_resource="es-models/gdc_from_graph/file.mapping.yaml",
        settings_resource="es-models/gdc_from_graph/settings.yaml",
        descriptions_resource="es-models/gdc_from_graph/descriptions.yaml",
    )
    validate_index(
        index_name="test_gdc_from_graph_project",
        mapping_resource="es-models/gdc_from_graph/project.mapping.yaml",
        settings_resource="es-models/gdc_from_graph/settings.yaml",
        descriptions_resource="es-models/gdc_from_graph/descriptions.yaml",
    )
Exemplo n.º 3
0
def test_init_index__skips_existing_indices(get_args, validate_index):
    """Confirm existing indices are not recreated when ``--delete`` is not passed."""
    args = get_args("--index", "case_set", "--prefix", "test")
    init_index.init_index(args)

    # The preexisting test_case_set should have the graph case mapping/settings.
    validate_index(
        index_name="test_case_set",
        mapping_resource="es-models/gdc_from_graph/case.mapping.yaml",
        settings_resource="es-models/gdc_from_graph/settings.yaml",
    )
Exemplo n.º 4
0
def test_init_index__skips_if_prompt_doesnt_match(get_args, validate_index,
                                                  patch_input, user_input):
    """Confirm ``--delete`` does not delete indices if the confirmation prompt fails."""
    patch_input(user_input)

    args = get_args("--index", "case_set", "--prefix", "test", "--delete")
    init_index.init_index(args)

    validate_index(
        index_name="test_case_set",
        mapping_resource="es-models/gdc_from_graph/case.mapping.yaml",
        settings_resource="es-models/gdc_from_graph/settings.yaml",
    )
Exemplo n.º 5
0
def test_init_index__deletes_if_prompt_matches(get_args, validate_index,
                                               patch_input):
    """Confirm ``--delete`` deletes and recreates indices if the prompt passes."""
    patch_input("test_case_set")

    args = get_args("--index", "case_set", "--prefix", "test", "--delete")
    init_index.init_index(args)

    # init_index should have recreated the case set index with the proper settings.
    validate_index(
        index_name="test_case_set",
        mapping_resource="es-models/case_set/case_set.mapping.yaml",
        settings_resource="es-models/case_set/settings.yaml",
    )
Exemplo n.º 6
0
def test_init_index__creates_viz_indices(get_args, validate_index):
    """Verify `init_index` can create the visualization indices correctly."""
    args = get_args(
        "--index",
        "case_centric",
        "cnv_centric",
        "cnv_occurrence_centric",
        "gene_centric",
        "ssm_centric",
        "ssm_occurrence_centric",
        "--prefix",
        "test_viz",
    )
    init_index.init_index(args)

    validate_index(
        index_name="test_viz_case_centric",
        mapping_resource="es-models/case_centric/case_centric.mapping.yaml",
        settings_resource="es-models/case_centric/settings.yaml",
    )
    validate_index(
        index_name="test_viz_cnv_centric",
        mapping_resource="es-models/cnv_centric/cnv_centric.mapping.yaml",
        settings_resource="es-models/cnv_centric/settings.yaml",
    )
    validate_index(
        index_name="test_viz_cnv_occurrence_centric",
        mapping_resource=
        ("es-models/cnv_occurrence_centric/cnv_occurrence_centric.mapping.yaml"
         ),
        settings_resource="es-models/cnv_occurrence_centric/settings.yaml",
    )
    validate_index(
        index_name="test_viz_gene_centric",
        mapping_resource="es-models/gene_centric/gene_centric.mapping.yaml",
        settings_resource="es-models/gene_centric/settings.yaml",
    )
    validate_index(
        index_name="test_viz_ssm_centric",
        mapping_resource="es-models/ssm_centric/ssm_centric.mapping.yaml",
        settings_resource="es-models/ssm_centric/settings.yaml",
    )
    validate_index(
        index_name="test_viz_ssm_occurrence_centric",
        mapping_resource=
        ("es-models/ssm_occurrence_centric/ssm_occurrence_centric.mapping.yaml"
         ),
        settings_resource="es-models/ssm_occurrence_centric/settings.yaml",
    )
Exemplo n.º 7
0
def test_init_index__ignores_unknown_indices(get_args, validate_index):
    """Confirm unknown indices are ignored, and do not block creating known indices."""
    args = get_args("--index", "awg_centric", "case_set", "cnv_set",
                    "file_set", "--prefix", "test")
    init_index.init_index(args)

    validate_index(
        index_name="test_case_set",
        mapping_resource="es-models/case_set/case_set.mapping.yaml",
        settings_resource="es-models/case_set/settings.yaml",
    )
    validate_index(
        index_name="test_file_set",
        mapping_resource="es-models/file_set/file_set.mapping.yaml",
        settings_resource="es-models/file_set/settings.yaml",
    )