Skip to content

Instantly share code, notes, and snippets.

@heikkil
Created April 21, 2014 07:06
Show Gist options
  • Save heikkil/11134586 to your computer and use it in GitHub Desktop.
Save heikkil/11134586 to your computer and use it in GitHub Desktop.
grep for obo ontology files

NAME

obogrep - grep obo entries with a string

SYNOPSIS

obogrep [--version | [-?|-h|--help] | [-g|--debug] | [-v|--invert-match] | [-c|--count] |query obofile

DESCRIPTION

Grep-like command line program to explore ontology files in obo format.

http://www.geneontology.org/GO.format.obo-1_4.shtml

The input is automatically detected. The default is a plain obo file. If the filename ends in gz, the file is opened as gunzip. If there is no filename, the input is assumed to come from STDIN, so that commands can be piped together.

Matches are case insensitive.

Examples:

obogrep adherens go.obo.txt.gz | obogrep cellular_component| less
obogrep junction go.obo.txt.gz | obogrep lar_comp | obogrep -v musc

Options

-v, --invert-match

  Invert the sense of matching, to select non-matching lines.  (-v
  is specified by POSIX.)

-c, --count

  Print out only the number of matching entries.

TODO

Does not take the obo file header into account.

Sometimes prints out spurious '[Term]' lines.

VERSION HISTORY

0.0, 15 Dec 2009, start of the project
0.1, 15 Dec 2009, basic functionality
0.2, 15 Dec 2009, simple rewrite
0.3, 20 Apr 2014, open compresses file automatically
0.4, 20 Apr 2014, input from STDIN
0.5, 20 Apr 2014, the count option: -c/--count

LICENSE

You may distribute this program under the same terms as perl itself.

AUTHOR

Heikki Lehvaslaiho, heikki lehvaslaiho a gmail com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment