New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in anndata$write(filename = filename, compression = compression, : attempt to apply non-function #8
Comments
Hey @akhst7 ! Could you provide a preproducible example script and sample dataset? Which version of anndata for R are you using? Kind regards, |
Thanks for helping. I am using
So the file in question was generated by sceasy package with a following command;
abd imported in R by andante package as follows;
In the previous post (now in closed), I added two layers, split and unsell to pbmc10k.ad, by
Both spl.t and unspl are trasnposed matrix derived from space matrix files in Suerat obj (pbmc10k). I uploaded the original "pbmc10k.h5ad" in my AWS S3 and a link is ; https://myanndata.s3.us-east-2.amazonaws.com/pbmc10k.h5ad Thanks for help !! |
Am I correct in understanding that your script looks something like this: library(tidyverse)
library(anndata)
# downloaded from: https://myanndata.s3.us-east-2.amazonaws.com/pbmc10k.h5ad
pbmc10k.ad <- read_h5ad("pbmc10k.h5ad")
spl.t <- ...?
unspl <- ...?
pbmc10k.ad$layers[["spl"]]<-spl.t
pbmc10k.ad$layers[["unspl"]]<-unspl
pbmc10k.ad$write_h5ad("pbmc10k.new.h5ad") Could you fill in how you define |
@rcannood
Structure of both of these are;
I also uploaded both spl.t and unspl in AWS S3
Thanks. |
Sorry, I think you didn't quite set the permissions just right, because I
get an 'access denied' message.
Could you send me an R file and the relevant data files to replicate the
issue that you're having, beginning to end?
I feel like I'm trying to piece together the commands that you ran in order
to get here, without being certain that it's exactly what you're looking
for.
…On Fri, Apr 2, 2021 at 4:11 AM akhst7 ***@***.***> wrote:
@rcannood <https://github.com/rcannood>
yeah. Two the missing ones are as follows;
spliced<-GetAssayData(pbmc10k, assay = "spliced")
spl.t<-as.matrix(spliced) %>% t()
unspliced<-GetAssayData(pbmc10k, assay = "unspliced")
unspl<-as.matrix(unspliced) %>% t()
Structure of both of these are;
> str(spl.t)
num [1:10194, 1:36601] 0 0 0 0 0 0 0 0 0 0 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:10194] "AAAGAACAGAGATTCA-1" "AAAGAACTCCTCAGGG-1" "AACAAAGAGCGCGTTC-1" "AAAGGATCAAGCAGGT-1" ...
..$ : chr [1:36601] "BX004987.1" "AC145212.1" "MAFIP" "AC011043.1" ...
> str(unspl)
num [1:10194, 1:36601] 0 0 0 0 0 0 0 0 0 0 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:10194] "AAACCCACATAACTCG-1" "AAACCCACATGTAACC-1" "AAACCCAGTGAGTCAG-1" "AAACCCAGTGCTTATG-1" ...
..$ : chr [1:36601] "BX004987.1" "AC145212.1" "MAFIP" "AC011043.1" ...
I also uploaded both spl.t and unspl in AWS S3
https://myanndata.s3.us-east-2.amazonaws.com/splt.RDS
https://myanndata.s3.us-east-2.amazonaws.com/unspl.RDS
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEHFKXEHVV4PCTG55P7AHDTGURVHANCNFSM42DMPHGQ>
.
|
@rcannood Sorry about that. I fixed the permission of those files and you should be able to download them. You can use the same link to download. They are little too big for mail attachment since my school mail server has this idiotically small limit for attachment. Thanks. |
Can you send me a reproducible script that I can run in order to debug your problem? |
I can't even write the ist imported ann obj.
If this does not occur in your R, it must be specific to my R setup but I am not sure what's causing it. |
Hmm.. I see. This does work for me: > pbmc10k.ad <- read_h5ad("pbmc10k.h5ad")
> pbmc10k.ad$write_h5ad("pbmc10k_2.h5ad") I've noticed Python anndata doesn't expand the '~' by default, though this is not the issue that you're encountering. Could you try running: devtools::install_github("dynverse/anndata")
anndata::install_anndata() Could you also show me the output of the following command? reticulate::py_config() |
So I run
Install_anndata() imports python anndata from conda ? I have anndata installed under pip3;
here is py_config output
Thanks. |
I found a workaround for this. I created the Anndata obj, pbmc10K.ad including unspl and spl layers in R as described above. Then I did the following;
So basically, I called Python from R and using AnnData to save the pbmc10k.ad to pbmc.h5ad. I check to see if I can load the pbmc.h5ad into scvelo in the Jupyter Notebook as follows;
Isn't anndata essentially a wrapper for python AnnData package ? If so how come read_h5ad works but write_h5ad does not ? |
My apologies for the delay, I was out of office during the past week. I finally found the problem. It seemed that I pushed a fix to the devel branch of this repository. I'll push the bug fix to CRAN asap. Can you confirm that installing the devel branch solves your issue? |
It works now. Thanks for fixing. I am gonna close this. |
HI,
I am tiring to save an ad file as follows;
write_h5ad(pbmc10k.ad, "~/Desktop/pbmc10k.new.h5ad")
but I get this error ;
Here is my ann data;
Any help will be appreciated.
The text was updated successfully, but these errors were encountered: