linnarsson-lab / loom-viewer

Tool for sharing, browsing and visualizing single-cell data stored in the Loom file format
BSD 2-Clause "Simplified" License
35 stars 6 forks source link

Link to download loom file #36

Closed slinnarsson closed 8 years ago

slinnarsson commented 8 years ago

I made a new endpoint "/clone/..:" to download the actual .loom file for a dataset. This makes it easy to download a dataset from a public server, and then work with it locally.

In the client, each dataset should have a "Download" button. This should be visible but not take too much visual space, so an icon would make sense. Maybe a cloud with arrow.

When clicked, this downloads the file to the user's computer.

slinnarsson commented 8 years ago

And the icon should have a tooltip, e.g. "Download this .loom file" so that the purpose is clear.

slinnarsson commented 8 years ago

Even better: "Download Midbrain_20160601.loom" i.e. using the actual name of the file.

JobLeonard commented 8 years ago

Ok, this should be simple enough. It's just an addition to the list of datasets we currently have in the client, right? That is to say: I can just take the projects from the /loom/ endpoint and find all available loom files as /clone/<transcriptome>__<project>__<dataset>.loom?

(not yet taking into account your earlier remark that we are likely to relax the naming convention for loom files)

slinnarsson commented 8 years ago

The endpoint is GET /clone/{project}/{filename}. From /loom you'll now get a list of datasets, each of which is a list with two items: project and filename. For example:

[
   ["Midbrain", "midbrain_20160801.loom"],
   ["Cortex", "astrocytes_final.loom"],
   ["Cortex", "oligos_final.loom"]
]

The link to download the last of those datasets would be /clone/Cortex/oligos_final.loom and the tooltip would show as Download oligos_final.loom.

The concept of transcriptome is gone because it was only ever needed to support uploads.

slinnarsson commented 8 years ago

Actually, maybe I should make /loom return a dictionary instead? It would be easier then to add fields later on and they would not rely on the order of fields in a list:

[
   {"project": "Midbrain", "filename": "midbrain_20160801.loom"},
   {"project": "Cortex", "filename": "astrocytes_final.loom"},
   {"project": "Cortex", "filename": "oligos_final.loom"}
]
slinnarsson commented 8 years ago

I made the change to the /loom endpoint, and updated the docs.

JobLeonard commented 8 years ago

Isn't that the existing method of listing projects you had before, with a "filename" field added and all the loom-pipeline-related fields stripped? This is what /loom returned before:

[
    {
        "project": "midbrain",
        "status": "created",
        "cluster_method": "AP",
        "transcriptome": "hg19_sUCSC",
        "message": "Ready to browse.",
        "regression_label": "_Cluster",
        "n_features": 1000,
        "dataset": "human_sten_May29"
    },
    {
        "project": "Published",
        "status": "created",
        "cluster_method": "AP",
        "transcriptome": "mm10_sUCSC",
        "message": "Ready to browse.",
        "regression_label": "_Cluster",
        "n_features": 1000,
        "dataset": "Oligodendrocytes_Science_2016"
    }
]

The client side currently relies on a number of these fields - "status" is used to determine if projects can be opened and message is displayed as an explanation. Since that is all loom-pipeline specific that needs to be stripped out as well.

Also, I showed the react-router branch version of Loom to Gioelle and Lars, in part to test the browser code, and they got a bit confused by the UI, not understanding where to click to get to a datavisualisation. I need to re-arrange it to be more intuitive; might as well do that while I implement the download button.

slinnarsson commented 8 years ago

Exactly. We might want to add metadata such as "title", "description", "authors", "reference" etc. in the future. These would be stored in the loom file itself, and not related to the pipeline.

JobLeonard commented 8 years ago

Well, that was even easier than expected. Nice when issues take only half an hour to implement ;)

JobLeonard commented 8 years ago

Forgot the tooltip