csf-ngs / forskalle-api

Command Line Interface and Python API for Forskalle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FSK API + cli

Python library for Fsk3 API. Will add functionality as needed.

Installation

Install from the VBCF.NGS repository:

pip3 install git+https://ngs.vbcf.ac.at/repo/software/forskalle-api.git
# or github
pip3 install git+https://github.com/csf-ngs/forskalle-api.git

Usage

CLI

fsk-cli [command] [options] etc

Point it at your favorite Forskalle instance either by

  • setting environment variables: FSK_API_BASE and FSK_API_KEY
  • using a config file in ~/.fsk_api.yml, please see doc/ for an example
  • providing --base and --key

Try fsk-cli --help for some hints!

Examples

Set all sequenced samples of a multiplex to Ok:

fsk-cli multi get M4711 | jq '.multiplex_samples[].sample_id' | \
  while read sample_id; do 
    fsk-cli set-sequencing-status $sample_id --status Ok
  done

In place editing with jq and updating:

# update all request lanes to status Ready
fsk-cli request get R4711 | \
  jq '.request_lanes[].status="Ready"' | \
  fsk-cli request update R4711

Library

from forskalle_api import FskApi

fsk_api = FskApi()
sample_json = fsk_api.get_sample(54321)
from forskalle_api import FskApi
from forskalle_api.auto.queryparams import IlluminaRunFilters
from forskalle_api.fsk_query import FskQuery

fsk_api = FskApi()
irf = IlluminaRunFilters(sequenced_after="2020-05-01")
q = FskQuery(filters=irf)
runs = fsk_api.get_runs_illumina(q)

There is no API-doc or similar, but we all love reading python source code!

Models

Models and Query Parameters are autogenerated from forskalle. Return values of most api calls are thin class layers with type hints, e.g. forskalle_api.auto.models.Sample with all properties and relationships to allow easy navigation in your source code editor.

You can also find de/serialization helpers (serializeSample from Class to dict, plainToSample from dict to Class).

About

Command Line Interface and Python API for Forskalle


Languages

Language:Python 99.7%Language:Singularity 0.3%