Author: bugman Date: Sat Sep 30 16:51:33 2006 New Revision: 2591 URL: http://svn.gna.org/viewcvs/relax?rev=2591&view=rev Log: An attempt at fixing bug #7241 (https://gna.org/bugs/?7241).
The algorithm I've implemented is to first check for and use peptide chains, then check for and use nucleotide chains. If neither are present a new error RelaxNoPdbChainError is raised. Modified: 1.2/errors.py 1.2/generic_fns/pdb.py Modified: 1.2/errors.py URL: http://svn.gna.org/viewcvs/relax/1.2/errors.py?rev=2591&r1=2590&r2=2591&view=diff ============================================================================== --- 1.2/errors.py (original) +++ 1.2/errors.py Sat Sep 30 16:51:33 2006 @@ -135,6 +135,7 @@ if Debug: self.save_state() + # PDB errors. ############# @@ -155,7 +156,7 @@ # Loading error. class RelaxPdbLoadError(BaseError): def __init__(self, name): - self.text = "The PDB file " + `name` + " could not be loaded properly, no proteins could be extracted." + self.text = "The PDB file " + `name` + " could not be loaded properly, no molecular chains could be extracted." if Debug: self.save_state() @@ -165,6 +166,14 @@ self.text = "The unit XH bond vectors for the run " + `run` + " have not been calculated." if Debug: self.save_state() + + # PDB data corresponding to the run already exists. + class RelaxNoPdbChainError(BaseError): + def __init__(self): + self.text = "No peptide or nucleotide chains can be found within the PDB file." + if Debug: + self.save_state() + # Nuclear errors. ################# Modified: 1.2/generic_fns/pdb.py URL: http://svn.gna.org/viewcvs/relax/1.2/generic_fns/pdb.py?rev=2591&r1=2590&r2=2591&view=diff ============================================================================== --- 1.2/generic_fns/pdb.py (original) +++ 1.2/generic_fns/pdb.py Sat Sep 30 16:51:33 2006 @@ -225,8 +225,13 @@ if self.print_flag: print "\nStructure " + `i + 1` + "\n" - # Reassign the first peptide chain of the first structure. - pdb_residues = self.relax.data.pdb[self.run].structures[i].peptide_chains[0].residues + # Reassign the first peptide or nucleotide chain of the first structure. + if hasattr(self.relax.data.pdb[self.run].structures[i], 'peptide_chains'): + pdb_residues = self.relax.data.pdb[self.run].structures[i].peptide_chains[0].residues + elif hasattr(self.relax.data.pdb[self.run].structures[i], 'nucleotide_chains'): + pdb_residues = self.relax.data.pdb[self.run].structures[i].nucleotide_chains[0].residues + else: + raise RelaxNoPdbChainError # Loop over the sequence. for j in xrange(len(self.relax.data.res[self.run])): _______________________________________________ relax (http://nmr-relax.com) This is the relax-commits mailing list relax-commits@gna.org To unsubscribe from this list, get a password reminder, or change your subscription options, visit the list information page at https://mail.gna.org/listinfo/relax-commits