biocore / biocore/microsetta-public-api

Add endpoint for taxa ranks

Open
#72 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The results processing pipeline is now able to characterize the top ranked genera in a dataset. I'm not sure if we should generalize beyond genera -- I think focusing on just one taxon rank is okay right now.

For support of visualization, it would be nice to have an endpoint `GET /dataset/{dataset}/taxonomy/ranks/{resource}?sample_size=int` and `GET /dataset/{dataset}/taxonomy/ranks/{resource}/sample/{sample_id}`

With the former, the idea is to obtain a sample of observed ranks. The example plots for this used a sample of 30k data points (no real difference observed at 10k or 100k). It could return a structure like the following, where the values in the arrays are in index order with each other:

```json
{
"genus": ["Bacteroides", "Prevotella", "Bacteroides", ...],
"rank": [10, 7, 9, ...]
}
```

The second `GET` could return the same type of structure, but for the genera and ranks specific to the requested sample.

In the proof of concept, the behind the scenes code relied on a melted dataframe, the head of which looked like:

|Genus |variable|Rank|
|-----|--------|----|
|g__Bacteroides | 10317.000093406 | 13.0|
|g__Prevotella | 10317.000007157 | 4.0|
|g__Phascolarctobacterium | 10317.000070730 | 3.0|
|g__Faecalibacterium | 10317.000001130 | 5.0|
|g__Ruminococcus | 10317.000014174 | 17.0|

We don't really need the sample IDs for this to work hence omitting them from the return. The actual plotting was based on a pandas `.sample` call on this melted table.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating the existing dataset and taxonomy API routes and the results-processing pipeline that produces ranked genera. Review the pandas melted-table sampling described in the issue, then define the responses for both requested GET endpoints. Done means both routes return aligned genus and rank arrays, including dataset-level sampling and sample-specific results.

Written by the indexing model from the issue text.

Assessment

Tech stack
pandas, python
Domain
api, data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.