I would like to post the code here but the data reading part is rather long. However I can post the dataprinting function where the problem may have occured?
I use autoflush, yes I close my files. and the strange thing is this problem does not occur with some input and it occurs with others..
What I put below is only a short part of the program. Other relevant part could be the part where the pdb file is read from the given file but it seems like a writing buffer rather than reading buffer...
mainbody {
my $index=0;
my $input=$mw->getOpenFile();
open FILE, ">$input" or die $!;
FILE->autoflush(1);
#someother direct printings into file(direct meaning printing i
+nto file within this body without calling other functions as below)
tie @lines, 'Tie::File', $input or die $!;
#somemore direct printings into file
#below are functions that get arrays, some indices and prints them
+ into file
if($pdb_active)
{
printtoDataBase(\@exp_beta_alpha,16,6); #below
printtoDataBase(\@exp_beta_heavy,32,6);
}
#other printing functions
untie @lines;
close FILE;
}
sub printtoDataBase #the part where the problem occurs
{
my ($dataArray,$column,$ref_size)=@_;
my $index=0;
$repeat=10;
my @dataArray=@$dataArray; #deref
for (;$repeat<($residuenumber+10); $repeat++)
{
my $size = length $dataArray[$index];
if($size>($ref_size))
{
$size=($ref_size);
}
#refsize tells up to how many digits do the user w
+ant the number to be displayed
substr($lines[$repeat],($column),($size))=
substr($dataArray[$index],0,($size));
$index++;
} # above function gets the b-factor numbers in the file found
+ the stated part by the substr
}
|