Retrieving Data
🤓 The ultimate guide for data analysts using Isabl!
Last updated
🤓 The ultimate guide for data analysts using Isabl!
Last updated
Filters enable you to subset the data of your interest. For example you can use filters to retrieve all the BAM files of a given project, or get all VCFs from a given variant calling application. Filters are field-value pairs and can be used both in the Command Line and within Python. Check out this examples:
Note that fields can traverse the relational model. To do so concatenate the fields with __
(e.g. samples__disease__acronym=AML
, or a dot in the Command Line application.name=PINDEL
)
As indicated in the previous hint, filter fields can traverse database relationships. However, all filters can be augmented using lookups:
To get a full description of all available filters please visit Isabl's Redoc API documentation at https://isabl.github.io/redoc/ or https://isabl.mskcc.org/api/v1 (replacing isabl.mskcc.org
with your own host). Another useful way to explore the relational model is by using isabl get-metadata
.
Here are some common and useful filters for Isabl.
The filter count_limit
enables you to limit the total number of instances that will be retrieved. For example to get the output directory for the first 10 successful analyses you could do:
On the other side, limit
will determine how many instances should be retrieved at the same time. For example, the following command would retrieve paths to all successful analyses in batches of 10000:
To get for example all experiments that have a BAM file for GRCh37
you could do:
The following filters can be used to (quite dramatically) improve the performance for some queries:
Filter
Description
Usage
distinct
If you set distinct to false, the each result within the query won't be guaranteed to be unique, yet the response will be faster.
distinct=false
paginator
By activating the cursor pagination, you would be able to traverse queries results, but you won't know the total number of results.
paginator=cursor
paginator=cursor
is still experimental, please report an issue if you have trouble.
Filters in the command line are usually provided using the -fi
or --filters
flags. Relations or lookups can be provided using double underscores or dots (e.g. application.name
or application__name
). Here is a list of Isabl commands available to retrieve information:
Command
Description
Example
get-count
Get count of database instances given a particular query. For example, how many failed analyses are in the system?
isabl get-count analyses -fi status FAILED
get-metadata
isabl get-metadata samples -fi category TUMOR -f disease
get-data
This command will retrieved the raw data linked to experiments as imported in Isabl (e.g. BAM, FASTQ, CRAM). Use --verbose
to see what experiments have missing data.
isabl get-data -fi projects.pk.in 102,103
get-bams
isabl get-bams -fi has_bam_for GRCh37
get-reference
isabl get-reference GRCh37
get-bed
Retrieve a BED file linked to a particular sequencing technique. By default, the targets BED file is returned, to get the baits BED use --bed-type
.
isabl get-bed HEMEPACT --assembly GRCh37
get-paths
isabl get-paths projects 102
get-outdirs
isabl get-outdirs -fi name PINDEL -fi status SUCCEEDED
get-results
isabl get-results -fi application.pk 1 -r command_script
Another useful way to explore the relational model is by using isabl get-metadata
:
Expand and navigate with arrow keys, press e to expand all and E to minimize. Learn more at fx
documentation. Use --help
to learn about other ways to visualize metadata (e.g. tsv
).
Furthermore, you can limit the amount of information you are retrieving by passing the list of fields you are interested in:
By default, the command get-reference
helps you retrieve the assembly reference genome.
However, by means of the --data-id
flag, the command get-reference
also allows you to retrieve the indexes generated during import. To get a list of available files per assembly use --resources
:
Then get the one you are interested in with:
You can use get-outdirs
within the command line to systematically explore output directories. For example:
Further more you can retrieve files within those directories by using --pattern
:
Additionally, you can retrieve results directly registered by the application:
To visualize what results are available for a given application run:
You can retrieve the application primary key from the front end.
Importantly, isabl-cli
can also be used as a Software Development Kit within python:
If you are using ipython
, use ?
to get help on a method (e.g. ii.get_instances?
)
To get started, we can retrieve specific instances from the database:
These instances are Munch
, in other words they are dot-dicts (like javascript). So you can do both analysis["status"]
or analysis.status
.
A more general way to retrieve any object in the database is using get_instance
:
Some examples of things you can do with these instances:
To get multiple instances you can do:
Similarly to isabl get-count
, you can determine the number of available results for a given query:
To retrieve all samples and experiments for a given individual:
You can also retrieve multiple trees:
If you have permissions, you will be able to systematically alter instances in the database:
With great power, comes... yeah you know how it goes. Just be careful.
Here are other useful utilities available in isabl-cli
:
Method
Description
ii.api.chunks
Given a list of elements, return a list of chunks of n
elements from the original list.
ii.api.api_request
Perform an authenticated request to Isabl API.
ii.api.retry_request
Retry an HTTP request multiple times with a delay between each failure.
Isabl Web is a great tool to retrieve information and understand the state of affairs within the system. Simply type something in the search bar to retrieve instances across multiple schemas:
Multiple panels will be stacked horizontally as you request more information:
The projects detail panel conveys all assets and stakeholders linked to a particular project:
Live Tables are directly wired to the API and will enable you to search and filter on specific columns. For the later, simply click in the column name:
The samples tree panel provides access to all assets generated on a given individual.
By clicking on a given node in the tree, you can retrieve more metadata, filter out available analyses on that instance, and even get access to BAM files:
We can retrieve different types of results for all analyses generated by Isabl. For example accessing a project level quality control report:
Similarly we can retrieve other types of results such as a VCF:
Retrieve instances metadata in multiple formats. To limit the number of fields you are interested in use -f
(i.e. ).
Get the official bam registered for a given list of experiments. Use --assembly
if there are BAMs available for different versions of the genome. Use to filter those experiments with a registered BAM.
Isabl supports the linkage of auxiliary resources to the assembly instances. get-reference
gives you the path to the reference FASTA, however you can retrieve other linked resources.
Retrieve the storage directory for any instance in the database. Use to retrieve files within those directories.
This command is a short cut of isabl get-paths analyses
. Learn more about retrieving results .
Retrieve analyses results produced by applications. Use to list all available choices for a given application.