473,405 Members | 2,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

fetching lines....until something

76
hi guys,
here is what i've been trying to do. i have two arrays (@arr1 and @arr2) which i compare and get the difference in them, which work fine. but now i'm trying to get the info (ie, the id of the sequence) from the file that has the difference ('diff_file'),and compare it with the id in the sequence itself (starts with '>') from the 'mySeqFile', and get just that sequece. i'm stucked at this point. i hope i'm clear. following is the sample of the mySeqFile and the script:
any help would be really appreciated.

--------mySeqFile---------
>ebA1155
MRMKACFNLFRVRDRFVLLAKDILPEDAKDILPEDAKDILP
QSQKMLADPLMQNDEVRAACDAPKVGIDDMLATIFRH
>ebA5 ebA5
MSVIAIHAAIVGVTVVVAYVLHMRTVAKDILPEDSRVFVHY
YGRINKLLCDAPKVGIDDMLATIFRHVPNGEFDQALERARS


------theScript----------------
Expand|Select|Wrap|Line Numbers
  1. #!/urs/bin/perl -w
  2. my @arr2 = (ebA1135, ebA1158, ebA1251, ebA150);
  3.  
  4. my $differ = 'diff_file';
  5. open(OF1, ">$differ");
  6.  
  7. my $fasta = './mySeqFile';
  8. open(FH3, "<$fasta");
  9.  
  10. my $file1 = '2tmsNabove.tab';
  11. open(FH1,"<$file1");
  12.  
  13. while (<FH1>) {
  14.     if ($_ =~ /(\S+)\t(\S+)\t(\S+)/) {
  15.         push(@arr1, $1); next;
  16.     }
  17. }
  18. my %arr1 = map{$_ => 1} @arr1;
  19. my %arr2 = map{$_ => 1} @arr2;
  20.  
  21. my @diff = grep(!defined $arr2{$_}, @arr1);
  22. foreach $diff (@diff) {
  23.     my $num = $diff;
  24.     while (<FH3>) {
  25.         if ($_ =~ /^\>(\S+).+/) {
  26.             if ($num eq $1) {
  27.                 # print $_; next;
  28.                 do {
  29.                     push(@seq, $_);
  30.                     next;
  31.                 } until ($_ =~ /^\>/);
  32.                 next;
  33.             }
  34.         }
  35.     }
  36. }
  37.  
Jul 4 '07 #1
0 863

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Stephen Boulet | last post by:
I'm trying to parse a url to set my hardware & system clock (linux). Perhaps the best way to do this would be to use the urllib2 module to convert a site to text, but since I haven't found that...
10
by: Craig Bumpstead | last post by:
Hi, I was wondering the best and fastest way to determine how many lines are in a log file. At the moment I am simply doing a StreamReader.ReadLine and incrementing a counter until I reach...
15
by: Daren | last post by:
Hi, I need to be able to split large string variables into an array of lines, each line can be no longer than 70 chars. The string variables are text, so I would additionally like the lines...
1
by: deepdata | last post by:
Hi, I am trying to fetch data from db2 (express version) database by calling stored procedure. I have tried to use both cursor and for loop but still i am getting error. --======Start...
1
by: MD | last post by:
When displaying the metadata for our system, takes about 5 seconds to display 10 results to the browser. The whole process works like this. 1. Call the servlet from the javascript with Dom var...
42
by: mellyshum123 | last post by:
I need to read in a comma separated file, and for this I was going to use fgets. I was reading about it at http://www.cplusplus.com/ref/ and I noticed that the document said: "Reads characters...
5
by: Bhavesh | last post by:
Hello genious people, I m trying to insert a LARGE text from Multiline Textbox into my table of sqlserver2000. I m using vs-2005. Please note that I dont want to store blob data From FILE...
1
by: Bhavesh | last post by:
Hi Bruce, Thanks For Reply. U were right, Needed to pass string , but also need to pass size of Data( instead of 16, passed actual length of data). So that worked for me & didn't get any...
4
by: tokcy | last post by:
HI every one, i am using tooltip on click of link and i want like when that tooltip open then background window would be blure(). can anyone help me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.