An example STAR Parser script

From PDBWiki

Jump to: navigation, search

A sample Perl STAR (CIF) Parser script follows;

#!/usr/bin/perl -w
 
use strict;
use STAR::Parser;
 
my $file = '2hur.cif';
 
my @objs = STAR::Parser->parse( $file );
 
my $data = $objs[0];
 
my @items = $data->get_items;
 
warn scalar(@items), "\n";
 
#warn $data->get_keys; exit;
 
foreach my $item ( @items ) {
 
  print $item, "\n";
 
  # Uncomment the below to see all the data.
 
  # Or just One specific example;
  #next unless $item eq '_atom_site.Cartn_x';
 
  my @item_data = $data->get_item_data( $item );
 
  #for my $dat ( @item_data ) {
  #  print "\t$dat\n";
  #}
}
Personal tools