ingr = MultiSphereIngr(name=wid, pdb=pdbId, nbMol=int(eval(count)), positions=pos, radii=rad, encapsulatingRadius=R) rMatrix.addIngredient(ingr) print pdbId o.setInnerRecipe(rMatrix) #check lefty env.boundingBox = [[0, 0, 0], [2000, 2000, 2000]] env.name = "MycoplasmaGenitalium" env.saveRecipe("C:\\Users\\ludov\\Downloads\\MG_1.0.json", useXref=False, format_output="json") #save serialized from autopack.IOutils import serializedRecipe, saveResultBinary djson = serializedRecipe(env) f = open("C:\\Users\\ludov\\Downloads\\MG_1.0_serialized.json", "w") f.write(djson) f.close() saveResultBinary(env, "C:\\Users\\ludov\\Downloads\\MG_1.0_serialized.bin", False, True) #MG4 - nascent 753 #MG4 - processed I 753 #MG4 - processed II 753 #MG4 - signal sequence 753 #MG4 - folded 776
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")
# h.loopThroughIngr(excludeIngr) # h.loopThroughIngr(excludeIngr) # h.loopThroughIngr(setJitter) # h.loopThroughIngr(setJitter) # h.loopThroughIngr(setJitter) # h.loopThroughIngr(setJitter) h.fill5(verbose=0, usePP=False) h.collectResultPerIngredient() rname = fileName + "_" + i.isoformat() + ".json" rname = "C:\Users\ludovic\Documents\CellPackViewer_Cluster\Data\HIV\cellPACK\mycoDNA1.json" h.saveRecipe(rname, useXref=True, mixed=True, kwds=["source", "name"], result=True, grid=False, packing_options=False, indent=False, quaternion=True) #h.saveRecipe(fileName+"_"+i.isoformat()+".json",useXref=True,mixed=True, # kwds=["source","name","positions","radii"],result=True, # grid=False,packing_options=False,indent=False,quaternion=True) else: h.saveRecipe(fileName + "_" + i.isoformat() + ".json", useXref=True, mixed=True, result=False, grid=True, packing_options=True, indent=True,
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) 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) # print ("json ?",h.result_json) # if export_json : # fileName, fileExtension = os.path.splitext(resultfilename) # h.store_asJson(n+"_result.json",indent=False)#fileName+"1.json",indent=False)
lcg.coverShape(comp.vertices, comp.vnormals) #remove lipids overlaping posrot = lcg.arrayOfBeads #save again with lipids ? #fix HIV1_CA_mono_0_1_0 #center is [405.609,1000.253,377.306] # if apply the center on all instance ? meanings rotate the center and apply it #h.saveRecipe("/home/ludo/hivexp/BloodHIV1.0_noref.json",useXref=False,mixed=True,result=False,grid=False,packing_options=True,indent=True,quaternion=True) h.saveRecipe("/home/ludo/hivexp/BloodHIV1.0_mixed_tr.json", useXref=True, mixed=True, kwds=["source", "name"], result=True, grid=False, packing_options=False, indent=False, quaternion=True) #h.exportToBD_BOX(res_filename="/opt/data/dev/hivbdbox/test_ntr",bd_type="rigid") #then run ~/Tools/bd_box-2.2/bin/bd_rigid test.prm --out_filename=err.log from autopack.bd_box import rigid_box as bd_box res_filename = "/opt/data/dev/hivbdbox/test_full_hack_tr" bd = bd_box(res_filename, bounding_box=h.boundingBox) bd.offset = [0, 0, 0] #bd.params["xbox"]["value"]=4000.0 #bd.params["ybox"]["value"]=4000.0 #bd.params["zbox"]["value"]=4000.0 bd.makePrmFile()
#"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, # kwds=["source","name","nbMol","molarity","positions","radii"],result=True, # grid=False,packing_options=False,indent=False,quaternion=True) if resultfile != "": r = h.loadResult(resultfile, transpose=transpose) #for c4d transpose ingredients = h.restore(*r) h.saveRecipe("D:\\Data\\cellPACK_data\\Mycoplasma\\Mpn_Results_H_1.json", useXref=False, mixed=True, kwds=["source", "name"], result=True, transpose=True, grid=False, packing_options=False, indent=False, quaternion=True) h.saveRecipe("D:\\Data\\cellPACK_data\\Mycoplasma\\Mpn_Results_H_2.json", useXref=False, mixed=True, kwds=["source", "name"], result=True, transpose=False, grid=False, packing_options=False, indent=False, quaternion=True)
break envdata = r[1][0][:6] alldata = [] alldata.extend(envdata) alldata.extend(data) alldata.extend(respol) r[1][0] = alldata for d in r[1][0]: d[1] = d[1].transpose() ingredients = h.restore(*r) h.saveRecipe("hivimmature_start_pol.json", useXref=True, mixed=True, kwds=["source", "name"], result=True, grid=False, packing_options=False, indent=False, quaternion=True) #transpose # #h.buildGrid(boundingBox=h.boundingBox,gridFileIn=None,rebuild=True , # gridFileOut="/home/ludo/hivexp/gridOut",previousFill=True) # #gag.completion = 1.0 #env.completion = 1.0 ##rest should pack around #gag.nbMol = 0 #env.nbMol = 0
#h.exteriorRecipe.ingredients[0].overwrite_nbMol_value=1 # #h.exteriorRecipe.ingredients[1].nbMol=2 #h.exteriorRecipe.ingredients[1].overwrite_nbMol_value=1 # #h.exteriorRecipe.ingredients[2].nbMol=2 #h.exteriorRecipe.ingredients[2].overwrite_nbMol_value=1 #h.fill5(verbose = 0,usePP=False) r=h.loadResult(rname,transpose=True)#)# or not ? ingredients = h.restore(*r) # h.collectResultPerIngredient() h.saveRecipe(path+"smallblood_results_tr.json",useXref=True,mixed=True,kwds=["source","name"],result=True,grid=False,packing_options=False,indent=False,quaternion=True) #h.exportToBD_BOX(res_filename=path+"test_tr",bd_type="rigid")#transpose ? from autopack.bd_box import rigid_box as bd_box res_filename = path+"test_tr" bd=bd_box(res_filename,bounding_box=h.boundingBox) bd.offset = [0,0,0] #bd.params["xbox"]["value"]=4000.0 #bd.params["ybox"]["value"]=4000.0 #bd.params["zbox"]["value"]=4000.0 bd.makePrmFile() r = h.exteriorRecipe #bd.addAutoPackIngredient(r.ingredients[1]) #bd.addAutoPackIngredient(r.ingredients[2]) #bd.addAutoPackIngredient(r.ingredients[3]) if r : for ingr in r.ingredients:
h.saveResult = True h.resultfile = "/home/ludo/Dev/bdbox/" + n + v h.innerGridMethod = "bhtree" #jordan pure python ? sdf ? # h.boundingBox = [[-250.0, -6500.0/2.0, -250.0], [250.0, 6500.0/2.0, 250.0]] # h.boundingBox =[[-2482, -2389.0, 100.0], [2495, 2466, 2181.0]] h.buildGrid(boundingBox=h.boundingBox, gridFileIn=gridfile, rebuild=True, gridFileOut=None, previousFill=False) h.fill5(verbose=0, usePP=True) h.collectResultPerIngredient() h.saveRecipe(h.resultfile + "_mixed.json", useXref=True, mixed=True, kwds=["compNum", "encapsulatingRadius"], result=True, grid=False, packing_options=False, indent=False) #display ? #export the complete recipe as collada. each ingredient -> meshnode. Each instance->node instance env = h from autopack import bd_box #bd_box.executable_dmatrix="dmatrix" #env.exportToBD_BOX(res_filename="/home/ludo/Dev/bdbox/"+n+v,bd_type="rigid") #require no overlapp at all... #execfile("pathto/export_recipe_collada.py") #I usually run this on with pmv,anaconda or mayapy #execfile("/Users/ludo/DEV/git_upy/examples/export_collada.py")