Exemple #1
0
def fibRename(request, chosenPDB):
    #get run number
    runnum=tagOutput(request)
    #get chosenPDB name
    name = removePath(chosenPDB)
    name = name[:-4]
    #add Rosettas silly suffix
    suffix = '_0001.pdb'
    PathtofibrilPDB = 'RUN' + runnum + '_' + name + suffix
    return PathtofibrilPDB
Exemple #2
0
def UsedParam(Qobject6):  #inputed object containing the chosen run number

    #special path for fibPDB output
    makestring = str(Qobject6.fibrilPDB)
    FIBspecialPath = '/media/' + makestring[25:]
    #special path for LL output
    makestring2 = str(Qobject6.LLoutputPic)
    LLspecialPath = '/media/' + makestring2[25:]
   
    #make dictionary of used parameters from the Results object
    used = {'ID': str(Qobject6.mostRes),
            'Run date':  str(Qobject6.timestamp),
            'PDB':  removePath(str(Qobject6.PDBused)),
            'Optional_exp_layerlines': removePath(str(Qobject6.experimentalData)),
            'Intensity file' : removePath(str(Qobject6.intensity)),
            'Turns':  str(Qobject6.turns),
            'Units' : str(Qobject6.units),
            'Rise' : str(Qobject6.rise),
            'Resolution (L)': str(Qobject6.rescutL),
            'Resolution (H)' : str(Qobject6.rescutH),
            'fibPDB' : FIBspecialPath,
            'LLoutput' : LLspecialPath,
            'Handedness':  str(Qobject6.LorR)}
    if Qobject6.jobname != ' ':
        used['jobname'] = str(Qobject6.jobname)
    if Qobject6.bfactor != 20.0:
        used['Bfactor'] =  str(Qobject6.bfactor)
    if Qobject6.bfactorSolv != 400:
        used['BfactorSolv'] = str(Qobject6.bfactorSolv)
    if Qobject6.bfactorSolvK != 0.4:
        used['BfactorSolvK'] = str(Qobject6.bfactorSolvK)
    if Qobject6.qfhtK1 != 2.0:
        used['qfhtK1'] =  str(Qobject6.qfhtK1)
    if Qobject6.qfhtK2 != 2.2:
        used['qfhtK2'] =  str(Qobject6.qfhtK2)
    if Qobject6.scscaling != 0.92:
        used['sc_scaling'] = str(Qobject6.scscaling)
    if Qobject6.gridR != 256:
        used['gridR'] =  str(Qobject6.gridR)
    if Qobject6.gridZ != 128:
        used['gridZ'] =  str(Qobject6.gridZ)
    if Qobject6.gridPhi != 128:
        used['gridPhi'] =  str(Qobject6.gridPhi)
    if Qobject6.R_step != 0.001:
        used['R_step'] =  str(Qobject6.R_step)
    if Qobject6.layer_lines != 20:
        used['layer_lines'] =  str(Qobject6.layer_lines)
    if Qobject6.experimentalData != 'none chosen':
        used['Chi-square'] =  str(Qobject6.chisq)

    #make parameters.txt for email/download
    ParamUsedFile(Qobject6, used)

    #make 'CurrentLoaded.txt' with the 'used' dictionary so data can be displayed in other renders
    thefile = PathMaker(Qobject6.username, 'CurrentLoaded.txt')
    fout = open(thefile, 'w')
    json.dump(used, fout)
    fout.close()

    #include most recent newrundict.txt, so it can be displayed during page refresh
    rundict=getRunDict(Qobject6.username)
    used['ToBeRunHTML'] = rundict

    #for display on mainpage
    return used
Exemple #3
0
def toberun(object):
    username = object.username  #need name for finding correct user dir
    #open newrundict.txt, open the dictionary
    import json
    thefile = PathMaker(username, 'newrundict.txt')
    try:
        FHin = open(thefile, 'r')
    except:
        newrundict(username) #if you cant open above, just make new file in user's dir and month with default settings
        FHin = open(thefile, 'r')  #now open the new file
    #take out the dict
    theDict = json.load(FHin)
    #open the object, take out whats needed
    #PDBdown
    if hasattr(object, 'PDBdown'):
        key = 'PDB'
        value= str(object.PDBdown)
        value = removePath(value)   #extra path removal bit, so just file name is seen
        theDict[key]=value
    #PDBup
    if hasattr(object, 'PDBup'):
        key = 'PDB'
        value= str(object.PDBup)
        value = removePath(value)   #extra path removal bit, so just file name is seen
        theDict[key]=value
    #Experimental
    if hasattr(object, 'EXPupload'):
        key = 'Optional_exp_layerlines'
        value= str(object.EXPupload)
        value = removePath(value)    #extra path removal bit, so just file name is seen
        theDict[key]=value
    #parameters
    if hasattr(object, 'jobname') and str(object.jobname) != ' ':
        key = 'jobname'
        value= str(object.jobname)
        theDict[key]=value
    if hasattr(object, 'turns'):
        key = 'turns'
        value= str(object.turns)
        theDict[key]=value
    if hasattr(object, 'units'):
        key = 'units'
        value= str(object.units)
        theDict[key]=value
    if hasattr(object, 'rise'):
        key = 'rise'
        value= str(object.rise)
        theDict[key]=value
    if hasattr(object, 'rescutH'):
        key = 'resolution (H)'
        value= str(object.rescutH)
        theDict[key]=value
    if hasattr(object, 'rescutL'):
        key = 'resolution (L)'
        value= str(object.rescutL)
        theDict[key]=value
    if hasattr(object, 'LorR'):
        key = 'handedness'
        value= str(object.LorR)
        theDict[key]=value
    #extra parameters (these should be added to dict only if not default vals)
    if hasattr(object, 'rfactor') and str(object.rfactor) != 'False':
        key = 'rfactor'
        value= str(object.rfactor)
        theDict[key]=value
    if hasattr(object, 'bfactor') and str(object.bfactor) != '20.0':
        key = 'bfactor'
        value= str(object.bfactor)
        theDict[key]=value
    if hasattr(object, 'bfactorSolv') and str(object.bfactorSolv) != '400.0':
        key = 'bfactorSolv'
        value= str(object.bfactorSolv)
        theDict[key]=value
    if hasattr(object, 'bfactorSolvK') and str(object.bfactorSolvK) != '0.4':
        key = 'bfactorSolvK'
        value= str(object.bfactorSolvK)
        theDict[key]=value
    if hasattr(object, 'qfhtK1') and str(object.qfhtK1) != '2.0':
        key = 'qfhtK1'
        value= str(object.qfhtK1)
        theDict[key]=value
    if hasattr(object, 'qfhtK2') and str(object.qfhtK2) != '2.2':
        key = 'qfhtK2'
        value= str(object.qfhtK2)
        theDict[key]=value
    if hasattr(object, 'scscaling') and str(object.scscaling) != '0.92':
        key = 'scscaling'
        value= str(object.scscaling)
        theDict[key]=value
    if hasattr(object, 'gridR') and str(object.gridR) != '256':
        key = 'gridR'
        value= str(object.gridR)
        theDict[key]=value
    if hasattr(object, 'gridZ') and str(object.gridZ) != '128':
        key = 'gridZ'
        value= str(object.gridZ)
        theDict[key]=value
    if hasattr(object, 'gridPhi') and str(object.gridPhi) != '128':
        key = 'gridPhi'
        value= str(object.gridPhi)
        theDict[key]=value
    if hasattr(object, 'R_step') and str(object.R_step) != '0.001':
        key = 'R_step'
        value= str(object.R_step)
        theDict[key]=value
    if hasattr(object, 'layer_lines') and str(object.layer_lines) != '20':
        key = 'layer_lines'
        value= str(object.layer_lines)
        theDict[key]=value



    #save the dict to the file and close
    fout = open(thefile, 'w')
    json.dump(theDict,fout)
    FHin.close()
    fout.close()
    #return saved dictionary
    return theDict