in reply to seeking help for seek function

the data file is around 1GB. Since, its too big to read line by line,

I think the above is your biggest mistake. It doesn't matter how big the file is, so long as the individual lines aren't >2GB, then you can read the file line by line.

I think that all your seek/tell stuff is just a distraction from your real problem. This might be a true case of the XY problem.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^2: seeking help for seek function
by Anonymous Monk on Mar 26, 2010 at 06:33 UTC
    hi, thank you very much for your advice. As you said, i tried a different method to solve the problem and succeeded in it, its very fast too :) here is how i did it !!!
    #!/usr/bin/perl -w use strict; use warnings; open(FH1,$ARGV[0]) or die "can not open\n"; open(FH2,$ARGV[1]) or die "can not open\n"; my @indx; while(<FH1>){ my ($id,$seq)=split("\t",$_); push(@indx, $id,$seq); } my %hashseq=@indx; while(<FH2>){ if($_=~m/^clus/){ my $clushead=$_; print "$clushead"; } else{ $_=~s/\t//g;$_=~s/\n//g; my $tes=$_; print $tes,"\t",$hashseq{"$tes"}; } }
    Thank you very much once again :)
Re^2: seeking help for seek function
by pearly (Initiate) on Mar 26, 2010 at 06:36 UTC
    hi, thank you very much for your advice. As you said, i tried a different method to solve the problem and succeeded in it, its very fast too :) here is how i did it !!!
    #!/usr/bin/perl -w use strict; use warnings; open(FH1,$ARGV[0]) or die "can not open\n"; open(FH2,$ARGV[1]) or die "can not open\n"; my @indx; while(<FH1>){ my ($id,$seq)=split("\t",$_); push(@indx, $id,$seq); } my %hashseq=@indx; while(<FH2>){ if($_=~m/^clus/){ my $clushead=$_; print "$clushead"; } else{ $_=~s/\t//g;$_=~s/\n//g; my $tes=$_; print $tes,"\t",$hashseq{"$tes"}; } }
    Thank you very much once again :) (p.s: sorry for posting twice. forgot to login previously.)