embdbi.c


Function embDbiFieldNew

Constructor for field token structures.

Prototype

EmbPField embDbiFieldNew (
      void
);

TypeNameRead/WriteDescription
EmbPField RETURNField token structure.

From EMBOSS 2.4.0


Function embDbiFieldDel

Destructor for field token structures.

Prototype

void embDbiFieldDel (
      EmbPField* pthys
);

TypeNameRead/WriteDescription
EmbPField*pthysDeleteField token structure.
void RETURN

From EMBOSS 4.1.0


Function embDbiFieldDelMap

Destructor for field token structures to be mapped to lists or tables.

Prototype

void embDbiFieldDelMap (
      void** pthys,
      void* cl
);

TypeNameRead/WriteDescription
void**pthysDeleteField token structure.
void*clModifyUnused
void RETURN

From EMBOSS 4.1.0


Function embDbiCmpId

Comparison function for two entries.

Prototype

ajint embDbiCmpId (
      const void* a,
      const void* b
);

TypeNameRead/WriteDescription
const void*aInputFirst id (EmbPEntry*)
const void*bInputSecond id (EmbPEntry*)
ajint RETURNComparison value, -1, 0 or +1.

From EMBOSS 1.13.0


Function embDbiCmpFieldId

Comparison function for the entrynames in two field structures.

Prototype

ajint embDbiCmpFieldId (
      const void* a,
      const void* b
);

TypeNameRead/WriteDescription
const void*aInputFirst id (EmbPField*)
const void*bInputSecond id (EmbPField*)
ajint RETURNComparison value, -1, 0 or +1.

From EMBOSS 2.4.0


Function embDbiCmpFieldField

Comparison function for two field token values

Prototype

ajint embDbiCmpFieldField (
      const void* a,
      const void* b
);

TypeNameRead/WriteDescription
const void*aInputFirst id (EmbPField*)
const void*bInputSecond id (EmbPField*)
ajint RETURNComparison value, -1, 0 or +1.

From EMBOSS 2.4.0


Function embDbiEntryNew

Constructor for entry structures.

Prototype

EmbPEntry embDbiEntryNew (
      ajuint nfields
);

TypeNameRead/WriteDescription
ajuintnfieldsInputNumber of data fields to be included
EmbPEntry RETURNEntry structure.

From EMBOSS 1.13.0


Function embDbiEntryDel

Destructor for entry structures.

Prototype

void embDbiEntryDel (
      EmbPEntry* Pentry
);

TypeNameRead/WriteDescription
EmbPEntry*PentryDeleteEntry structure
void RETURN

From EMBOSS 4.0.0


Function embDbiEntryDelMap

Destructor for entry structures to be mapped to lists or tables.

Prototype

void embDbiEntryDelMap (
      void** pthys,
      void* cl
);

TypeNameRead/WriteDescription
void**pthysDeleteField token structure.
void*clModifyUnused
void RETURN

From EMBOSS 4.1.0


Function embDbiFileList

Makes a list of all files in a directory matching a wildcard file name.

Prototype

AjPList embDbiFileList (
      const AjPStr dir,
      const AjPStr wildfile,
      AjBool trim
);

TypeNameRead/WriteDescription
const AjPStrdirInputDirectory
const AjPStrwildfileInputWildcard file name
AjBooltrimInputExpand to search, trim results
AjPList RETURNNew list of all files with full paths

From EMBOSS 1.13.0


Function embDbiFileListExc

Makes a list of all files in a directory matching a wildcard file name.

Prototype

AjPList embDbiFileListExc (
      const AjPStr dir,
      const AjPStr wildfile,
      const AjPStr exclude
);

TypeNameRead/WriteDescription
const AjPStrdirInputDirectory
const AjPStrwildfileInputWildcard file list
const AjPStrexcludeInputWildcard file list (NULL if none to exclude)
AjPList RETURNNew list of all files with full paths

From EMBOSS 1.13.2


Function embDbiFlatOpenlib

Open a flat file library

Prototype

AjBool embDbiFlatOpenlib (
      const AjPStr lname,
      AjPFile* libr
);

TypeNameRead/WriteDescription
const AjPStrlnameInputSource file basename
AjPFile*librModifyDatabase file
AjBool RETURNajTrue on success

From EMBOSS 2.3.0


Function embDbiRmFile

Remove a file or a set of numbered files

Prototype

void embDbiRmFile (
      const AjPStr dbname,
      const char* ext,
      ajuint nfiles,
      AjBool cleanup
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name
const char*extInputBase file extension
ajuintnfilesInputNumber of files, or zero for unnumbered.
AjBoolcleanupInputIf ajTrue, clean up temporary files after
void RETURN

From EMBOSS 1.13.0


Function embDbiRmFileI

Remove a numbered file

Prototype

void embDbiRmFileI (
      const AjPStr dbname,
      const char* ext,
      ajuint ifile,
      AjBool cleanup
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name
const char*extInputBase file extension
ajuintifileInputFile number.
AjBoolcleanupInputIf ajTrue, clean up temporary files after
void RETURN

From EMBOSS 1.13.0


Function embDbiRmEntryFile

Remove the sorted entryname file (kept until end of processing as it is the sorted list of all entries, used to count entries for field indexing.

Prototype

void embDbiRmEntryFile (
      const AjPStr dbname,
      AjBool cleanup
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name
AjBoolcleanupInputIf ajTrue, clean up temporary files after
void RETURN

From EMBOSS 2.4.0


Function embDbiSortFile

Sort a file, or a set of numbered files, individually

Prototype

void embDbiSortFile (
      const AjPStr dbname,
      const char* ext1,
      const char* ext2,
      ajuint nfiles,
      AjBool cleanup,
      const AjPStr sortopt
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name
const char*ext1InputInput file extension
const char*ext2InputOutput file extension
ajuintnfilesInputNumber of files to sort (zero if unnumbered)
AjBoolcleanupInputIf ajTrue, clean up temporary files after
const AjPStrsortoptInputExtra options for the system sort
void RETURN

From EMBOSS 1.13.0


Function embDbiHeaderSize

Updates the file header for an index file to include the correct file size.

Prototype

void embDbiHeaderSize (
      AjPFile file,
      ajuint filesize,
      ajuint recordcnt
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
ajuintfilesizeInputFile size (if known, can be rewritten)
ajuintrecordcntInputNumber of records
void RETURN

From EMBOSS 2.4.0


Function embDbiHeader

Writes the header for an index file. Resets the file pointer to beginning of file, and leaves the file pointer at the start of the first record.

Prototype

void embDbiHeader (
      AjPFile file,
      ajuint filesize,
      ajuint recordcnt,
      short recordlen,
      const AjPStr dbname,
      const AjPStr release,
      const char[4] date
);

TypeNameRead/WriteDescription
AjPFilefileModifyOutput file
ajuintfilesizeInputFile size (if known, can be rewritten)
ajuintrecordcntInputNumber of records
shortrecordlenInputRecord length (bytes)
const AjPStrdbnameInputDatabase name (up to 20 characters used)
const AjPStrreleaseInputRelease as a string (up to 10 characters used)
const char[4]dateInputDate dd,mm,yy,00
void RETURN

From EMBOSS 2.4.0


Function embDbiFileSingle

Builds a filename for a single temporary file to save IDs or some other index field, for example EMBL01.list

Prototype

AjPFile embDbiFileSingle (
      const AjPStr dbname,
      const char* extension,
      ajuint num
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name
const char*extensionInputFilename extension.
ajuintnumInputNumber for this file (start at 1)
AjPFile RETURNOpened output file

From EMBOSS 2.4.0


Function embDbiFileIn

Builds a filename for a summary file to read IDs or some other index field, for example EMBL.acnum_sort

Prototype

AjPFile embDbiFileIn (
      const AjPStr dbname,
      const char* extension
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name
const char*extensionInputFilename extension.
AjPFile RETURNOpened output file

From EMBOSS 2.4.0


Function embDbiFileOut

Builds a filename for a summary file to save IDs or some other index field, for example EMBL.acnum_srt2

Prototype

AjPFile embDbiFileOut (
      const AjPStr dbname,
      const char* extension
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name
const char*extensionInputFilename extension.
AjPFile RETURNOpened output file

From EMBOSS 2.4.0


Function embDbiFileIndex

Builds a filename for a summary file to save IDs or some other index field, for example EMBL.acsrt2

Prototype

AjPFile embDbiFileIndex (
      const AjPStr indexdir,
      const AjPStr field,
      const char* extension
);

TypeNameRead/WriteDescription
const AjPStrindexdirInputIndex directory
const AjPStrfieldInputField name
const char*extensionInputFilename extension.
AjPFile RETURNOpened output file

From EMBOSS 2.4.0


Function embDbiWriteDivision

Writes the division index file

Prototype

void embDbiWriteDivision (
      const AjPStr indexdir,
      const AjPStr dbname,
      const AjPStr release,
      const char[4] date,
      ajuint maxfilelen,
      ajuint nfiles,
      AjPStr const* divfiles,
      AjPStr const* seqfiles
);

TypeNameRead/WriteDescription
const AjPStrindexdirInputIndex directory
const AjPStrdbnameInputDatabase name
const AjPStrreleaseInputRelease number as a string
const char[4]dateInputDate
ajuintmaxfilelenInputMax file name length
ajuintnfilesInputNumber of files indexes
AjPStr const*divfilesInputDivision filenames
AjPStr const*seqfilesInputSequence filenames (or NULL if none)
void RETURN

From EMBOSS 2.4.0


Function embDbiWriteDivisionRecord

Writes a record to the division lookup file

Prototype

void embDbiWriteDivisionRecord (
      AjPFile file,
      ajuint maxnamlen,
      short recnum,
      const AjPStr datfile,
      const AjPStr seqfile
);

TypeNameRead/WriteDescription
AjPFilefileModifyIndex file
ajuintmaxnamlenInputMaximum file name length
shortrecnumInputRecord number
const AjPStrdatfileInputData file name
const AjPStrseqfileInputSequence file name (or NULL if none)
void RETURN

From EMBOSS 2.4.0


Function embDbiWriteEntryRecord

Writes a record to the entryname index file

Prototype

void embDbiWriteEntryRecord (
      AjPFile file,
      ajuint maxidlen,
      const AjPStr id,
      ajuint rpos,
      ajuint spos,
      ajushort filenum
);

TypeNameRead/WriteDescription
AjPFilefileModifyhit file
ajuintmaxidlenInputMaximum length for an id string
const AjPStridInputThe id string for this entry
ajuintrposInputData file offset
ajuintsposInputsequence file offset
ajushortfilenumInputfile number in division file
void RETURN

From EMBOSS 2.4.0


Function embDbiWriteHit

Writes a record to the field hit (.hit) index file

Prototype

void embDbiWriteHit (
      AjPFile file,
      ajuint idnum
);

TypeNameRead/WriteDescription
AjPFilefileModifyhit file
ajuintidnumInputEntry number (1 for the first) in the entryname file
void RETURN

From EMBOSS 2.4.0


Function embDbiWriteTrg

Writes a record to the field target (.trg) index file

Prototype

void embDbiWriteTrg (
      AjPFile file,
      ajuint maxfieldlen,
      ajuint idnum,
      ajuint idcnt,
      const AjPStr hitstr
);

TypeNameRead/WriteDescription
AjPFilefileModifyhit file
ajuintmaxfieldlenInputMaximum field token length
ajuintidnumInputFirst record number (1 for the first) in the field hit index file
ajuintidcntInputNumber of entries for this field value in the field hit index file
const AjPStrhitstrInputField token string
void RETURN

From EMBOSS 2.4.0


Function embDbiSortOpen

Open sort files for entries and all fields

Prototype

AjPFile embDbiSortOpen (
      AjPFile* alistfile,
      ajuint ifile,
      const AjPStr dbname,
      AjPStr const* fields,
      ajuint nfields
);

TypeNameRead/WriteDescription
AjPFile*alistfileOutputSort files for each field.
ajuintifileInputInput file number (used for temporary file names)
const AjPStrdbnameInputDatabase name (used for temporary file names)
AjPStr const*fieldsInputField names (used for temporary file names)
ajuintnfieldsInputNumber of fields
AjPFile RETURNSort file for entries

From EMBOSS 2.4.0


Function embDbiSortClose

Close the sort files for entries and all fields

Prototype

void embDbiSortClose (
      AjPFile* elistfile,
      AjPFile* alistfile,
      ajuint nfields
);

TypeNameRead/WriteDescription
AjPFile*elistfileModifySort file for entries
AjPFile*alistfileModifySort files for each field.
ajuintnfieldsInputNumber of fields
void RETURN

From EMBOSS 2.4.0


Function embDbiMemEntry

Stores data for current entry in memory by appending to lists

Prototype

void embDbiMemEntry (
      AjPList idlist,
      AjPList* fieldList,
      ajuint nfields,
      EmbPEntry entry,
      ajuint ifile
);

TypeNameRead/WriteDescription
AjPListidlistModifyList of entry IDs
AjPList*fieldListModifyList of field tokens for each field
ajuintnfieldsInputNumber of fields
EmbPEntryentryModifyCurrent entry
ajuintifileInputCurrent input file number
void RETURN

From EMBOSS 2.4.0


Function embDbiSortWriteEntry

Write the entryname index file using data from the entry sort file.

Prototype

ajuint embDbiSortWriteEntry (
      AjPFile entFile,
      ajuint maxidlen,
      const AjPStr dbname,
      ajuint nfiles,
      AjBool cleanup,
      const AjPStr sortopt
);

TypeNameRead/WriteDescription
AjPFileentFileModifyEntry file
ajuintmaxidlenInputMaximum id length
const AjPStrdbnameInputDatabase name (used in temp file names)
ajuintnfilesInputNumber of files
AjBoolcleanupInputCleanup temp files if true
const AjPStrsortoptInputSort commandline options
ajuint RETURNNumber of entries

From EMBOSS 2.4.0


Function embDbiMemWriteEntry

Write entryname index for in-memory processing

Prototype

ajuint embDbiMemWriteEntry (
      AjPFile entFile,
      ajuint maxidlen,
      const AjPList idlist,
      void*** ids
);

TypeNameRead/WriteDescription
AjPFileentFileModifyentryname index file
ajuintmaxidlenInputMaximum entry id length
const AjPListidlistInputList of entry IDs to be written
void***idsOutputAjPStr* array of IDs from list
ajuint RETURNNumber of entries written (excluding duplicates)

From EMBOSS 2.4.0


Function embDbiSortWriteFields

Write the indices for a field.

Prototype

ajuint embDbiSortWriteFields (
      const AjPStr dbname,
      const AjPStr release,
      const char[4] date,
      const AjPStr indexdir,
      const AjPStr fieldname,
      ajuint maxFieldLen,
      ajuint nfiles,
      ajuint nentries,
      AjBool cleanup,
      const AjPStr sortopt
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name (used for temp file names)
const AjPStrreleaseInputRelease number as a string
const char[4]dateInputDate
const AjPStrindexdirInputIndex directory
const AjPStrfieldnameInputField name (used for temp file names)
ajuintmaxFieldLenInputMaximum field token length
ajuintnfilesInputNumber of data files
ajuintnentriesInputNumber of entries
AjBoolcleanupInputCleanup temp files if true
const AjPStrsortoptInputSort command line options
ajuint RETURNNumber of unique field targets written

From EMBOSS 2.4.0


Function embDbiMemWriteFields

Write the fields indices

Prototype

ajuint embDbiMemWriteFields (
      const AjPStr dbname,
      const AjPStr release,
      const char[4] date,
      const AjPStr indexdir,
      const AjPStr fieldname,
      ajuint maxFieldLen,
      const AjPList fieldList,
      void** ids
);

TypeNameRead/WriteDescription
const AjPStrdbnameInputDatabase name (used for temp file names)
const AjPStrreleaseInputRelease number as a string
const char[4]dateInputDate
const AjPStrindexdirInputIndex directory
const AjPStrfieldnameInputField name (used for file names)
ajuintmaxFieldLenInputMaximum field token length
const AjPListfieldListInputList of field tokens to be written
void**idsInputAjPStr* array offield token s from list
ajuint RETURNNumber of unique field targets written

From EMBOSS 2.4.0


Function embDbiDateSet

Sets the date as an integer array from a formatted string. The integer array is the internal format in database index headers

Prototype

void embDbiDateSet (
      const AjPStr datestr,
      char[4] date
);

TypeNameRead/WriteDescription
const AjPStrdatestrInputDate as a string
char[4]dateOutputData char (1 byte int) array
void RETURN

From EMBOSS 2.4.0


Function embDbiMaxlen

Compares a string to a maximum string length.

Prototype

void embDbiMaxlen (
      AjPStr* token,
      ajint* maxlen
);

TypeNameRead/WriteDescription
AjPStr*tokenModifyToken string
ajint*maxlenModifyMaximum string length
void RETURN

From EMBOSS 2.4.0


Function embDbiLogHeader

Writes the header to a database indexing logfile

Prototype

void embDbiLogHeader (
      AjPFile logfile,
      const AjPStr dbname,
      const AjPStr release,
      const AjPStr datestr,
      const AjPStr indexdir,
      ajuint maxindex
);

TypeNameRead/WriteDescription
AjPFilelogfileModifyLog file
const AjPStrdbnameInputDatabase name
const AjPStrreleaseInputRelease number, name or code
const AjPStrdatestrInputIndexing date as a string dd/mm/yy
const AjPStrindexdirInputIndex directory relative path
ajuintmaxindexInputMaximum index token length (usually zero)
void RETURN

From EMBOSS 4.0.0


Function embDbiLogFields

Writes database indexing logfile report of fields selected for indexing

Prototype

void embDbiLogFields (
      AjPFile logfile,
      AjPStr const* fields,
      ajuint nfields
);

TypeNameRead/WriteDescription
AjPFilelogfileModifyLog file
AjPStr const*fieldsInputField names
ajuintnfieldsInputNumber of fields
void RETURN

From EMBOSS 4.0.0


Function embDbiLogSource

Writes database indexing logfile report of source data selected for indexing

Prototype

void embDbiLogSource (
      AjPFile logfile,
      const AjPStr directory,
      const AjPStr filename,
      const AjPStr exclude,
      AjPStr const* inputFiles,
      ajuint nfiles
);

TypeNameRead/WriteDescription
AjPFilelogfileModifyLog file
const AjPStrdirectoryInputData directory relative path
const AjPStrfilenameInputSelected filenames wildcard
const AjPStrexcludeInputExcluded filenames wildcard
AjPStr const*inputFilesInputFile names
ajuintnfilesInputNumber of files
void RETURN

From EMBOSS 4.0.0


Function embDbiLogCmdline

Writes database indexing logfile report of commandline used

Prototype

void embDbiLogCmdline (
      AjPFile logfile
);

TypeNameRead/WriteDescription
AjPFilelogfileModifyLog file
void RETURN

From EMBOSS 4.0.0


Function embDbiLogFile

Writes database indexing logfile report of a single source file

Prototype

void embDbiLogFile (
      AjPFile logfile,
      const AjPStr curfilename,
      ajuint idCountFile,
      AjPStr const* fields,
      const ajuint* countField,
      ajuint nfields
);

TypeNameRead/WriteDescription
AjPFilelogfileModifyLog file
const AjPStrcurfilenameInputSource filename
ajuintidCountFileInputNumber of IDs in file
AjPStr const*fieldsInputField names
const ajuint*countFieldInputNumber of field tokens in this file
ajuintnfieldsInputNumber of fields
void RETURN

From EMBOSS 4.0.0


Function embDbiLogFinal

Writes database indexing logfile report of final totals

Prototype

void embDbiLogFinal (
      AjPFile logfile,
      ajuint maxindex,
      const ajint* maxFieldLen,
      AjPStr const* fields,
      const ajuint* fieldTot,
      ajuint nfields,
      ajuint nfiles,
      ajuint idDone,
      ajuint idCount
);

TypeNameRead/WriteDescription
AjPFilelogfileModifyLog file
ajuintmaxindexInputUser defined maximum index token length (usually zero)
const ajint*maxFieldLenInputMaximum index token length for each field. Negative values were upper limits. Positive values are the maximum in the data
AjPStr const*fieldsInputField names
const ajuint*fieldTotInputNumber of unique field tokens
ajuintnfieldsInputNumber of fields
ajuintnfilesInputNumber of input files
ajuintidDoneInputNumber of unique IDs indexed
ajuintidCountInputTotal number of IDs indexed
void RETURN

From EMBOSS 4.0.0


Function embDbiExit

Cleanup database indexing internals on exit

Prototype

void embDbiExit (
      void
);

TypeNameRead/WriteDescription
void RETURN

From EMBOSS 4.0.0