---
name: "go-filter-subset"
section: "1p"
platform: "linux"
package: "libgo-perl"
version: "0.15-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/go-filter-subset"
---

# go-filter-subset(1p)

extracts a subgraph from an ontology file

## NAME

go-filter-subset.pl - extracts a subgraph from an ontology file

## SYNOPSIS

```
  go-filter-subset.pl -id GO:0003767 go.obo
  go-filter-subset.pl -id GO:0003767 -to png go.obo | xv -
  go-filter-subset.pl -filter_code 'sub{shift->name =~ /transcr/}' go.obo
```

## DESCRIPTION

Exports a subset of an ontology from a file. The subset can be based on a specified set of IDs, a preset "subset" filter in the ontology file (eg a GO "slim" or subset), or a user-defined filter.

The subset can be exported in any format, including a graphical image

## ARGUMENTS

- \-id ID

  ID to use as leaf node in subgraph. All ancestors of this ID are included in the exported graph (unless -partial is set)

  Multiple IDs can be passed

  ```
    -id ID1 -id ID2 -id ID3 ....etc
  ```

- \-subset SUBSET\_ID

  Extracts a named subset from the ontology file. (only works with obo format files). For example, a specific GO slim

  ONLY terms belonging to the subset are exported - the -partial option is automatically set

- \-namespace NAMESPACE

  only terms in this namespace

- \-filter\_code SUBROUTINE

  **advanced option**

  A subroutine with which the GO::Model::Term object is tested for inclusion in the subgraph (all ancestors are automatically included)

  You should have an understanding of the go-perl object model before using this option

  Example:

  ```
    go-filter-subset -filter_code 'sub {shift->namespace eq 'molecular_function'}' go.obo
  ```

  (the same things can be achieved with the -namespace option)

- \-partial

  If this is set, then only terms that match the user query are included. Parentage is set to the next recursive parent node in the filter

  For example, with the -subset option: if X and Y belong to the subset, and Z does not, and X is\_a Z is\_a Y, then the exported graph withh have X is\_a Y

- \-use\_cache

  If this switch is specified, then caching mode is turned on.

  With caching mode, the first time you parse a file, then an additional file will be exported in a special format that is fast to parse. This file will have the same filename as the original file, except it will have the ".cache" suffix.

  The next time you parse the file, this program will automatically check for the existence of the ".cache" file. If it exists, and is more recent than the file you specified, this is parsed instead. If it does not exist, it is rebuilt.

### DOCUMENTATION

\<http://www.godatabase.org/dev\>
