Skip to contents

此函数用于创建一个新的 BioCyc SmartTable

Usage

biocyc_create_smart_table(
  session,
  orgid = "ECOLI",
  name = "test",
  type = c("Genes", "Compounds", "Reactions", "Pathways", "Proteins",
    "Transcription-Units", "Attenuators"),
  description = NULL,
  values = c("trpA", "trpB")
)

Arguments

session

httr::handle对象,表示已建立的BioCyc会话

orgid

字符串,生物体数据库标识符,即 orgid(如 "ECOLI")

name

字符串,SmartTable的名称(可选)

type

字符串,第一列对象所属的类,如 'Genes'、'Compounds'。默认 "Genes"

description

字符串,SmartTable的描述(可选)

values

字符串向量,取值

Value

字符串,创建的SmartTable的 ID

Details

For json input files, parameters are encoded as part of the file format.

JSON Structure for SmartTable Data Retrieval and Creation

JSON file structure:

  • name (optional) - name field of SmartTable

  • description (optional) - description field of SmartTable

Contents of the short form, which is for creating a single column of values only:

  • type: an object class that values will be coerced into for the given database into the SmartTable

  • pgdb: an org id for the database in which SmartTable objects will reside and be coerced with the given type

  • values: an array of strings, which will be coerced into objects for the SmartTable in a single column

Contents of the long form, which is for creating multiple columns of values:

  • columns: a list (JSON array) of columns, each of which is:

  • name (optional): a string that will be the name of the column

  • type: an object class that values will be coerced into for the SmartTable

  • rows: a JSON array, each element is a dictionary mapping column ids to values. Each value corresponds to one cell in the SmartTable and contains:

  • value: a string, number, or frameid: , pgdb: which will be coerced into an object for the SmartTable

JSON examples:

// Short form
{"name": "sample short-form group",
"description": "sample short-form description",
"pgdb": "ECOLI",
"type": "Genes",
"values": ["trpA", "trpB"]
}

// long form (2 columns)
{"name": "sample long-form group",
 "description": "This is a longer form of JSON used with a SmartTable.",
 "columns": [{"name": "Gene", "type": "Genes"}, {"name": "Expression Level"}]
 "rows": [{{"frameid": "EG11204", "pgdb": "ECOLI"}, "1.3"},
          {{"frameid": "EG11205", "pgdb": "ECOLI"}, "-2.2"}]
}

Examples

if (FALSE) { # \dontrun{
session <- establish_biocyc_session("your_email_address", "your_password")
smart_table_id <- create_smart_table(session, '/path/to/data.json')
print(paste("创建的SmartTable ID:", smart_table_id))
} # }