module Bio.PDB.EventParser.ParseHEADER(parseHEADER)
where
import qualified Data.ByteString.Char8 as BS
import Bio.PDB.EventParser.PDBEvents
import Bio.PDB.EventParser.PDBParsingAbstractions
headerFields = [(6, mKeyword "header" "HEADER"),
(10, mSpc 4 ),
(50, dStr "classification" "" ),
(59, dStr "depDate" "" ),
(62, mSpc 3 ),
(66, dStr "idCode" "" )]
parseHEADER :: (Monad m) => BS.ByteString -> Int -> m [PDBEvent]
parseHEADER line line_no = return $ if errs == [] then [result] else errs
where
(fields, errs) = parseFields headerFields line line_no
[fRec, fSpc1, fClass, fDepDate, fSpc2, fIdCode] = fields
IFStr clas = fClass
IFStr depDate = fDepDate
IFStr idCode = fIdCode
result = HEADER { classification = clas,
depDate = depDate,
idCode = idCode }