示例#1
0
def starting_ehcp(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 ehcp method'''
    hcp_input = checkKeggOrganism(in_put)
    out_retrieve = doretrieve(hcp_input, out_put)
    retrieve_pro = os.listdir(out_retrieve)
    for reline in retrieve_pro:
        fw_name = os.path.join(out_retrieve, reline)
        fr_name = os.path.join(args_extenddata, reline)
        fw = open(fw_name, 'ab')
        with open(fr_name) as fr:
            for line in fr:
                fw.write(line)
        fw.close()

    # set default aligned by muscle if not specify clustalw
    if args_clustalw:
        out_alg = doclustalw_file(out_retrieve, out_put, args_clustalw_p)
    elif args_muscle:
        out_alg = domuscle_file(out_retrieve, out_put, args_muscle_p)

    out_concat = cocat_path(out_alg)
    # gblocks
    out_gblock = dogblocks(out_concat, args_gblocks)
    out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_raxml:
        doraxml(out_f2p, out_put, args_raxml_p, args_thread)
示例#2
0
def starting_ehcp(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 ehcp method'''
    hcp_input, recovery_dic = checkKeggOrganism(in_put)
    start = time.time()
    out_retrieve = doretrieve(hcp_input, out_put, args_db)
    end = time.time()
    auto_build_log.info(
        'Retrieving HCP sequences used time: {} Seconds'.format(end - start))

    if not recovery_dic == {}:
        recovery(out_retrieve, recovery_dic)
    retrieve_pro = os.listdir(out_retrieve)
    for reline in retrieve_pro:
        fw_name = os.path.join(out_retrieve, reline)
        fr_name = os.path.join(args_extenddata, reline)
        fw = open(fw_name, 'a')
        with open(fr_name) as fr:
            for line in fr:
                fw.write(line)
        fw.close()

    # set default aligned by muscle if not specify clustalw or mafft
    start2 = time.time()

    if args_clustalw:
        out_alg = doclustalw_file(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft_file(out_retrieve, out_put, args_mafft_p,
                               args_thread)
    elif args_muscle:
        out_alg = domuscle_file(out_retrieve, out_put, args_muscle_p,
                                args_thread)

    out_concat = cocat_path(out_alg)

    # set default trim by gblocks if not specify trimal
    if args_trimal:
        out_f2p = dotrimal(out_concat, args_trimal_p)
    elif args_gblocks:
        out_gblock = dogblocks(out_concat, args_gblocks_p)
        out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        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_ehcp(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 ehcp method'''
    hcp_input, recovery_dic = checkKeggOrganism(in_put)
    out_retrieve = doretrieve(hcp_input, out_put)
    if not recovery_dic == {}:
        recovery(out_retrieve,recovery_dic)
    retrieve_pro = os.listdir(out_retrieve)
    for reline in retrieve_pro:
        fw_name = os.path.join(out_retrieve, reline)
        fr_name = os.path.join(args_extenddata, reline)
        fw = open(fw_name, 'ab')
        with open(fr_name) as fr:
            for line in fr:
                fw.write(line)
        fw.close()

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

    out_concat = cocat_path(out_alg)

    # set default trim by gblocks if not specify trimal
    if args_trimal:
        out_f2p = dotrimal(out_concat, args_trimal_p)
    elif args_gblocks:
        out_gblock = dogblocks(out_concat, args_gblocks_p)
        out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        doraxml(out_f2p, out_put, args_raxml_p, args_thread)
示例#4
0
def build_hcp(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 hcp method'''
    out_retrieve = in_put
    # set default aligned by muscle if not specify clustalw
    if args_clustalw:
        out_alg = doclustalw_file(out_retrieve, out_put, args_clustalw_p)
    elif args_muscle:
        out_alg = domuscle_file(out_retrieve, out_put, args_muscle_p)
    out_concat = cocat_path(out_alg)
    out_gblock = dogblocks(out_concat, args_gblocks)
    out_f2p = fasta2phy(out_gblock)
    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_raxml:
        doraxml(out_f2p, out_put, args_raxml_p, args_thread)
示例#5
0
def starting_hcp(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_db):
    '''reconstruct phylogenetic tree by hcp method'''
    hcp_input, recovery_dic = checkKeggOrganism(in_put)
    start = time.time()
    out_retrieve = doretrieve(hcp_input, out_put, args_db)
    end = time.time()
    auto_build_log.info(
        'Retrieving HCP sequences used time: {} Seconds'.format(end - start))

    if not recovery_dic == {}:
        recovery(out_retrieve, recovery_dic)
    # set default aligned by muscle if not specify clustalw
    start2 = time.time()
    if args_clustalw:
        out_alg = doclustalw_file(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft_file(out_retrieve, out_put, args_mafft_p,
                               args_thread)
    elif args_muscle:
        out_alg = domuscle_file(out_retrieve, out_put, args_muscle_p,
                                args_thread)

    out_concat = cocat_path(out_alg)

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

    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        doraxml(out_f2p, out_put, args_raxml_p, args_thread)
    end2 = time.time()
    auto_build_log.info(
        'Contracting species tree used time: {} Seconds'.format(end2 - start2))
示例#6
0
def starting_hcp(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 hcp method'''
    hcp_input, recovery_dic = checkKeggOrganism(in_put)
    out_retrieve = doretrieve(hcp_input, out_put)
    if not recovery_dic == {}:
        recovery(out_retrieve,recovery_dic)
    # set default aligned by muscle if not specify clustalw
    if args_clustalw:
        out_alg = doclustalw_file(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft_file(out_retrieve, out_put, args_mafft_p)
    elif args_muscle:
        out_alg = domuscle_file(out_retrieve, out_put, args_muscle_p)

    out_concat = cocat_path(out_alg)

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

    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        doraxml(out_f2p, out_put, args_raxml_p, args_thread)
示例#7
0
def build_hcp(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 hcp 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_file(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft_file(out_retrieve, out_put, args_mafft_p,
                               args_thread)
    elif args_muscle:
        out_alg = domuscle_file(out_retrieve, out_put, args_muscle_p,
                                args_thread)

    out_concat = cocat_path(out_alg)

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

    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        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 build_hcp(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 hcp method'''
    out_retrieve = in_put
    # set default aligned by muscle if not specify clustalw or mafft
    if args_clustalw:
        out_alg = doclustalw_file(out_retrieve, out_put, args_clustalw_p)
    elif args_mafft:
        out_alg = domafft_file(out_retrieve, out_put, args_mafft_p)
    elif args_muscle:
        out_alg = domuscle_file(out_retrieve, out_put, args_muscle_p)

    out_concat = cocat_path(out_alg)

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

    # reconstruct tree
    if args_fasttree:
        doFastTree(out_f2p, out_put, args_fasttree_p, args_thread)
    elif args_iqtree:
        doiqtree(out_f2p, out_put, args_iqtree_p, args_thread)
    elif args_raxml:
        doraxml(out_f2p, out_put, args_raxml_p, args_thread)
from physpetool.convert.concatenate import cocat_path


cocat_path('/home/yangfang/physpetools/testdata/muscle_alignment_pro')
示例#10
0
from physpetool.convert.concatenate import cocat_path

cocat_path('/home/yangfang/physpetools/testdata/muscle_alignment_pro')