if filename in autopack.RECIPES: n = filename v = sys.argv[2] filename = autopack.RECIPES[n][v]["setupfile"] resultfile = autopack.RECIPES[n][v]["resultfile"] setupfile = autopack.retrieveFile(filename, cache="recipes") else: setupfile = filename #overwrite result file resultfile = "output_autopack_test" print("ok use ", setupfile, filename) fileName, fileExtension = os.path.splitext(setupfile) print fileName n = os.path.basename(fileName) recipe = n h = Environment(name=n) h.loadRecipe(setupfile) h.setupfile = filename if resultfile is not None: h.resultfile = resultfile h.saveResult = False # h.overwriteSurfacePts = False # h.compartments[0].overwriteSurfacePts = False #build the grid #change the grid size ? h.smallestProteinSize = 80.0 h.freePtsUpdateThrehod = 0.0 if doit: #h.boundingBox=[[ -2482, -2389, -500.26],[ 2495, 2466, 500.02]] h.buildGrid(boundingBox=h.boundingBox, gridFileIn=None,
maskGrid.stepSize = [space, space, space] maskGrid.origin = (boundingBox[1] - boundingBox[0]) / 2.0 #maskGrid.normalize() h['amin'], h['amax'], h['amean'], h['arms'] = maskGrid.stats() w.write(filename, maskGrid) #filename = "/Users/ludo/Desktop/cell.xml" #filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2D1.1.xml" #filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2Dgradients1.0.xml" #filename = "/Users/ludo/DEV/autopack_git/data/Mycoplasma/recipe/Mycoplasma1.3.xml" #filename = "/Users/ludo/Desktop/cell_hack.xml" filename = "/Users/ludo/Downloads/autopack_ouput/hiv_experiment/HIV1.6.xml" fileName, fileExtension = os.path.splitext(filename) n = os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe = n h.load_XML(filename) afviewer = None if not NOGUI: print h, helper setattr(h, "helper", helper) afviewer = AFViewer(ViewerType=h.helper.host, helper=h.helper) afviewer.SetHistoVol(h, 20.0, display=False) h.host = h.helper.host #afviewer.displayPreFill() h.saveResult = True #resultfilename = h1.resultfile = wrkDir+os.sep+"autoFillRecipeScripts"+os.sep+"2DsphereFill"+os.sep+"results"+os.sep+"SpherefillResult.afr" #resultfilename = h.resultfile = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/results/2DsphereFill_1.1.apr"
else : setupfile =filename else : #Or we can also use the server for gathering the file recipe = "NM_Analysis_FigureB" version = "1.1" filename = autopack.RECIPES[recipe][version]["setupfile"] resultfile= autopack.RECIPES[recipe][version]["resultfile"] setupfile = autopack.retrieveFile(filename,cache="recipes") #you could overwrite here the filename #filename = "something.json" fileName, fileExtension = os.path.splitext(setupfile) n=os.path.basename(fileName) h = Environment(name=n) h.loadRecipe(setupfile) afviewer=None h.placeMethod="pandaBullet" h.encapsulatingGrid=0 #default for periodicity h.use_periodicity = False autopack.testPeriodicity = True autopack.biasedPeriodicity = [1,1,0] analyse = AnalyseAP(env=h, viewer=afviewer, result_file=None) h.analyse = analyse analyse.g.Resolution = 1.0 #h.smallestProteinSize=30.0#get it faster? same result ? h.boundingBox=np.array(h.boundingBox)
# if len(sys.argv) > 1: filename = sys.argv[1] resultfile = None if filename in autopack.RECIPES: n = filename v = sys.argv[2] filename = autopack.RECIPES[n][v]["setupfile"] resultfile = autopack.RECIPES[n][v]["resultfile"] setupfile = autopack.retrieveFile(filename, cache="recipes") print("ok use ", setupfile, filename) fileName, fileExtension = os.path.splitext(setupfile) n = os.path.basename(fileName) recipe = n h = Environment(name=n) h.loadRecipe(setupfile) h.setupfile = filename if resultfile is not None: h.resultfile = resultfile fileName, fileExtension = os.path.splitext(setupfile) afviewer = None if not NOGUI: print h, helper setattr(h, "helper", helper) afviewer = AFViewer(ViewerType=h.helper.host, helper=h.helper) afviewer.SetHistoVol(h, 20.0, display=False) h.host = h.helper.host afviewer.displayPreFill() h.saveResult = False #h.loopThroughIngr(setCompartment)
load = False pack = True if len(sys.argv) > 1: #and doit : filename = sys.argv[1] resultfile = None if filename in autopack.RECIPES: n = filename v = sys.argv[2] filename = autopack.RECIPES[n][v]["setupfile"] resultfile = autopack.RECIPES[n][v]["resultfile"] setupfile = autopack.retrieveFile(filename, cache="recipes") print("ok use ", setupfile, filename) fileName, fileExtension = os.path.splitext(setupfile) n = os.path.basename(fileName) h = Environment(name=n) h.loadRecipe(setupfile) h.setupfile = filename if resultfile is not None: h.resultfile = resultfile fileName, fileExtension = os.path.splitext(setupfile) if load: rfile = h.resultfile resultfilename = autopack.retrieveFile(rfile, cache="results") if resultfilename is None: print("no result for " + n + " " + h.version + " " + rfile) sys.exit() print("get the result file from ", resultfilename) result, orgaresult, freePoint = h.loadResult( resultfilename=resultfilename) # restore_grid=False,backward=True)#load text ?#this will restore the grid
filename = autopack.RECIPES[n][v]["setupfile"] resultfile = autopack.RECIPES[n][v]["resultfile"] setupfile = autopack.retrieveFile(filename, cache="recipes") print("ok use ", setupfile, filename) fileName, fileExtension = os.path.splitext(setupfile) n = os.path.basename(fileName) else: setupfile = filename = "C:\Users\ludov\Google Drive\TSRI HIV Modeling\HIVsphere_simple_r140.json" # resultfile = "C:\Users\ludov\Google Drive\TSRI HIV Modeling\cellpack_models\Sphere_140_m330_random_tr.json" # resultfile = "C:\Users\ludov\Google Drive\TSRI HIV Modeling\cellpack_models\Sphere_140_10_random_tr.json" resultfile = "C:\Users\ludov\Google Drive\TSRI HIV Modeling\cellpack_models\HIV_VLP_140_214_random_tr.json" # resultfile = "C:\Users\ludov\OneDrive\Documents\\backupC4DHiv\sphere140_rand_49_tr.json" # setupfile = filename = "C:\Users\ludov\Google Drive\TSRI HIV Modeling\HIVsphere_simple_r139.json" # resultfile = "C:\Users\ludov\OneDrive\Documents\\backupC4DHiv\sphere139_random_127_tr.json" n = "HIV_VLP" h = Environment(name=n) h.loadRecipe(setupfile) h.setupfile = filename if resultfile is not None: h.resultfile = resultfile fileName, fileExtension = os.path.splitext(setupfile) rfile = h.resultfile resultfilename = autopack.retrieveFile(rfile, cache="results") if resultfilename is None: print("no result for " + n + " " + h.version + " " + rfile) sys.exit() print("get the result file from ", resultfilename) h.compartments[0].name = "HIVenvelop_140" result, orgaresult, freePoint = h.loadResult(resultfilename=resultfilename) # restore_grid=False,backward=True)#load text ?#this will restore the grid ingredients = h.restore(result, orgaresult, freePoint)
localdir = wrkDir = autopack.__path__[0] helper = autopack.helper if helper is None: import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper from autopack.Environment import Environment filename = "/home/ludo/hivexp/BloodHIV1.0.json" #filename ="/home/ludo/hivexp/HIVimature1.0.json" fileName, fileExtension = os.path.splitext(filename) n = os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe = n h.loadRecipe(filename) #previousresult = "/home/ludo/hivexp/BloodHIV1.0_mixed.json" #previousresult = "/home/ludo/hivexp/BloodHIV1.0_centered.json" previousresult = "/home/ludo/hivexp/BloodHIV1.0_mixed_tr.json" r = h.loadResult(previousresult, transpose=True) # ingredients = h.restore(*r) from autopack.lipids import lipidsCG #generate the membrane lcg = lipidsCG() comp = h.compartments[0] lcg.coverShape(comp.vertices, comp.vnormals) #remove lipids overlaping
centroids = np.loadtxt(data_folder + os.sep + fname + "_cl.txt") nProxy = len(centroids) R = np.linalg.norm(centroids, axis=1).max() + proxy_radius return [ centroids.tolist(), ], [ (np.ones(nProxy) * proxy_radius).tolist(), ], R, mesh, fname, center #X = ProteinAnalysis("MAEGEITTFTALTEKFNLPPGNYKKPKLLYCSNGGHFLRILPDGTVDGTRDRSDQHIQLQLSAESVGEVYIKSTETGQYLAMDTSGLLYGSQTPSEECLFLERLEENHYNTYTSKKHAEKNWFVGLKKNGSCKRGPRTHYGQKAILFLPLPV") #print(X.count_amino_acids()) #print(X.get_amino_acids_percent()) #print(X.molecular_weight()) left = [] env = Environment(name="MG") #c Cytosol #d DNA #e Extracellular Space #m Membrane #tc Terminal Organelle Cytosol #tm Terminal Organelle Membrane #rCyto = Recipe() ## sorted(numbers, key=str.lower) #for ing_name in sorted(ingrs_dic, key=unicode.lower): # ingrs_dic: # # either xref or defined # ing_dic = ingrs_dic[ing_name] # ingr = io_ingr.makeIngredientFromJson(inode=ing_dic, recipe=env.name) # rCyto.addIngredient(ingr) # # setup recipe
else : import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper #filename = "/Users/ludo/Desktop/cell.xml" #filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2D1.1.xml" #filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2Dgradients1.0.xml" filename = "/Users/ludo/DEV/autopack_git/data/Mycoplasma/recipe/Mycoplasma1.3.xml" #filename = "/Users/ludo/Desktop/cell_hack.xml" #filename = "/Users/ludo/DEV/autopack_git/autoPACK_database_1.0.0/recipes/NM_Analysis_FigureC1.3.xml" filename = "D:\\Data\\cellPACK_data\\Mycoplasma\\Mpn_1.0.json" fileName, fileExtension = os.path.splitext(filename) n=os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe=n h.loadRecipe(filename) afviewer=None if not NOGUI : print h,helper setattr(h,"helper",helper) afviewer = AFViewer(ViewerType=h.helper.host,helper=h.helper) afviewer.SetHistoVol(h,20.0,display=False) h.host=h.helper.host afviewer.displayPreFill() h.saveResult = False #resultfilename = h1.resultfile = wrkDir+os.sep+"autoFillRecipeScripts"+os.sep+"2DsphereFill"+os.sep+"results"+os.sep+"SpherefillResult.afr" #resultfilename = h.resultfile = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/results/2DsphereFill_1.1.apr"
recipefile = "D:\\Data\\cellPACK_data\\Mycoplasma\\Mpn_1.0.json" tr = "" #"_tr" transpose = True resultfile = "D:\\Data\\cellPACK_data\\Mycoplasma\\Mpn_Results_H" + tr + ".json" # or Tr workingdir = "D:\\Data\\cellPACK_data\\Mycoplasma\\" workingdir = "D:\\Data\\cellPACK_data_git\\influenza\Influenza\\" recipefile = "Influenza_3.json" resultfile = "" #workingdir ="C:\Users\ludov\OneDrive\Documents\cellVIEW-i\Data\\" #recipefile="christmas.json" fileName, fileExtension = os.path.splitext(recipefile) n = os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe = n h.loadRecipe(workingdir + recipefile) # save a full recipe no Xref #"nbMol": nbmol, #"molarity" : ingr.molarity, #"source": ingr.source, #"positions":ingr.positions, #"radii":ingr.radii} rname = workingdir + "recipes\\BloodHIVMycoRB_full.1.0.json" rname = workingdir + "recipes\\Mycoplasma1.7.json" rname = workingdir + recipefile #h.saveRecipe(rname,useXref=False,mixed=True,
helper = autopack.helper if helper is None: import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper from autopack.Environment import Environment from autopack import transformation as tr import numpy as np filename = "/home/ludo/hivexp/HIVimature1.0.json" fileName, fileExtension = os.path.splitext(filename) n = os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe = n h.loadRecipe(filename) h.smallestProteinSize = 40 resultfilename = h.resultfile = "/home/ludo/hivexp/hivfull" previousresult = "/home/ludo/hivexp/HIVimature_results.json" r = h.loadResult("/home/ludo/hivexp/HIVimature_results.json", transpose=False) # #ingredients = h.restore(*r) #env is 0:6 #if need to offset ENV thats here. #gag is 6: #every 4th gag try to place gag_pol
#wrkDir = AutoFill.__path__[0] localdir = wrkDir = autopack.__path__[0] path="/opt/data/dev/BD_EXP/" helper = autopack.helper if helper is None : import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper from autopack.Environment import Environment filename = path+"smallBlood.json" fileName, fileExtension = os.path.splitext(filename) n=os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe=n h.loadRecipe(filename) h.placeMethod="pandaBullet" rname=path+"smallblood_results.json" #h.buildGrid(boundingBox=h.boundingBox,gridFileIn=None,rebuild=True ,gridFileOut=path+"gridOut",previousFill=False,lookup=2) # #def setNB(ingr): # ingr.nbMol = 0 # ingr.molarity = 0.0 # ingr.overwrite_nbMol_value = 0.0
recipe = parVals['running_settings']['recipePath'] if recipe != '': #remove 1.1.json from recipe setupfile = recipe filename = setupfile else: # don't do it as else #Or we can also use the server for gathering the file recipe = recipename # put recipe here version = version # put version here filename = autopack.RECIPES[recipe][version]["setupfile"] setupfile = autopack.retrieveFile(filename, cache="recipes") fileName, fileExtension = os.path.splitext(setupfile) n = os.path.basename(fileName) h = Environment(name=n) h.loadRecipe(setupfile) h.dump = False afviewer = None #h.placeMethod="pandaBullet" #h.encapsulatingGrid=0 # default for periodicity # h.use_periodicity = False # autopack.testPeriodicity = True # autopack.biasedPeriodicity = [1,1,0] analyse = AnalyseAP(env=h, viewer=afviewer, result_file=None) h.analyse = analyse analyse.g.Resolution = 1.0 #h.smallestProteinSize=30.0#get it faster? same result ? h.boundingBox = np.array(h.boundingBox)
helperClass = upy.getHelperClass() helper =helperClass() else : import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper #filename = "/Users/ludo/Desktop/cell.xml" #filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2D1.1.xml" #filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2Dgradients1.0.xml" #filename = "/Users/ludo/DEV/autopack_git/data/Mycoplasma/recipe/Mycoplasma1.3.xml" #filename = "/Users/ludo/Desktop/cell_hack.xml" filename = "/Users/ludo/DEV/autopack_git/autoPACK_database_1.0.0/recipes/NM_Analysis_FigureC1.3.xml" fileName, fileExtension = os.path.splitext(filename) n=os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe=n h.load_XML(filename) afviewer=None if not NOGUI : print h,helper setattr(h,"helper",helper) afviewer = AFViewer(ViewerType=h.helper.host,helper=h.helper) afviewer.SetHistoVol(h,20.0,display=False) h.host=h.helper.host afviewer.displayPreFill() h.saveResult = False #resultfilename = h1.resultfile = wrkDir+os.sep+"autoFillRecipeScripts"+os.sep+"2DsphereFill"+os.sep+"results"+os.sep+"SpherefillResult.afr" #resultfilename = h.resultfile = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/results/2DsphereFill_1.1.apr"
import upy helperClass = upy.getHelperClass() helper =helperClass() else : import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper #filename = "/Users/ludo/Desktop/cell.xml" #filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2D1.1.xml" filename = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/Test_Spheres2Dgradients1.0.xml" #filename = "/Users/ludo/DEV/autopack_git/data/Mycoplasma/recipe/Mycoplasma1.3.xml" #filename = "/Users/ludo/Desktop/cell_hack.xml" fileName, fileExtension = os.path.splitext(filename) n=os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe=n h.load_XML(filename) afviewer=None if not NOGUI : print h,helper setattr(h,"helper",helper) afviewer = AFViewer(ViewerType=h.helper.host,helper=h.helper) afviewer.SetHistoVol(h,20.0,display=False) h.host=h.helper.host afviewer.displayPreFill() h.saveResult = False #resultfilename = h1.resultfile = wrkDir+os.sep+"autoFillRecipeScripts"+os.sep+"2DsphereFill"+os.sep+"results"+os.sep+"SpherefillResult.afr" #resultfilename = h.resultfile = wrkDir+os.sep+"autoFillRecipeScripts/2DsphereFill/results/2DsphereFill_1.1.apr"
if len(sys.argv) > 1: filename = sys.argv[1] resultfile = None if filename in autopack.RECIPES: n = filename v = sys.argv[2] filename = autopack.RECIPES[n][v]["setupfile"] resultfile = autopack.RECIPES[n][v]["resultfile"] else: resultfile = sys.argv[2] setupfile = autopack.retrieveFile(filename, cache="recipes") print("ok use ", setupfile, filename, resultfile) fileName, fileExtension = os.path.splitext(setupfile) n = os.path.basename(fileName) h = Environment(name=n) h.loadRecipe(setupfile) h.setupfile = filename if resultfile is not None: h.resultfile = resultfile fileName, fileExtension = os.path.splitext(setupfile) if export_json: print("expot json recipe ", fileName) h.saveRecipe(fileName + ".json", useXref=useXref, indent=True) if check_result: rfile = h.resultfile resultfilename = autopack.retrieveFile(rfile, cache="results") if resultfilename is None: print("no result for " + n + " " + h.version + " " + rfile) sys.exit() print("get the result file from ", resultfilename)
# pathToCP="/opt/data/dev/cellPACK/cellPACK_data_git/cellPACK_database_1.1.0/" pathToCP="D:\\DATA\\cellPACK_data\\cellPACK_database_1.1.0\\" #D:\Data\cellPACK_data\cellPACK_database_1.1.0\other # filename = "/home/ludo/hivexp/BloodHIV1.0.json" filename = "/opt/data/dev/cellPACK/cellPACK_data_git/cellPACK_database_1.1.0/recipes/Mycoplasma1.6.json" filename = "/opt/data/dev/cellPACK/cellPACK_data_git/cellPACK_database_1.1.0/recipes/DNAplectoneme.1.0.json" filename = pathToCP+os.sep+"recipes"+os.sep+"Mycoplasma1.6_full.json" filename = pathToCP+os.sep+"recipes"+os.sep+"Mycoplasma1.7.json" filename = "C:\\Dev\\flexpack_dev_1.1\\data\\cellpack\\recipes\\Mycoplasma1.7.json" #path = "/home/ludo/hivexp/" fileName, fileExtension = os.path.splitext(filename) n=os.path.basename(fileName) h = Environment(name=n) h.totalNBBeads = 0 ##h.helper = helper #recipe=n h.loadRecipe(filename) # ##for each ingredient, PDB, make a sphere Tree using SBL #sbl_binary_U="sbl-ballcovor-pdb-U.exe" #sbl_binary_A="sbl-ballcovor-pdb-A.exe" #sbl_binary_C="sbl-ballcovor-pdb-C.exe" #sbl_binary_T="sbl-ballcovor-txt.exe" # #sbl_arg_file=" -f " #sbl_arg_nballs=" --n-inner-balls " #sbl_arg_outer=" --outer " #sbl_arg_interpolated=" --interpolated "
helper = autopack.helper if helper is None and not NOGUI: import upy helperClass = upy.getHelperClass() helper = helperClass() else: import upy helperClass = upy.getHelperClass() helper = helperClass(vi="nogui") autopack.helper = helper recipe = "D:\\Data\\cellPACK_data\\cellPACK_database_1.1.0\\recipes\\HIV_VLP.1.1.json" #127 filename = recipe #"/Users/ludo/DEV/autopack_git/autoPACK_database_1.0.0/recipes/NM_Analysis_FigureA1.0.xml" fileName, fileExtension = os.path.splitext(filename) n = os.path.basename(fileName) h = Environment(name=n) #h.helper = helper recipe = n h.loadRecipe(filename) #recenter ingredient position according center. #should manually do the mesh ? for c in h.compartments: for ingr in c.surfaceRecipe.ingredients: ingr.positions = np.array(ingr.positions) - np.array(ingr.offset) ingr.sphereFile = None #save the recipe h.version = "1.2" h.saveRecipe( "D:\\Data\\cellPACK_data\\cellPACK_database_1.1.0\\recipes\\HIV_VLP.1.2.json", useXref=False, format_output="json")
v = sys.argv[2] filename = autopack.RECIPES[n][v]["setupfile"] resultfile = autopack.RECIPES[n][v]["resultfile"] setupfile = autopack.retrieveFile(filename, cache="recipes") # or the filename directly else: setupfile = filename # overwrite result file resultfile = "output_autopack_test" print("ok use ", setupfile, filename) fileName, fileExtension = os.path.splitext(setupfile) print fileName n = os.path.basename(fileName) recipe = n h = Environment(name=n) h.loadRecipe(setupfile) h.setupfile = filename if resultfile is not None: h.resultfile = resultfile h.saveResult = False h.freePtsUpdateThrehod = 0.0 afviewer = None analyse = AnalyseAP(env=h, viewer=afviewer, result_file=None) h.analyse = analyse analyse.g.Resolution = 1.0 # firs time we build the grid h.buildGrid(boundingBox=h.boundingBox, gridFileIn=None,