Пример #1
0
def test_delete_m80():

    c = Cohort("DeleteMe")
    dbFile = os.path.join(c.m80.thawed_dir, "db.sqlite")
    assert os.path.exists(dbFile) == True
    FreezableAPI.delete("Cohort", "DeleteMe")
    assert os.path.exists(dbFile) == False
Пример #2
0
def RNACohort(RNAAccession1, RNAAccession2):
    FreezableAPI.delete("Cohort", "RNACohort")
    x = Cohort("RNACohort")
    x.add_accession(RNAAccession1)
    x.add_accession(RNAAccession2)
    yield x
    FreezableAPI.delete(x.m80.dtype, x.m80.name)
Пример #3
0
def test_delete_missing():

    c = Cohort("DeleteMe")
    dbFile = os.path.join(c.m80.thawed_dir, "db.sqlite")
    assert os.path.exists(dbFile) == True
    # Giving the wrong information shouldnt do anything
    FreezableAPI.delete("Cohort", "DeleteMeee")
    assert os.path.exists(dbFile) == True
    FreezableAPI.delete("Cohort", "DeleteMe")
    assert os.path.exists(dbFile) == False
Пример #4
0
def simpleCohort():
    FreezableAPI.delete("Cohort", "TestCohort")
    # Create the simple cohort
    a = Accession("Sample1", files=["file1.txt", "file2.txt"], type="WGS")
    b = Accession("Sample2", files=["file1.txt", "file2.txt"], type="WGS")
    c = Accession("Sample3", files=["file1.txt", "file2.txt"], type="CHIP")
    d = Accession("Sample4", files=["file1.txt", "file2.txt"], type="CHIP")

    x = Cohort("TestCohort")
    for acc in [a, b, c, d]:
        x.add_accession(acc)
    yield x
    FreezableAPI.delete(x.m80.dtype, x.m80.name)
Пример #5
0
def delete(slug, force):
    # Validate the input
    if force is False:  # pragma: no cover
        click.confirm(f'Are you sure you want to delete "{slug}"')
    try:
        dtype, name, tag = FreezableAPI.parse_slug(slug)
        if tag is not None:
            raise TagInvalidError()
    except TagInvalidError:
        click.echo("Cannot delete tags, only entire datasets.")
        sys.exit(1)
    except FreezableNameInvalidError:
        click.echo(
            "Please provide a valid dataset name: <dtype>.<name>. E.g. Project.foobar"
            "Note: do not include tags")
        sys.exit(1)
    # Make sure that the dataset is available
    if not FreezableAPI.exists(dtype, name):
        click.echo(f'"{dtype}.{name}" not in minus80 datasets! '
                   "check available datasets with the ls command")
        sys.exit(1)
    else:
        FreezableAPI.delete(dtype, name)
        sys.exit(0)
Пример #6
0
def simpleProject(scope="module"):
    tmpdir = tempfile.TemporaryDirectory()
    x = Project("simpleProject")
    x.create_link(Path(tmpdir.name) / "tmp")
    yield x
    FreezableAPI.delete(x.m80.dtype, x.m80.name)