CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
help-how to find the 0hits in my query

 



anunitha
New User

Aug 20, 2015, 3:35 AM

Post #1 of 2 (1348 views)
help-how to find the 0hits in my query Can't Post

# Query: gi|258541105|ref|NC_013209.1|:c813-388 Acetobacter pasteurianus IFO 3283-01, complete genome
# Database: acetobact
# 0 hits found
# BLASTN 2.2.31+
# Query: gi|258541105|ref|NC_013209.1|:c2420-1206 Acetobacter pasteurianus IFO 3283-01, complete genome
# Database: acetobact
# 0 hits found


like this i have thousand query, in that there are 10, 4, 3,1,2 etc hits. in this i have to find or extract only the quer contain 0 hits how to do.


Laurent_R
Veteran / Moderator

Aug 22, 2015, 2:31 AM

Post #2 of 2 (1288 views)
Re: [anunitha] help-how to find the 0hits in my query [In reply to] Can't Post

Hi,
read your file line by line.
Whenever you find a line starting by "# Query", store the line in a variable.
When you find a line containing "0 hits found" print out the variable you stored previously.

Something like this:


Code
my $query; 
while (<$fh>) {
$query = $_ if /# Query/;
print $query if /0 hits found/;
}

Note that I kept it short and simple. In a real professional program, I would make it a bit more robust (like, it there one space or several between the "#" et the rest or the line, using explicit variables, etc.)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives