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
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.