Beispiel #1
0
def rsem_index(job, args):
    download_url(url=args.ref, name='ref.fa', work_dir=job.tempDir)
    download_url(url=args.gtf, name='annotation.gtf', work_dir=job.tempDir)

    # Run RSEM to generate reference
    rsem_dir = os.path.join(job.tempDir, args.rsem_name)
    os.mkdir(rsem_dir)
    docker_parameters = [
        '--entrypoint', 'rsem-prepare-reference', '-v',
        '{}:/data'.format(job.tempDir), '--rm', '--log-driver=none'
    ]
    parameters = [
        '-p',
        str(args.cores), '--gtf', '/data/annotation.gtf', '/data/ref.fa',
        os.path.join('/data', args.rsem_name, args.rsem_name)
    ]
    dockerCall(
        job,
        tool=
        'quay.io/ucsc_cgl/rsem:1.2.25--d4275175cc8df36967db460b06337a14f40d2f21',
        parameters=parameters,
        dockerParameters=docker_parameters)

    # Compress rsemRef into a tarball
    rsem_tar = '{}.tar.gz'.format(args.rsem_name)
    tarball_files(rsem_tar, file_paths=[rsem_dir], output_dir=job.tempDir)

    # Move to output dir
    tar_path = os.path.join(job.tempDir, rsem_tar)
    if _move_instead_of_return:
        move_files([tar_path], args.output_dir)
    else:
        return job.fileStore.readGlobalFile(tar_path)
Beispiel #2
0
def star_index(job, args):
    download_url(url=args.ref, name='ref.fa', work_dir=job.tempDir)
    download_url(url=args.gtf, name='annotation.gtf', work_dir=job.tempDir)

    # Run STAR to generate index
    star_dir = os.path.join(job.tempDir, args.star_name)
    os.mkdir(star_dir)
    parameters = [
        '--runThreadN',
        str(args.cores), '--runMode', 'genomeGenerate', '--genomeDir',
        '/data/' + args.star_name, '--genomeFastaFiles', 'ref.fa',
        '--sjdbGTFfile', 'annotation.gtf'
    ]
    dockerCall(
        job,
        tool=
        'quay.io/ucsc_cgl/star:2.4.2a--bcbd5122b69ff6ac4ef61958e47bde94001cfe80',
        workDir=job.tempDir,
        parameters=parameters)

    # Compress starIndex into a tarball
    star_tar = '{}.tar.gz'.format(args.star_name)
    tarball_files(star_tar, file_paths=[star_dir], output_dir=job.tempDir)

    # Move to output dir or return
    tar_path = os.path.join(job.tempDir, star_tar)
    if _move_instead_of_return:
        move_files([tar_path], args.output_dir)
    else:
        return job.fileStore.readGlobalFile(tar_path)
Beispiel #3
0
def kallisto_index(job, args):
    if args.transcriptome:
        download_url(url=args.transcriptome,
                     name='transcriptome.fa',
                     work_dir=job.tempDir)
    else:
        _create_transcriptome(job, args, job.tempDir)

    # Run Kallisto Index
    parameters = [
        'index', 'transcriptome.fa', '-i',
        '/data/{}.index'.format(args.kallisto_name)
    ]
    dockerCall(
        job,
        tool=
        'quay.io/ucsc_cgl/kallisto:0.43.1--355c19b1fb6fbb85f7f8293e95fb8a1e9d0da163',
        workDir=job.tempDir,
        parameters=parameters)

    # Move to output dir
    output_path = os.path.join(job.tempDir, args.kallisto_name + '.index')
    if _move_instead_of_return:
        move_files([output_path], args.output_dir)
    else:
        return job.fileStore.readGlobalFile(output_path)
def star_index(job, args):
    work_dir = job.fileStore.getLocalTempDir()
    download_url(url=args.ref, name='ref.fa', work_dir=work_dir)
    download_url(url=args.gtf, name='annotation.gtf', work_dir=work_dir)

    # Run STAR to generate index
    star_dir = os.path.join(work_dir, args.star_name)
    os.mkdir(star_dir)
    parameters = [
        '--runThreadN',
        str(args.cores), '--runMode', 'genomeGenerate', '--genomeDir',
        '/data/' + args.star_name, '--genomeFastaFiles', 'ref.fa',
        '--sjdbGTFfile', 'annotation.gtf'
    ]
    dockerCall(
        job,
        tool=
        'quay.io/ucsc_cgl/star:2.4.2a--bcbd5122b69ff6ac4ef61958e47bde94001cfe80',
        workDir=work_dir,
        parameters=parameters)

    # Compress starIndex into a tarball
    subprocess.check_call(['tar', '-zcvf', star_dir + '.tar.gz', star_dir])

    # Move to output dir or return
    if _move_instead_of_return:
        move_files([star_dir + '.tar.gz'], args.output_dir)
    else:
        return job.fileStore.readGlobalFile(star_dir + '.tar.gz')
Beispiel #5
0
def hera_index(job, args):
    # Download input files
    download_url(url=args.ref, name='ref.fa', work_dir=job.tempDir)
    download_url(url=args.gtf, name='annotation.gtf', work_dir=job.tempDir)

    # Run Hera build
    hera_dir = os.path.join(job.tempDir, args.hera_name)
    os.mkdir(hera_dir)
    docker_parameters = [
        '--rm', '--log-driver=none', '-v', '{}:/data'.format(job.tempDir),
        '--entrypoint=/hera/build/hera_build'
    ]
    parameters = [
        '--fasta', '/data/ref.fa', '--gtf', '/data/annotation.gtf', '--outdir',
        '/data'
    ]
    dockerCall(job,
               tool='jvivian/hera',
               workDir=job.tempDir,
               parameters=parameters,
               dockerParameters=docker_parameters)

    # No naming options during creation so fix here
    if args.hera_name != 'hera-index':
        os.rename(os.path.join(job.tempDir, 'hera-index'), hera_dir)

    # Compress
    hera_tar = '{}.tar.gz'.format(args.hera_name)
    tarball_files(hera_tar, file_paths=[hera_dir], output_dir=job.tempDir)

    # Move to output dir
    tar_path = os.path.join(job.tempDir, hera_tar)
    if _move_instead_of_return:
        move_files([tar_path], args.output_dir)
    else:
        return job.fileStore.readGlobalFile(tar_path)
def hera_index(job, args):
    work_dir = job.fileStore.getLocalTempDir()

    # Download input files
    download_url(url=args.ref, name='ref.fa', work_dir=work_dir)
    download_url(url=args.gtf, name='annotation.gtf', work_dir=work_dir)

    # Run Hera build
    hera_dir = os.path.join(work_dir, args.hera_name)
    os.mkdir(hera_dir)
    docker_parameters = [
        '--rm', '--log-driver=none', '-v', '{}:/data'.format(work_dir),
        '--entrypoint=/hera/build/hera_build'
    ]
    parameters = [
        '--fasta', '/data/ref.fa', '--gtf', '/data/annotation.gtf', '--outdir',
        '/data'
    ]
    dockerCall(job,
               tool='jvivian/hera',
               workDir=work_dir,
               parameters=parameters,
               dockerParameters=docker_parameters)

    # No naming options during creation so fix here
    if args.hera_name != 'hera-index':
        os.rename(os.path.join(work_dir, 'hera-index'), hera_dir)

    # Compress
    subprocess.check_call(['tar', '-zcvf', hera_dir + '.tar.gz', hera_dir])

    # Move to output dir
    if _move_instead_of_return:
        move_files([hera_dir + '.tar.gz'], args.output_dir)
    else:
        return job.fileStore.readGlobalFile(hera_dir + '.tar.gz')