@@ -333,7 +333,7 @@ public void consumeAtomSite(AtomSite atomSite) {
333333 atom .setY (cartnY .get (atomIndex ));
334334 atom .setZ (cartnZ .get (atomIndex ));
335335
336- atom .setOccupancy ((float ) occupancy .get (atomIndex ));
336+ atom .setOccupancy ((float ) ( occupancy .isDefined ()? occupancy . get (atomIndex ) : 1.0 ));
337337 atom .setTempFactor ((float ) bIsoOrEquiv .get (atomIndex ));
338338
339339 if (altLocation == null || altLocation .isEmpty () || "." .equals (altLocation )) {
@@ -975,7 +975,7 @@ public void consumeStructRefSeq(StructRefSeq structRefSeq) {
975975 dbRef .setIdCode (structRefSeq .getPdbxPDBIdCode ().isDefined ()? structRefSeq .getPdbxPDBIdCode ().get (rowIndex ):null );
976976 dbRef .setDbAccession (structRefSeq .getPdbxDbAccession ().isDefined ()? structRefSeq .getPdbxDbAccession ().get (rowIndex ):null );
977977 dbRef .setDbIdCode (structRefSeq .getPdbxDbAccession ().isDefined ()? structRefSeq .getPdbxDbAccession ().get (rowIndex ):null );
978- dbRef .setChainName (structRefSeq .getPdbxStrandId ().get (rowIndex ));
978+ dbRef .setChainName (structRefSeq .getPdbxStrandId ().isDefined ()? structRefSeq . getPdbxStrandId (). get (rowIndex ): null );
979979
980980 OptionalInt structRefRowIndex = IntStream .range (0 , structRef .getRowCount ())
981981 .filter (i -> structRef .getId ().get (i ).equals (refId ))
@@ -990,34 +990,39 @@ public void consumeStructRefSeq(StructRefSeq structRefSeq) {
990990
991991 int seqBegin ;
992992 int seqEnd ;
993+ char beginInsCode = ' ' ;
994+ char endInsCode = ' ' ;
993995
994- try {
995- seqBegin = Integer .parseInt (structRefSeq .getPdbxAuthSeqAlignBeg ().get (rowIndex ));
996- seqEnd = Integer .parseInt (structRefSeq .getPdbxAuthSeqAlignEnd ().get (rowIndex ));
997- } catch (NumberFormatException e ) {
998- // this happens in a few entries, annotation error? e.g. 6eoj
999- logger .warn ("Couldn't parse pdbx_auth_seq_align_beg/end in _struct_ref_seq. Will not store dbref " +
1000- "alignment info for accession {}. Error: {}" , dbRef .getDbAccession (), e .getMessage ());
1001- return ;
1002- }
996+ if (structRefSeq .getPdbxAuthSeqAlignBeg ().isDefined () && structRefSeq .getPdbxAuthSeqAlignEnd ().isDefined ()) {
997+ try {
998+ seqBegin = Integer .parseInt (structRefSeq .getPdbxAuthSeqAlignBeg ().get (rowIndex ));
999+ seqEnd = Integer .parseInt (structRefSeq .getPdbxAuthSeqAlignEnd ().get (rowIndex ));
1000+ } catch (NumberFormatException e ) {
1001+ // this happens in a few entries, annotation error? e.g. 6eoj
1002+ logger .warn ("Couldn't parse pdbx_auth_seq_align_beg/end in _struct_ref_seq. Will not store dbref " +
1003+ "alignment info for accession {}. Error: {}" , dbRef .getDbAccession (), e .getMessage ());
1004+ return ;
1005+ }
10031006
1004- char beginInsCode = ' ' ;
1005- String pdbxSeqAlignBegInsCode = structRefSeq .getPdbxSeqAlignBegInsCode ().get (rowIndex );
1006- if (pdbxSeqAlignBegInsCode .length () > 0 ) {
1007- beginInsCode = pdbxSeqAlignBegInsCode .charAt (0 );
1008- }
1007+ String pdbxSeqAlignBegInsCode = structRefSeq .getPdbxSeqAlignBegInsCode ().get (rowIndex );
1008+ if (pdbxSeqAlignBegInsCode .length () > 0 ) {
1009+ beginInsCode = pdbxSeqAlignBegInsCode .charAt (0 );
1010+ }
10091011
1010- char endInsCode = ' ' ;
1011- String pdbxSeqAlignEndInsCode = structRefSeq .getPdbxSeqAlignEndInsCode ().get (rowIndex );
1012- if (pdbxSeqAlignEndInsCode .length () > 0 ) {
1013- endInsCode = pdbxSeqAlignEndInsCode .charAt (0 );
1014- }
1012+ String pdbxSeqAlignEndInsCode = structRefSeq .getPdbxSeqAlignEndInsCode ().get (rowIndex );
1013+ if (pdbxSeqAlignEndInsCode .length () > 0 ) {
1014+ endInsCode = pdbxSeqAlignEndInsCode .charAt (0 );
1015+ }
10151016
1016- if (beginInsCode == '?' ) {
1017- beginInsCode = ' ' ;
1018- }
1019- if (endInsCode == '?' ) {
1020- endInsCode = ' ' ;
1017+ if (beginInsCode == '?' ) {
1018+ beginInsCode = ' ' ;
1019+ }
1020+ if (endInsCode == '?' ) {
1021+ endInsCode = ' ' ;
1022+ }
1023+ } else {
1024+ seqBegin = structRefSeq .getSeqAlignBeg ().get (rowIndex );
1025+ seqEnd = structRefSeq .getSeqAlignEnd ().get (rowIndex );
10211026 }
10221027
10231028 dbRef .setSeqBegin (seqBegin );
@@ -1814,6 +1819,10 @@ private void initMaps() {
18141819
18151820 String [] chainNames = entityPoly .getPdbxStrandId ().get (rowIndex ).split ("," );
18161821 List <String > asymIds = entityId2asymId .get (entityPoly .getEntityId ().get (rowIndex ));
1822+ if (asymIds == null ) {
1823+ logger .warn ("No asym ids found for entity {} in _struct_asym. Can't provide a mapping from asym ids to author chain ids for this entity" , entityPoly .getEntityId ().get (rowIndex ));
1824+ break ;
1825+ }
18171826 if (chainNames .length != asymIds .size ()) {
18181827 logger .warn ("The list of asym ids (from _struct_asym) and the list of author ids (from _entity_poly) " +
18191828 "for entity {} have different lengths! Can't provide a mapping from asym ids to author chain " +
0 commit comments