Esempio n. 1
0
for pdd in pdbList:
    print(pdd)
print('*****************\n')
#This is all the data we are going to be looking at
geoList = [
    'N:N+1', 'TAU', 'PSI', 'PHI', 'N:C', 'CA:C', 'C:O', 'N:CA', 'C-1:N',
    'C:N+1', 'OMEGA', 'CA:C:O:N+1', 'O:N+1', 'CA:O', 'CA:N+1', 'CA:C:N+1',
    'C-1:N:CA'
]
hueList = ['aa', 'rid', 'bfactor', 'pdbCode', 'bfactorRatio', 'disordered']

if SaveAgain:
    print('Creating CSV files anew')

    #Load original csv unrestricted on occupant and bfactor
    pdbmanager = geopdb.GeoPdbs(pdbOriginalPath, edDataPath, False, False,
                                True)
    georep = psu.GeoReport(pdbList,
                           pdbOriginalPath,
                           edDataPath,
                           printPath,
                           ed=False,
                           dssp=False,
                           includePdbs=False,
                           keepDisordered=True)
    print('Create unrestricted csv')
    dataUnrestricted = georep.getGeoemtryCsv(geoList, hueList, -1)
    dataUnrestricted.to_csv(printPath + "Results14_UnrestrictedStats.csv",
                            index=False)

    #Load good csv
    pdbmanager.clear()
Esempio n. 2
0
def createGeosFileOld(pdbSet, cutOff):
    print('Running CreateGeosFile on', pdbSet)

    setName = 'BEST'
    #pdbDataPath = 'F:/Code/ProteinDataFiles/pdb_out/NCACO_001_05/'
    pdbDataPath = 'F:/Code/ProteinDataFiles/pdb_out/' + pdbSet + '/'
    keepDisordered = False
    bFactorFactor = -1  #no need to restrict on bfactor and electron density but we do not want occupant verions

    if pdbSet == 'RESTRICTED':
        pdbDataPath = 'F:/Code/ProteinDataFiles/pdb_data/'
        keepDisordered = False
        bFactorFactor = 1.3
    elif pdbSet == 'UNRESTRICTED':
        pdbDataPath = 'F:/Code/ProteinDataFiles/pdb_data/'
        keepDisordered = True
        bFactorFactor = -1

    edDataPath = 'F:/Code/ProteinDataFiles/ccp4_data/'
    printPath = 'F:/Code/BbkProject/PhDThesis/0.Papers/3.DefensibleGeometry/EvidencedSet/DataA/'

    #TIMER
    print('----------start report 14----------')
    startx = time.time()

    #This gets the list of pdbs
    pdbdata = pd.read_csv(
        '../../PdbLists/Pdbs_Evidenced.csv'
    )  # This is a list of pdbs <= 1.1A non homologous to 90%
    pdbListIn = pdbdata['PDB'].tolist()[0:]
    if cutOff > 0:
        pdbListIn = pdbdata['PDB'].tolist()[0:cutOff]

    pdbList = []
    for pdb in pdbListIn:
        import os.path
        if os.path.isfile((pdbDataPath + 'pdb' + pdb + '.ent').lower()):
            pdbList.append(pdb.lower())
        else:
            print('No file:', (pdbDataPath + 'pdb' + pdb + '.ent').lower())

    #Clear the pdb manager cache
    pdbmanager = geopdb.GeoPdbs(pdbDataPath, edDataPath, False, False,
                                keepDisordered)
    pdbmanager.clear()

    #This is all the data we are going to be looking at
    geoLists = []
    #geoLists.append(['TAU'])#for dssp from linux only
    #geoLists.append(['0', ['TAU']])
    #We currently have these
    geoLists.append(['1BOND', ['N:CA', 'CA:C', 'C:O', 'C-1:N', 'C:N+1']])
    geoLists.append([
        '2ANGS',
        ['TAU', 'C-1:N:CA', 'CA:C:N+1', 'CA:C:O', 'O:C:N+1', 'CA:C:N+1']
    ])
    geoLists.append(['3DIHS', ['PHI', 'PSI', 'OMEGA', 'CA-1:C-1:N:CA']])
    geoLists.append(['4DIST', ['N:N+1', 'N:C']])
    geoLists.append(['5HB', ['N:O-2', 'C:O-2', 'N:CA:C:O-2', 'N:CA:N+1:O-2']])
    geoLists.append(['6HB', ['N:O-3', 'C:O-3', 'N:CA:C:O-3', 'N:CA:N+1:O-3']])
    #geoLists.append(['9HBO', ['N:{O}','C:{O}','N:CA:C:{O}','N:CA:N+1:{O}']])

    #geoLists.append(['10CIS', ['CA-1:C-1:N:CA', 'CA-1:CA']])
    # geoLists.append(['7HB', ['N:O-4', 'C:O-4', 'N:CA:C:O-4', 'N:CA:N+1:O-4']])
    # geoLists.append(['8HB', ['N:O-5', 'C:O-5', 'N:CA:C:O-5', 'N:CA:N+1:O-5']])
    # Water
    #geoLists.append(['7WAT', ['N:HOH','C:HOH','N:CA:C:HOH','N:CA:N+1:HOH']])
    # Other!
    #geoLists.append(['8XTRA', ['N:HETATM']])

    hueList = ['aa', 'rid', 'bfactor', 'pdbCode', 'bfactorRatio', 'disordered']
    aas = ['ALL']

    print('Creating CSV files anew')
    for geoListT in geoLists:
        geoList = geoListT[1]
        set = geoListT[0]
        for aa in aas:
            tag = 'Set' + set + aa + '_' + pdbSet
            georep = psu.GeoReport(pdbList,
                                   pdbDataPath,
                                   edDataPath,
                                   printPath,
                                   ed=False,
                                   dssp=False,
                                   includePdbs=False,
                                   keepDisordered=keepDisordered)
            print('Create csv', pdbDataPath, geoList)
            dataUnrestricted = georep.getGeoemtryCsv(geoList,
                                                     hueList,
                                                     bFactorFactor,
                                                     allAtoms=True,
                                                     restrictedAa=aa)
            dataUnrestricted.to_csv(printPath + 'CsvGeos_' + setName + '_' +
                                    tag + '.csv',
                                    index=False)

    print('----------Finished----------')
    endx = time.time()
    time_diff = endx - startx
    timestring = str(int(time_diff / 60)) + "m " + str(int(
        time_diff % 60)) + "s"
    print(timestring)
Esempio n. 3
0
            calcList = [self.geoX, self.geoY]
        hueList = hues
        if hues == None:
            hueList = [self.hue]
        for rest in self.restrictions:
            if rest not in hueList:
                hueList.append(rest)

        dfs = []
        if self.parent != None:
<<<<<<< Updated upstream
=======

>>>>>>> Stashed changes
            from PsuGeometry import GeoPdb as geopdb
            pdbmanager = geopdb.GeoPdbs(self.parent.pdbDataPath, self.parent.edDataPath, self.parent.ed, self.parent.dssp)
            for pdb in self.parent.pdbCodes:
                apdb = pdbmanager.getPdb(pdb)
                data = apdb.getGeoemtryCsv(calcList, hueList)
                dfs.append(data)
            self.data = pd.concat(dfs, ignore_index=True)
        else:
            print('PSU: cannot create data, pass in report parent to plots')

    def applyRestrictions(self):
        # now the data can be restricted as per the restrictions, which is a dictionary of restrictions, eg aa:'THR,PRO'
        if len(self.restrictions)>0 and not self.data.empty:
            dfs = []
            for rest in self.restrictions:
                allowed = self.restrictions[rest]
                allows = allowed.split(',')
geoList = ['N:N+1','TAU','PSI']
hueList = ['aa', 'rid', 'bfactor']
aas = ['GLY']
###################################################################################
pdbDataPath = '/home/rachel/Documents/Bioinformatics/ProteinDataFiles/pdb_data/'
edDataPath = '/home/rachel/Documents/Bioinformatics/ProteinDataFiles/ccp4_data/'
printPath = '/home/rachel/Documents/Bioinformatics/ProteinDataFiles/results_psu/Paper02/'
if myWindowsLaptop:
    pdbDataPath = 'F:/Code/ProteinDataFiles/pdb_data/'
    edDataPath = 'F:/Code/ProteinDataFiles/ccp4_data/'
    printPath = 'F:/Code/ProteinDataFiles/results_psu/Paper02/'


###########################################################################################
georep = psu.GeoReport(pdbList, pdbDataPath, edDataPath, printPath, ed=False, dssp=False, includePdbs=True,keepDisordered=keepDisordered)
pdbmanager = geopdb.GeoPdbs(georep.pdbDataPath, georep.edDataPath, georep.ed, georep.dssp)

data = georep.getGeoemtryCsv(geoList, hueList,bfactorFactor)
#data = data.query('TAU > 100')
#data = data.query('TAU < 125')
dataPsiRange = data.query('PSI > -50')
dataPsiRange = dataPsiRange.query('PSI < 50')


#for pd in pdbList:
#    apdb = pdbmanager.getPdb(pd, True)
#    atomData = apdb.getDataFrame()
#    fullFileName = printPath + 'Results10_' + pd + '.csv'
#    atomData.to_csv(fullFileName, index=False)

for aa in aas:
Esempio n. 5
0
    def printReport(self, reportName,fileName):
        print('PSU: create report',reportName,'for',fileName)
        self.flush()

        printList = []
        if reportName == 'BackboneOutliers': # Sp2Planarity, DensityAtomCompare, OmegaCis
            atomData = self.getReportCsv(reportName)
            title = 'Backbone Outliers Report'
            cols = 3
            printList = []
            #printList.append(GeoQuery(['Bonds', atomData, 'C-1:N', 'N:CA','aa', '2FoFc', 'viridis_r', False, 0, 0])
            self.addScatter(data=atomData,geoX='C-1:N',geoY='N:CA',title='Bonds',ghost=True)
            self.addScatter(data=atomData, geoX='CA:C', geoY='C:N+1', title='Bonds',ghost=True)
            self.addScatter(data=atomData, geoX='C-1:N', geoY='C:N+1', title='Bonds',ghost=True)
            self.addScatter(data=atomData, geoX='C-1:N:CA', geoY='N:CA:C', title='Angles',ghost=True)
            self.addScatter(data=atomData, geoX='N:CA:C', geoY='CA:C:N+1', title='Angles',ghost=True)
            self.addScatter(data=atomData, geoX='C-1:N:CA', geoY='CA:C:N+1', title='Angles',ghost=True)
            self.printToHtml(title, cols, fileName)
        elif reportName == 'RachelsChoice' or reportName == 'RachelsChoiceNonXRay' :
            atomData = self.getReportCsv(reportName)
            # We want the dummy trace correlation plot so we can see if there are areas of interest
            title = "Rachel's Choice of Correlations"
            cols = 4
            printList = []

            densityHue = '2FoFc'
            if reportName == 'RachelsChoiceNonXRay':
                densityHue = 'bfactor'

            self.addScatter(geoX='C-1:N:CA:C', geoY='N:CA:C:N+1', title='', hue='dssp',palette='gist_rainbow',ghost=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='N:CA:C:N+1', title='', hue=densityHue, palette='cubehelix_r',ghost=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='N:CA:C:N+1', title='', hue='aa', palette='gist_rainbow',ghost=True,categorical=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='N:CA:C:N+1', title='', hue='pdbCode', palette='gist_rainbow',ghost=True,categorical=True)

            self.addScatter(geoX='N:CA:CB:CG', geoY='CA:CB:CG:CD', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='N:CA:CB:CG', geoY='CA:CB:CG:CD', title='', hue=densityHue, palette='cubehelix_r',ghost=True)
            self.addScatter(geoX='N:CA:CB:CG', geoY='CA:CB:CG:CD', title='', hue='aa', palette='gist_rainbow',ghost=True,categorical=True)
            self.addScatter(geoX='N:CA:CB:CG', geoY='CA:CB:CG:CD', title='', hue='pdbCode', palette='gist_rainbow',ghost=True,categorical=True)

            self.addScatter(geoX='N:CA', geoY='CA:C', title='', hue='dssp', palette='gist_rainbow',ghost=True)
            self.addScatter(geoX='N:CA', geoY='CA:C', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='N:CA', geoY='CA:C', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='N:CA', geoY='CA:C', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='CA:CA+1', geoY='CA-1:CA', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='CA:CA+1', geoY='CA-1:CA', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='CA:CA+1', geoY='CA-1:CA', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='CA:CA+1', geoY='CA-1:CA', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='N:CA:C', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='N:CA:C', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='N:CA:C', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='N:CA:C', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='N:O', geoY='CB:O', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='N:O', geoY='CB:O', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='N:O', geoY='CB:O', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='N:O', geoY='CB:O', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='N:CA:C:N+1', geoY='N:O', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='N:O', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='N:O', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='N:O', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='N:CA:C:N+1', geoY='CB:O', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='CB:O', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='CB:O', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='CB:O', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='N:CA:C:N+1', geoY='N:CA:C:O', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='N:CA:C:O', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='N:CA:C:O', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='N:CA:C:O', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='N:CA:C:N+1', geoY='CA-1:CA:CA+1', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='CA-1:CA:CA+1', title='', hue=densityHue, palette='cubehelix_r',ghost=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='CA-1:CA:CA+1', title='', hue='aa', palette='gist_rainbow',ghost=True,categorical=True)
            self.addScatter(geoX='N:CA:C:N+1', geoY='CA-1:CA:CA+1', title='', hue='pdbCode', palette='gist_rainbow',ghost=True,categorical=True)

            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:C', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:C', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:C', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:C', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:CB', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:CB', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:CB', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='C-1:N:CA:C', geoY='C-1:CB', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='CA-1:C-1:N:CA', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='CA-1:C-1:N:CA', title='', hue=densityHue, palette='cubehelix_r',ghost=True)
            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='CA-1:C-1:N:CA', title='', hue='aa', palette='gist_rainbow',ghost=True,categorical=True)
            self.addScatter(geoX='CA:C:N+1:CA+1', geoY='CA-1:C-1:N:CA', title='', hue='pdbCode', palette='gist_rainbow',ghost=True,categorical=True)

            self.addScatter(geoX='CA-2:CA-1:CA', geoY='CA:CA+1:CA+2', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='CA-2:CA-1:CA', geoY='CA:CA+1:CA+2', title='', hue=densityHue, palette='cubehelix_r',ghost=True)
            self.addScatter(geoX='CA-2:CA-1:CA', geoY='CA:CA+1:CA+2', title='', hue='aa', palette='gist_rainbow',ghost=True,categorical=True)
            self.addScatter(geoX='CA-2:CA-1:CA', geoY='CA:CA+1:CA+2', title='', hue='pdbCode', palette='gist_rainbow',ghost=True,categorical=True)

            self.addScatter(geoX='C-1:N:CA', geoY='CA:C:N+1', title='', hue='dssp', palette='gist_rainbow', ghost=True)
            self.addScatter(geoX='C-1:N:CA', geoY='CA:C:N+1', title='', hue=densityHue, palette='cubehelix_r', ghost=True)
            self.addScatter(geoX='C-1:N:CA', geoY='CA:C:N+1', title='', hue='aa', palette='gist_rainbow', ghost=True,categorical=True)
            self.addScatter(geoX='C-1:N:CA', geoY='CA:C:N+1', title='', hue='pdbCode', palette='gist_rainbow', ghost=True,categorical=True)

            self.printToHtml(title, cols, fileName)

        elif reportName == 'MainChainHistograms': # Sp2Planarity, DensityAtomCompare, OmegaCis
            atomData = self.getReportCsv(reportName)
            title = 'Main Chain Histograms'
            cols = 3
            printList = []

            self.addHistogram(data=atomData,geoX='C-1:N',title='C-1:N',hue='rid',ghost=True)
            self.addHistogram(data=atomData,geoX='N:CA',title='O:C:N+1',hue='rid',ghost=True)
            self.addHistogram(data=atomData,geoX='CA:C',title='N+1:C:CA',hue='rid',ghost=True)

            self.addHistogram(data=atomData, geoX='C:O', title='C:0', hue='rid',ghost=True)
            self.addHistogram(data=atomData, geoX='CA-1:CA', title='CA-1:CA', hue='rid',ghost=True)
            self.addHistogram(data=atomData, geoX='CA:CA+1', title='CA:CA+1', hue='rid',ghost=True)

            self.addHistogram(data=atomData, geoX='C-1:N:CA', title='Tau-1', hue='rid',ghost=True)
            self.addHistogram(data=atomData, geoX='N:CA:C', title='Tau', hue='rid',ghost=True)
            self.addHistogram(data=atomData, geoX='CA:C:N+1', title='Tau+1', hue='rid',ghost=True)

            self.addHistogram(data=atomData, geoX='C-1:N:CA:C', title='PHI', hue='rid',ghost=True)
            self.addHistogram(data=atomData, geoX='N:CA:C:N+1', title='PSI', hue='rid',ghost=True)
            self.addHistogram(data=atomData, geoX='CA:C:N+1:CA+1', title='AbsVal OMEGA', hue='rid', operation='ABS',ghost=True)

            self.printToHtml(title, cols, fileName)

        elif reportName == 'Sp2Planarity': # Sp2Planarity, DensityAtomCompare, OmegaCis
            atomData = self.getReportCsv(reportName)
            title = 'Sp2 Planarity'
            cols = 4
            printList = []
            self.addHistogram(data=atomData,geoX='N+1:O:C:CA',title='AbsVal Dihedral',hue='rid',operation='ABS')
            self.addHistogram(data=atomData,geoX='CA:C:O',title='CA:C:O',hue='rid')
            self.addHistogram(data=atomData,geoX='O:C:N+1',title='O:C:N+1',hue='rid')
            self.addHistogram(data=atomData,geoX='N+1:C:CA',title='N+1:C:CA',hue='rid')

            self.addScatter(data=atomData, geoX='N+1:O:C:CA', geoY='CA:C:O',hue='dssp')
            self.addScatter(data=atomData, geoX='N+1:O:C:CA', geoY='O:C:N+1')
            self.addScatter(data=atomData, geoX='N+1:O:C:CA', geoY='N+1:C:CA',hue='bfactor')
            self.addScatter(data=atomData, geoX='N+1:C:CA', geoY='O:C:N+1',hue='FoFc', palette='Spectral',centre=True)

            self.printToHtml(title, cols, fileName)

        elif reportName == 'DataPerPdb':
            pdbmanager = geopdb.GeoPdbs(self.pdbDataPath, self.edDataPath, self.ed, self.dssp)
            for pdb in self.pdbCodes:
                print('\tPSU:', reportName, 'for', pdb)
                apdb = pdbmanager.getPdb(pdb,True)
                atomData = apdb.getDataFrame()
                title = 'General Data Report'
                cols = 3
                self.addScatter(data=atomData, geoX='atomNo', geoY='aa', hue='aa', categorical=True,palette='gist_rainbow')
                self.addScatter(data=atomData, geoX='atomNo', geoY='dssp',hue= 'aa',categorical=True,palette='gist_rainbow')
                self.addScatter(data=atomData, geoX='2FoFc', geoY='bfactor',hue= 'element',palette='jet_r',categorical=True)
                self.addScatter(data=atomData, geoX='atomNo', geoY='bfactor',hue= 'element',palette='jet_r',categorical=True)
                self.addScatter(data=atomData, geoX='atomNo', geoY='2FoFc',hue='element',palette='jet_r',categorical=True)
                self.addScatter(data=atomData, geoX='atomNo', geoY='FoFc',hue='element',palette='jet_r',categorical=True)
                self.addScatter(data=atomData, geoX='x', geoY='y',hue='atomNo', palette='plasma_r')
                self.addScatter(data=atomData, geoX='y', geoY='z',hue='atomNo', palette='plasma_r')
                self.addScatter(data=atomData, geoX='z', geoY='x',hue='atomNo', palette='plasma_r')
                self.printToHtml(title, cols, fileName + '_' + apdb.pdbCode)

        elif reportName == 'Slow_DensityPointsPerPdb' or reportName == 'Slow_DensityPeaksPerPdb': # this can only be done per pdb
            for pdb in self.pdbCodes:
                pdbmanager = geopdb.GeoPdbs(self.pdbDataPath, self.edDataPath, self.ed, self.dssp)
                apdb = pdbmanager.getPdb(pdb,True)
                if apdb.hasDensity:
                    print('\tPSU:', reportName, 'for', apdb.pdbCode)
                    allPoints = True
                    maintitle = 'Density Points and Atoms Comparison'
                    if reportName == 'Slow_DensityPeaksPerPdb':
                        allPoints = False
                        maintitle = 'Density Peaks and Atoms Comparison'
                    peaksData = apdb.getStructureDensity(allPoints,10,self.pdbDataPath,self.edDataPath)
                    atomData = apdb.getDataFrame()
                    atomData['FoFc2'] = atomData['FoFc'] ** 2

                    cols = 3
                    printList = []
                    self.addScatter(data=peaksData, geoX='c', geoY='r', title='Density CR Fo',hue='Fo',palette='gist_gray_r')
                    self.addScatter(data=peaksData, geoX='r', geoY='s',title='Density RS Fo',hue='Fo',palette='gist_gray_r')
                    self.addScatter(data=peaksData, geoX='s', geoY='c',title='Density SC Fo',hue='Fo',palette='gist_gray_r')

                    self.addScatter(data=peaksData, geoX='c', geoY='r',title='Density CR Fo',hue='Fo',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='r', geoY='s',title='Density RS Fo',hue='Fo',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='s', geoY='c',title='Density SC Fo',hue='Fo',palette='cubehelix_r')

                    self.addScatter(data=peaksData, geoX='c', geoY='r',title='Density CR 2FoFC',hue='2FoFc',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='r', geoY='s',title='Density RS 2FoFC',hue='2FoFc',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='s', geoY='c',title='Density SC 2FoFC',hue='2FoFc',palette='cubehelix_r')

                    self.addScatter(data=peaksData, geoX='c', geoY='r',title='Density CR FC',hue='Fc',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='r', geoY='s',title='Density RS FC',hue='Fc',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='s', geoY='c',title='Density SC FC',hue='Fc',palette='cubehelix_r')

                    self.addScatter(data=peaksData, geoX='c', geoY='r',title='Density CR FoFC',hue='FoFc',palette='PiYG',centre=True)
                    self.addScatter(data=peaksData, geoX='r', geoY='s',title='Density RS FoFC',hue='FoFc',palette='PiYG',centre=True)
                    self.addScatter(data=peaksData, geoX='s', geoY='c',title='Density SC FoFC',hue='FoFc',palette='PiYG',centre=True)

                    self.addScatter(data=peaksData, geoX='x', geoY='y',title='Density XY Fo',hue='Fo',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='y', geoY='z',title='Density YZ Fo',hue='Fo',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='z', geoY='x',title='Density ZX Fo',hue='Fo',palette='cubehelix_r')

                    self.addScatter(data=peaksData, geoX='x', geoY='y',title='Density XY FoFC',hue='FoFc',palette='PiYG',centre=True)
                    self.addScatter(data=peaksData, geoX='y', geoY='z',title='Density YZ FoFC',hue='FoFc',palette='PiYG',centre=True)
                    self.addScatter(data=peaksData, geoX='z', geoY='x', title='Density ZX FoFC',hue='FoFc',palette='PiYG',centre=True)

                    self.addScatter(data=peaksData, geoX='x', geoY='y',title='Density XY 2FoFC',hue='2FoFc',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='y', geoY='z',title='Density YZ 2FoFC',hue='2FoFc',palette='cubehelix_r')
                    self.addScatter(data=peaksData, geoX='z', geoY='x',title='Density ZX 2FoFC',hue='2FoFc',palette='cubehelix_r')

                    self.addScatter(data=atomData, geoX='x', geoY='y',title='PDB XY 2FoFc',hue='2FoFc',palette='cubehelix_r')
                    self.addScatter(data=atomData, geoX='y', geoY='z',title='PDB YZ 2FoFc',hue='2FoFc',palette='cubehelix_r')
                    self.addScatter(data=atomData, geoX='z', geoY='x',title='PDB ZX 2FoFc',hue='2FoFc',palette='cubehelix_r')
                    self.addScatter(data=atomData, geoX='x', geoY='y',title='PDB XY Electrons',hue='electrons',palette='Spectral_r',categorical=True)
                    self.addScatter(data=atomData, geoX='y', geoY='z',title='PDB YZ Electrons',hue='electrons',palette='Spectral_r',categorical=True)
                    self.addScatter(data=atomData, geoX='z', geoY='x',title='PDB ZX Electrons',hue='electrons',palette='Spectral_r',categorical=True)
                    self.addScatter(data=atomData, geoX='x', geoY='y',title='PDB XY FoFc',hue='FoFc',palette='PiYG',centre=True)
                    self.addScatter(data=atomData, geoX='y', geoY='z',title='PDB YZ FoFc',hue='FoFc',palette='PiYG',centre=True)
                    self.addScatter(data=atomData, geoX='z', geoY='x',title='PDB ZX FoFc',hue='FoFc',palette='PiYG',centre=True)
                    self.addScatter(data=atomData, geoX='x', geoY='y',title='PDB XY bfactor',hue='bfactor',palette='cubehelix_r')
                    self.addScatter(data=atomData, geoX='y', geoY='z',title='PDB YZ bfactor',hue='bfactor',palette='cubehelix_r')
                    self.addScatter(data=atomData, geoX='z', geoY='x',title='PDB ZX bfactor',hue='bfactor',palette='cubehelix_r')
                    self.addScatter(data=atomData, geoX='x', geoY='y',title='PDB XY atom nos',hue='atomNo',palette='gist_ncar')
                    self.addScatter(data=atomData, geoX='y', geoY='z',title='PDB YZ atom nos',hue='atomNo',palette='gist_ncar')
                    self.addScatter(data=atomData, geoX='z', geoY='x',title='PDB ZX atom nos',hue='atomNo',palette='gist_ncar')
                    self.addScatter(data=atomData, geoX='x', geoY='y',title='PDB XY amino acids',hue='aa',palette='nipy_spectral',categorical=True)
                    self.addScatter(data=atomData, geoX='y', geoY='z',title='PDB YZ amino acids',hue='aa',palette='nipy_spectral',categorical=True)
                    self.addScatter(data=atomData, geoX='z', geoY='x',title='PDB ZX amino acids',hue='aa',palette='nipy_spectral',categorical=True)
                    self.addScatter(data=atomData, geoX='bfactor', geoY='2FoFc',title='PDB bfactor vs 2FoFc',hue='electrons',palette='viridis_r',categorical=True)
                    self.addScatter(data=atomData, geoX='Fc', geoY='Fo',title='PDB Fc vs Fc',hue='electrons',palette='viridis_r',categorical=True)
                    self.addScatter(data=atomData, geoX='electrons', geoY='2FoFc',title='PDB electrons vs 2FoFc',hue='element',palette='viridis_r',categorical=True)
                    self.addHistogram(data=atomData, geoX='aa',title='Amino Acids')
                    self.addHistogram(data=atomData, geoX='element',title='Atoms')
                    self.addHistogram(data=atomData, geoX='2FoFc',title='Peaks in 2FoFc')
                    self.printToHtml(maintitle, cols, fileName + '_' + apdb.pdbCode)
                else:
                    print('\tPSU:',apdb.pdbCode,'has no density matrix')
Esempio n. 6
0
 def addDataView(self, pdbCode, geoX, geoY, palette='viridis', hue='2FoFc', categorical=False, title='',centre=False,sort='ASC'):
     pdbmanager = geopdb.GeoPdbs(self.pdbDataPath, self.edDataPath, self.ed, self.dssp)
     apdb = pdbmanager.getPdb(pdbCode,True)
     df = apdb.getDataFrame()
     self.addScatter(data=df, geoX=geoX, geoY=geoY, title=title, hue=hue, palette=palette,categorical=categorical,centre=centre,sort=sort)