Author: bugman Date: Thu Nov 22 18:09:57 2007 New Revision: 3831 URL: http://svn.gna.org/viewcvs/relax?rev=3831&view=rev Log: Bug fix for the generic_fns.sequence.read() function, it's now functional! The empty first containers are now taken into account. Modified: 1.3/generic_fns/sequence.py Modified: 1.3/generic_fns/sequence.py URL: http://svn.gna.org/viewcvs/relax/1.3/generic_fns/sequence.py?rev=3831&r1=3830&r2=3831&view=diff ============================================================================== --- 1.3/generic_fns/sequence.py (original) +++ 1.3/generic_fns/sequence.py Thu Nov 22 18:09:57 2007 @@ -101,19 +101,32 @@ for i in xrange(len(file_data)): # A new molecule. if mol_name_col and cdp.mol[mol_index].name != file_data[i][mol_name_col]: + # Replace the first empty molecule. + if mol_index = 0 and cdp.mol[0].name == None: + cdp.mol[0].name = file_data[i][mol_name_col] + # Create a new molecule. - cdp.mol.add_item(mol_name=file_data[i][mol_name_col]) - - # Increment the molecule index. - mol_index = mol_index + 1 + else: + # Add the molecule. + cdp.mol.add_item(mol_name=file_data[i][mol_name_col]) + + # Increment the molecule index. + mol_index = mol_index + 1 # A new residue. if res_name_col and cdp.mol[mol_index].res[res_index].name != file_data[i][res_name_col]: + # Replace the first empty residue. + if res_index = 0 and cdp.mol[mol_index].res[0].name == None: + cdp.mol[mol_index].res[0].name = file_data[i][res_name_col] + cdp.mol[mol_index].res[0].num = int(file_data[i][res_num_col]) + # Create a new residue. - cdp.mol[mol_index].res.add_item(res_name=file_data[i][res_name_col], res_num=int(file_data[i][res_num_col])) - - # Increment the residue index. - res_index = res_index + 1 + else: + # Add the residue. + cdp.mol[mol_index].res.add_item(res_name=file_data[i][res_name_col], res_num=int(file_data[i][res_num_col])) + + # Increment the residue index. + res_index = res_index + 1 # A new spin. if spin_num_col: