# function for running CABS with different temperatures # it will compute in directory name+_+temperature here = os.getcwd() # since pycabs changing directories... a = pycabs.CABS(sequence,secstr,template,name+"_"+str(temperature)) a.createLatticeReplicas(replicas=1) a.modeling(Ltemp=temperature,Htemp=temperature, phot=300,cycles=100,dynamics=True) #remember to come back to `here` directory os.chdir(here) #init these variables _before_ running cabs name = "fnord" # we have some template, it has to be as list template=["/home/user/pycabs/playground/2pcy.pdb"] # suppose we have porter prediction of sec. str. sss = pycabs.parsePorterOutput("/home/user/pycabs/proba/playground/porter.ss") sequence = sss[0] secstr = sss[1] # now we have all data required to run CABS temp_from = 1.5 temp_to = 3.0 temp_interval = 0.1 temperatures=np.arange(temp_from,temp_to,temp_interval) # ranges of temperature # create thread pool with two parallel threads pool = mp.Pool(processes=2) pool.map(runCABS,temperatures) # run cabs threads # HERE IS THE END OF PART WHERE WE RUN CABS in parallel fashion.
#!/usr/bin/env python import pycabs from Pycluster import * from numpy import array,zeros data = pycabs.parsePorterOutput("/home/user/pycabs/proba/playground/porter.ss") # read PORTER working_dir = "de_novo" # name of project templates = [] # deNOVO a = pycabs.CABS(data[0],data[1],templates,working_dir) # initialize CABS, create required files # DENOVO a.generateConstraints() a.createLatticeReplicas() # create start models from templates a.modeling(Htemp=3.0,cycles=20,phot=100) # start modeling with default INP values and create TRAF.pdb when done tr = a.getTraCoordinates() # load TRAF into memory and calculate RMSD all-vs-all : #calculating RMSD 2D array for clustering distances = zeros((len(tr),len(tr))) for i in range(len(tr)): for j in range(i,len(tr)): rms = pycabs.rmsd(tr[i],tr[j]) distances[i][j] = distances[j][i] = rms #save RMSD array as heat map pycabs.heat_map(distances,"Protein model","Protein model","RMSD") # clustering by K-medoids method (with 5 clusters) clusterid,error,nfound = kmedoids(distances,nclusters=5,npass=15,initialid=None) print clusterid,error clusterid,error,nfound = kcluster(distances,nclusters=5,npass=15) # save cluster medoids to file