Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Accessing database entries by accession number

Pierrick Roger edited this page Mar 6, 2018 · 4 revisions

This page has been generated automatically from a package vignette. Please do not edit, since your modifications will later be removed.

Introduction

In this vignette, we will explain how to download and access entry information from databases.

First you need to create an instance of the Biodb class:

mybiodb <- biodb::Biodb$new()

Getting list of available databases

A database ID is required for choosing which database to access. To get the list of available database IDs, just run:

mybiodb$getDbsInfo()$getIds()

Getting an entry from the database

To obtain an entry from a database you have to call the getEntry() method from the BiodbFactory class. The following example access the KEGG Compound database in order to retrieve the entry number 2:

entry <- mybiodb$getFactory()$getEntry('kegg.compound', id = 'C00005')

Accessing entry fields

From an entry instance, you can access different values stored in fields. Here is an example to get back the entry number (or accession number) used to obtain this entry:

entry$getFieldValue('accession')

We can have a list of all available fields for an entry:

entry$getFieldNames()

You can also get a data frame of the field values with the method getFieldsAsDataFrame():

entry$getFieldsAsDataFrame()