ImportError: Unable to initialise R instance. Please run this separately through R with Shazam's tutorial. #111
Replies: 26 comments
-
hi @saramoein372, that error indicates you may have an incompatible rpy2/r setup - it's trying to open R twice or it cannot find R?. I'm not sure what's the best way for you to sort that out but the work around for now is to save the airr file out: # in python
# write out the airr file
vdj.write_airr('airr.tsv') and then you load up when you eventually get to the steps with says: # in R
# Find threshold using density method
output <- findThreshold(dist_ham$dist_nearest, method="density")
threshold <- output@threshold
threshold Note down the threshold value is what you supply to the vdj object: vdj.threshold = threshold_value Note that the threshold value is only used for |
Beta Was this translation helpful? Give feedback.
-
Thanks Kelvin. I also have another question about I get an error: What is the solution for this error? Thank you. |
Beta Was this translation helpful? Give feedback.
-
You need to run |
Beta Was this translation helpful? Give feedback.
-
Thanks Kelvin. Sorry if this is not a related question; however I have many troubles for Shazam installation on R. In different ways I tried to fix my installation, but still could not solve it. Thanks, |
Beta Was this translation helpful? Give feedback.
-
no worries. You need to looks like you need to do |
Beta Was this translation helpful? Give feedback.
-
Thanks Kelvin for your helps. Still getting error. Since morning I am installing this package! May I ask what R version are you using? Thanks, |
Beta Was this translation helpful? Give feedback.
-
I use R 4.0.3. You might need to update your R version if you using <4 |
Beta Was this translation helpful? Give feedback.
-
Thanks Kelvin. I have another question: after assigning vdj.threshold = 0.27, can I immediately run "ddl.tl.generate_network(vdj)"? Is it because I have not run these commands first "ddl.pp.calculate_threshold(vdj, manual_threshold = 0.1) |
Beta Was this translation helpful? Give feedback.
-
Partly yes. For
For this, did you go through the entire preprocess workflow outline in the tutorial? Areyou analyzing TCR or BCR? There's a bug in the version (0.1.9) on pypi in that the aa columns were not included after the TCR realignment step but this is corrected in the master version here on github. If you reinstall the master version, or use the singularity container to handle the preprocessing, that should hopefully get rid of the issue. Alternatively, you can supply another |
Beta Was this translation helpful? Give feedback.
-
Thanks Kelvin. Thanks, |
Beta Was this translation helpful? Give feedback.
-
yes use
|
Beta Was this translation helpful? Give feedback.
-
Thanks Kevin. I could pass that part. Currently, I am running the Interoperability with scirpy. Now I am blocked at this step: Getting error: ValueError: Do you have any idea how to solve it? I really appreciate your time. |
Beta Was this translation helpful? Give feedback.
-
Something like |
Beta Was this translation helpful? Give feedback.
-
Thank you so much Kelvin. I could run most part of the pipeline in the BCR visualization step. The problem is my clone network plots are all empty! But for adata, I used what I had generated form previous cell ranger step, which probably is not correct. Thanks, |
Beta Was this translation helpful? Give feedback.
-
Just to complete my last message, I used "adata = sc.read_h5ad('/Users/saramoein/downloads/BCR1/adata2.h5ad')" |
Beta Was this translation helpful? Give feedback.
-
Hmm can you check if the cell barcodes are correct? the indices in |
Beta Was this translation helpful? Give feedback.
-
Thanks. I see that the vdj.metadata indices are strating with BCR (for example BCR_AAACCTGTCACTGGGC), but for adata, they hav no "BCR". For example (AAACCTGCAAAGCAAT-1) . So I should fix this part. But the question is the number of rows for vdj.metadata is 773, but the adata.obs has 13800 rows. Can it be a problem? |
Beta Was this translation helpful? Give feedback.
-
should be fine. the bcr data can be a subset of the adata but the barcodes must exist in the adata object. |
Beta Was this translation helpful? Give feedback.
-
Hi Kelvin, I have a question, which probably looks basic. But I am trapped and can not solve it. Actually, I am going to replace the 'BCR_" prefix in vdj.metedata with " ". That when I replace, it changes. But after new operation on "vdj" again I see the original indexes. Can I ask your help what command I should use for replacing my indexing: for example "BCR_TTTGGTTGTAGGCATG" replacing with "TTTGGTTGTAGGCATG". I used vdj.metadata.index= vdj.metadata.index.str.replace('BCR_',''). it works until I have not called new function on vdj. So it looks my replacing command is not working permanently. Do you have any idea how to replace the index with other characters? |
Beta Was this translation helpful? Give feedback.
-
Hi Sara, you should change i would do: temp = vdj.data.copy()
temp['cell_id'] = # replace function here
new_vdj = ddl.Dandelion(temp) The reason is the What i normally do is to ensure that that my cell barcodes align right at the beginning of the preprocessing. Hence the function |
Beta Was this translation helpful? Give feedback.
-
Thanks Kelvin for your response. I used all singularity for preprocessing step. and now need to fix the cell ids in adata and vdj. Is it vdj['cell_id'] that I should match it with adat['cell_id']? I am so confused. Because my vdj.data.cell_id are my adata.obs.index are like "AAACCTGAGAACAATC-1" How I should match vdj and adta barcodes? I am really confused and I really appreciate your help. Thank you. |
Beta Was this translation helpful? Give feedback.
-
I think the easiest solution is to change the index names in i think a simple fix would be to do the following: # now, in your anndata object:
adata.obs_names = ['BCR_' + x.split('-')[0] for x in adata.obs_names]
# then do what i describe above for the vdj.data['cell_id'] If that doesn't fix it, when you run |
Beta Was this translation helpful? Give feedback.
-
Thank you Kelvin for great helping! |
Beta Was this translation helpful? Give feedback.
-
I think you will find that the bcr coverage is not as high as the transcriptome data. so i would keep it all in. If there's no further questions to the original question, i will close this issue as the rest of your problems sounds like that are general python/pandas related queries. |
Beta Was this translation helpful? Give feedback.
-
Thanks. Sure, close it. |
Beta Was this translation helpful? Give feedback.
-
Hi Kelvin,
Thanks for your helps. I am running the dandelion pipeline for BCR Clustering. When running "ddl.pp.calculate_threshold(vdj)" I get the error:
"ImportError: Unable to initialise R instance. Please run this separately through R with Shazam's tutorial."
How I should run this problem in Jupiter?
Thanks,
Sara
Beta Was this translation helpful? Give feedback.
All reactions