Good Morning,

I'm a student of Bioinformatics from the University of Bologna. 

I'm working on a personal idea and I'm using MUSTANG to perform multiple structural alignment.
To run the algorithm .pdb file with just one chain are required so I'm looking for tools or a suggestion in order to edit in a clever and fast way all the files. 

'til now I wrote some command lines in python but I think that they're not enough specific to correctly edit all the files in fact I often have to check manually all the structures again.

someone could help me?

thanks in advance!
Dade. 
    
    """
    Extract a single chain from a PDB file
    """

    from __future__ import print_function
    import Bio.PDB
    import Bio.PDB.PDBIO
    import sys
    import argparse


    class ChainSelect(Bio.PDB.Select):
        def __init__(self, target_chain):
            self.target_chain = target_chain
        def accept_chain(self, chain):
            if chain.get_id() == self.target_chain:
                return 1
            else:
                return 0

    def main():
        argparser = argparse.ArgumentParser(description="Extract chain from a PDB file")
        argparser.add_argument('infile', help="Path to input file (PDB)")
        argparser.add_argument('chain', help="Chain to extract")
        argparser.add_argument('outfile', help="Path to output file (PDB)")
        args = argparser.parse_args()

        pdbparser = Bio.PDB.PDBParser()
        io = Bio.PDB.PDBIO()
        with open(args.infile, 'r') as infile:
            struct = pdbparser.get_structure(args.infile, infile)
            io.set_structure(struct)
        with open(args.outfile, 'w') as outfile:
            io.save(outfile, ChainSelect(args.chain))
        return 0

    if __name__=="__main__":
        sys.exit(main())

Run it with something like:

    python extract_chain.py 1XXX.pdb A 1XXXA.pdb

to extract just chain A from 1XXX.pdb.