Example #1
0
File: main.py Project: ABorrel/LSRs
def applyTMAlign (substruct):

    p_dir_dataset = pathManage.dataset(substruct)
    l_folder = listdir(p_dir_dataset)

    for ref_folder in l_folder:
        if len (ref_folder) != 4:
            continue
        l_pdbfile = listdir(p_dir_dataset + ref_folder + "/")
        p_pdb_ref = pathManage.findPDBRef(p_dir_dataset + ref_folder + "/")


        for pdbfile in l_pdbfile:
            # try if PDB not ligand
            if len(pdbfile.split ("_")[0]) != 4 or not search (".pdb", pdbfile):
                continue
            # same alignment
            elif p_dir_dataset + ref_folder + "/" + pdbfile == p_pdb_ref:
                continue
            else:
                p_file_pdb = p_dir_dataset + ref_folder + "/" + pdbfile
                p_dir_align = pathManage.alignmentOutput(substruct + "/" + p_pdb_ref.split ("/")[-1][:-4] + "__" + p_file_pdb.split ("/")[-1][:-4])

                # superimpose
                runOtherSoft.runTMalign(p_file_pdb, p_pdb_ref, p_dir_align)
    return 1
Example #2
0
def applyTMAlign(substruct):

    p_dir_dataset = pathManage.dataset(substruct)
    l_folder = listdir(p_dir_dataset)

    for ref_folder in l_folder:
        if len(ref_folder) != 4:
            continue
        l_pdbfile = listdir(p_dir_dataset + ref_folder + "/")
        p_pdb_ref = pathManage.findPDBRef(p_dir_dataset + ref_folder + "/")

        for pdbfile in l_pdbfile:
            # try if PDB not ligand
            if len(pdbfile.split("_")[0]) != 4 or not search(".pdb", pdbfile):
                continue
            # same alignment
            elif p_dir_dataset + ref_folder + "/" + pdbfile == p_pdb_ref:
                continue
            else:
                p_file_pdb = p_dir_dataset + ref_folder + "/" + pdbfile
                p_dir_align = pathManage.alignmentOutput(
                    substruct + "/" + p_pdb_ref.split("/")[-1][:-4] + "__" +
                    p_file_pdb.split("/")[-1][:-4])

                # superimpose
                runOtherSoft.runTMalign(p_file_pdb, p_pdb_ref, p_dir_align)
    return 1
Example #3
0
def applyTMAlignList(l_pr_ref, pr_out):

    pathManage.generatePath(pr_out)
    nb_pr_ref = len(l_pr_ref)
    d_out = {}
    i = 0
    while i < nb_pr_ref:
        j = i + 1
        PDB1 = l_pr_ref[i].split("/")[-1][0:4]
        # print PDB1

        while j < nb_pr_ref:
            PDB2 = l_pr_ref[j].split("/")[-1][0:4]
            # folder TM align
            pr_alignement = pr_out + PDB1 + "__" + PDB2 + "/"
            #print pr_alignement
            #print PDB1,i, PDB2,j
            #print l_pr_ref[i]
            # RUN
            out_file = runOtherSoft.runTMalign(l_pr_ref[i], l_pr_ref[j],
                                               pr_alignement)
            # clean folders -> pb with several run -> clean too fast -> try / except
            try:
                CleanResultTMalign(pr_alignement)
            except:
                pass
            # parse result
            if not PDB1 in d_out.keys():
                if not PDB2 in d_out.keys():
                    d_out[PDB1] = {}
                    d_out[PDB1][PDB2] = parseTMalign.parseOutputTMalign(
                        out_file[-1])
                else:
                    d_out[PDB2][PDB1] = {}
                    d_out[PDB2][PDB1] = parseTMalign.parseOutputTMalign(
                        out_file[-1])
            else:
                d_out[PDB1][PDB2] = {}
                d_out[PDB1][PDB2] = parseTMalign.parseOutputTMalign(
                    out_file[-1])
            j = j + 1
        i = i + 1

    return d_out
Example #4
0
def applyTMAlignList (l_pr_ref, pr_out):
    
    
    pathManage.generatePath(pr_out)
    nb_pr_ref = len (l_pr_ref)
    d_out = {}
    i = 0
    while i < nb_pr_ref : 
        j = i + 1
        PDB1 = l_pr_ref[i].split ("/")[-1][0:4]
        # print PDB1
    
        while j < nb_pr_ref :
            PDB2 =  l_pr_ref[j].split ("/")[-1][0:4]
            # folder TM align
            pr_alignement = pr_out + PDB1 + "__" + PDB2 + "/"
            #print pr_alignement
            #print PDB1,i, PDB2,j
            #print l_pr_ref[i]
            # RUN
            out_file = runOtherSoft.runTMalign(l_pr_ref[i], l_pr_ref[j], pr_alignement)
            # clean folders -> pb with several run -> clean too fast -> try / except
            try : CleanResultTMalign (pr_alignement)
            except : pass
            # parse result
            if not PDB1 in d_out.keys () : 
                if not PDB2 in d_out.keys () : 
                    d_out[PDB1] = {}
                    d_out[PDB1][PDB2] = parseTMalign.parseOutputTMalign(out_file[-1])
                else : 
                    d_out[PDB2][PDB1] = {}
                    d_out[PDB2][PDB1] = parseTMalign.parseOutputTMalign(out_file[-1])
            else : 
                d_out[PDB1][PDB2] = {}
                d_out[PDB1][PDB2] = parseTMalign.parseOutputTMalign(out_file[-1])
            j = j + 1
        i = i + 1
    
    return d_out