# 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) #export the complete recipe as collada. each ingredient -> meshnode. Each instance->node instance env = h cxml = build_scene( env, "C:\Users\ludov\Google Drive\TSRI HIV Modeling\cellpack_models\HIV_VLP_140_214_random.dae" ) #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") #import upy #helper = upy.getHelperClass()() #helper.read("/Users/ludo/DEV/autopack_git/autoPACK_database_1.0.0/geometries/HIV1_capside_3j3q_Rep_Med_0_2_1.dae")
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) # print ("ok ",n+"_result.json",fileName+".json") if mixedJson and export_json: #special case for HIV import json import numpy if HIV: with open("/home/ludo/biomthiv.json", 'r') as fp: #doesnt work with symbol link ? jsondic = json.load(fp) #,indent=4, separators=(',', ': ')
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 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
# 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, # 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"],
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 #could try to rotate around a point mrot = [] angle = 0 for i in range(6): m = tr.rotation_matrix(math.radians(angle), [0, 0, 1], point=[5.841, -1.458, 133.803]) mrot.append(m) angle += 60 #tr.rotation_matrix(math.radians(60), [0,0,1], point=[5.841,-1.458,-133.803])
#h.loopThroughIngr(setNB) #h.loopThroughIngr(setNB) #h.loopThroughIngr(setNB) # #h.exteriorRecipe.ingredients[0].nbMol=2 #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
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" r = h.loadResult(previousresult, transpose=False) # ingredients = h.restore(*r) #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,