def mergeProteinAndMembranePdb(file,fileToMerge): ''' Merges all amino acid lines in file with non protein atoms in filetoMerge the box size of fileToMerge is kept and the boxsize of file is discarded ''' boxSize = pdb_util.findPDBBoxSize(fileToMerge) lines = pdb_util.findAllNonProtein(fileToMerge) toMerge = pdb_util.findAllAminoAcidLines(file) #backup the file versionFile(file) # #write new file with open(file,"w") as f: str = boxSize.strip() +'\n' + toMerge.strip() +'\n'+ lines.strip() f.write(str) logCommand("Merged the non Amino acid lines of %s with all the atoms in %s"%(file,fileToMerge))
parser.add_argument("--confs",default ="/Users/iman/nethome/iman/Projects/EGFR/EGFR_WT/sim_frames/*pdb", help="starting configurations to use, can use glob pattern ex:*pdb") args = parser.parse_args() frames = glob.glob(args.confs) frames.sort() scrwl_sequence_file = "scrwl_sequence.txt" index = 0 membrane.copyItpFiles() for frame in frames: proteinString = md_tools.strip_vsites(pdb_util.findAllAminoAcidLines(frame)) #proteinString = pdb_util.findAllAminoAcidLines(frame) #All files will have the same sequence so we only need to do this once if(os.path.isfile(scrwl_sequence_file)==False and args.mutations): sequence = md_tools.generateOneLetterSequence(proteinString,args.mutations) f= open(scrwl_sequence_file,"w") f.write(sequence) confFile = "%s/conf_%s.pdb"%(util.ProjectDirectories.CONF_DIR,index) with open(confFile,"w") as f: f.write(proteinString) # if args.mutatations: # #TODO set correct filenames # args = ['Scwrl4','-i',confFile,'-o','confs/test.pdb']
files = glob.glob(path) files = sorted_nicely(set(files)) index=0 # proteinFileName = "conf%s.pdb" #we just prefix the regular filename of the starting file with conf proteinFileName = "conf_%s" for system in files: currentProtein = proteinFileName%os.path.basename(system) #we only want to do pdb2gmx on the protein not the rest of the stuff str = findAllAminoAcidLines(system) str = strip_vsites(str) with open(currentProtein,"w") as f: f.write(str) #FIXME awful and hacky and not general if(os.path.isfile("../mutate.pml")): mutateAbsPath = os.path.abspath("../mutate.pml") os.system("cp %s protein.pdb"%currentProtein) print "Mutating!" cmd = "/Applications/MacPyMOL.app/Contents/MacOS/MacPyMOL -c ../mutate.pml" os.system(cmd) logCommand(cmd) os.system("cp protein_mutated.pdb %s"%currentProtein) print "Done mutating" logCommand("Mutated protein using the file mutate.pml in root project dir")