Skip to content

Commit 0561aa5

Browse files
committed
Started using auth_asym_id #95
1 parent 3e7adde commit 0561aa5

File tree

4 files changed

+27
-20
lines changed

4 files changed

+27
-20
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ All versions are properly annotated on [github](https://github.com/douweschulte/
1111
* Implemented `FromIterator` for the `PDB` struct
1212
* Removed requirement for `atom_site.pdbx_formal_charge`, `atom_site.group_PDB`, `atom_site.occupancy`, and `atom_site.B_iso_or_equiv` for mmCIF files (thanks to #93)
1313
* Added support for SCALE, ORIGX, and MTRIX in mmCIF files (open and save)
14+
* Fixed ignoring some of the `auth_*` series of mmCIF columns, by giving them precedence over the `label_*` columns in `seq_id` and `asym_id` (thanks to #95)
15+
* Fixed remark-type-number 400 missing from the valid number list (thanks to #96)
16+
* Fixed a small bug in saving MtriX records (thanks to #96)
1417

1518
### v0.9.2
1619
* Added `open_mmcif_raw`

src/read/mmcif/parser.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -320,21 +320,22 @@ fn parse_atoms(input: &Loop, pdb: &mut PDB) -> Option<Vec<PDBError>> {
320320
8, ATOM_ANISOU_3_2, "_atom_site.aniso_U[3][2]", Optional;
321321
9, ATOM_ANISOU_3_3, "_atom_site.aniso_U[3][3]", Optional;
322322
10, ATOM_ASYM_ID, "atom_site.label_asym_id", Required;
323-
11, ATOM_B, "atom_site.B_iso_or_equiv", Optional;
324-
12, ATOM_CHARGE, "atom_site.pdbx_formal_charge", Optional;
325-
13, ATOM_COMP_ID, "atom_site.label_comp_id", Required;
326-
14, ATOM_GROUP, "atom_site.group_PDB", Optional;
327-
15, ATOM_ID, "atom_site.id", Required;
328-
16, ATOM_INSERTION, "atom_site.pdbx_PDB_ins_code", Optional;
329-
17, ATOM_MODEL, "atom_site.pdbx_PDB_model_num", Optional;
330-
18, ATOM_NAME, "atom_site.label_atom_id", Required;
331-
19, ATOM_OCCUPANCY, "atom_site.occupancy", Optional;
332-
20, ATOM_SEQ_ID, "atom_site.label_seq_id", Required;
333-
21, ATOM_AUTH_SEQ_ID, "atom_site.auth_seq_id", Optional;
334-
22, ATOM_TYPE, "atom_site.type_symbol", Required;
335-
23, ATOM_X, "atom_site.Cartn_x", Required;
336-
24, ATOM_Y, "atom_site.Cartn_y", Required;
337-
25, ATOM_Z, "atom_site.Cartn_z", Required;
323+
11, ATOM_AUTH_ASYM_ID, "atom_site.auth_asym_id", Optional;
324+
12, ATOM_B, "atom_site.B_iso_or_equiv", Optional;
325+
13, ATOM_CHARGE, "atom_site.pdbx_formal_charge", Optional;
326+
14, ATOM_COMP_ID, "atom_site.label_comp_id", Required;
327+
15, ATOM_GROUP, "atom_site.group_PDB", Optional;
328+
16, ATOM_ID, "atom_site.id", Required;
329+
17, ATOM_INSERTION, "atom_site.pdbx_PDB_ins_code", Optional;
330+
18, ATOM_MODEL, "atom_site.pdbx_PDB_model_num", Optional;
331+
19, ATOM_NAME, "atom_site.label_atom_id", Required;
332+
20, ATOM_OCCUPANCY, "atom_site.occupancy", Optional;
333+
21, ATOM_SEQ_ID, "atom_site.label_seq_id", Required;
334+
22, ATOM_AUTH_SEQ_ID, "atom_site.auth_seq_id", Optional;
335+
23, ATOM_TYPE, "atom_site.type_symbol", Required;
336+
24, ATOM_X, "atom_site.Cartn_x", Required;
337+
25, ATOM_Y, "atom_site.Cartn_y", Required;
338+
26, ATOM_Z, "atom_site.Cartn_z", Required;
338339
);
339340

340341
let positions_: Vec<Result<Option<usize>, PDBError>> = COLUMNS
@@ -398,8 +399,9 @@ fn parse_atoms(input: &Loop, pdb: &mut PDB) -> Option<Vec<PDBError>> {
398399
parse_column!(get_isize, ATOM_SEQ_ID)
399400
.unwrap_or_else(|| pdb.total_residue_count() as isize)
400401
});
401-
let chain_name =
402-
parse_column!(get_text, ATOM_ASYM_ID).expect("Chain name should be provided");
402+
let chain_name = parse_column!(get_text, ATOM_AUTH_ASYM_ID).unwrap_or_else(|| {
403+
parse_column!(get_text, ATOM_ASYM_ID).expect("Chain name should be provided")
404+
});
403405
let pos_x = parse_column!(get_f64, ATOM_X).expect("Atom X position should be provided");
404406
let pos_y = parse_column!(get_f64, ATOM_Y).expect("Atom Y position should be provided");
405407
let pos_z = parse_column!(get_f64, ATOM_Z).expect("Atom Z position should be provided");

src/save/mmcif.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ _atom_site.label_atom_id
231231
_atom_site.label_alt_id
232232
_atom_site.label_comp_id
233233
_atom_site.label_asym_id
234+
_atom_site.auth_asym_id
234235
_atom_site.label_entity_id
235236
_atom_site.label_seq_id
236237
_atom_site.auth_seq_id
@@ -276,8 +277,9 @@ _atom_site.aniso_U[3][3]"
276277
atom.name().to_string(), // Name
277278
conformer.alternative_location().unwrap_or(".").to_string(), // Alternative location
278279
conformer.name().to_string(), // Residue name
279-
chain.id().to_string(), // Chain name
280-
chain_index.to_string(), // Entity ID, using chain serial number
280+
number_to_base26(chain_index), // Label Chain name, defined to be without gaps
281+
chain.id().to_string(), // Auth Chain name
282+
chain_index.to_string(), // Entity ID, using chain serial number
281283
(residue_index + 1).to_string(), // `label_seq_id` defined to be [1-N] where N is the index
282284
residue.serial_number().to_string(), // Residue serial number
283285
residue.insertion_code().unwrap_or(".").to_string(), // Insertion code

src/structs/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub use chain::Chain;
2121
pub use conformer::Conformer;
2222
pub use database_reference::*;
2323
pub use elements::{AtomicRadius, Element};
24-
use helper::*;
24+
pub(crate) use helper::*;
2525
pub use hierarchy::*;
2626
pub use model::Model;
2727
pub use mtrix::MtriX;

0 commit comments

Comments
 (0)