コード例 #1
0
def starting_esrna(in_put, out_put, args_muscle, args_muscle_p, args_clustalw,
                   args_clustalw_p, args_gblocks, args_raxml, args_raxml_p,
                   args_fasttree, args_fasttree_p, args_thread,
                   args_extenddata):
    '''reconstruct phylogenetic tree by ssu rna extend method'''
    extend_check = checkFile(args_extenddata)
    ssu_input = checkSilvaOrganism(in_put)
    out_retrieve = retrieve16srna(ssu_input, out_put)
    retrieve_srna_path = os.path.join(out_retrieve, 'rna_sequence.fasta')

    fw = open(retrieve_srna_path, 'ab')
    with open(extend_check) as read:
        for line in read:
            fw.write(line)
    fw.close()

    # set default aligned by muscle if not specify clustalw
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)
    # gblocks
    if args_gblocks is gblockspara_pro:
        args_gblocks = gblockspara_dna
    out_gblock = dogblocks(out_alg, args_gblocks)
    out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_raxml:
        if args_raxml_p is raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
コード例 #2
0
ファイル: autobuild.py プロジェクト: genostack/physpetools
def starting_esrna(in_put, out_put, args_muscle, args_muscle_p, args_clustalw,
                   args_clustalw_p, args_mafft, args_mafft_p, args_gblocks,
                   args_gblocks_p, args_trimal, args_trimal_p, args_raxml,
                   args_raxml_p, args_fasttree, args_fasttree_p, args_iqtree,
                   args_iqtree_p, args_thread, args_extenddata, args_db):
    '''reconstruct phylogenetic tree by ssu rna extend method'''
    extend_check = checkFile(args_extenddata)
    ssu_input, recovery_dic = checkSilvaOrganism(in_put)
    start = time.time()
    out_retrieve = retrieve16srna(ssu_input, out_put, args_db)
    end = time.time()
    auto_build_log.info(
        'Retrieving SSU rRNA sequences used time: {} Seconds'.format(end -
                                                                     start))
    if not recovery_dic == []:
        recovery_silva(out_retrieve, recovery_dic, ssu_input)
    retrieve_srna_path = os.path.join(out_retrieve, 'rna_sequence.fasta')

    fw = open(retrieve_srna_path, 'a')
    with open(extend_check) as read:
        for line in read:
            fw.write(line)
    fw.close()

    # set default aligned by muscle if not specify clustalw
    start2 = time.time()
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft(out_retrieve, out_put, args_mafft_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)

    # set default trim by gblocks if not specify trimal
    if args_trimal:
        out_f2p = dotrimal(out_alg, args_trimal_p)
    elif args_gblocks:
        if args_gblocks_p is gblockspara_pro:
            args_gblocks_p = gblockspara_dna
            out_gblock = dogblocks(out_alg, args_gblocks_p)
        out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        if args_raxml_p is raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
    end2 = time.time()
    auto_build_log.info(
        'Constructing species tree used time: {} Seconds'.format(end2 -
                                                                 start2))
コード例 #3
0
def starting_esrna(in_put, out_put,
                   args_muscle, args_muscle_p,
                   args_clustalw, args_clustalw_p,
                   args_mafft, args_mafft_p,
                   args_gblocks, args_gblocks_p,
                   args_trimal, args_trimal_p,
                   args_raxml, args_raxml_p,
                   args_fasttree, args_fasttree_p,
                   args_iqtree,args_iqtree_p,
                   args_thread, args_extenddata):
    '''reconstruct phylogenetic tree by ssu rna extend method'''
    extend_check = checkFile(args_extenddata)
    ssu_input,recovery_dic = checkSilvaOrganism(in_put)
    out_retrieve = retrieve16srna(ssu_input, out_put)
    if not recovery_dic == {}:
        recovery(out_retrieve,recovery_dic)
    retrieve_srna_path = os.path.join(out_retrieve, 'rna_sequence.fasta')

    fw = open(retrieve_srna_path, 'ab')
    with open(extend_check) as read:
        for line in read:
            fw.write(line)
    fw.close()

    # set default aligned by muscle if not specify clustalw
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft(out_retrieve, out_put, args_mafft_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)

    # set default trim by gblocks if not specify trimal
    if args_trimal:
        out_f2p = dotrimal(out_alg, args_trimal_p)
    elif args_gblocks:
        if args_gblocks_p is gblockspara_pro:
            args_gblocks_p = gblockspara_dna
            out_gblock = dogblocks(out_alg, args_gblocks_p)
        out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        if args_raxml_p is raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
コード例 #4
0
def starting_srna(in_put, out_put,
                  args_muscle, args_muscle_p,
                  args_clustalw, args_clustalw_p,
                  args_mafft, args_mafft_p,
                  args_gblocks, args_gblocks_p,
                  args_trimal, args_trimal_p,
                  args_raxml, args_raxml_p,
                  args_fasttree, args_fasttree_p,
                  args_iqtree,args_iqtree_p,
                  args_thread):
    '''reconstruct phylogenetic tree by ssu rna method'''
    ssu_input,recovery_dic = checkSilvaOrganism(in_put)
    out_retrieve = retrieve16srna(ssu_input, out_put)
    if not recovery_dic == {}:
        recovery(out_retrieve,recovery_dic)

    # set default aligned by muscle if not specify clustalw or mafft
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft(out_retrieve, out_put, args_mafft_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)

    # set default trim by gblocks if not specify trimal
    if args_trimal:
        out_f2p = dotrimal(out_alg, args_trimal_p)
    elif args_gblocks:
        if args_gblocks_p is gblockspara_pro:
            args_gblocks_p = gblockspara_dna
            out_gblock = dogblocks(out_alg, args_gblocks_p)
        out_f2p = fasta2phy(out_gblock)

    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        if args_raxml_p is raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
コード例 #5
0
ファイル: buildtree.py プロジェクト: YulongNiu/physpetools
def build_srna(in_put, out_put, args_muscle, args_muscle_p, args_clustalw, args_clustalw_p,
               args_gblocks, args_raxml, args_raxml_p, args_fasttree, args_fasttree_p, args_thread):
    '''reconstruct phylogenetic tree by ssu rna method'''
    out_retrieve = in_put
    # set default aligned by muscle if not specify clustalw
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)

    if args_gblocks == gblockspara_pro:
        args_gblocks = gblockspara_dna
    out_gblock = dogblocks(out_alg, args_gblocks)
    out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_raxml:
        if args_raxml_p == raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
コード例 #6
0
def build_srna(in_put, out_put,
               args_muscle, args_muscle_p,
               args_clustalw, args_clustalw_p,
               args_mafft, args_mafft_p,
               args_gblocks, args_gblocks_p,
               args_trimal, args_trimal_p,
               args_raxml, args_raxml_p,
               args_fasttree, args_fasttree_p,
               args_iqtree,args_iqtree_p,
               args_thread):
    '''reconstruct phylogenetic tree by ssu rna method'''
    out_retrieve = in_put
    # set default aligned by muscle if not specify clustalw or mafft
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft(out_retrieve, out_put, args_mafft_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)

    # set default trim by gblocks if not specify trimal
    if args_trimal:
        out_f2p = dotrimal(out_alg, args_trimal_p)
    elif args_gblocks:
        if args_gblocks_p == gblockspara_pro:
            args_gblocks_p = gblockspara_dna
            out_gblock = dogblocks(out_alg, args_gblocks_p)
        out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        if args_raxml_p == raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
コード例 #7
0
def build_srna(in_put, out_put, args_muscle, args_muscle_p, args_clustalw,
               args_clustalw_p, args_mafft, args_mafft_p, args_gblocks,
               args_gblocks_p, args_trimal, args_trimal_p, args_raxml,
               args_raxml_p, args_fasttree, args_fasttree_p, args_iqtree,
               args_iqtree_p, args_thread):
    '''reconstruct phylogenetic tree by ssu rna method'''
    start = time.time()
    out_retrieve = in_put
    # set default aligned by muscle if not specify clustalw or mafft
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft(out_retrieve, out_put, args_mafft_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)

    # set default trim by gblocks if not specify trimal
    if args_trimal:
        out_f2p = dotrimal(out_alg, args_trimal_p)
    elif args_gblocks:
        if args_gblocks_p == gblockspara_pro:
            args_gblocks_p = gblockspara_dna
            out_gblock = dogblocks(out_alg, args_gblocks_p)
        out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        if args_raxml_p == raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
    end = time.time()
    build_log.info(
        'Constructing species tree used time: {} Seconds'.format(end - start))
コード例 #8
0
def starting_srna(in_put, out_put, args_muscle, args_muscle_p, args_clustalw,
                  args_clustalw_p, args_gblocks, args_raxml, args_raxml_p,
                  args_fasttree, args_fasttree_p, args_thread):
    '''reconstruct phylogenetic tree by ssu rna method'''
    ssu_input = checkSilvaOrganism(in_put)
    out_retrieve = retrieve16srna(ssu_input, out_put)
    # set default aligned by muscle if not specify clustalw
    if args_clustalw:
        out_alg = doclustalw(out_retrieve, out_put, args_clustalw_p)
    elif args_muscle:
        out_alg = domuscle(out_retrieve, out_put, args_muscle_p)
    # gblocks
    if args_gblocks is gblockspara_pro:
        args_gblocks = gblockspara_dna
        out_gblock = dogblocks(out_alg, args_gblocks)
    out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        args_fasttree_p_add = "-nt " + args_fasttree_p.lstrip()
        doFastTree(out_f2p, out_put, args_fasttree_p_add, args_thread)
    elif args_raxml:
        if args_raxml_p is raxmlpara_pro:
            args_raxml_p = raxmlpara_dna
            doraxml(out_f2p, out_put, args_raxml_p, args_thread)
コード例 #9
0
from physpetool.phylotree.domuscle import domuscle, domuscle_file

# test domuscle fuction
# input = "/home/yangfang/physpetools/testdata/protein.fastq"
# output = "/home/yangfang/physpetools/testdata/protein_alignment2.fasta"
# domuscle(input, output)

# test domuscle_file fuction
# input = "/home/yangfang/physpetools/testdata/temp/conserved_protein"
# output = "/home/yangfang/physpetools/testdata/phytree/test"
# out_alg = domuscle_file(input, output)
# print out_alg

musclepara = '-maxiters 100'
input = "/home/yangfang/physpetools/temp/16srnadata20160725152715"
output = "/home/yangfang/physpetools/testdata/test16srandata"
out_alg = domuscle(input, output, musclepara)
print out_alg
コード例 #10
0
from physpetool.phylotree.domuscle import domuscle, domuscle_file

# test domuscle fuction
# input = "/home/yangfang/physpetools/testdata/protein.fastq"
# output = "/home/yangfang/physpetools/testdata/protein_alignment2.fasta"
# domuscle(input, output)

# test domuscle_file fuction
# input = "/home/yangfang/physpetools/testdata/temp/conserved_protein"
# output = "/home/yangfang/physpetools/testdata/phytree/test"
# out_alg = domuscle_file(input, output)
# print out_alg

musclepara = '-maxiters 100'
input = "/home/yangfang/physpetools/temp/16srnadata20160725152715"
output = "/home/yangfang/physpetools/testdata/test16srandata"
out_alg = domuscle(input, output,musclepara)
print (out_alg)