SmotifTF
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/SmotifTF/GetSMotifsfromPDB.pm view on Meta::CPAN
SmotifTF::PDB::PDBCoordinateSectionParse::GetPDBHetatmRecordFields($line);
}
else {
die "There was error: unexpected line-start\n\t$line";
}
unless ( ( exists( $$HashRef_CoordRecord{'AtomName'} ) )
&& ( exists( $$HashRef_CoordRecord{'ResidueNumber'} ) )
&& ( exists( $$HashRef_CoordRecord{'ResidueInsertionCode'} ) ) )
{
die
"There was error: no atom name or res num or insertion code in returned hash\n\t$line\n";
# return;
}
my $AtomType = $$HashRef_CoordRecord{'AtomName'};
next PDBLINE unless ( $AtomType eq 'CA' );
my $num = $$HashRef_CoordRecord{'ResidueNumber'};
my $insert = $$HashRef_CoordRecord{'ResidueInsertionCode'};
my $residuenumber = $num . $insert;
$residuenumber =~ s/\s+//g;
if ( $residuenumber eq $motifstart ) {
$InRange = 1;
$count++;
}
if ($InRange) {
$count++;
if ( $count == $ss1lng + 1 ) {
$loopstart = $residuenumber;
}
if ( $count == ( $ss1lng + $looplength ) ) {
$loopend = $residuenumber;
last;
}
}
else {
next PDBLINE;
}
} #end PDBLINE loop
return ( $loopstart, $loopend );
}
################################################################
##### CHECKED
#####################MUST CHANGE THIS SUBROUTINE TO WORK WITH PDB FILE
sub checklength {
my ( $start, $end, $ressequence, $sssequence, $ArrayRef_coordchain ) = @_
; #smotif start residue, end residue, aa sequence, secondary structure sequence, pdb coord records for chain
unless ( defined($start)
&& defined($end)
&& defined($ressequence)
&& defined($sssequence)
&& defined($ArrayRef_coordchain) )
{
die "There was error: arguments for checklength subroutine\n";
# return;
}
my $checklength;
#count insertions in the start-end range
my $numinsertions = 0;
my $InRange = 0;
my $rescount = 0;
my %CAcoords;
my $firstresnum = 'NA';
my $lastresnum = 'NA';
PDBLINE: foreach my $line (@$ArrayRef_coordchain) {
#get the coordinate line info for any ATOM or HETATM record
next PDBLINE unless ( $line =~ /^(ATOM|HETATM)/ );
my ($HashRef_CoordRecord);
if ( $line =~ /^ATOM/ ) {
$HashRef_CoordRecord =
SmotifTF::PDB::PDBCoordinateSectionParse::GetPDBAtomRecordFields($line);
}
elsif ( $line =~ /^HETATM/ ) {
$HashRef_CoordRecord =
SmotifTF::PDB::PDBCoordinateSectionParse::GetPDBHetatmRecordFields($line);
}
else {
die "There was error: unexpected line-start\n\t$line\n";
# return;
}
unless ( ( exists( $$HashRef_CoordRecord{'AtomName'} ) )
&& ( exists( $$HashRef_CoordRecord{'ResidueNumber'} ) )
&& ( exists( $$HashRef_CoordRecord{'ResidueInsertionCode'} ) ) )
{
die
"There was error: no atom name or res num or insertion code in returned hash\n\t$line\n";
# return;
}
#check the CA atoms
my $AtomType = $$HashRef_CoordRecord{'AtomName'};
next PDBLINE unless ( $AtomType eq 'CA' );
#get the current residue PDB number (number and insert code)
#when the smotif start residue/insert code is encountered, set InRange=1
my $num = $$HashRef_CoordRecord{'ResidueNumber'};
my $insert = $$HashRef_CoordRecord{'ResidueInsertionCode'};
my $residuenumber = $num . $insert;
$residuenumber =~ s/\s+//g;
if ( $residuenumber eq $start ) {
$InRange = 1;
}
#if the parseing is in the coordinates for the smotif
if ($InRange) {
#check to see if there is an insertion code.
#this is used to count the number of insertions.
if ( $insert !~ /\s+/ ) { $numinsertions++; }
if ( $insert =~ /\s+/ ) {
#set first and last PDB residue numbers
if ( $firstresnum eq 'NA' ) {
$firstresnum = $num;
}
$lastresnum = $num;
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 2.587 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-9f2165ba459b )