tidy up code

This commit is contained in:
Tanushree Tunstall 2020-05-15 13:48:50 +01:00
parent f7e371a585
commit 548d9a5192
2 changed files with 4 additions and 9 deletions

View file

@ -28,9 +28,8 @@ def main():
Function to call if run from command line. Function to call if run from command line.
Example use: Example use:
pdb_chain_extract.py -f <your_pdb_file> -c <chainid1><chainid2> pdb_chain_extract.py -f <your_pdb_file> -c <chainid1><chainid2> -p <outpath> -o <outfile>
Extracts chain 'A' by default. Extracts chain 'A' by default.
FIXME: extract all chains from the given pdb and write them out individually
""" """
arg_parser = argparse.ArgumentParser() arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('-i', '--pdb_file', help='provide pdb file', default = 'None') arg_parser.add_argument('-i', '--pdb_file', help='provide pdb file', default = 'None')
@ -64,9 +63,6 @@ def main():
pdb_chains_file = outpath + '/' + outfile + '_' + c_names + '.pdb' pdb_chains_file = outpath + '/' + outfile + '_' + c_names + '.pdb'
io = PDBIO() io = PDBIO()
io.set_structure(structure) io.set_structure(structure)
#io.save(structure.get_id() + "_crop.structure", ChainExtract())
#io.save("_crop.pdb", ChainExtract(my_chains))
#io.save('{}'.format(pdb_chains_file), ChainExtract(my_chains))
io.save(pdb_chains_file, ChainExtract(my_chains)) io.save(pdb_chains_file, ChainExtract(my_chains))
if __name__ == "__main__": if __name__ == "__main__":

View file

@ -59,12 +59,11 @@ def main():
for chain in chains: for chain in chains:
chain = chain.upper() chain = chain.upper()
print ('Extracting chain:', chain) print ('Extracting chain:', chain)
#pdb_chain_file = 'pdb_file_chain_{}.pdb'.format(chain)
#pdb_chain_file = outpath + '/' + 'pdb_file_chain_{}.pdb'.format(chain) pdb_chain_file = outpath + '/' + outfile + '_{}.pdb'.format(chain)
pdb_chain_file = outpath + '/' + outfile + '_{}.pdb'.format(chain)
io = PDBIO() io = PDBIO()
io.set_structure(structure) io.set_structure(structure)
#io.save('{}'.format(pdb_chain_file), ChainSelect(chain))
io.save('{}'.format(pdb_chain_file), ChainSelect(chain)) io.save('{}'.format(pdb_chain_file), ChainSelect(chain))
if __name__ == "__main__": if __name__ == "__main__":