Beispiel #1
0
from Bio.PDB import PDBIO
from Bio.PDB.PDBParser import PDBParser
from optparse import OptionParser
parser = OptionParser()
parser.add_option(
    "-f",
    "--pdbfile",
    default=None,
    type="string",
    help="pdb structure file for additional 3-coord cartesian per residue")
(options, args) = parser.parse_args()

parser = PDBParser()

structure = parser.get_structure("mystruct", options.pdbfile)
model = structure[0]

average_bfactors = {}

for residue in model["C"]:
    average_bfactors[residue.get_id()[1]] = 0.0

for chain in model.get_list():
    for residue in chain.get_list():
        if residue.has_id("CA"):
            ca = residue["CA"]
            average_bfactors[residue.get_id()[1]] += float(
                ca.get_bfactor()) / float(len(model.get_list()))

for chain in model.get_list():
Beispiel #2
0
    pdb_text_file = open(args[0], 'r')
    for line in pdb_text_file.readlines():
        if line.strip() == "":
            continue
        elif line.strip().split()[0] == "ATOM":
            continue
        elif line.strip().split()[0] == "TER":
            continue
        else:
            other_lines.append(line.strip())
    pdb_text_file.close()

parser = PDBParser(PERMISSIVE=1)
warnings.simplefilter('ignore', PDBExceptions.PDBConstructionWarning)

input_pdb = parser.get_structure('X', args[0])

output_structure_builder = StructureBuilder.StructureBuilder()
output_structure_builder.init_structure(args[1])
output_structure_builder.init_model(0)
output_struct = output_structure_builder.get_structure()

for model in output_struct:
    for new_order_id in new_chain_order:
        model.add(input_pdb[0][new_order_id])

id_iterator = 0
for model in output_struct:
    for chain in model:
        chain.id = new_chain_ids[id_iterator]
        id_iterator += 1
Beispiel #3
0
## opening file for dumping resolutions
sf = open('res.txt', 'w')
if options.path != None:		
	print ('Resolution', file=sf)
	resolution = ''
	pdb_path = []
	parser = PDBParser()
	for pdb in pdbid:
		try:
			pdb_dir = pdb[1:3]
			pdb_dir = pdb_dir.lower()
			pdb = pdb.lower() ## lower case, becuase last character fo pdbid from fasta file is in uppercase
			#print (pdb)
			pdb_path1 = str(options.path) + pdb_dir + '/pdb' + str(pdb) + '.ent' ## full path to the pdb.ent file
			pdb_path.append(pdb_path1)
			structure = parser.get_structure('PHA-L', pdb_path1)
			resolution = str(structure.header['resolution'])
			print ('for ', pdb)
			print (resolution, file=sf)
			#print (pdb_path)
		except IOError:
			print ('Can not find', pdb_path1, ' file')	
	#for pdb in pdb_path:
	#	try:
	#		#print (pdb)
	#		structure = parser.get_structure('PHA-L', pdb)	
	#		resolution = str(structure.header['resolution'])
	#		print ('for ', pdb)
	#		print (resolution, file=sf)
	#		#print (resolution)
	#	except IOError:
Beispiel #4
0
	parser.add_option("--output",dest="output",default="out", help="Output name for resfile")
	parser.add_option("--native",dest="native",action='store_true',help='Just repack the residues on the side flagged "design side"', default=False)
	parser.add_option("--design-side",dest="design_side",default='1',help="Side of interface to design - either 1 or 2. Defaults to 1.")
	parser.add_option("--repack",dest="repack",action='store_true',default=False, help='Repack side of the interface not being designed')
	(options,args)= parser.parse_args()
	
	if len(args) < 1:
		parser.error('specify a pdb file or use -h')
	elif len(args) > 1:
		print 'Warning: only the first pdb is considered by this script. The rest will be ignored'

	warnings.simplefilter('ignore',PDBExceptions.PDBConstructionWarning)	

	print 'Processing',args[0]
	parser = PDBParser()
	structure = parser.get_structure( 'X', args[ 0 ] )

	## As implemented thid script only considers side chain distances. Can easily
	## be reconfigured for Ca or Cb distances though
	side1, side2 = sc_distance_cutoff( structure[ 0 ], 
									   list( options.side1 ),
									   list( options.side2 ),
									   float(options.nearby_atom_cutoff) )
	
	side_dict = {
					'1' : sorted( side1, key=lambda res: ( res[1], int(res[0]) ) ),
					'2' : sorted( side2, key=lambda res: ( res[1], int(res[0]) ) )
				}

	opposing_side = '2' if options.design_side == '1' else '1'
	packer_aas = 'NATAA' if options.native else 'ALLAA'
Beispiel #5
0
    return antibody_residues
    
if __name__ == '__main__':
    usage = "%prog [options] <pdb_file>"
    parser=OptionParser(usage)
    parser.add_option("--antibody",dest="antibody",help="the chains that make up antibody (as a string, e.g. 'AB')", default="")
    parser.add_option("--output",dest="output",default="out", help="Output name for pivots file")
    (options,args)= parser.parse_args()
    
    if len(args) < 1:
        parser.error('specify a pdb file or use -h')
    elif len(args) > 1:
        print('Warning: only the first pdb is considered by this script. The rest will be ignored')

    warnings.simplefilter('ignore',PDBExceptions.PDBConstructionWarning)    

    print('Processing',args[0])
    
    input_pdb = args[0]
    output = options.output.strip()
    antibody_chains=options.antibody
    
    parser = PDBParser()
    structure = parser.get_structure( 'X', input_pdb )

    antibody_residues = get_antibody_residues(structure[0],antibody_chains)
    
    with open(output+'.pivots', 'w')  as out:
        for seqpos, chain, resid in antibody_residues:
            out.write( ''.join([ seqpos.strip(), chain.strip() ])+',' )
#!/usr/bin/python

# Xavier Ambroggio, 2012
# [email protected]

from Bio.PDB import PDBIO
from Bio.PDB.PDBParser import PDBParser
from optparse import OptionParser
parser=OptionParser()
parser.add_option("-f", "--pdbfile", default = None, type = "string", help="pdb structure file for additional 3-coord cartesian per residue")
(options,args)=parser.parse_args()

parser=PDBParser()

structure=parser.get_structure("mystruct", options.pdbfile)
model=structure[0]

average_bfactors = {}

for residue in model["X"] :
    average_bfactors[ residue.get_id()[1] ] = 0.0
    
for chain in model.get_list():
    for residue in chain.get_list():
      sum_over_natoms = 0  
      if residue.has_id("N"):
        ca=residue["N"]
        average_bfactors[ residue.get_id()[1] ] += float( ca.get_bfactor() ) 
        sum_over_natoms += 1
      if residue.has_id("H"):
        ca=residue["H"]