Python library for constructing GO-CAM model RDF
Project description
gocamgen
Base repo for constructing GO-CAM model RDF
Installation
pip install gocamgen
Tests
python3 test_gocamgen.py
Usage
from gocamgen.gocamgen import GoCamModel
model = GoCamModel("model title")
model.declare_class("PomBase:SPBC12C2.02c")
uri_a = model.declare_individual("GO:0016757")
uri_b = model.declare_individual("PomBase:SPBC12C2.02c")
axiom = model.add_axiom(uri_a, URIRef(expand_uri("RO:0002333")), uri_b)
model.add_evidence(axiom, "EXP", "PMID:1234567")
model.write("output_file.ttl")
Quick generation of models from GPAD
Specify source GPAD file. All possible models will be generated and exported to .ttl
.
python3 gen_models_by_gene.py --gpad_file wb.gpad
Additionally, a gene product identifier can be specified to only translate and export that GP's model.
python3 gen_models_by_gene.py --gpad_file wb.gpad --specific_gene WB:WBGene00004055
In general, annotation lines will be grouped by gene product identifier (col 2) with some lines filtered out due to various evidence code/reference rules.
Generating annotation extensions usage spreadsheet
To be clear, this creates a spreadsheet aggregating all extensions "patterns" (e.g. happens_during(GO:P)
, positively_regulates(GO:P)
) that are decided to be invalid according to the rules currently encoded in this same script. These same rules are used by the model generation import.
Example to generate spreadsheet from one GPAD file:
python3 gpad_extensions_mapper.py --filename wb.gpad --out_file bad_extensions.tsv
Example to generate spreadsheet (results compiled into one .tsv) from directory of GPADs:
python3 gpad_extensions_mapper.py --dir gpad_files/ --out_file bad_extensions.tsv
Snippet from created spreadsheet:
Aspect | Total count | Extension | UniProt | WB | ParkinsonsUK-UCL |
---|---|---|---|---|---|
F | 2 | happens_during(GO:P),happens_during(WBls) | 2 | 0 | 0 |
F | 2 | happens_during(WBls) | 0 | 2 | 0 |
F | 4 | regulates_activity_of(geneID) | 0 | 4 | 0 |
F | 1 | occurs_in(WBbt),part_of(GO:P) | 1 | 0 | 0 |
F | 3 | occurs_in(WBbt) | 2 | 1 | 0 |
F | 1 | activated_by(geneID) | 0 | 1 | 0 |
Drilling down to offending GPAD lines "by extension pattern"
If you'd like to get the actual GPAD containing the invalid extension pattern, just copy-paste the pattern into the --pattern
option and rerun on the same GPAD(s):
python3 gpad_extensions_mapper.py --filename wb.gpad --pattern "regulates_activity_of(geneID)"
By default this will output the lines to a [pattern].gpad
file like regulates_activity_of(geneID).gpad
but this can be overidden with --pattern_outfile
. There's also an option for running multiple patterns at once by plugging the path to a newline-separated list of patterns into the --pattern_sourcefile
, which then creates multiple GPAD files named after each pattern.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file gocamgen-0.0.5.tar.gz
.
File metadata
- Download URL: gocamgen-0.0.5.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 715f4959077bf7dd44f34cd82e40609b5c87a06b5820f4d706cb57ecf56069aa |
|
MD5 | 281bc170b66aa5d83797840204901c70 |
|
BLAKE2b-256 | 8c3b42fedad038748148f8f27e9565da6d06c606376523a37a08d5b7c84bb34b |