From 338fcc9d355f42a116d514e6516d014d096b302a Mon Sep 17 00:00:00 2001 From: Juan Miguel Cejuela Date: Fri, 24 Jun 2016 11:27:57 +0200 Subject: [PATCH] import constants from relna, not nalaf -- https://github.com/Rostlab/nalaf/issues/155 --- relna.py | 2 +- relna/learning/svmlight.py | 5 +---- relna/learning/taggers.py | 2 +- relna/utils/__init__.py | 12 ++++++++++++ relna/utils/writers.py | 2 +- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/relna.py b/relna.py index 1720b07..89154f1 100644 --- a/relna.py +++ b/relna.py @@ -4,7 +4,7 @@ import pkg_resources -from nalaf.utils import PRO_CLASS_ID, MUT_CLASS_ID, PRO_REL_MUT_CLASS_ID +from relna.utils import PRO_CLASS_ID, MUT_CLASS_ID, PRO_REL_MUT_CLASS_ID from nalaf.utils.readers import TextFilesReader, PMIDReader from nalaf.utils.readers import StringReader from nalaf.utils.writers import TagTogFormat, PubTatorFormat diff --git a/relna/learning/svmlight.py b/relna/learning/svmlight.py index 7223c28..dc9b37d 100644 --- a/relna/learning/svmlight.py +++ b/relna/learning/svmlight.py @@ -2,10 +2,7 @@ import sys import subprocess import pkg_resources - -from nalaf.structures.data import Label -from nalaf.utils import MUT_CLASS_ID -from random import random, seed +from random import random class SVMLightTreeKernels: diff --git a/relna/learning/taggers.py b/relna/learning/taggers.py index 76e1857..58e1fba 100644 --- a/relna/learning/taggers.py +++ b/relna/learning/taggers.py @@ -6,7 +6,7 @@ from relna.utils.swissprot_utils import Swissprot from relna.utils.go_utils import GOTerms from nalaf.structures.data import Entity, Relation -from nalaf.utils import MUT_CLASS_ID, PRO_CLASS_ID, PRO_REL_MUT_CLASS_ID, ENTREZ_GENE_ID, UNIPROT_ID +from relna.utils import MUT_CLASS_ID, PRO_CLASS_ID, ENTREZ_GENE_ID, UNIPROT_ID from nalaf.learning.taggers import Tagger diff --git a/relna/utils/__init__.py b/relna/utils/__init__.py index e69de29..88de072 100644 --- a/relna/utils/__init__.py +++ b/relna/utils/__init__.py @@ -0,0 +1,12 @@ +THRESHOLD_VALUE = 1 + +# TODO The constants should be renamed. Do not make sense in relna. +# Copied from nalaf directly for historical reasons. + +PRO_CLASS_ID = 'e_1' +MUT_CLASS_ID = 'e_2' +ORG_CLASS_ID = 'e_3' +PRO_REL_MUT_CLASS_ID = 'r_4' # e_1/e_2 +PRO_REL_ORG_CLASS_ID = 'r_5' # e_1/e_3 +ENTREZ_GENE_ID = 'n_4' +UNIPROT_ID = 'n_5' diff --git a/relna/utils/writers.py b/relna/utils/writers.py index 803ed63..5ca0ea0 100644 --- a/relna/utils/writers.py +++ b/relna/utils/writers.py @@ -1,7 +1,7 @@ from itertools import chain import sys import os -from nalaf.utils import MUT_CLASS_ID, PRO_CLASS_ID +from relna.utils import MUT_CLASS_ID, PRO_CLASS_ID class RelnaConsoleWriter: