Example #1
0
def runDiamond(input, query, cpus, output, premade_db=None):
    # create DB of protein sequences
    # check diamond version
    if lib.getDiamondVersion() >= '2.0.5':
        # run in frameshift mode
        cmd = ['diamond', 'blastx', '--threads', str(cpus), '-q', input,
               '--db', 'diamond', '-o', 'diamond.matches.tab', '-e', '1e-10',
               '-k', '0', '--more-sensitive', '--unal', '0', '-c', '1', '-F', '15',
               '-f', '6', 'sseqid', 'slen',
               'sstart', 'send', 'qseqid', 'qlen', 'qstart', 'qend', 'pident',
               'length', 'evalue', 'score', 'qcovhsp', 'qframe']
    else:
        if int(cpus) > 8:
            cpus = 8
        cmd = ['diamond', 'blastx', '--threads', str(cpus), '-q', input,
               '--db', 'diamond', '-o', 'diamond.matches.tab', '-e', '1e-10',
               '-k', '0', '--more-sensitive', '-f', '6', 'sseqid', 'slen',
               'sstart', 'send', 'qseqid', 'qlen', 'qstart', 'qend', 'pident',
               'length', 'evalue', 'score', 'qcovhsp', 'qframe']
    if premade_db is None:
        db_cmd = ['diamond', 'makedb', '--threads',
                  str(cpus), '--in', query, '--db', 'diamond']
        lib.runSubprocess4(db_cmd, output, lib.log)
    else:
        lib.log.debug('Using premade Diamond database: {}'.format(premade_db))
        os.symlink(os.path.abspath(premade_db),
                   os.path.join(output, 'diamond.dmnd'))
    # now run search
    lib.runSubprocess4(cmd, output, lib.log)
Example #2
0
lib.setupLogging(log_name)
FNULL = open(os.devnull, 'w')
cmd_args = " ".join(sys.argv) + '\n'
lib.log.debug(cmd_args)

# get version of programs
exo_version = subprocess.Popen(
    ['exonerate', '--version'],
    stdout=subprocess.PIPE).communicate()[0].split('\n')[0]
exo_version = exo_version.split('version ')[-1]
blast_version = subprocess.Popen(
    ['tblastn', '-version'],
    stdout=subprocess.PIPE).communicate()[0].split('\n')[0]
blast_version = blast_version.split(': ')[-1]
if args.filter == 'diamond':
    diamond_version = lib.getDiamondVersion()


def runDiamond(input, query, cpus, output):
    # create DB of protein sequences
    cmd = [
        'diamond', 'makedb', '--threads',
        str(cpus), '--in', query, '--db', 'diamond'
    ]
    lib.runSubprocess4(cmd, output, lib.log)
    # now run search
    cmd = [
        'diamond', 'blastx', '--threads',
        str(cpus), '-q', input, '--db', 'diamond', '-o', 'diamond.matches.tab',
        '-e', '1e-10', '-k', '0', '--more-sensitive', '-f', '6', 'sseqid',
        'slen', 'sstart', 'send', 'qseqid', 'qlen', 'qstart', 'qend', 'pident',