Grep – a life skill for everyone

If you know me, you know that I’m not a computational biology kind of gal.  I’m perfectly content to think of my laptop as the magic box that lets me look at cats with captions and write WordPress posts.  I say hats off to you, real computational biologists, you people who can truly understand how a principle component analysis works.*

But last year I did a stint in a computational lab, so somewhat reluctantly I learned Shell scripting.  (Shell scripting is like Sesame-Street-level computer programming.)  The other day I found myself needing to search a large mass of protein sequence for a motif.  How to do it?  The Shell command grep.

Here’s the thing.  If you have a Macintosh, then grep is a super-pimped out search feature that is inside your computer right now.  For searching inside large text files, it’s way more powerful than Spotlight or whatever they’re calling that magnifying glass in the corner these days.  You’ll need to know some kindergarten-level computer programming to be able to use it, but it’s totally worthwhile.

Start by taking the stuff you want to search and pasting it into a text file.  It’s important that it’s plain text and that there aren’t any spaces in the file name.  Save and quit.

Click me to enlarge!

Open the computer program Terminal.  It’s in Applications > Utilities.

Type ls and hit return.  That gives you a top-level list of all the folders on your computer.  Type cd and the name of a folder to open it.  Keep going until you’ve opened the folder that has your file in it.  (Your folders had better not have spaces in their names!)

Type grep whatyou'relookingfor nameoftextfile.

There he is!

But can’t ⌘F do the same thing just as well?  Ah, here is where grep is a pimped-out search feature.  It can use regular expressions.  Here’s a longer explanation of regular expressions, but in short, they let you specify any sort of search criteria you could possibly imagine.  Here’s a real simple example where I remember that the word I’m searching for starts with w, but I don’t know what comes next:

And that’s the magic of grep!

* “Principal component analysis (PCA) is a mathematical procedure that uses an orthogonal transformation to convert a set of observations of possibly correlated variables into a set of values of linearly uncorrelated variables called principal components,” says Wikipedia.

What do I do with all these radishes?

I scored a bunch of radishes at the Asian food store the other day, brought them home, then realized: this is a ton of radishes.

This is only about 1/3 of the total radishes

What was I going to do with all of these?  Why did I buy so many?  You only need about one radish to slice up and put on your salad, so this pile represents about 30 salads’ worth of radishes.

Fortunately, the Internet is a wonderful place, so I went searching around for radish recipes.  Turns out you can roast them like any other root vegetable.

First, I sliced the radishes up thinly.

Added some golden potatoes, tossed them with olive oil, salt, and Italian seasoning.

After about 45 minutes in the oven at 350°, they look like this.

The flavor is still spicy like a raw radish, but much more mellow and a little bit earthy.  I think roasted radishes would make a great winter dish.

Abarat: Absolute Midnight

Ever since the second book of the Abarat series was published in 2004, I’d been eagerly awaiting the arrival of its sequel.  For those who aren’t familiar with the books, let me tell you that the Abarat series is a strange beast: kids’ stuff by Clive Barker.  Yup.

Barker held back a bit with the weird and creepy stuff for the first two books as he told the story of Candy Quackenbush, a girl from Minnesota who finds a portal to a magical dimension.  But in the third one, Abarat: Absolute Midnight, all Hell breaks loose.  I can’t really describe the plot to you.  In third books of five-book series, plots are hard to describe.  But in a nutshell an apocalypse has come to Candy’s Abarat.

We haven’t just got Mater Motley now.  We’ve got eldritch abominations fighting other eldritch abominations.

Highlights include the gorgeous, Barkeresque language, the full-color illustrations every few pages, and Rojo Pixler, who’s like every creepy rumor you’ve heard about Walt Disney.

Romantic spoiler alert: Who the heck is Gazza?  He shows up halfway through the book and instantly he and Candy fall in love with each other.  I was rather rooting for Candy/Malingo.  Although it would have been disturbing, Candy/Carrion or Candy/Finnegan Hob would have made for an interesting story, too.

Balcony Garden: Day 0

Ever since I moved into an apartment with a balcony last summer, I’ve been itching to put a container garden out there.  But last year the growing season was already well underway, so I’ve had to wait impatiently all through the fall, winter, and spring until the danger of frost is gone.

Now.  Now is the time.

From the PBS plant sale I picked up two tomatoes (a cherry and a Roma), two bell pepper plants, one basil, and a hosta.  I there are also some lettuce seeds and a pair of mots who you’ve already met.  The mots are going outside for the season.

From the left: the basil and the bell pepper plants, the tomatoes

From the left: Mot 1, lettuce seeds, Mot 2, hosta, Mot 3

This is an east-facing balcony, so it’s iffy whether the tomatoes will make any fruits.  We will have to wait and see.

This is Neat: Caulerpa

Source: www.reefcorner.com

How many cells do you think this thing has?

a.  100,000

b.  1 million

c.  10 million

d.  1 billion

One.  This is all one cell.  What you’re looking at is a frond from a genus of seaweed called CaulerpaCaulerpa grows in tropical waters and is considered an invasive species in the Mediterranean Ocean.  Each individual of Caulerpa is one huge, enormous cell.  The inside of the plant is a syncytium, which means that millions of cell nuclei are floating around with no cell membranes to separate them.

This is neat: Chip Art

If you take a pair of pliers to your laptop and crack open the plastic casing, you’ll find a greenish motherboard with all the guts of the computer attached to it.  One of these guts is the computer’s CPU, a little square computer chip that probably has the word “Intel” printed on it.  If you strip the epoxy coating off of the CPU and put it under a microscope, what you’ll see will look a lot like the downtown of a city from a helicopter.  Rectangles and rectangles and rectangles of transistors printed on a silicon wafer.

And this.

Source: Chipworks

When there’s extra space on a computer chip, sometimes the chip designers like to have fun with it.

The practice of putting little pictures on computer chips is called chip art.  Though the practice is discouraged, it’s hard to get caught doing it – you’d have to void the warranty on your computer and put it under a microscope to see that it’s even there.  There were even reports of “bill sux” inscribed on a Pentium chip, but it turned out to be a hoax.

Chipworks, a company that specializes in analyzing computer chip circuitry for copyright infringement, keeps a gallery of all the chip art they’ve bumped into over the years.

There he is!
Source: Chipworks

Paying for an Online Newspaper – Follow-Up

One of the most fascinating things about getting Freshly Pressed the other week was all the comments people left about the New York Times digital paywall.  They ranged from “I can’t afford the subscription fee” to “Guys?  It’s actually pretty easy to get around the page view limit” to “I happily subscribe because we need to support newspapers.”

There were a lot of people who were willing to pay for the Times even though they could have hacked it.

I wonder if it is valid to compare the New York Times’s business model to Netflix and iTunes.  I know that it’s really easy to steal movies and music over the Internet (and I don’t want to go there), but these two sites make it convenient to pay real money for them.  What are peoples’ motivations for choosing iTunes over the Pirate Bay?  I know mine is that I want to pay money for this stuff, because it’s good.

Also compare the recent phenomenon on Kickstarter.  Kickstarter is a fundraiser site that people can use to raise capital for starting creative projects.  The webcomic Order of the Stick gives away its content for free and keeps itself funded by selling merchandise.  Recently, artist Rich Burlew raised quite a lot of money on Kickstarter because fans adored his strip so much that they were dying for the chance to give him money.

Is this an anomaly?  Or is building up the goodwill of your readers the business model of the future?