pearly has asked for the wisdom of the Perl Monks concerning the following question:
why is the seek function not fetching the content but the position? thanks !!!file1: SID834.56 AGAAGTCGTACGATCA SID164.26 AGTCGATCATTATATATTCGCTAG SID4.56 AGCTAGCGATCGATCCCCCCCCCCCCCCCC SID5764.12 CGATCGATC SID564.12 ACGAATATGATAC file2: cluster number 1: (reads count:2) SID834.56 SID564.12 cluster number 2: (reads count:2) SID164.26 SID5764.12 cluster number 3: (reads count:1) SID4.56 code: #!/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\t".tell FH1); } while(<FH2>){ if($_=~m/^clus/){ my $clushead=$_; print "\n$clushead"; } else{ $_=~s/\t//g;$_=~s/\n//g; my $tes=$_; my @hit=grep(/$tes/,@indx); my $sca="@hit"; my ($id1,$pos)=split("\t",$sca); print sysseek (FH1,$pos,0),"\n" or die "seek:$!"; } } desired results: cluster number 1: (reads count:2) SID834.56 AGAAGTCGTACGATCA SID564.12 ACGAATATGATAC cluster number 2: (reads count:2) SID164.26 AGTCGATCATTATATATTCGCTAG SID5764.12 CGATCGATC cluster number 3: (reads count:1) SID4.56 AGCTAGCGATCGATCCCCCCCCCCCCCCCC results which i get now: cluster number 1: (reads count:2) 27 146 cluster number 2: (reads count:2) 62 122 cluster number 3: (reads count:1) 101
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: seeking help for seek function
by moritz (Cardinal) on Mar 25, 2010 at 07:35 UTC | |
by Anonymous Monk on Mar 25, 2010 at 08:58 UTC | |
by Corion (Patriarch) on Mar 25, 2010 at 09:02 UTC | |
by pearly (Initiate) on Mar 25, 2010 at 09:01 UTC | |
by cdarke (Prior) on Mar 25, 2010 at 10:27 UTC | |
by pearly (Initiate) on Mar 25, 2010 at 10:33 UTC | |
by Marshall (Canon) on Mar 25, 2010 at 10:56 UTC | |
|
Re: seeking help for seek function
by ikegami (Patriarch) on Mar 25, 2010 at 07:11 UTC | |
by pearly (Initiate) on Mar 25, 2010 at 07:17 UTC | |
by ikegami (Patriarch) on Mar 25, 2010 at 07:50 UTC | |
by Anonymous Monk on Mar 25, 2010 at 08:56 UTC | |
by pearly (Initiate) on Mar 25, 2010 at 09:57 UTC | |
by pearly (Initiate) on Mar 25, 2010 at 09:01 UTC | |
by almut (Canon) on Mar 25, 2010 at 09:15 UTC | |
|
Re: seeking help for seek function
by BrowserUk (Patriarch) on Mar 25, 2010 at 14:02 UTC | |
by pearly (Initiate) on Mar 26, 2010 at 06:36 UTC | |
by Anonymous Monk on Mar 26, 2010 at 06:33 UTC |