@Override
	public void newStructRefSeq(StructRefSeq sref) {
		DBRef r = new DBRef();

		r.setIdCode(sref.getPdbx_PDB_id_code());
		r.setDbAccession(sref.getPdbx_db_accession());
		r.setDbIdCode(sref.getPdbx_db_accession());

		r.setChainName(sref.getPdbx_strand_id());
		StructRef structRef = getStructRef(sref.getRef_id());
		if (structRef == null){
			logger.info("could not find StructRef " + sref.getRef_id() + " for StructRefSeq " + sref);
		} else {
			r.setDatabase(structRef.getDb_name());
			r.setDbIdCode(structRef.getDb_code());
		}

		int seqbegin;
		int seqend;
		try{
			seqbegin = Integer.parseInt(sref.getPdbx_auth_seq_align_beg());
			seqend   = Integer.parseInt(sref.getPdbx_auth_seq_align_end());
		}
		catch(NumberFormatException e){
			// this happens in a few entries, annotation error? e.g. 6eoj
			logger.warn("Couldn't parse pdbx_auth_seq_align_beg/end in _struct_ref_seq. Will not store dbref alignment info for accession {}. Error: {}", r.getDbAccession(), e.getMessage());
			return;
		}

		Character begin_ins_code = ' ';
		if (sref.getPdbx_seq_align_beg_ins_code() != null ) {
		    begin_ins_code = new Character(sref.getPdbx_seq_align_beg_ins_code().charAt(0));
		}

		Character end_ins_code = ' ';
		if (sref.getPdbx_seq_align_end_ins_code() != null) {
		    end_ins_code = new Character(sref.getPdbx_seq_align_end_ins_code().charAt(0));
		}

		if (begin_ins_code == '?')
			begin_ins_code = ' ';

		if (end_ins_code == '?')
			end_ins_code = ' ';

		r.setSeqBegin(seqbegin);
		r.setInsertBegin(begin_ins_code);

		r.setSeqEnd(seqend);
		r.setInsertEnd(end_ins_code);

		int dbseqbegin = Integer.parseInt(sref.getDb_align_beg());
		int dbseqend   = Integer.parseInt(sref.getDb_align_end());

		Character db_begin_in_code = ' ';
		if (sref.getPdbx_db_align_beg_ins_code() != null) {
		    db_begin_in_code = new Character(sref.getPdbx_db_align_beg_ins_code().charAt(0));
		}

		Character db_end_in_code = ' ';
		if (sref.getPdbx_db_align_end_ins_code() != null) {
		    db_end_in_code = new Character(sref.getPdbx_db_align_end_ins_code().charAt(0));
		}

		if (db_begin_in_code == '?')
			db_begin_in_code = ' ';

		if (db_end_in_code == '?')
			db_end_in_code = ' ';


		r.setDbSeqBegin(dbseqbegin);
		r.setIdbnsBegin(db_begin_in_code);

		r.setDbSeqEnd(dbseqend);
		r.setIdbnsEnd(db_end_in_code);

		List<DBRef> dbrefs = structure.getDBRefs();
		if ( dbrefs == null)
			dbrefs = new ArrayList<DBRef>();
		dbrefs.add(r);

		logger.debug(r.toPDB());

		structure.setDBRefs(dbrefs);

	}
@ Override public void newStructRefSeq ( StructRefSeq sref ) { DBRef r = new DBRef ( ) ; r . setIdCode ( sref . getPdbx_PDB_id_code ( ) ) ; r . setDbAccession ( sref . getPdbx_db_accession ( ) ) ; r . setDbIdCode ( sref . getPdbx_db_accession ( ) ) ; r . setChainName ( sref . getPdbx_strand_id ( ) ) ; StructRef structRef = getStructRef ( sref . getRef_id ( ) ) ; if ( structRef == null ) { logger . info ( "could not find StructRef " + sref . getRef_id ( ) + " for StructRefSeq " + sref ) ; } else { r . setDatabase ( structRef . getDb_name ( ) ) ; r . setDbIdCode ( structRef . getDb_code ( ) ) ; } int seqbegin ; int seqend ; try { seqbegin = Integer . parseInt ( sref . getPdbx_auth_seq_align_beg ( ) ) ; seqend = Integer . parseInt ( sref . getPdbx_auth_seq_align_end ( ) ) ; } catch ( NumberFormatException e ) { logger . warn ( "Couldn't parse pdbx_auth_seq_align_beg/end in _struct_ref_seq. Will not store dbref alignment info for accession {}. Error: {}" , r . getDbAccession ( ) , e . getMessage ( ) ) ; return ; } Character begin_ins_code = ' ' ; if ( sref . getPdbx_seq_align_beg_ins_code ( ) != null ) { begin_ins_code = new Character ( sref . getPdbx_seq_align_beg_ins_code ( ) . charAt ( 0 ) ) ; } Character end_ins_code = ' ' ; if ( sref . getPdbx_seq_align_end_ins_code ( ) != null ) { end_ins_code = new Character ( sref . getPdbx_seq_align_end_ins_code ( ) . charAt ( 0 ) ) ; } if ( begin_ins_code == '?' ) begin_ins_code = ' ' ; if ( end_ins_code == '?' ) end_ins_code = ' ' ; r . setSeqBegin ( seqbegin ) ; r . setInsertBegin ( begin_ins_code ) ; r . setSeqEnd ( seqend ) ; r . setInsertEnd ( end_ins_code ) ; int dbseqbegin = Integer . parseInt ( sref . getDb_align_beg ( ) ) ; int dbseqend = Integer . parseInt ( sref . getDb_align_end ( ) ) ; Character db_begin_in_code = ' ' ; if ( sref . getPdbx_db_align_beg_ins_code ( ) != null ) { db_begin_in_code = new Character ( sref . getPdbx_db_align_beg_ins_code ( ) . charAt ( 0 ) ) ; } Character db_end_in_code = ' ' ; if ( sref . getPdbx_db_align_end_ins_code ( ) != null ) { db_end_in_code = new Character ( sref . getPdbx_db_align_end_ins_code ( ) . charAt ( 0 ) ) ; } if ( db_begin_in_code == '?' ) db_begin_in_code = ' ' ; if ( db_end_in_code == '?' ) db_end_in_code = ' ' ; r . setDbSeqBegin ( dbseqbegin ) ; r . setIdbnsBegin ( db_begin_in_code ) ; r . setDbSeqEnd ( dbseqend ) ; r . setIdbnsEnd ( db_end_in_code ) ; List < DBRef > dbrefs = structure . getDBRefs ( ) ; if ( dbrefs == null ) dbrefs = new ArrayList < DBRef > ( ) ; dbrefs . add ( r ) ; logger . debug ( r . toPDB ( ) ) ; structure . setDBRefs ( dbrefs ) ; }
create a DBRef record from the StrucRefSeq record:
<pre>
PDB record                    DBREF
Field Name                    mmCIF Data Item
Section                       n.a.
PDB_ID_Code                   _struct_ref_seq.pdbx_PDB_id_code
Strand_ID                     _struct_ref_seq.pdbx_strand_id
Begin_Residue_Number          _struct_ref_seq.pdbx_auth_seq_align_beg
Begin_Ins_Code                _struct_ref_seq.pdbx_seq_align_beg_ins_code
End_Residue_Number            _struct_ref_seq.pdbx_auth_seq_align_end
End_Ins_Code                  _struct_ref_seq.pdbx_seq_align_end_ins_code
Database                      _struct_ref.db_name
Database_Accession_No         _struct_ref_seq.pdbx_db_accession
Database_ID_Code              _struct_ref.db_code
Database_Begin_Residue_Number _struct_ref_seq.db_align_beg
Databaes_Begin_Ins_Code       _struct_ref_seq.pdbx_db_align_beg_ins_code
Database_End_Residue_Number   _struct_ref_seq.db_align_end
Databaes_End_Ins_Code         _struct_ref_seq.pdbx_db_align_end_ins_code
</pre>