Formatters

Formatters take the output from an XML parser and return a Drupal-form friendly array. Typically a formatter will return a table each for:

  • The base Chado record

  • Properties

  • DBXrefs

  • New Chado records created and linked, including organisms, contacts, projects, analyses, etc

EUtilsFormatter

class EUtilsFormatter

Subclassed by EUtilsAssemblyFormatter, EUtilsBioProjectFormatter, EUtilsBioSampleFormatter

Public Functions

format (array $data)

Format a parser’s output.

Parameters

$data – The data array returned by a parser.

Returns

array This function does not return anything. It directly manipulates the elements array.

getDbLink (string $accession, string $db)

Generates a URL link given a db string and accession.

Parameters
  • $accession – Accession string.

  • $db – Database lookup string.

Returns

mixed returns either the accession string, or the accession with a link to the xref.

getNCBIDB (string $db_name)

Fetch the DB object for an NCBI DB.

Parameters

$db_name – The DB name as passed by the parser.

Returns

bool Returns a database object or FALSE.

EUtilsFormatterFactory

class EUtilsFormatterFactory : public EUtilsFactoryInterface

EUtilsFormatterFactory.

Creates a formatter given the db.

Public Functions

get (string $db)
Parameters

$db – The database name.

Throws

Returns

The formatter for the given DB.

EUtilsAssemblyFormatter

class EUtilsAssemblyFormatter : public EUtilsFormatter

Parse EUtilsAssemblyParser output for display on a form.

Public Functions

format (array $data)

Add the formatted data into a table.

Parameters

$data – The parsed XML data.

Returns

array Drupal form elements array of each section in a fieldset.

EUtilsBioProjectFormatter

class EUtilsBioProjectFormatter : public EUtilsFormatter

Class EutilsBioProject Formatter.

Public Functions

format (array $data)

Add the formatted data into a table.

Parameters

$data – The parsed XML data.

Returns

array Drupal form elements array of each section in a fieldset.

EUtilsBioSampleFormatter

class EUtilsBioSampleFormatter : public EUtilsFormatter

Class EUtilsBioSampleFormatter.

Public Functions

format (array $data)

Add the formatted data into a table.

Parameters

$data – The parsed XML data.

Returns

array Drupal form elements array of each section in a fieldset.

EUtilsPubmedFormatter

Pubmed records are not directly imported via this module, as this functionality is already provided via Tripal core.