Esempio n. 1
0
    def testStudyVariance(self):
        alnFileName = "../../alignmentFiles/mmult.list-FINAL.aln"
        workingDirectory = "../../alignmentFiles/"
        resultsFileName2 = "../../alignmentFiles/results2.results"
        generateMultipleAlignment.getResidues(0.8, resultsFileName2, alnFileName, workingDirectory, False, True, False)
        AtomicresultsFileName = "../../alignmentFiles/results2.Atomic"
        generateMultipleAlignment.composeAtomicMatrix(resultsFileName2, AtomicresultsFileName)
        filteredAtomicMatrixFileName = "../../alignmentFiles/filteredResults2.Atomic"
        generateMultipleAlignment.filterAtomicMatrix(AtomicresultsFileName, filteredAtomicMatrixFileName)
        caMatrixFileName = "../../alignmentFiles/filteredResults2.Atomic"
        dimensions = generateMultipleAlignment.getDimensions(caMatrixFileName)
        (mask, matrix) = svdAnalysis.loadCAmatrix(caMatrixFileName, dimensions)
        (caMatrix, caMask) = svdAnalysis.getCovarianceMatrix(mask, matrix)
        (atoms_variance, atoms_variance_mask) = svdAnalysis.getAtomsVariance(caMatrix, caMask)
        (max, min, mean, normalizedAtoms) = svdAnalysis.atoms_variance_statistics(atoms_variance, atoms_variance_mask)
        print ("max %f \n" % (max,))
        print ("min %f \n" % (min,))
        print ("mean %f \n" % (mean,))
        print normalizedAtoms

        print "\n\n"
        workingDirectory = "../../alignmentFiles/"
        varianceFileName = workingDirectory + "variance.atomic"
        maskFileName = workingDirectory + "variance_mask.atomic"
        svdAnalysis.serializeAtomsVariance(atoms_variance, atoms_variance_mask, varianceFileName, maskFileName)
        (atoms_variance, atoms_variance_mask) = svdAnalysis.encarnateAtomsVariance(varianceFileName, maskFileName)
        assert 30 == len(atoms_variance[0])
        for variance in atoms_variance[0]:
            print ("%3.f \n" % (variance,))
Esempio n. 2
0
 def testGlobalReal(self):
     alnFileName = "../../alignmentFiles/mmult3.aux"
     workingDirectory = "../../alignmentFiles/"
     resultsFileName2 = "../../alignmentFiles/results2.results"
     generateMultipleAlignment.getResidues(0.4, resultsFileName2, alnFileName, workingDirectory, False, True, False)
     AtomicresultsFileName = "../../alignmentFiles/results2.Atomic"
     generateMultipleAlignment.composeAtomicMatrix(resultsFileName2, AtomicresultsFileName)
     filteredAtomicMatrixFileName = "../../alignmentFiles/filteredResults2.Atomic"
     generateMultipleAlignment.filterAtomicMatrix(AtomicresultsFileName, filteredAtomicMatrixFileName)
     caMatrixFileName = "../../alignmentFiles/filteredResults2.Atomic"
     dimensions = generateMultipleAlignment.getDimensions(caMatrixFileName)
     print "dimensions\n"
     print ("%d %d \n" % (dimensions[0], dimensions[1]))
     (mask, matrix) = svdAnalysis.loadCAmatrix(caMatrixFileName, dimensions)
     (caMatrix, caMask) = svdAnalysis.getCovarianceMatrix(mask, matrix)
     print ("matrix.shape %d %d" % (caMatrix.shape[0], caMatrix.shape[1]))
     maskFileName = workingDirectory + "mask.atomic"
     matrixFileName = workingDirectory + "matrix.atomic"
     svdAnalysis.serializeCAMaskAndCAMatrix(mask, matrix, maskFileName, matrixFileName)
     realCAMatrixFileName = workingDirectory + "caMatrix.atomic"
     realCAMaskFileName = workingDirectory + "caMask.atomic"
     svdAnalysis.serializeCAMaskAndCAMatrix(caMask, caMatrix, realCAMaskFileName, realCAMatrixFileName)
Esempio n. 3
0
 def __load_variability_data(self, minimumPercentage):
     """
     __alphaCarbonsFileName  where to write the aligned C_alphas for each pdb.
     __alnFileName           the alignment filename. No need to be already formatted 
     __workingDirectory      where the pdbs are stored
     onlyBackbone          select only the backbone. Default False
     onlyAlphaCarbon       select only the alphaCarbons. Default True. Consider that all the latter programs work over this option and no other!!!!
     
     self.removedLines contains the removed lines, that is if a residue position is not aligned over a percentage for all
     the pdbs, this line is removed, and its order is this array        
     """
     self.__mmult = generateMultipleAlignment.getResidues(minimumPercentage, self.__alphaCarbonsFileName, self.__alnFileName, 
                                            self.__workingDirectory, False, True, False)
     
     generateMultipleAlignment.composeAtomicMatrix(self.__alphaCarbonsFileName, self.__rawAtomicMatrixFileName)
     self.removedLines = generateMultipleAlignment.filterAtomicMatrix(self.__rawAtomicMatrixFileName, self.__filteredAtomicMatrixFileName)
     self.dimensions   = generateMultipleAlignment.getDimensions(self.__filteredAtomicMatrixFileName)