Monthly Archives: July 2010

Perl tips: how to read a .gz file

Well, and since I’m in a blogging mode, here is one more thing I didn’t know about Perl (I can easily count the things I know!):

Question: Can Perl read a .gz file?

Answer: Of course. Ask the right question now.

Question: How can Perl read a .gz file?

Answer: Still not good enough a question…

Question: What is at least one way for Perl to read a .gz file?

Answer: Try:

if ($file =~ /.gz$/) {
open(IN, “gunzip -c $file |”) || die “can’t open pipe to $file”;
}
else {
open(IN, $file) || die “can’t open $file”;
}

while () {

Answer Credit: Rob Edwards

Blast output 8

Blast tabular output (#8) is arguably the most useful (usable?) blastall output. However, I always forget what the column headers are (although–theoretically–I shouldn’t). I never put enough reminders. I know that I have one or two files in my computer with the column headers, but, why not add one more (honestly, I may have already blogged about it Embarassed:

Here are blast output 8 column headers:

query subject %id

alignment
length

mismatches gap
openings

query
start

query
end

subject
start

subject
end

E
value

bit
score