lamindb: unable to download cellxgene's dataset?

Hi, I tried to follow everything and did this:

dataset = ln.Dataset.filter(name="cellxgene-census").one()
dataset.files.all()[0].save()

to get this error from django: ProgrammingError: permission denied for table lnschema_core_file

How would I go to download all the files in the dataset?

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 30 (19 by maintainers)

Most upvoted comments

To correct my answer above, if you save files with the transfer, you can only use global settings for the organism since you don’t call the File constructor.

So this is what I had tried at some point but the issue is that many files in cx_dataset had no organisms set

here cx_dataset = ln.Dataset.using("laminlabs/cellxgene-census").one()

You are right, we also noticed that some files don’t have metadata when we queried via the census production API. But we will now have those files labeled directly using the cellxgene REST API so that everything should be labeled. This is going to be completed either later today or tomorrow. I’ll ping you once we update the instance!

You need to to provide the organism= to File, not to .save(). Tried to explain here: https://lamin.ai/docs/bio-registries#manage-registries-across-organism, but I see that as the error only show up upon save, this can be not very clear. We’ll improve the error propagation here, thanks for raising it!

To correct my answer above, if you save files with the transfer, you can only use global settings for the organism since you don’t call the File constructor.

To set the organism for each file (which is already annotated), you can:

for file in cx_dataset.files.all():
    organism_record = file.organism.first()
    lb.settings.organism = organism_record
    ...
    file.save()

An alternative way of doing it is to stratify your download script into two parts, first register all human data, and then register all mouse data and changing the global setting in between.

There was a bug here - repeated data transfers weren’t entirely idempotent. Now they are: https://github.com/laminlabs/lamindb/pull/1311

I didn’t see it immediately because you had introduced the try-except statements.

We’ll make a new lamindb release with the data loader and this bug fix and everything should work as expected.