peptidedigest.article_db#

Functions for creating and managing a SQLite database for storing articles and their model responses.

Module Contents#

Functions#

create_database(name)

Create a SQLite database with the given name.

insert_article(database, article_info[, model_responses])

Insert an article and its model responses into the database.

get_article(database[, doi, pmc_id])

Get the article information and model responses for a given DOI.

get_articles(database)

Get all articles from the database.

update_article(database, doi, model_responses)

Update the model responses for an article in the database.

check_article_exists(database, value, column)

Check if an article with the given value in the specified column exists in the database.

delete_article(database[, doi, pmc_id])

Delete an article and its model responses from the database.

peptidedigest.article_db.create_database(name)[source]#

Create a SQLite database with the given name.

Parameters:

name (str) – The name of the database to create.

Returns:

The database is created in the current working directory.

Return type:

None

peptidedigest.article_db.insert_article(database, article_info, model_responses=None)[source]#

Insert an article and its model responses into the database.

Parameters:
  • database (str) – The name of the database to insert the article into.

  • article_info (dict) – A dictionary containing the article information.

  • model_responses (dict) – A dictionary containing the model responses for the article.

Returns:

The article and model responses are inserted into the database.

Return type:

None

peptidedigest.article_db.get_article(database, doi=None, pmc_id=None)[source]#

Get the article information and model responses for a given DOI.

Parameters:
  • database (str) – The name of the database to retrieve the article from.

  • doi (str) – The DOI of the article to retrieve.

  • pmc_id (str) – The PMC ID of the article to retrieve.

Returns:

A dictionary containing the article information and model responses.

Return type:

dict

peptidedigest.article_db.get_articles(database)[source]#

Get all articles from the database.

Parameters:

database (str) – The name of the database to retrieve the articles from.

Returns:

A list of dictionaries containing the article information and model responses.

Return type:

list

peptidedigest.article_db.update_article(database, doi, model_responses)[source]#

Update the model responses for an article in the database.

Parameters:
  • database (str) – The name of the database to update the article in.

  • doi (str) – The DOI of the article to update.

  • model_responses (dict) – A dictionary containing the updated model responses.

Returns:

The model responses for the article are updated in the database.

Return type:

None

peptidedigest.article_db.check_article_exists(database, value, column)[source]#

Check if an article with the given value in the specified column exists in the database.

Parameters:
  • database (str) – The name of the database to check for the article.

  • value (str) – The value to check for in the specified column.

  • column (str) – The column to check for the value.

Returns:

True if the article exists, False otherwise.

Return type:

bool

peptidedigest.article_db.delete_article(database, doi=None, pmc_id=None)[source]#

Delete an article and its model responses from the database.

Parameters:
  • database (str) – The name of the database to delete the article from.

  • doi (str) – The DOI of the article to delete.

  • pmc_id (str) – The PMC ID of the article to delete.

Returns:

The article and model responses are deleted from the database.

Return type:

None