package PGF::GapResolution::ParseGapValidationInfo; =head1 NAME PGF::GapResolution::ParseGapValidationInfo =head1 SYNOPSIS use PGF::GapResolution::ParseGapValidationInfo; my $obj = PGF::GapResolution::ParseGapValidationInfo->new($validationInfoFile); my $leftContig = $obj->getLeftContig(); my $rightContig = $obj->getRightContig(); my $leftContigLength = $obj->getLeftContigLength(); my $rightContigLength = $obj->getRightContigLength(); my ($leftStart,$leftEnd) = $obj->getLeftAnchorPos(); my ($rightStart,$rightEnd) = $obj->getRightAnchorPos(); my ($anchorStart,$anchorEnd) = $obj->getAnchorPos(); my $anchorDistance = $obj->getAnchorDistance(); my $gapSize = $obj->getGapSize(); my $gapSizeStdDev = $obj->getGapSizeStdDev(); my $numConsistentReadPairs = $obj->getNumConsistentReadPairs(); my $numInconsistentReadPairs = $obj->getNumInconsistentReadPairs(); my $pctConsistent = $obj->getPctConsistent(); my $avgConsensusQuality = $obj->getAvgConsensusQualityBetweenAnchors(); my $isDistanceValid = $obj->isDistanceValid(); my $isReadPairingValid = $obj->isReadPairingValid(); my $isQualityValid = $obj->isQualityValid(); my $status = $obj->isSuccessful(); my $designPrimer = $obj->doPrimerDesign(); my $comment = $obj->getComment(); =head1 DESCRIPTION This module parses the validinfo.txt file generated by validateSubProject.pl as part of the Gap Resolution sub system and contains access methods to the data. The format of the validinfo.txt are key/value pairs. An example of leftAnchorContig=name of contig leftAnchorContigLength=number leftAnchorStart=number leftAnchorEnd=number rightAnchorContig=name of contig rightAnchorContigLength=number rightAnchorStart=number rightAnchorEnd=number anchorStart=number anchorEnd=number anchorDistance=number gapSize=number gapSizeStdDev=number numConsistentReadPairs=number numInconsistentReadPairs=number pctConsistent=number avgConsensusQualityBetweenAnchors=number isDistanceValid=0|1 isReadPairingValid=0|1 isQualityValid=0|1 status=PASS|FAIL doPrimerDesign=0|1 comment=comment entry =head1 AUTHOR(s) Stephan Trong =head1 HISTORY =over =item * Stephan Trong 12/11/2008 Creation =back =cut #============================================================================# use strict; use Carp; use Carp qw(cluck); use FindBin qw($RealBin); use lib "$FindBin::RealBin/../lib"; #============================================================================# sub new { my $class = shift; my $file = shift; my %attribs = _parseFile($file); my $self = { _attribs=>\%attribs }; bless $self, $class; return $self; } #============================================================================# sub _parseFile { my $file = shift; my %attribs = (); unless (open FH, $file ) { confess "ERROR: failed to open file $file: $!"; } while ( my $entry = ) { chomp $entry; next if !length $entry; if ( $entry =~ /^(.+)\s*=\s*(.+)$/ ) { $attribs{$1} = $2; } } close FH; return %attribs; } #============================================================================# sub getLeftContig { return $_[0]->{_attribs}{leftAnchorContig} || ''; } #============================================================================# sub getRightContig { return $_[0]->{_attribs}{rightAnchorContig} || ''; } #============================================================================# sub getLeftContigLength{ return $_[0]->{_attribs}{leftAnchorContigLength} || ''; } #============================================================================# sub getRightContigLength{ return $_[0]->{_attribs}{rightAnchorContigLength} || ''; } #============================================================================# sub getLeftAnchorPos { return $_[0]->{_attribs}{leftAnchorStart}, $_[0]->{_attribs}{leftAnchorEnd} || ''; } #============================================================================# sub getRightAnchorPos { return $_[0]->{_attribs}{rightAnchorStart}, $_[0]->{_attribs}{rightAnchorEnd} || ''; } #============================================================================# sub getAnchorPos{ return $_[0]->{_attribs}{anchorStart}, $_[0]->{_attribs}{anchorEnd} || ''; } #============================================================================# sub getAnchorDistance { return $_[0]->{_attribs}{anchorDistance} || ''; } #============================================================================# sub getGapSize { return $_[0]->{_attribs}{gapSize} || ''; } #============================================================================# sub getGapSizeStdDev { return $_[0]->{_attribs}{gapSizeStdDev} || ''; } #============================================================================# sub getNumConsistentReadPairs { return $_[0]->{_attribs}{numConsistentReadPairs} || ''; } #============================================================================# sub getNumInconsistentReadPairs { return $_[0]->{_attribs}{numInconsistentReadPairs} || ''; } #============================================================================# sub getPctConsistent{ return $_[0]->{_attribs}{pctConsistent} || ''; } #============================================================================# sub getAvgConsensusQualityBetweenAnchors{ return $_[0]->{_attribs}{avgConsensusQualityBetweenAnchors} || ''; } #============================================================================# sub isDistanceValid { return $_[0]->{_attribs}{isDistanceValid} || ''; } #============================================================================# sub isReadPairingValid { return $_[0]->{_attribs}{isReadPairingValid} || ''; } #============================================================================# sub isQualityValid { return $_[0]->{_attribs}{isQualityValid} || ''; } #============================================================================# sub doPrimerDesign { return $_[0]->{_attribs}{doPrimerDesign} || ''; } #============================================================================# sub isSuccessful { if ( $_[0]->{_attribs}{status} eq 'SUCCESSFUL' || $_[0]->{_attribs}{status} eq 'PASS' ) { # Status=SUCCESSFUL is deprecated but checked for backwards compatibility. return 1; } else { return 0; } } #============================================================================# sub getComment { return $_[0]->{_attribs}{comment} || ''; } #============================================================================# sub getAllAttribs { return %{$_[0]->{_attribs}}; } #============================================================================# 1;