diff --git a/src/bzh/plealog/dbmirror/annotator/SRAnnotatorUtils.java b/src/bzh/plealog/dbmirror/annotator/SRAnnotatorUtils.java index 96aa2ad..2c1de44 100755 --- a/src/bzh/plealog/dbmirror/annotator/SRAnnotatorUtils.java +++ b/src/bzh/plealog/dbmirror/annotator/SRAnnotatorUtils.java @@ -41,6 +41,8 @@ import bzh.plealog.dbmirror.lucenedico.DicoUtils; import bzh.plealog.dbmirror.lucenedico.Dicos; import bzh.plealog.dbmirror.util.Utils; +import bzh.plealog.dbmirror.util.conf.DBMSAbstractConfig; +import bzh.plealog.dbmirror.util.conf.DBMSConfigurator; import bzh.plealog.dbmirror.util.xref.DBXrefInstancesManager; public class SRAnnotatorUtils { @@ -127,6 +129,15 @@ private static String collectAdditionalIds(SRClassification classif, SRClassific return buf.toString(); } + private static boolean getDataPath(String confKey) { + DBMSConfigurator conf; + conf = DBMSAbstractConfig.getConfigurator(); + if (conf == null) { + return false; + } + return "true".equalsIgnoreCase(conf.getProperty(confKey)); + } + public static SRClassification prepareClassification(SROutput bo, DicoTermQuerySystem dico) { // Extract Bio Classification (IPR, EC, GO and TAX) for all hits @@ -159,11 +170,13 @@ public static SRClassification prepareClassification(SROutput bo, DicoTermQueryS dTerm = dico.getTerm(Dicos.NCBI_TAXONOMY, id); if (dTerm!=null) { term.setDescription(dTerm.getDataField()); - idpath = dico.getTaxPathIds(id, true, true); - if (idpath!=null) { - idpath = Utils.replaceAll(idpath, "n", ""); - term.setPath(idpath); - collectAdditionalIds(classif, classif2, idpath, dico, Dicos.NCBI_TAXONOMY); + if (getDataPath(DBMSConfigurator.ANNOT_GET_TAX_PATH)) { + idpath = dico.getTaxPathIds(id, true, true); + if (idpath!=null) { + idpath = Utils.replaceAll(idpath, "n", ""); + term.setPath(idpath); + collectAdditionalIds(classif, classif2, idpath, dico, Dicos.NCBI_TAXONOMY); + } } } } @@ -173,10 +186,12 @@ else if (id.startsWith(AnnotationDataModelConstants.ANNOTATION_CATEGORY.EC.name( dTerm = dico.getTerm(Dicos.ENZYME, id); if (dTerm!=null) { term.setDescription(dTerm.getDataField()); - idpath = dico.getEnzymePathIds(id, true); - if (idpath!=null) { - term.setPath(idpath); - collectAdditionalIds(classif, classif2, idpath, dico, Dicos.ENZYME); + if (getDataPath(DBMSConfigurator.ANNOT_GET_ENZ_PATH)) { + idpath = dico.getEnzymePathIds(id, true); + if (idpath!=null) { + term.setPath(idpath); + collectAdditionalIds(classif, classif2, idpath, dico, Dicos.ENZYME); + } } } } @@ -185,10 +200,12 @@ else if (id.startsWith(AnnotationDataModelConstants.ANNOTATION_CATEGORY.GO.name( dTerm = dico.getTerm(Dicos.GENE_ONTOLOGY, id); if (dTerm!=null) { term.setDescription(DicoUtils.getSimpleGoString(dTerm)); - gopaths = dico.getGoPathId(id); - if(!gopaths.isEmpty()) { - idpath = collectAdditionalIds(classif, classif2, gopaths, dico, Dicos.GENE_ONTOLOGY); - term.setPath(idpath); + if (getDataPath(DBMSConfigurator.ANNOT_GET_GO_PATH)) { + gopaths = dico.getGoPathId(id); + if(!gopaths.isEmpty()) { + idpath = collectAdditionalIds(classif, classif2, gopaths, dico, Dicos.GENE_ONTOLOGY); + term.setPath(idpath); + } } } } diff --git a/src/bzh/plealog/dbmirror/util/conf/DBMSConfigurator.java b/src/bzh/plealog/dbmirror/util/conf/DBMSConfigurator.java index 6946fbe..356e672 100755 --- a/src/bzh/plealog/dbmirror/util/conf/DBMSConfigurator.java +++ b/src/bzh/plealog/dbmirror/util/conf/DBMSConfigurator.java @@ -66,6 +66,13 @@ public class DBMSConfigurator { public static final String ASPERA_KEY = "aspera.key.path"; public static final String ASPERA_BIN = "aspera.bin.path"; + //introduced in BeeDeeM 4.8; get GO path during Annotator process. Default is false. + public static final String ANNOT_GET_GO_PATH = "annotator.get.go.path"; + //introduced in BeeDeeM 4.8; get NCBI Tax path during Annotator process. Default is true. + public static final String ANNOT_GET_TAX_PATH = "annotator.get.tax.path"; + //introduced in BeeDeeM 4.8; get Enzyme path during Annotator process. Default is true. + public static final String ANNOT_GET_ENZ_PATH = "annotator.get.enz.path"; + public static enum LUCENE_FS_VALUES {FS_DEFAULT, FS_NIO, FS_SIMPLE}; public static enum LUCENE_LK_VALUES {LK_DEFAULT, LK_NATIVE, LK_SIMPLE}; @@ -75,7 +82,8 @@ public static enum LUCENE_LK_VALUES {LK_DEFAULT, LK_NATIVE, LK_SIMPLE}; private static final String[] KEYS ={MIRROR_PATH, MIRROR_PREPA_PATH, MIRROR_FILE, LONG_FILE_NAME, FDB_PRG_NAME, FDB_PATH_NAME, UI_SHOW_PATH, COPY_WORKERS, - FASTA_VOLSIZE, LUCENE_FS, LUCENE_LOCK, ASPERA_KEY, ASPERA_BIN}; + FASTA_VOLSIZE, LUCENE_FS, LUCENE_LOCK, ASPERA_KEY, ASPERA_BIN, + ANNOT_GET_GO_PATH, ANNOT_GET_TAX_PATH, ANNOT_GET_ENZ_PATH}; public DBMSConfigurator() { try { @@ -131,6 +139,7 @@ public void load(String path, boolean listenReload) throws IOException { _pConfig = new PropertiesConfiguration(path); _pathToFile = path; cleanValues(); + setDefaults(); } catch (Exception e) { // this has been done for backward compatibility when replacing // standard Properties by ConfigurationProperties @@ -228,7 +237,19 @@ protected void cleanValues() { _pConfig.setProperty(key, props.getProperty(key)); } } - + + protected void setDefaults() { + if (_pConfig.getProperty(ANNOT_GET_GO_PATH)==null) { + _pConfig.setProperty(ANNOT_GET_GO_PATH, "false"); + } + if (_pConfig.getProperty(ANNOT_GET_TAX_PATH)==null) { + _pConfig.setProperty(ANNOT_GET_TAX_PATH, "true"); + } + if (_pConfig.getProperty(ANNOT_GET_ENZ_PATH)==null) { + _pConfig.setProperty(ANNOT_GET_ENZ_PATH, "true"); + } + } + public void dumpContent(Log logger) { for (String key : KEYS) { if (_pConfig.containsKey(key) == false)