Chem-Structure-Parser
view release on metacpan or search on metacpan
h('structure_info'); # by name
h(*res_type); # by name, unquoted
h(\&aa3to1); # by reference
h(); # the list of documented functions
perl -MChem::Structure::Parser -e 'h(*structure_info)' # straight from the shell
Note that `h(res_type)`, with no quotes and no sigil, cannot be made to work:
every function here is exported, so Perl parses the bareword as a call to
`res_type()` before `h` is ever reached. Use one of the three forms above.
# Functions/Subroutines
## structure_info
my $info = structure_info($file, %options);
Reads `$file` and returns a hash reference. The format is worked out from the
file name â `.pdb`, `.ent`, `.cif`, `.mmcif`, `.pdbx` â and from the first
records in the file when the name gives nothing away. `.gz` files are read as
they are, without unpacking to a temporary file.
### What comes back
Laid out the way `tree` lays out a directory, this is `1a22.ent.pdb` â a real
file, real values, the long lists cut short:
$info
âââ file '1a22.ent.pdb' the path it was read from
âââ format 'pdb' or 'mmcif'
âââ id '1A22' from HEADER, or from the file name
âââ title 'HUMAN GROWTH HORMONE BOUND TO SINGLE RECEPTOR'
âââ header
â âââ classification 'COMPLEX (HORMONE/RECEPTOR)'
â âââ deposit_date '15-JAN-98'
â âââ id_code '1A22'
âââ experiment [ 'X-RAY DIFFRACTION' ]
âââ resolution 2.6 REMARK 2
âââ r_work 0.187 REMARK 3
âââ r_free undef this entry does not report one
âââ temperature 287 REMARK 200
âââ ph 6.5
âââ keywords [ 'COMPLEX (HORMONE-RECEPTOR)', 'PITUITARY HORMONE', ... ]
âââ authors [ 'A.M.DE VOS', 'M.ULTSCH' ]
âââ journal
â âââ auth [ 'T.CLACKSON', 'M.H.ULTSCH', 'J.A.WELLS', 'A.M.DE VOS' ]
â âââ titl 'STRUCTURAL AND FUNCTIONAL ANALYSIS OF THE 1:1 GROWTH...'
â âââ ref 'J.MOL.BIOL. V. 277 1111 1998'
â âââ refn 'ISSN 0022-2836'
â âââ pmid '9571026'
â âââ doi '10.1006/JMBI.1998.1669'
âââ compound COMPND, by MOL_ID
â âââ 1
â â âââ mol_id '1'
â â âââ molecule 'GROWTH HORMONE'
â â âââ chain [ 'A' ]
â â âââ engineered 'YES'
â â âââ mutation 'YES'
â âââ 2 { molecule 'GROWTH HORMONE RECEPTOR', chain [ 'B' ],
â fragment 'EXTRACELLULAR DOMAIN', engineered 'YES' }
âââ source SOURCE, by MOL_ID
â âââ 1 { organism_scientific 'HOMO SAPIENS', organism_common
â 'HUMAN', organism_taxid '9606', mol_id '1',
â expression_system 'ESCHERICHIA COLI',
â expression_system_taxid '562' }
âââ entity_of_chain COMPND and SOURCE, by chain
â âââ A { mol_id '1', molecule 'GROWTH HORMONE', fragment undef,
â â ec undef, organism 'HOMO SAPIENS', taxid '9606',
â â expressed_in 'ESCHERICHIA COLI' }
â âââ B { ..., fragment 'EXTRACELLULAR DOMAIN' }
âââ seqres what SEQRES says was in the crystal
â âââ A
â â âââ sequence 'FPTIPLSRLFDNAMLRAHRLHQLAFDTYQEFEEAYIPKEQKYSFLQ...'
â â âââ residues [ 'PHE', 'PRO', 'THR', 'ILE', ... ] 191 of them
â â âââ length 191
â âââ B { sequence, residues, length 238 }
âââ dbref
â âââ A [ { database 'UNP', accession 'P01241',
â db_id 'SOMA_HUMAN', seq_begin '1', seq_end '191',
â db_begin '27', db_end '217', chain 'A' } ]
âââ seqadv [ { chain 'A', resseq '120', resname 'ARG',
â db_res 'GLY', db_seq '146', comment 'ENGINEERED' } ]
âââ modres { } no MSE-style residues here
âââ het
â âââ HOH { het_id 'HOH', formula '69(H2 O)', water 1 }
âââ hetnam { }
âââ formul { }
âââ helix [ { id '1', class '1', length '29',
â init_chain 'A', init_resname 'SER', init_resseq '7',
â end_chain 'A', end_resname 'TYR', end_resseq '35' },
â ... ] 12 of them
âââ sheet [ ... ] 12
âââ ssbond [ { chain1 'A', resseq1 '53',
â chain2 'A', resseq2 '165', length '2.02' }, ... ] 5
âââ link [ ]
âââ cispep [ ]
âââ site [ ]
âââ cryst1 { a '67.7', b '67.7', c '228',
â alpha '90', beta '90', gamma '90',
â sgroup 'P 43 21 2', z '8' }
âââ biological_assembly [ 32 lines of REMARK 350, verbatim ]
âââ revdat [ { num '3', date '18-APR-18', id '1A22',
â type '1', what 'REMARK' }, ... ]
âââ remarks every REMARK, by number
â âââ 2 [ '', 'RESOLUTION. 2.60 ANGSTROMS.' ]
â âââ 350 [ ... ] 32 lines
â âââ ... 1, 3, 4, 100, 200, 280, 290, 300, 465, 470, 500
âââ conect [ [ 448, 1255 ], ... ] 10
âââ records every record type, counted
â âââ REMARK 365
â âââ SEQRES 34
â âââ HELIX 12
â âââ ... AUTHOR, COMPND, CONECT, CRYST1, DBREF, SOURCE, SSBOND, ...
âââ n_models 1 how many MODEL records the file has
âââ model 1 which one the chains below are
âââ models there only with model => 'all'
âââ stats
â âââ n_atoms 3113 atoms kept: this model, less what was filtered
â âââ total_atoms 3113 atoms the file has, every model, unfiltered
â âââ n_hetatm 69 of n_atoms, the ones written as HETATM
â âââ n_hydrogens 0
â âââ n_water_atoms 69
â âââ n_lines 3605
â âââ n_atom_records 3044 ATOM lines seen, whether kept or not
â âââ n_hetatm_records 69 HETATM lines, likewise
â âââ n_anisou 0
â âââ n_skipped 0 coordinate lines the options threw away
â âââ elements { C 1946, O 643, N 507, S 17 }
â â every element in the file, keyed by its IUPAC
â â symbol; the counts add up to n_atoms
â âââ bfactor { min '2.7', max '85.39', mean 30.83, n 3113 }
â âââ bbox { xmin '12.142', xmax '80.34', ymin '2.011', ... }
â âââ center [ '46.241', '29.135', '134.559' ]
âââ chain_order [ 'A', 'B' ] the order the file has them in
âââ chains
âââ A
â âââ id 'A'
â âââ type 'protein' protein dna rna water hetero unknown
â âââ sequence 'FPTIPLSRLFDNAMLRAHRLHQLAFDTYQEFEEAYIPKEQ...'
â â single-letter, what has coordinates
â âââ seqres 'FPTIPLSRLFDNAMLRAHRLHQLAFDTYQEFEEAYIPKEQ...'
â âââ seqres_length 191
â âââ n_residues 206
â âââ n_polymer 180
â âââ n_water 26
â âââ n_ligand 0
â âââ n_atoms 1492
â âââ n_hetatm 26
â âââ elements { C 938, O 301, N 246, S 7 }
â â the same tally for this chain alone;
â â adds up to the chain's n_atoms
â âââ n_missing 11 SEQRES less what was modelled
â âââ gaps [ { after 129, before 136, missing 6 },
â â { after 148, before 154, missing 5 } ]
â âââ n_gaps 2
â âââ missing_residues
â â [ 130, 131, 132, 133, 134, 135,
â â 149, 150, 151, 152, 153 ]
â âââ first 1 the first and last polymer residue keys
â âââ last 191
â âââ residue_types { amino_acid 180, water 26 }
â âââ molecule 'GROWTH HORMONE' from COMPND
â âââ organism 'HOMO SAPIENS' from SOURCE
â âââ mol_id '1'
â âââ dbref [ { ... } ] as in the top-level dbref
â â ec and fragment are here too, in a
â â chain whose file gives them
â âââ residue_order [ '1', '2', '3', ... '574' ] file order, 206
â âââ residues keyed number + insertion code
â âââ 54
â â âââ resname 'PHE'
â â âââ number 54
â â âââ icode ''
â â âââ key '54'
â â âââ chain 'A'
â â âââ one 'F' '' when there is no letter for it
â â âââ type 'amino_acid'
â â â nucleotide water ligand ion
â â âââ standard 1 one of the twenty, or a standard base
â â âââ modified 0 1 for MSE, still an M in the sequence
â â âââ hetero 0 1 when it was written as HETATM
â â âââ free not here; 1 for a free amino acid
â â â bound in a site (see below)
â â âââ n_atoms 11
â â âââ b_mean 22.55
â â âââ center [ 65.311, 17.127, 140.515 ]
â â âââ atom_order [ 'N', 'CA', 'C', 'O', 'CB', ... ]
â â âââ atoms
â â âââ CA
â â â âââ name 'CA'
â â â âââ serial 450
â â â âââ element 'C'
â â â âââ charge ''
â â â âââ x '66.446'
â â â âââ y '18.25'
â â â âââ z '141.982'
â â â âââ occupancy '1'
â â â âââ bfactor '24.53'
â â â âââ altloc ''
â â â âââ hetero 0
â â â âââ altlocs [ { altloc, x, y, z, occupancy,
â â â bfactor }, ... ]
â â â present only when the atom has
â â â alternate conformers; every conformer
â â â is listed, the chosen one included,
â â â and one of them having no letter at
â â â all does not take it off the list
â â âââ ... N, C, O, CB, CG, CD1, CD2, CE1, CE2, CZ
â âââ ... 1 .. 191, then the waters at 512 .. 574
âââ B the same again: 235 residues, 1621 atoms
A record that is not in the file reads as `undef`, and a list that is not in
the file reads as an empty arrayref â `title` being `undef` means there was no
TITLE, which is a different thing from a TITLE that was blank.
Everything the module does not take apart is still in `remarks` and in the
raw record counts, so nothing in the file is lost.
### The two sequences
`sequence` and `seqres` are the two different questions people mean by "the
sequence": what was modelled, and what was in the crystal. They differ
wherever a terminus or a loop went unmodelled, which is what `gaps` counts and
`n_missing` totals â eleven residues of chain A above, in two stretches.
`missing_residues` is the same eleven one number at a time, in ascending
order, for asking whether a particular residue was modelled without walking
( run in 1.032 second using v1.01-cache-2.11-cpan-364913b4093 )