Пример #1
0
def netsurfp_rsa(dataset):
    netsurfp_dir = os.environ['NETSURFP_DIR']
    original_dir = os.getcwd()
    os.chdir(netsurfp_dir)
    system_call('rm -rf ./temp/')
    system_call('mkdir temp')
    os.chdir('./temp')
    pnet.utils.write_dataset(dataset,
                             os.path.join(netsurfp_dir, 'temp/temp.seq'))
    command = '../netsurfp -i temp.seq -a >temp.rsa'
    system_call(command)
    path = os.path.join(netsurfp_dir, 'temp/temp.rsa')
    os.chdir(original_dir)
    with open(path, 'r') as f:
        lines = f.readlines()
    lines = [line.split() for line in lines]
    start = 0
    length = len(dataset.sequences[0])
    for i, line in enumerate(lines):
        if len(line) == 10 and line[3] == '1' and line[0] in ['B', 'E']:
            start = i
            break
    data = np.array(lines[start:start + length])
    seq = ''.join(list(data[:, 1]))
    assert str(seq) == str(dataset.sequences[0])
    rsa = data[:, 4]
    return np.array(np.reshape(rsa, newshape=(-1, 1)), dtype=float)
Пример #2
0
def raptorx_ss(dataset):
    raptorx_dir = os.environ['RAPTORX_DIR']
    original_dir = os.getcwd()
    os.chdir(raptorx_dir)
    system_call('rm temp.seq')
    system_call('rm -rf ./tmp/temp/')
    pnet.utils.write_dataset(dataset, os.path.join(raptorx_dir, 'temp.seq'))
    command = './oneline_command.sh temp.seq'
    system_call(command)
    path = os.path.join(raptorx_dir, 'tmp/temp/temp.ss3')
    os.chdir(original_dir)
    return read_ss(path, dataset, order=[5, 4, 3])
Пример #3
0
def psspred_ss(dataset):
    psspred_dir = os.environ['PSSPRED_DIR']
    original_dir = os.getcwd()
    os.chdir(psspred_dir)
    system_call('rm -rf ./temp/')
    system_call('mkdir temp')
    os.chdir('./temp')
    pnet.utils.write_dataset(dataset, os.path.join(psspred_dir,
                                                   'temp/temp.seq'))
    command = 'perl ../PSSpred.pl temp.seq'
    system_call(command)
    path = os.path.join(psspred_dir, 'temp/seq.dat.ss')
    os.chdir(original_dir)
    return read_ss(path, dataset, order=[3, 5, 4])