Esempio n. 1
0
def burst_build(infile,
                outfile_prefix,
                accelerator=False,
                shell=False,
                clustradius=None,
                shear=None):
    cmd = [
        'burst15',
        '--references',
        infile,
        '--output',
        outfile_prefix + ".edb",
        '--npenalize',
        '--makedb',
        '--fingerprint',
    ]

    if accelerator:
        cmd += ['--accelerator', accelerator]

    if shear:
        cmd += ['--shear', str(shear)]

    if clustradius:
        cmd += ['--clustradius', str(clustradius)]

    return run_command(cmd, shell=shell)
Esempio n. 2
0
def burst_align_any(input_fp,
                    output_fp,
                    burst_db_prefix,
                    accelerator=False,
                    threads=1,
                    shell=False,
                    percent_id=.98):
    """
    :param input_fp:
    :param output_fp:
    :param burst_db_prefix:
    :param accelerator:
    :param tax:
    :param threads:
    :param pct_id:
    :param shell:
    :param taxa_ncbi:
    :return:
    """

    #TODO: Look up SOP

    cmd = [
        'burst15', '--queries', input_fp, '--references',
        burst_db_prefix + '.edx', '--output', output_fp, '--threads',
        str(threads), '--mode', 'ANY', '--npenalize', '--id',
        str(percent_id), '--forwardreverse'
    ]

    if accelerator:
        cmd += ['--accelerator', accelerator]

    return run_command(cmd, shell=shell)
Esempio n. 3
0
def bowtie2_align(infile,
                  outfile,
                  database,
                  alignments_to_report=16,
                  num_threads=1,
                  shell=False,
                  percent_id=.98):
    """
    Search a bowtie2 index with multiple alignment.
    :param infile: the query FASTA file
    :param outfile: the resulting SAM file
    :param database: path to the bowtie2 index
    :param alignments_to_report: the number of alignments to report (default=32)
    :param num_threads: the number of threads to use (default=SETTINGS)
    :param shell: whether to use the shell NOT RECOMMENDED (default=False)
    :return: the STDERR/STDOUT
    """
    cmd = [
        'bowtie2', '--no-unal', '-x', database, '-S', outfile, '--np', '1',
        '--mp', '"1,1"', '--rdg', '"0,1"', '--rfg', '"0,1"', '--score-min',
        format_pct_id(percent_id), '-f', infile, '--very-sensitive', '-k',
        str(alignments_to_report), '-p',
        str(num_threads), '--no-hd'
    ]
    return run_command(cmd, shell=shell)
Esempio n. 4
0
def utree_search(input_compressed_tree,
                 input_fasta_to_search,
                 output,
                 shell=False):
    # usage: xtree-search compTree.ctr fastaToSearch.fa output.txt
    cmd = [
        'utree-search', input_compressed_tree, input_fasta_to_search, output
    ]
    return run_command(cmd, shell=shell)
Esempio n. 5
0
def bowtie2_build(infile, outfile, shell=False):
    """
    This function will build a bowtie2 index with a given infile and output to the outfile
    :param infile: the FASTA file to build the index with
    :param outfile: the prefix for the bowtie2 index
    :param shell: whether to use the shell NOT RECOMMENDED (default=False)
    :return: the STDERR/STDOUT
    """
    cmd = ['bowtie2-build', '-f', infile, outfile]
    return run_command(cmd, shell=shell)
Esempio n. 6
0
def utree_search_gg(input_compressed_tree,
                    input_fasta_to_search,
                    output,
                    threads=1,
                    shell=False):
    # [v1.5a] usage: xtree-searchGG compTree.ctr fastaToSearch.fa output.txt [threads] [RC]
    cmd = [
        'utree-search_gg', input_compressed_tree, input_fasta_to_search,
        output, threads, 'RC'
    ]
    return run_command(cmd, shell=shell)
Esempio n. 7
0
def utree_build_gg(input_fasta,
                   input_fasta_labels,
                   output_uncompressed_tree,
                   threads=1,
                   complevel=2,
                   shell=False):
    # [v2.0 SigNature Edition] usage: utree-buildGG input_fasta.fa labels.map output.ubt threads{0=auto} [complevel]
    cmd = [
        'utree-build_gg', input_fasta, input_fasta_labels,
        output_uncompressed_tree, threads, complevel
    ]
    return run_command(cmd, shell=shell)
Esempio n. 8
0
def utree_build(input_fasta,
                input_fasta_labels,
                output_uncompressed_tree,
                threads=1,
                shell=False):
    # usage: utree-build input_fasta.fa labels.map output.ubt [threads]
    cmd = [
        'utree-build',
        input_fasta,
        input_fasta_labels,
        output_uncompressed_tree,
        threads,
    ]
    return run_command(cmd, shell=shell)
Esempio n. 9
0
def burst_align(input_fp,
                output_fp,
                burst_db_prefix,
                threads=1,
                percent_id=.98,
                tax=False,
                accelerator=False,
                taxacut=5,
                shell=False,
                taxa_ncbi=False):
    """

    :param input_fp:
    :param output_fp:
    :param burst_db_prefix:
    :param accelerator:
    :param tax:
    :param threads:
    :param pct_id:
    :param shell:
    :param taxa_ncbi:
    :return:
    """

    #TODO: Look up SOP

    cmd = [
        'burst15', '--queries', input_fp, '--references',
        burst_db_prefix + '.edx', '--output', output_fp, '--threads',
        str(threads), '--mode', 'CAPITALIST', '--id',
        str(percent_id), '--npenalize', '--skipambig', '--forwardreverse'
    ]

    if taxa_ncbi:
        cmd += ['--taxa_ncbi']

    if accelerator:
        cmd += ['--accelerator', accelerator]

    if tax:
        cmd += ['--taxonomy', tax, '--taxacut', taxacut]

    return run_command(cmd, shell=shell)
Esempio n. 10
0
def utree_compress(input_uncompressed_tree,
                   output_compressed_tree,
                   shell=False):
    # usage: xtree-compress preTree.ubt compTree.ctr
    cmd = ['utree-compress', input_uncompressed_tree, output_compressed_tree]
    return run_command(cmd, shell=shell)