uk.ac.ebi.adfconverter.tools.checker
Class DatabaseChecker

java.lang.Object
  extended byuk.ac.ebi.adfconverter.tools.checker.DatabaseChecker

public class DatabaseChecker
extends java.lang.Object

Checking for database stuff will check database tags and database accesion number In Approved db file structure, the item name are: DB tag item - DBTag database link item - URI$ database name - DBName regex - ACCRegex

Version:
1 31 July 2004 TODO test file loading each time (save memory)/ keep in memory the data TODO deal with several approved file
Author:
Pierre MARGUERITE

Constructor Summary
DatabaseChecker()
          Default Constructor with a default DatabaseChecker with a default DB file path: etc/checking/public_DB_Accnos.xls
DatabaseChecker(java.lang.String DBFileStructureDescriptionFileName, java.lang.String approvedDBFile, java.lang.String nameLinkSeparator, boolean _isAccessionNumberCheckingEnable)
          Constructor with a given approved DB file, approved DB file structure xml file,and the separator between DB name and web link retrieved from workbook
 
Method Summary
static void addApprouvedDBFile(java.lang.String DBFile)
          DBFileStructureDescriptionFileName is the same of all DBfile loaded duriing execution
static boolean checkDBAccNumber(ADFConverterLogger log, java.lang.String tag, java.lang.String AccNumber)
          Checks if an Accession is correct (regex matching) according to the database tag additional information will be added during MAGE object creation
static DataBuffer checkDBTag(ADFConverterLogger log, DataBuffer tag, boolean doCuration, java.util.ArrayList userDefinedTags, boolean isStrictChecking)
          Checks if a DB tag is an approved Databases or a userdefined one.
static java.lang.String getDBComment(java.lang.String dbTag)
          retrieves the comment for a given DBTag
static java.lang.String getDBName(java.lang.String dbTag)
          retrieves the database name for a given DBTag
static java.lang.String getDBURI(java.lang.String dbTag)
          retrieves the URI for a given DBTag
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseChecker

public DatabaseChecker()
                throws IncorrectDataBaseInit
Default Constructor with a default DatabaseChecker with a default DB file path: etc/checking/public_DB_Accnos.xls

Throws:
IncorrectDataBaseInit - if an errors occurs during checker initialisation

DatabaseChecker

public DatabaseChecker(java.lang.String DBFileStructureDescriptionFileName,
                       java.lang.String approvedDBFile,
                       java.lang.String nameLinkSeparator,
                       boolean _isAccessionNumberCheckingEnable)
                throws IncorrectDataBaseInit
Constructor with a given approved DB file, approved DB file structure xml file,and the separator between DB name and web link retrieved from workbook

Parameters:
DBFileStructureDescriptionFileName - path to the file describing the approvd DB file structure
approvedDBFile - path to the approved database file
nameLinkSeparator - separator between name and link in the DB table
_isAccessionNumberCheckingEnable -
Throws:
IncorrectDataBaseInit
Method Detail

addApprouvedDBFile

public static void addApprouvedDBFile(java.lang.String DBFile)
                               throws IncorrectDataBaseInit
DBFileStructureDescriptionFileName is the same of all DBfile loaded duriing execution

Parameters:
DBFile -
Throws:
IncorrectDataBaseInit - if an error occurs during checker initialisation TODO deal with files with different data structure

checkDBAccNumber

public static boolean checkDBAccNumber(ADFConverterLogger log,
                                       java.lang.String tag,
                                       java.lang.String AccNumber)
Checks if an Accession is correct (regex matching) according to the database tag additional information will be added during MAGE object creation

Parameters:
log - logger to report comment into.
tag - the tag of the Database
AccNumber - the accession to check
Returns:
true if the Accession is corresponding to the Database tag.

checkDBTag

public static DataBuffer checkDBTag(ADFConverterLogger log,
                                    DataBuffer tag,
                                    boolean doCuration,
                                    java.util.ArrayList userDefinedTags,
                                    boolean isStrictChecking)
Checks if a DB tag is an approved Databases or a userdefined one. Two type of checking: strict : the tag must exactly match the tag in the approved Database List relax: the ckecking is case insensitive

Parameters:
log - the logger for the checked file:
tag - the tag to check
doCuration - if a curation is done on the tag
userDefinedTags - the list of databases defined by the user
isStrictChecking - if the checking is strict or relax
Returns:
the DBTag if the DBTag has been identified as known databases, if curation asked, the correct tag is return. null, otherwise

getDBComment

public static java.lang.String getDBComment(java.lang.String dbTag)
retrieves the comment for a given DBTag

Parameters:
dbTag - the given Database tag
Returns:
the corresponding comment, if the dbTag has been found. null otherwise

getDBName

public static java.lang.String getDBName(java.lang.String dbTag)
retrieves the database name for a given DBTag

Parameters:
dbTag - the given Database tag
Returns:
the corresponding db name, if the dbTag has been found. null otherwise

getDBURI

public static java.lang.String getDBURI(java.lang.String dbTag)
retrieves the URI for a given DBTag

Parameters:
dbTag - the given Database tag
Returns:
the corresponding URI, if the dbTag has been found. null otherwise


European Bioinformatics InstituteMicroarray Informatics Team