GRASP Console ScriptΒΆ

A Simple GRASP (grasp.nhlbi.nih.gov) API based on SQLAlchemy and Pandas

Author Michael D Dacre <mike.dacre@gmail.com>
Organization Stanford University
License MIT License, use as you wish
Created 2016-10-08
Version 0.3.0b1
Last modified: 2016-10-17 00:18

This is the front-end to a python grasp api, intended to allow easy database creation and simple querying. For most of the functions of this module, you will need to call the module directly.

usage: grasp [-h] {search,conf,info,init} ...
Sub-commands:
search (s, lookup)

Query database for variants by location or id

Query for SNPs in the database. By default returns a tab-delimeted list of SNPs with the following columns: ‘id’, ‘snpid’, ‘study_snpid’, ‘chrom’, ‘pos’, ‘phenotype’, ‘pval’ The –extra flag adds these columns: ‘InGene’, ‘InMiRNA’, ‘inLincRNa’, ‘LSSNP’ The –study-info flag adds these columns: ‘study_id (PMID)’, ‘title’ The –db-snp flag uses the myvariant API to pull additional data from db_snp.

usage: grasp search [-h] [--extra] [--study-info] [--db-snp] [--pandas] [-o]
                    [--path]
                    query
Positional arguments:
query rsID, chrom:loc or chrom:start-end
Options:
--extra Add some extra columns to output
--study-info Include study title and PMID
--db-snp Add dbSNP info to output
--pandas Write output as a pandas dataframe
-o, --out File to write to, default STDOUT.
--path PATH to write files to
conf (config)

Manage local config

usage: grasp conf [-h]
                  [--db {sqlite,postgresql,mysql} | --get-path | --set-path PATH | --init]
Options:
--db

Set the current database platform.

Possible choices: sqlite, postgresql, mysql

--get-path Change the sqlite file path
--set-path Change the sqlite file path
--init Initialize the config with default settings. Will ERASE your old config!
info

Display database info

Write data summaries (also found on the wiki) to a file or the console. Choices: all: Will write everything to separate rst files, ignores all other flags except `–path` phenotypes: All primary phenotypes. phenotype_categories: All phenotype categories. populations: All primary populations. population_flags: All population flags. snp_columns: All SNP columns. study_columns: All Study columns.

usage: grasp info [-h] [-o] [--path]
                  {phenotypes,phenotype_categories,all,population_flags,populations,study_columns,snp_columns}
Positional arguments:
display

Choice of item to display, if all, results are written to independant rst files, and optional args are ignored

Possible choices: phenotypes, phenotype_categories, all, population_flags, populations, study_columns, snp_columns

Options:
-o, --out File to write to, default STDOUT.
--path PATH to write files to
init

Initialize the database

usage: grasp init [-h] [-n] study_file grasp_file
Positional arguments:
study_file GRASP study file from: github.com/MikeDacre/grasp/blob/master/grasp2_studies.txt
grasp_file GRASP tab delimeted file
Options:
-n, --no-progress
 Do not display a progress bar