From 73599cd810e97f22d01d651416468e34dd6c9dde Mon Sep 17 00:00:00 2001 From: elserj Date: Wed, 13 Mar 2013 21:10:53 +0000 Subject: [PATCH] Added script that can take an obo file and tell you how many non-obsolete terms exist svn path=/; revision=434 --- .../obo_count_non_obolete_terms.pl | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 interactome_scripts/obo_count_non_obolete_terms.pl diff --git a/interactome_scripts/obo_count_non_obolete_terms.pl b/interactome_scripts/obo_count_non_obolete_terms.pl new file mode 100755 index 0000000..e03006f --- /dev/null +++ b/interactome_scripts/obo_count_non_obolete_terms.pl @@ -0,0 +1,54 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +# use this to get filename, without the rest of the directory structure +use File::Basename; + +########################################################################## +# po_obsolete_check.pl # +# Version 0.1 # +# # +# Written by Justin Elser, Dept. of BPP, OSU 2011 # +# # +# Program will check the current po obo file for terms that have # +# been obsoleted. It will then check all association files for # +# annotations linked with those terms and create output files for # +# used for manual intervention by annotation curators. # +# # +# Program should be made part of the SOP when loading new DBs # +# # +########################################################################## + +# Use Chris Mungall's GO::Parser to do the searching for is_obsoletes +use GO::Parser; + + +my $obo_file = $ARGV[0]; + +# init GO parser +my $parser = GO::Parser->new({handler=>'obj'}); +$parser->parse($obo_file); + +my $ont = $parser->handler->graph; + + +my $obo_terms = $ont->get_all_nodes; + +# hash to store obsolete terms +my %obs_terms_hash; +my $good_terms_count = 0; + + +foreach my $term (@$obo_terms) { + if ($term->is_obsolete){ + my $id = $term->acc; + my $name = $term->name; + $obs_terms_hash{$id} = $name; + }else{ + $good_terms_count++; + } +} + +print "Good terms count = $good_terms_count\n"; -- 2.34.1