def test_each():
    upper = lambda x: x.upper()
    eq_(run(Fun(linecmd('echo "a\nb\nc"')) |
            each(upper) |
            strip('\n') |
            join),
        'ABC')
Exemple #2
0
def multiple_alignment_use_files(file_input, alignment_type=SeqTypeData().TYPE_DEFAULT):
    muscle_cmd = SeqTypeData().type2cmd_f[alignment_type]
    result = iterpipes.run(iterpipes.linecmd(str(muscle_cmd) + " -in \"" + file_input + "\""))
    result_list = []
    for i in result:
        result_list.append(i.strip())
    # iores = StringIO()
    # for i in result_list:
    #     print(i[0])
    #     iores.write(i)
    name = file_input[:file_input.rfind('.')] + "-aligned.fa"
    with open(name, "wt") as tmpfd:
        tmpfd.write("\n".join(result_list))
    return fasta_tools.read_fasta(name, False)
Exemple #3
0
def multiple_alignment_use_files(file_input,
                                 alignment_type=SeqTypeData().TYPE_DEFAULT):
    muscle_cmd = SeqTypeData().type2cmd_f[alignment_type]
    result = iterpipes.run(
        iterpipes.linecmd(str(muscle_cmd) + " -in \"" + file_input + "\""))
    result_list = []
    for i in result:
        result_list.append(i.strip())
    # iores = StringIO()
    # for i in result_list:
    #     print(i[0])
    #     iores.write(i)
    name = file_input[:file_input.rfind('.')] + "-aligned.fa"
    with open(name, "wt") as tmpfd:
        tmpfd.write("\n".join(result_list))
    return fasta_tools.read_fasta(name, False)
def test_linecmd():
    text = six.u('абв\nabc\n')
    tr = linecmd('tr a-z A-Z')
    eq_(list(tr(text)), [six.u('абв\n'), six.u('ABC\n')])