示例#1
0
文件: cli.py 项目: gncv/gencove-cli
def biosamples_list(
    basespace_project_id,
    host,
    email,
    password,
    api_key,
):
    """List all Biosamples from BaseSpace project.

    Examples:

        List Biosamples of a BaseSpace project:

            gencove basespace biosamples list 12345678

        List Biosamples of a BaseSpace projects:

            gencove basespace biosamples list 12345678,87654321

    """
    BiosamplesList(
        basespace_project_id,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#2
0
文件: cli.py 项目: gncv/gencove-cli
def list_project_batch_types(project_id, host, email, password, api_key):
    """List batch types that are available for a project."""
    ListBatchTypes(
        project_id,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#3
0
def create_project_batch(  # pylint: disable=too-many-arguments
    project_id,
    batch_type,
    batch_name,
    sample_ids,
    host,
    email,
    password,
    api_key,
):
    """Create a batch in a project."""
    if sample_ids:
        sample_ids = [s_id.strip() for s_id in sample_ids.split(",")]
        echo_debug("Sample ids translation: {}".format(sample_ids))
    else:
        sample_ids = []

    CreateBatch(
        project_id,
        batch_type,
        batch_name,
        sample_ids,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#4
0
文件: cli.py 项目: gncv/gencove-cli
def get_batch(batch_id, output_filename, host, email, password, api_key,
              no_progress):
    """Get batch that is available for a project."""
    GetBatch(
        batch_id,
        output_filename,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
        no_progress,
    ).run()
示例#5
0
def create_merged_vcf(
    project_id,
    host,
    email,
    password,
    api_key,
):
    """Merge VCF files in a project."""
    CreateMergedVCF(
        project_id,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#6
0
def status_merged_vcf(
    project_id,
    host,
    email,
    password,
    api_key,
):
    """Get status of merge VCF files job in a project."""
    StatusMergedVCF(
        project_id,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#7
0
文件: cli.py 项目: gncv/gencove-cli
def get_metadata(
    sample_id,
    output_filename,
    host,
    email,
    password,
    api_key,
):
    """Get sample metadata."""
    GetMetadata(
        sample_id,
        output_filename,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#8
0
def set_metadata(
    sample_id,
    json,
    host,
    email,
    password,
    api_key,
):
    """Set sample metadata."""
    SetMetadata(
        sample_id,
        json,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#9
0
def get_merged_vcf(
    project_id,
    output_filename,
    host,
    email,
    password,
    api_key,
    no_progress,
):
    """Download merged VCF file in a project."""
    GetMergedVCF(
        project_id,
        output_filename,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
        no_progress,
    ).run()
示例#10
0
文件: cli.py 项目: gncv/gencove-cli
def delete_project_samples(  # pylint: disable=too-many-arguments
    project_id,
    sample_ids,
    host,
    email,
    password,
    api_key,
):
    """Delete samples in a project."""
    sample_ids = ([s_id.strip()
                   for s_id in sample_ids.split(",")] if sample_ids else [])
    echo_debug("Sample ids translation: {}".format(sample_ids))

    DeleteSamples(
        project_id,
        sample_ids,
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#11
0
def basespace_list(
    host,
    email,
    password,
    api_key,
):
    """List all BaseSpace projects.

    Examples:

        Import Biosamples to a project:

            gencove basespace projects list

    """
    BaseSpaceList(
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#12
0
def autoimport_list(
    host,
    email,
    password,
    api_key,
):
    """Lists S3 automatic import jobs.

    Examples:

        List S3 automatic import jobs:

            gencove s3 autoimports list
    """  # noqa: E501

    S3AutoImportList(
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#13
0
文件: cli.py 项目: gncv/gencove-cli
def list_projects(host, email, password, api_key):
    """List your projects."""
    List(
        Credentials(email=email, password=password, api_key=api_key),
        Optionals(host=host),
    ).run()
示例#14
0
def download_file(
    sample_id,
    file_type,
    destination,
    host,
    email,
    password,
    api_key,
    no_progress,
):  # noqa: D413,D301,D412 # pylint: disable=C0301
    """Download sample file metadata.

    SAMPLE_ID   specific sample for which to download the results

    FILE_TYPE   specific deliverable to download results for

    DESTINATION path/to/file

    Examples:

        Download sample:

            gencove samples download-file e6b45af7-07c5-4a6d-9f97-6e1efbf3e215 ancestry-json ancestry.json

        Download and print to stdout then compress using gzip:

            gencove samples download-file e6b45af7-07c5-4a6d-9f97-6e1efbf3e215 ancestry-json - | gzip > ancestry.json.gz
    \f

    Args:
        sample_id (str): specific sample for which
            to download the results.
        file_type (str): specific deliverable to download
            results for.
        destination (str): path/to/file.
        no_progress (bool, optional, default False): do not show progress
            bar.
    """  # noqa: E501
    if destination in ("-", "/dev/stdout"):
        DownloadFile(
            sample_id,
            file_type,
            sys.stdout.buffer,
            Credentials(email=email, password=password, api_key=api_key),
            Optionals(host=host),
            no_progress,
        ).run()
    else:
        try:
            with open(destination, "wb") as destination_file:
                DownloadFile(
                    sample_id,
                    file_type,
                    destination_file,
                    Credentials(email=email,
                                password=password,
                                api_key=api_key),
                    Optionals(host=host),
                    no_progress,
                ).run()
        except IsADirectoryError:
            echo_error("Please specify a file path (not directory path)"
                       " for DESTINATION")
            raise click.Abort()  # pylint: disable=raise-missing-from