473,651 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fetching lines....until something

76 New Member
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'),a nd 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
MRMKACFNLFRVRDR FVLLAKDILPEDAKD ILPEDAKDILP
QSQKMLADPLMQNDE VRAACDAPKVGIDDM LATIFRH
>ebA5 ebA5
MSVIAIHAAIVGVTV VVAYVLHMRTVAKDI LPEDSRVFVHY
YGRINKLLCDAPKVG IDDMLATIFRHVPNG EFDQALERARS


------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 869

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

Similar topics

4
1698
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 option yet, I did this instead (which sometimes works, sometimes doesn't, and when it doesn't seems to get hung up on line 4 -- os.popen oddity?): #/usr/bin/env python import os,sys
10
7610
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 the end. Is there a better way?? Cheers, Craig
15
16335
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 to end at the end of a word, if you catch my drift. For example, I have a large string variable containing the text: "I've seen things you people wouldn't believe. Attack ships on fire
1
13653
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 procedure============= Create PROCEDURE get_timedout_scripts (
1
1328
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 dom = new ActiveXObject( "Msxml2.DOMDocument" ); dom.async = false; dom.load("/servlet/GetSearchResult?start=0&num=10"); 2. parse this dom to display in the table.
42
6787
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 from stream and stores them in string until (num -1) characters have been read or a newline or EOF character is reached, whichever comes first." My question is that if it stops at a new line character (LF?) then how does one read a file with...
5
2973
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 TO TABLE, like storing IMAGE into DB.
1
1817
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 error. But now problem in fetching, not able to fetch data from table correctly. Here is my code. I hav following problems with this coding
4
4265
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
8347
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8792
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8694
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8457
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7294
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2696
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1585
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.