Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cbioportal-api-client

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cbioportal-api-client

cBio Portal API client with promises and response parsing

  • 0.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-96%
Maintainers
1
Weekly downloads
 
Created
Source

cBio Portal API Client

npm Build Status Coverage Status Dependency Status

cBio Portal API client. Parses tab separated responses into JSON format. Works in node and in the browser via a module loader such as Webpack.

This library can be used programatically or via the command line.

Under active development: This library is currently under active development. The module API is not finalized and is likely to change before v1.

Installation
$ npm install cbioportal-api-client --save
Programmatic Usage

API Reference

import CbioPortal from 'cbioportal-api-client';

const cbioPortal = CbioPortal();

cbioPortal.getCancerStudies()
  .then(response => {
    console.log(response); // Prints array of cancer studies returned from API
  });

cbioPortal.getGeneticProfiles({ cancer_study_id: 'gbm_tcga' })
  .then(response => {
    console.log(response); // Prints array of genetic profiles returned from the 'gbm_tcga' study
  });
Command Line Usage

Note: Requires node.

# global install to use anywhere
$ npm install -g cbioportal-api-client

# print usage info using --help
$ cbioportal-api-client --help

  Usage: cbioportal-api-client [options] [command]


  Commands:

    getCancerStudies                 get cancer study meta-data
    getTypesOfCancer                 get clinical cancer types
    getGeneticProfiles [options]     get genetic profile data for a cancer study.
    getCaseLists [options]           get case lists stored for a specific cancer study.
    getProfileData [options]         get genomic profile data for one or more genes.
    getAlterationSummary [options]   summarize alterations for the profile data.

  You can get usage info for specific commands using [command] --help

  Options:

    -h, --help             output usage information
    -V, --version          output the version number
    -f, --format <format>  response format

# example API call, sends JSON formatted response to stdout
$ cbioportal-api-client getProfileData -s gbm_tcga_cnaseq -p gbm_tcga_mutations -g TP53
# .... cut long JSON response

# summarizing alterations
$ cbioportal-api-client getAlterationSummary -s gbm_tcga_cnaseq -p gbm_tcga_mutations,gbm_tcga_gistic -g TP53,MDM2,MDM4
{"summary":{"genes":{"mdm2":{"mutated":1,"cna":9,"combined":10},"mdm4":{"mutated":0,"cna":10,"combined":10},"tp53":{"mutated":29,"cna":2,"combined":30}},"overall":47}}

API Reference

Modules

cbioportal-api-client
cbioportal-api-client/utils/convertResponsePromise

Converts tab delimited responses to JSON format

cbioportal-api-client/utils/summarizeAlterationsPromise

Summarizes alterations for results

cbioportal-api-client


cbioportal-api-client ⏏ exports.default(config) ⇒ cbioPortal

Creates a new cBio Portal API client

Kind: exports method of cbioportal-api-client
Returns: cbioPortal

ParamTypeDescription
configObjectConfiguration options object.
config.requestOptsObjectOverride the request congfiguration object.

Example
Basic usage:

import CbioPortal from 'cbioportal-api-client';

const cbioPortal = CbioPortal();

cbioPortal.getCancerStudies()
  .then(response => {
    console.log(response); // Prints array of cancer studies returned from API
  });

cbioportal-api-client~cbioPortal : Object

cbioPortal API Object Prototype. Used as the object prototype when creating an API client object via the module factory method.

Kind: inner constant of cbioportal-api-client

See: Use CbioPortal() for object creation.


cbioPortal.getTypesOfCancer() ⇒ Promise

Retrieves a list of all the clinical types of cancer stored on the server.

Kind: instance method of cbioPortal
Returns: Promise
Fulfills: Array response data converted from TSV to JSON


cbioPortal.getCancerStudies() ⇒ Promise

Retrieves meta-data regarding cancer studies stored on the server.

Kind: instance method of cbioPortal
Returns: Promise
Fulfills: Array response data converted from TSV to JSON


cbioPortal.getGeneticProfiles(query) ⇒ Promise

Retrieves meta-data regarding all genetic profiles, e.g. mutation or copy number profiles, stored about a specific cancer study.

Kind: instance method of cbioPortal
Returns: Promise
Fulfills: Array response data converted from TSV to JSON

ParamTypeDescription
queryObject
query.cancer_study_idstringCancer study ID

cbioPortal.getCaseLists(query) ⇒ Promise

Retrieves meta-data regarding all case lists stored about a specific cancer study.

For example, a within a particular study, only some cases may have sequence data, and another subset of cases may have been sequenced and treated with a specific therapeutic protocol.

Multiple case lists may be associated with each cancer study, and this method enables you to retrieve meta-data regarding all of these case lists.

Kind: instance method of cbioPortal
Returns: Promise
Fulfill: response data converted from TSV to JSON

ParamTypeDescription
queryObject
query.cancer_study_idstringCancer study ID

cbioPortal.getProfileData(query) ⇒ Promise

Retrieves genomic profile data for one or more genes.

Note: If you pass in multiple genetic profile IDs and multiple genes, the library will make multiple requests as the API does not support this type of query.

Kind: instance method of cbioPortal
Returns: Promise
Fulfill: response data converted from TSV to JSON

ParamTypeDescription
queryObject
query.case_set_idstringA unique ID used to identify the case list ID in subsequent interface calls. This is a human readable ID. For example, "gbm_all" identifies all cases profiles in the TCGA GBM study.
query.genetic_profile_idArray.<string> | stringOne or more genetic profile IDs
query.gene_listArray.<string> | stringOne or more genes, specified as HUGO Gene Symbols or Entrez Gene IDs

cbioPortal.getAlterationSummary(query) ⇒ Promise

Summarize gene alterations

Kind: instance method of cbioPortal
Returns: Promise

ParamTypeDescription
queryObject
query.case_set_idstringA unique ID used to identify the case list ID in subsequent interface calls. This is a human readable ID. For example, "gbm_all" identifies all cases profiles in the TCGA GBM study.
query.genetic_profile_idArray.<string> | stringOne or more genetic profile IDs
query.gene_listArray.<string> | stringOne or more genes, specified as HUGO Gene Symbols or Entrez Gene IDs

cbioportal-api-client/utils/convertResponse ⇒ Promise

Converts tab delimited responses to JSON format

Returns: Promise - Resolves with the response JSON

ParamTypeDescription
responsestringTSV string

cbioportal-api-client/utils/summarizeAlterations ⇒ Promise

Summarizes alterations for results

Returns: Promise - Resolves with the summary
Fulfills: Object Object with results, see example

ParamTypeDescription
dataSetsObject | ArrayConverted response dataset(s)

Example
Basic Usage:

import CbioPortal from 'cbioportal-api-client';
import { summarizeAlterations } from 'cbioportal-api-client/dist/utils';

const cbioPortal = CbioPortal();

cbioPortal.getProfileData({
  case_set_id: 'gbm_tcga_cnaseq',
  genetic_profile_id: ['gbm_tcga_mutations', 'gbm_tcga_gistic'],
  gene_list: ['tp53', 'mdm2', 'mdm4']
})
.then(response => summarizeAlterations(response))
.then(result => console.log(result));

// console.log output

{
  summary: {
    genes: {
      tp53: {
        mutated: 29,
        cna: 2,
        combined: 30
      },
      mdm2: {
        mutated: 1,
        cna: 9,
        combined: 10
      },
      mdm4: {
        mutated: 0,
        cna: 10,
        combined: 10
      }
    },
    overall: 47
  }
}

FAQs

Package last updated on 01 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc