コード例 #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
ファイル: autobuild.py プロジェクト: genostack/physpetools
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
ファイル: buildtree.py プロジェクト: YulongNiu/physpetools
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
ファイル: autobuild.py プロジェクト: genostack/physpetools
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)