def trainAndTest(inputRoot, outputRoot, methodProtocol=conf.modelType, saveModelPath=None, isLastStep=False): sampledComplexesPath = os.path.join(inputRoot, "sampledInputs") wholeComplexesPath = os.path.join(inputRoot, "allInputs") predictOutputPath = os.path.join(outputRoot, methodProtocol) myMakeDir(predictOutputPath) numResults = len(os.listdir(predictOutputPath)) if numResults != 0: print("Warning: predictions outpath is not empty %s" % predictOutputPath) trainAndTester = pTrainTest.TrainAndTestWorker( trainDataPath=sampledComplexesPath, testPath=wholeComplexesPath, outputPath=predictOutputPath, nFolds=conf.N_KFOLD, isLastStep=isLastStep, saveModelFname=saveModelPath, verbose=True, numProc=conf.ncpu) trainAndTester.computeTrainAndTest() return predictOutputPath
def __init__(self, prefix, computedFeatsRootDir, areForTrainAndTest=True, boundAvailable=True, res2res_dist=6.0, statusManager=None): ''' :param prefix: str. An id for the complex :param computedFeatsRootDir: str. path where features will be stored :param areForTrainAndTest: boolean. True if ligand and receptor are posed in interacting coordinates and thus, we know the label. False if they are for prediction and thus, we cannot assign labels. :param: boundAvailable. True if there is a bound and unbound pdb for each complex. False otherwise :param res2res_dist: float. max distance between any heavy atoms of 2 amino acids to be considered as interacting (Angstrom) :param statusManager: class that implements .setStatus(msg) to communicate ''' ToolManager.__init__(self, computedFeatsRootDir, statusManager=statusManager) self.prefix = prefix self.areForTrainAndTest = areForTrainAndTest self.res2res_dist = res2res_dist self.boundAvailable = boundAvailable assert not ( boundAvailable == True and areForTrainAndTest == False ), "Error parameters in CMap: boundAvailable==True and areForTrainAndTest==False" self.ppb = PPBuilder( radius=200) # radius set to 200 to not worry about broken chains self.outPath = myMakeDir(computedFeatsRootDir, "common") self.outPathCM = myMakeDir(self.outPath, "contactMaps") self.outPathResDict = myMakeDir(self.outPath, "includedResidues") self.outPathNeigs = myMakeDir(self.outPath, "voroNeigs")
def __init__(self, computedFeatsRootDir, winSize): ''' :param computedFeatsRootDir: str. root path where results will be saved :param winSize: int>=1 or None. The size of the windows for sliding window if desired :param statusManager: class that implements .setStatus(msg) to communicate ''' SeqToolManager.__init__(self, computedFeatsRootDir, winSize) # self.psiBlastBin Inherited from ../../../Config # self.psiblastDB Inherited from ../../..Config # self.blastNThrs Inherited from ../../../Config self.consDbManager = PsiBlastManager.CONS_DB_MANAGER self.psiblastPathOutPath = myMakeDir(self.computedFeatsRootDir, "psiblast") self.pssmsPathRaw = myMakeDir(self.computedFeatsRootDir, "pssms/rawPssms") self.pssmsPathProc = myMakeDir(self.computedFeatsRootDir, "pssms/procPssms") if winSize: self.pssmsPathWindowed = myMakeDir( self.computedFeatsRootDir, "pssms/windowedPSSMs/wSize" + str(winSize)) else: self.pssmsPathWindowed = None
def __init__( self, computedFeatsRootDir, winSize, hhBlitsCMD_template="%(hhBlitsBinPath)s/hhblits -i %(fastaInFname)s -n 4 -d %(hhblitsDB)s " + "-oa3m %(aligsName)s -cpu %(hhBlitsNThrs)d -ohhm %(profileNameRaw)s -o /dev/null", statusManager=None): ''' :param computedFeatsRootDir: str. root path where results will be saved :param winSize: int>=1 or None. The size of the windows for sliding window if desired :param hhBlitsCMD_template: str. The shell command that will be used when computing hhblits in order to get the best correlated mutation scores :param statusManager: class that implements .setStatus(msg) to communicate ''' SeqToolManager.__init__(self, computedFeatsRootDir, winSize) # self.hhBlitsBinPath Inherited from ../../Config # self.hhBlitsDB Inherited from ../../Config # self.hhBlitsNThrs Inherited from ../../Config self.hhBlitsOut = myMakeDir(computedFeatsRootDir, "hhBlits") self.hhBlitsRaw = myMakeDir(self.hhBlitsOut, "rawHhBlits") self.hhBlitsProc = myMakeDir(self.hhBlitsOut, "procHhBlits") if winSize: self.hhBlitsPathWindowed = myMakeDir( self.hhBlitsOut, "windowedHhBlits/wSize" + str(winSize)) else: self.hhBlitsPathWindowed = None self.hhBlitsCMD_template = hhBlitsCMD_template
def __init__(self, rFname, lFname, computedFeatsRootDir=None, statusManager=None): ''' @param rFname: str. path to receptor pdb file @param lFname: str. path to ligand pdb file @param computedFeatsRootDir: str. path where features will be stored @param statusManager: class that implements .setStatus(msg) to communicate ''' Configuration.__init__( self) # Load configuration parameters such as path to programs self.statusManager = statusManager if computedFeatsRootDir != None: self.computedFeatsRootDir = computedFeatsRootDir self.computedFeatsRootDir = os.path.expanduser( self.computedFeatsRootDir ) #Creates root path where features will be saved myMakeDir(self.computedFeatsRootDir) self.rFname = rFname self.lFname = lFname if not os.path.isdir(self.computedFeatsRootDir): os.mkdir(self.computedFeatsRootDir)
def __init__( self, seqsManager, outPath, winSize, hhBlitsCMD_template="%(hhBlitsBinPath)s/hhblits -i %(fastaInFname)s -n 4 -d %(hhblitsDB)s " + "-oa3m %(aligsName)s -cpu %(psiBlastNThrs)d -ohhm %(profileNameRaw)s -o /dev/null" ): seqToolManager.__init__(self, seqsManager, outPath, winSize) ''' @param seqsManager: ..manageSeqs.seqsManager.SeqsManager @param outPath: str. path where hhblits results will be saved @param winSize: int. The size of sliding window ''' # self.hhBlits should be inherited from # self.hhBlitsBinPath Inherited from ../../Config # self.hhBlitsDB Inherited from ../../Config # self.psiBlastNThrs Inherited from ../../Config self.hhBlitsOut = myMakeDir(self.outPath, "hhBlits") self.hhBlitsRaw = myMakeDir(self.hhBlitsOut, "rawHhBlits") self.hhBlitsProc = myMakeDir(self.hhBlitsOut, "procHhBlits") self.hhBlitsPathWindowed = myMakeDir( self.hhBlitsOut, "windowedHhBlits/wSize" + str(winSize)) self.hhBlitsCMD_template = hhBlitsCMD_template
def main(resultsRoot=None, saveModelName=None): if resultsRoot is None: resultsRoot = os.path.expanduser(conf.resultsRootDir) computeFeatures() outpathCodif = codifyStep() myMakeDir(saveModelName) saveModelNameTmp = None if saveModelName is None else saveModelName + "." + conf.modelType isLastStep = True if USE_2_STEPS: isLastStep = False predictOutPath_1 = trainAndTest(outpathCodif, resultsRoot, methodProtocol=conf.modelType, saveModelPath=saveModelNameTmp, isLastStep=isLastStep) if USE_2_STEPS: outpathCodif = codifyStep(methodProtocol=conf.modelType + "_2", feedbackPaths=predictOutPath_1) saveModelNameTmp = None if saveModelName is None else saveModelName + "." + conf.modelType + "_2" predictOutPath_2 = trainAndTest(outpathCodif, resultsRoot, methodProtocol=conf.modelType + "_2", saveModelPath=saveModelNameTmp, isLastStep=True)
def __init__(self, prefix, computedFeatsRootDir=None, statusManager=None): ''' @prefix. An id for a complex. Pe. 1A2K. Extended prefix in seq step is prefix+chainType+chainId :param computedFeatsRootDir: str. path where features will be stored :param statusManager: class that implements .setStatus(msg) to communicate ''' FeaturesComputer.__init__(self, prefix=prefix, computedFeatsRootDir=computedFeatsRootDir, statusManager=statusManager) self.computedFeatsRootDir = myMakeDir(self.computedFeatsRootDir, "seqStep") self.SeqStructMapper = SeqStructMapper( computedFeatsRootDir=self.computedFeatsRootDir, statusManager=self.statusManager) self.seqsWorkingDir = self.SeqStructMapper.getSeqsOutDir() self.seqWindower = WindowSeqManager( self.computedFeatsRootDir, winSize=WIN_SIZE) #Object to launch and get sliding window of seqs self.conservationOutPath = myMakeDir(self.computedFeatsRootDir, "conservation") self.psiBlastManager = PsiBlastManager( self.conservationOutPath, winSize=WIN_SIZE) #Object to launch and process blast self.al2coManager = Al2coManager( self.conservationOutPath, winSize=None) #Object to launch and process al2co self.spider2Manager = Spider2Manager( self.computedFeatsRootDir, winSize=None) #Object to launch and process spyder2 self.singleChainOutPaths = [ self.seqsWorkingDir, self.psiBlastManager.getFinalPath(), self.al2coManager.getFinalPath(), self.seqWindower.getFinalPath() ] + [self.spider2Manager.getFinalPath()] self.pairwiseOutPaths = [] if self.useCorrMut: self.hHBlitsManager = HHBlitsManager( self.conservationOutPath, winSize=None, hhBlitsCMD_template=HHBLITS_CMD_TEMPLATE ) #Object to launch and process hhblits self.singleChainOutPaths.append(self.hHBlitsManager.getFinalPath()) self.corrMutManager = CorrMutManager( self.conservationOutPath) #Object to launch and process psicov self.pairwiseOutPaths.append(self.corrMutManager.getFinalPath()) self.singleChainOutPaths = filter(None, self.singleChainOutPaths) self.pairwiseOutPaths = filter(None, self.pairwiseOutPaths)
def __init__(self, rFname, lFname, computedFeatsRootDir=None, statusManager=None): ''' @param rFname: str. path to receptor pdb file @param lFname: str. path to ligand pdb file @param computedFeatsRootDir: str. path where features will be stored. If None they will be stored at default path (assigned in ../Config.py) @param statusManager: class that implements .setStatus(msg) to communicate ''' StructFeatComputer.__init__(self, rFname, lFname, computedFeatsRootDir, statusManager=statusManager) self.outPathRaw = myMakeDir(self.computedFeatsRootDir, "PSAIA/rawPSAIA") self.outPathProc = myMakeDir(self.computedFeatsRootDir, "PSAIA/procPSAIA") # self.listFileNameForPSAIA = os.path.join(self.psaiaRootDir, "%s_inputFile.fls") # self.configFileName= os.path.join(self.psaiaRootDir, "%s_psa_config.cfg") self.listFileNameForPSAIA = os.path.join(self.outPathRaw, "%s_inputFile.fls") self.configFileName = os.path.join(self.outPathRaw, "%s_psa_config.cfg") self.configForPSAIATemplate = '''analyze_bound: 1 analyze_unbound: 0 calc_asa: 1 z_slice: 0.25 r_solvent: 1.4 write_asa: 1 calc_rasa: 1 standard_asa: %s calc_dpx: 1 calc_cx: 1 cx_threshold: 10 cx_volume: 20.1 calc_hydro: 1 hydro_file: %s radii_filename: %s write_xml: 0 write_table: 1 output_dir: %s ''' % (os.path.join(self.psaiaRootDir, "amac_data/natural_asa.asa"), os.path.join(self.psaiaRootDir, "amac_data/hydrophobicity.hpb"), os.path.join(self.psaiaRootDir, "amac_data/chothia.radii"), self.outPathRaw)
def trainAndTest(inputRoot, outputRoot, stepType= conf.modelType, saveModelPath= None): trainAndTester= pTrainTest.TrainAndTest() sampledComplexesPath= os.path.join(inputRoot, "sampledInputs") wholeComplexesPath= os.path.join(inputRoot, "allInputs") predictOutputPath= os.path.join(outputRoot, stepType) myMakeDir(predictOutputPath) numResults= sum([1 for elem in os.listdir(predictOutputPath)]) if numResults!=0: print("Warning: predictions outpath is not empty %s"%predictOutputPath) trainAndTester.setParameters(sampledComplexesPath, wholeComplexesPath, predictOutputPath, numProc=conf.ncpu, nFolds=conf.N_KFOLD, verbose=True, saveModelFname=saveModelPath) trainAndTester.main() return predictOutputPath
def __init__(self, computedFeatsRootDir, winSize=None, statusManager=None): ''' :param computedFeatsRootDir: str. root path where results will be saved :param winSize: int>=1 or None. The size of the windows for sliding window if desired :param statusManager: class that implements .setStatus(msg) to communicate ''' SeqToolManager.__init__(self, computedFeatsRootDir, winSize) self.al2coOutPath = myMakeDir(self.computedFeatsRootDir, "al2co") if winSize: self.al2coPathWindowed = myMakeDir(self.computedFeatsRootDir, "al2co_wSize" + str(winSize)) else: self.al2coPathWindowed = None
def __init__(self, computedFeatsRootDir, winSize=None, statusManager=None): ''' :param computedFeatsRootDir: str. root path where results will be saved :param winSize: int>=1 or None. The size of the windows for sliding window if desired :param statusManager: class that implements .setStatus(msg) to communicate ''' SeqToolManager.__init__(self, computedFeatsRootDir, winSize) # self.spider2PyScript inherited from Config.py self.spider2OutPath = myMakeDir(self.computedFeatsRootDir, "SPIDER2_predAsaSS") if winSize: self.spider2PathWindowed = myMakeDir( self.computedFeatsRootDir, "spyder2_wSize" + str(winSize)) else: self.spider2PathWindowed = None
def __init__(self, rFname, lFname, computedFeatsRootDir= None, statusManager=None): ''' @param rFname: str. path to receptor fasta file @param lFname: str. path to ligand fasta file @param computedFeatsRootDir: str. path where features will be stored @param statusManager: class that implements .setStatus(msg) to communicate ''' SeqFeatComputer.__init__(self, rFname, lFname, computedFeatsRootDir, statusManager=statusManager) # at this point: computedFeatsRootDir= /path_to_computedFeatsRootDir/ # self.computedFeatsRootDir= /path_to_computedFeatsRootDir/seqStep This will be overrode self.outPath= myMakeDir(computedFeatsRootDir, "common/contactMaps") self.prefixR= os.path.split(rFname)[1].split(".")[0].split("_")[0] self.prefixL= os.path.split(lFname)[1].split(".")[0].split("_")[0] if self.prefixR == self.prefixL: self.prefix= self.prefixR else: if "<" in self.prefixL: raise FeatureComputerException("Error. Partner 1 fasta file %s must not contain '<' or '>' character"%lFname) if ">" in self.prefixR: raise FeatureComputerException("Error. Partner 1 fasta file %s must not contain '<' or'>' character"%rFname) self.prefixR= self.getExtendedPrefix(rFname) self.prefixL= self.getExtendedPrefix(lFname) self.prefix= self.prefixL+"<->"+self.prefixR self.outName= os.path.join(self.outPath,self.prefix+".cMap.tab") self.computeFun= self.contactMapOneComplex
def __init__(self, computedFeatsRootDir): ''' :param outPath: str. path where corrMut scores will be saved ''' CorrMutGeneric.__init__(self, computedFeatsRootDir) self.corrMutOutPath = myMakeDir(computedFeatsRootDir, "corrMut") self.featName = "psicov"
def __init__(self, prefix, computedFeatsRootDir=None, methodProtocol="struct", areForTrainAndTest=False, boundAvailable=False, statusManager=None): ''' :param prefix: str. Id for a given complex :param computedFeatsRootDir: str. Path where features files will be saved. By default it uses Config.py DEFAULT_PARAMETERS["computedFeatsRootDir"] will be used as out_path :param methodProtocol: str. "seq" if just sequential features will be used; "struct" if sequential and structural features will be used. "mixed" behaves equally than struct :param areForTrainAndTest: boolean. True if ligand and receptor are in interacting coordinates and thus, contact maps are needed to be computed in order to perform evaluation. False if ligand and receptor coordinates are not related and thus, evaluation does not makes sense. :param: boundAvailable. True if there is a bound and unbound pdb for each complex. False otherwise :param statusManager: class that implements .setStatus(msg) to communicate ''' FeaturesComputer.__init__(self, prefix, computedFeatsRootDir, statusManager=statusManager) if methodProtocol == "mixed": methodProtocol = "struct" self.methodProtocol = methodProtocol self.areForTrainAndTest = areForTrainAndTest self.boundAvailable = boundAvailable assert self.methodProtocol in ["seq", "struct"], 'Error methodProtocol in computeFeaturesAllPdbsOneDir ' +\ ' must be "seq", "struct", or "mixed" found -> %s'%(methodProtocol) self.computedFeatsRootDir = os.path.expanduser( self.computedFeatsRootDir ) #Creates root path where features will be saved self.computedFeatsRootDir = myMakeDir(self.computedFeatsRootDir)
def __init__(self, computedFeatsRootDir, statusManager=None): ''' :param computedFeatsRootDir: str. path where corrMut scores will be saved ''' CorrMutGeneric.__init__(self, computedFeatsRootDir, statusManager) self.corrMutOutPath = myMakeDir(computedFeatsRootDir, "corrMut") self.featName = "ccmPred"
def __init__(self, seqsManager, outPath, winSize): seqToolManager.__init__(self, seqsManager, outPath, winSize) ''' @param seqsManager: ..manageSeqs.seqsManager.SeqsManager @param outPath: str. root path where pssm results will be saved (./procPssms, ./rawPssms ./windowedPSSMs/winSize%d) @param winSize: int. The size of sliding window ''' # self.psiBlastBin Inherited from ../../../Config # self.psiblastDB Inherited from ../../..Config # self.blastNThrs Inherited from ../../../Config self.consDbManager = ConsDbManager() self.psiblastPathOutPath = myMakeDir(self.outPath, "psiblast") self.pssmsPathRaw = myMakeDir(self.outPath, "pssms/rawPssms") self.pssmsPathProc = myMakeDir(self.outPath, "pssms/procPssms") self.pssmsPathWindowed = myMakeDir( self.outPath, "pssms/windowedPSSMs/wSize" + str(winSize))
def __init__(self, rFname, lFname, computedFeatsRootDir=None, winSize=11, rPdbId=None, lPdbId=None, useCorrMut=False, statusManager=None): ''' @param rFname: str. path to receptor pdb file or fasta file @param lFname: str. path to ligand pdb file or fasta file @param computedFeatsRootDir: str. path where features will be stored. If None they will be stored at default path (assigned in ../Config.py) @param winSize: int. The size of the window that will be computed with the sequential features. @param rPdbId: str. pdbId of receptor in order to query 3dCons. If None, psiblast will be launched directly @param lPdbId: str. pdbId of receptor in order to query 3dCons. If None, psiblast will be launched directly @param useCorrMut: boolean. True if corrMuts wanted to be used @param statusManager: class that implements .setStatus(msg) to communicate ''' SeqFeatComputer.__init__(self, rFname, lFname, computedFeatsRootDir, statusManager=statusManager) ''' computedFeatsRootDir=/path/to...computedFeatsRootDir/ at this point self.computedFeatsRootDir=/path/to...computedFeatsRootDir/seqStep ''' conservationOutPath = myMakeDir(self.computedFeatsRootDir, "conservation") self.seqsManager = SeqsManager(rFname, lFname, computedFeatsRootDir) self.seqsManager.computeFun() #Extracts sequences from pdb files self.seqsWorkingDir = self.seqsManager.getSeqsOutDir() self.useCorrMut = useCorrMut self.lPdbId = lPdbId self.rPdbId = rPdbId self.psiBlastManager = PsiBlastManager( self.seqsManager, conservationOutPath, winSize) #Object to launch and process blast self.al2coManager = Al2coManager( self.seqsManager, conservationOutPath, None) #Object to launch and process al2co if self.useCorrMut: self.hHBlitsManager = HHBlitsManager( self.seqsManager, conservationOutPath, winSize, HHBLITS_CMD_TEMPLATE) #Object to launch and process hhblits self.corrMutManager = CorrMutManager( self.seqsManager, conservationOutPath) #Object to launch and process psicov self.spider2Manager = Spider2Manager( self.seqsManager, self.computedFeatsRootDir, None) #Object to launch and process spider2
def __init__(self, seqsManager, outPath): ''' @param seqsManager: ..manageSeqs.seqsManager.SeqsManager @param outPath: str. path where corrMut scores will be saved ''' seqToolManager.__init__(self,seqsManager, outPath, None) self.seqsManager= seqsManager self.corrMutOutPath= myMakeDir(outPath,"corrMut")
def __init__(self, rFname, lFname, computedFeatsRootDir=None): ''' @param rFname: str. path to receptor pdb or fasta file @param lFname: str. path to ligand pdb or fasta file @param computedFeatsRootDir: str. path where features will be stored. If None they will be stored at default path (assigned in ../Config.py) ''' SeqFeatComputer.__init__(self, rFname, lFname, computedFeatsRootDir) self.outPath = myMakeDir(self.computedFeatsRootDir, "extractedSeqs") self.fastaOutDir = myMakeDir(self.outPath, "seqsData") self.seqToStructDir = myMakeDir(self.outPath, "seqToStructMap") self.parser = PDBParser(QUIET=True) self.seqsDict = {} self.seqToStruct = {} self.structToSeq = {} self.seqToStructFnames = {}
def __init__(self, computedFeatsRootDir, statusManager= None): ''' :param computedFeatsRootDir: str. path where features will be stored. If None they will be stored at default path (assigned in ../Config.py) :param statusManager: class that implements .setStatus(msg) to communicate ''' StructToolManager.__init__(self, computedFeatsRootDir, statusManager) self.outPath= myMakeDir(self.computedFeatsRootDir, "halfSphereExpos")
def __init__(self, computedFeatsRootDir, winSize, statusManager=None): ''' :param computedFeatsRootDir: str. root path where results will be saved :param winSize: int>=1 or None. The size of the windows for sliding window if desired :param statusManager: class that implements .setStatus(msg) to communicate ''' assert not winSize is None and winSize >= 1, "Error, winSize must be greater or equal to one for WindowSeqManager" SeqToolManager.__init__(self, computedFeatsRootDir, winSize) self.outPath = myMakeDir(self.computedFeatsRootDir, "slidingWinSeq" + str(winSize))
def __init__(self, seqsManager, outPath): ''' @param seqsManager: ..manageSeqs.seqsManager.SeqsManager @param outPath: str. path where corrMut scores will be saved ''' CorrMutGeneric.__init__(self, seqsManager, outPath) self.seqsManager = seqsManager self.corrMutOutPath = myMakeDir(outPath, "corrMut") self.featName = "ccmPred"
def __init__(self, rFname, lFname, computedFeatsRootDir= None, statusManager=None): ''' @param rFname: str. path to receptor pdb file @param lFname: str. path to ligand pdb file @param computedFeatsRootDir: str. path where features will be stored @param statusManager: class that implements .setStatus(msg) to communicate ''' FeaturesComputer.__init__(self, rFname, lFname, computedFeatsRootDir, statusManager=statusManager) self.computeFun= self.computeOneComplex self.computedFeatsRootDir= myMakeDir(self.computedFeatsRootDir, "structStep")
def __init__(self, seqsManager, outPath, winSize): ''' @param seqsManager: ..manageSeqs.seqsManager.SeqsManager @param outPath: str. path where predictions will be saved @param winSize: int. The size of sliding window NOT USED ''' seqToolManager.__init__(self, seqsManager, outPath, winSize) # self.spider2PyScript inherited in Config.py self.spider2OutPath= myMakeDir(self.outPath,"SPIDER2")
def __init__(self, seqsManager, outPath, winSize): ''' @param seqsManager: ..manageSeqs.seqsManager.SeqsManager @param outPath: str. path where al2co scores will be saved @param winSize: int. The size of sliding window NOT USED ''' seqToolManager.__init__(self, seqsManager, outPath, winSize) self.al2coPerlScript = os.path.join(self.al2coRootDir, "get_al2co_scores.pl") self.al2coOutPath = myMakeDir(self.outPath, "al2co")
def __init__(self, computedFeatsRootDir, statusManager=None): ''' :param computedFeatsRootDir: str. root path where results will be saved :param statusManager: class that implements .setStatus(msg) to communicate ''' SeqToolManager.__init__(self, computedFeatsRootDir, winSize=None, statusManager=statusManager) self.outPath = myMakeDir(self.computedFeatsRootDir, "extractedSeqs") self.fastaOutDir = myMakeDir(self.outPath, "seqsData") self.seqToStructDir = myMakeDir(self.outPath, "seqToStructMap") self.seqsDict = {} self.seqToStruct = {} self.structToSeq = {} self.seqToStructFnames = {} self.seqToRefSeq = {} self.refSeqToSeq = {} self.currentSeq = {}
def __init__(self, computedFeatsRootDir, statusManager=None): ''' :param computedFeatsRootDir: str. root path where results will be saved :param winSize: int>=1 or None. The size of the windows for sliding window if desired :param statusManager: class that implements .setStatus(msg) to communicate ''' SeqToolManager.__init__(self, computedFeatsRootDir, None, statusManager) self.corrMutOutPath = myMakeDir(computedFeatsRootDir, "corrMut") self.chainsL = {} self.chainsR = {}
def __init__(self, rFname, lFname, computedFeatsRootDir=None, boundAvailable=True, res2res_dist=6.0, isForPrediction=False, statusManager=None): ''' @param rFname: str. path to receptor pdb file @param lFname: str. path to ligand pdb file @param computedFeatsRootDir: str. path where features will be stored @param boundAvailable: bool. True if bound structures are available. False otherwise. Bound structures must be located at the same path that unbound structures and need to be named as in the following example: 1A2K_l_u.pdb 1A2K_r_b.pdb @param res2res_dist: float. max distance between any heavy atoms of 2 amino acids to be considered as interacting (Amstrongs) @param isForPrediction: bool. False to compute contacts between amino acids, True otherwise. Positive contacts will be tag as 1, negative as -1. If True, all amino acids will have as tag np.nan @param statusManager: class that implements .setStatus(msg) to communicate ''' FeaturesComputer.__init__(self, rFname, lFname, computedFeatsRootDir) self.prefixR = os.path.split(rFname)[1].split(".")[0].split("_")[0] self.prefixL = os.path.split(lFname)[1].split(".")[0].split("_")[0] if self.prefixR == self.prefixL: self.prefix = self.prefixR else: if "<" in self.prefixL: raise FeatureComputerException( "Error. Ligand pdbFile name %s must not contain '<' or '>' character" % lFname) if ">" in self.prefixR: raise FeatureComputerException( "Error. Receptor pdbFile name %s must not contain '<' or'>' character" % rFname) self.prefixR = self.getExtendedPrefix(rFname) self.prefixL = self.getExtendedPrefix(lFname) self.prefix = self.prefixL + "<->" + self.prefixR self.isForPrediction = isForPrediction self.res2res_dist = res2res_dist self.boundAvailable = boundAvailable self.outPath = myMakeDir(self.computedFeatsRootDir, "common/contactMaps") self.outName = os.path.join(self.outPath, self.prefix + ".cMap.tab") self.parser = PDBParser(QUIET=True) # self.ppb=PPBuilder( radius= 200) # To not worry for broken chains self.ppb = CaPPBuilder() self.computeFun = self.contactMapOneComplex
def __init__(self, rFname, lFname, computedFeatsRootDir=None, statusManager=None): ''' @param rFname: str. path to receptor pdb file @param lFname: str. path to ligand pdb file @param computedFeatsRootDir: str. path where features will be stored @param statusManager: class that implements .setStatus(msg) to communicate ''' StructFeatComputer.__init__(self, rFname, lFname, computedFeatsRootDir, statusManager=statusManager) self.outPathRaw = myMakeDir(self.computedFeatsRootDir, "DSSP/rawDSSP") self.outPathProc = myMakeDir(self.computedFeatsRootDir, "DSSP/procDSSP") self.dsspBinPath = os.path.join(self.dsspRootDir, "mkdssp")