DETECTER

NodesBlock

Summary Package variables Synopsis Description General documentation Methods

Summary
 Parsing the PAML Files
Package variables top
No package variables defined.
Synopsistop
 my $nodes_block = new NodesBlock();
$nodes_block->parse_file('ABC.Redo.CFTRsubtree.Crop.txt');
Descriptiontop
 NodesBlock parses the PAML input and stores all the data as nodes and the site 
objects. Refer to Node and Site object for more details.
Methodstop
add_nodeDescriptionCode
delete_nodeDescriptionCode
get_nodeDescriptionCode
get_numb_of_nodesDescriptionCode
newDescriptionCode
parse_fileDescriptionCode

Methods description

add_nodecodetopprevnext
 Title    : add_node
Usage : $nodes_block_obj->add_node()
Function : adds node object to the nodes array
Returns : none
Argument : $node_obj
delete_nodecodetopprevnext
 Title    : delete_node
Usage : $nodes_block_obj->delete_node
Function : undefines the node object in the nodes array. This can be
used to remove large amounts of node data in memory.
Returns : none
Argument : position of node object in the nodes array
get_nodecodetopprevnext
 Title    : get_node
Usage : $nodes_block_obj->get_node()
Function : get the node object from the nodes array
Returns : $node_obj
Argument : position of node object in the nodes array
get_numb_of_nodescodetopprevnext
 Title    : get_numb_of_nodes
Usage : $no_of_nodes = $node_blocks_obj->get_number_of_nodes
Function : returns the number of nodes stored in the nodes_block_obj
Returns : number of nodes
Argument : none
newcodetopprevnext
 Title    : new
Usage : $nodes_block_obj = new NodesBlock()
Function : creates new object for storing NodesBlock data
Returns : NodesBlock Object
Argument : none
parse_filecodetopprevnext
 Title    : Parses the Input (PAML) File 
Usage : my $nodes_block = new NodesBlock($file_name);
Function : creates a new NodesBlock object by parsing files
Returns : NodesBlock object
Argument : $file_name

Methods code

add_nodedescriptiontopprevnext
sub add_node {
	my $class = shift;
	my $node  = shift;
	push(@{$class->{_nodes_array}},$node);
}
delete_nodedescriptiontopprevnext
sub delete_node {
	my $class = shift;
	$class->{_nodes_array}->[$_[0]] = undef;
}
get_nodedescriptiontopprevnext
sub get_node {
	my $class = shift;
	return $class->{_nodes_array}->[$_[0]];
}
get_numb_of_nodesdescriptiontopprevnext
sub get_numb_of_nodes {
	my $class = shift;
	my $numbOfnodes = @{$class->{_nodes_array}};
	return $numbOfnodes;
}
newdescriptiontopprevnext
sub new {
	my $class = shift;
	my $data  = {
		'_nodes_array' => []
	};
	bless ($data,$class);
	return $data;
}
parse_filedescriptiontopprevnext
sub parse_file {
	my $class     = shift;
	my $file_name = shift;
	my ($freq,$line,$data);

	open (IF, $file_name) or die $!;
	$line = <IF>;
	my $node;
	my $site_id;

	while ($line !~ /Prob/) { $line = <IF> }

	while ($line = <IF>) {
		$line =~ s/\\par//;		##get rid of all the /par's
chomp $line; $line =~ s/^\s*//g; if ( $line =~ /^Prob/ ) { print "$line\n"; $class->add_node($node) if (defined($node)); ### Adding nodes to the NodesBlock
##last if $count++ == 2;
$node = new Node(); (my $node_no = $line) =~s/[^\d]//g;
$node->set_node_no($node_no); $line = <IF>; $line = <IF>; $line = <IF>; } elsif ($line =~ /^\d+/) { ($header, $footer) = split(/:/, $line); $header =~s/^\s*//g;
($site_id, $freq, $data) = split(/\s+/,$header); $site_id = sprintf("%04d",$site_id); my $site_obj = new Site(); $site_obj->set_site($site_id,$data,$footer); $node->add_site($site_obj); ## Sites are added to the node
} }
}

General documentation

NodesBlock top
 Package 'NodeBlock'
FEEDBACK top
 All feedback (bugs, feature enhancements, etc.) are greatly appreciated.
AUTHOR top
 Danny W. De Kee (dan.dekee@gmail.com)