src/toil_lib/tools/variant_annotation.py
def run_oncotator(job, vcf_id, oncotator_db):
    """
    Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept
    other genome builds, but the output VCF is based on hg19.

    :param JobFunctionWrappingJob job: passed automatically by Toil
    :param str vcf_id: FileStoreID for VCF file
    :param str oncotator_db: FileStoreID for Oncotator database
    :return: Annotated VCF FileStoreID
    :rtype: str
    """
    job.fileStore.logToMaster('Running Oncotator')

    inputs = {'input.vcf': vcf_id,
              'oncotator_db': oncotator_db}

    work_dir = job.fileStore.getLocalTempDir()
    for name, file_store_id in inputs.iteritems():
        inputs[name] = job.fileStore.readGlobalFile(file_store_id, os.path.join(work_dir, name))

    # The Oncotator database may be tar/gzipped
    if tarfile.is_tarfile(inputs['oncotator_db']):
        tar = tarfile.open(inputs['oncotator_db'])
        tar.extractall(path=work_dir)
        # Get the extracted database directory name
        inputs['oncotator_db'] = tar.getmembers()[0].name
        tar.close()

    command = ['-i', 'VCF',
               '-o', 'VCF',
               '--db-dir', inputs['oncotator_db'],
               'input.vcf',
               'annotated.vcf',
               'hg19']  # Oncotator annotations are based on hg19

    docker_parameters = ['--rm', 'log-driver', 'none',
                         '-e', 'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'.format(job.memory)]
    dockerCall(job=job, workDir=work_dir,
               parameters=command,
               tool='jpfeil/oncotator:1.9--8fffc356981862d50cfacd711b753700b886b605',
               dockerParameters=docker_parameters)

    return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'annotated.vcf'))
def run_oncotator(job, vcf_id, oncotator_db):
    """
    Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept
    other genome builds, but the output VCF is based on hg19.

    :param JobFunctionWrappingJob job: passed automatically by Toil
    :param str vcf_id: FileStoreID for VCF file
    :param str oncotator_db: FileStoreID for Oncotator database
    :return: Annotated VCF FileStoreID
    :rtype: str
    """
    job.fileStore.logToMaster('Running Oncotator')

    inputs = {'input.vcf': vcf_id,
              'oncotator_db': oncotator_db}

    work_dir = job.fileStore.getLocalTempDir()
    for name, file_store_id in inputs.iteritems():
        inputs[name] = job.fileStore.readGlobalFile(file_store_id, os.path.join(work_dir, name))

    # The Oncotator database may be tar/gzipped
    if tarfile.is_tarfile(inputs['oncotator_db']):
        tar = tarfile.open(inputs['oncotator_db'])
        tar.extractall(path=work_dir)
        # Get the extracted database directory name
        inputs['oncotator_db'] = tar.getmembers()[0].name
        tar.close()

    command = ['-i', 'VCF',
               '-o', 'VCF',
               '--db-dir', inputs['oncotator_db'],
               'input.vcf',
               'annotated.vcf',
               'hg19']  # Oncotator annotations are based on hg19

    docker_parameters = ['--rm', 'log-driver', 'none',
                         '-e', 'JAVA_OPTS=-Djava.io.tmpdir=/data/ -Xmx{}'.format(job.memory)]
    dockerCall(job=job, workDir=work_dir,
               parameters=command,
               tool='jpfeil/oncotator:1.9--8fffc356981862d50cfacd711b753700b886b605',
               dockerParameters=docker_parameters)

    return job.fileStore.writeGlobalFile(os.path.join(work_dir, 'annotated.vcf'))
Uses Oncotator to add cancer relevant variant annotations to a VCF file. Oncotator can accept
    other genome builds, but the output VCF is based on hg19.

    :param JobFunctionWrappingJob job: passed automatically by Toil
    :param str vcf_id: FileStoreID for VCF file
    :param str oncotator_db: FileStoreID for Oncotator database
    :return: Annotated VCF FileStoreID
    :rtype: str