private Atom convertAtom ( AtomSite atom ) { Atom a = new AtomImpl ( ) ; a . setPDBserial ( Integer . parseInt ( atom . getId ( ) ) ) ; a . setName ( atom . getLabel_atom_id ( ) ) ; double x = Double . parseDouble ( atom . getCartn_x ( ) ) ; double y = Double . parseDouble ( atom . getCartn_y ( ) ) ; double z = Double . parseDouble ( atom . getCartn_z ( ) ) ; a . setX ( x ) ; a . setY ( y ) ; a . setZ ( z ) ; float occupancy = Float . parseFloat ( atom . getOccupancy ( ) ) ; a . setOccupancy ( occupancy ) ; float temp = Float . parseFloat ( atom . getB_iso_or_equiv ( ) ) ; a . setTempFactor ( temp ) ; String alt = atom . getLabel_alt_id ( ) ; if ( ( alt != null ) && ( alt . length ( ) > 0 ) && ( ! alt . equals ( "." ) ) ) { a . setAltLoc ( new Character ( alt . charAt ( 0 ) ) ) ; } else { a . setAltLoc ( new Character ( ' ' ) ) ; } Element element = Element . R ; try { element = Element . valueOfIgnoreCase ( atom . getType_symbol ( ) ) ; } catch ( IllegalArgumentException e ) { logger . info ( "Element {} was not recognised as a BioJava-known element, the element will be represented as the generic element {}" , atom . getType_symbol ( ) , Element . R . name ( ) ) ; } a . setElement ( element ) ; return a ; }
Convert a mmCIF AtomSite object to a BioJava Atom object