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))
def mergePdb(file,fileToMerge): ''' merges the contents of fileToMerge into file backs up file before doing the merge All lines starting with ATOM in fileToMerge will be added to the top of the file ''' with open(file,"r") as f: lines = f.readlines() toMerge = pdb_util.findAllAtomLines(fileToMerge) #backup the file versionFile(file) # #write new file with open(file,"w") as f: str = "".join(lines[1:4]) + toMerge +'\n'+ "".join(lines[4:]) f.write(str) logCommand("Merged the pdb files %s %s"%(file,fileToMerge))