velocyto.py icon indicating copy to clipboard operation
velocyto.py copied to clipboard

Error with dropEst->velocyto workflow

Open jeremymsimon opened this issue 6 years ago • 6 comments

I've been trying to follow your vignette for analyzing Drop-seq data with dropEst, then running velocyto. However I've encountered an error during dropest_bc_correct that I can't seem to navigate around.

Here's what I've tried:

droptag -c ~/dropEst/configs/drop_seq.xml R1.fastq.gz R2.fastq.gz -n N714_droptag

STAR --genomeDir ~/STAR_indexes/hg38-mm10/ --readFilesIn N714_droptag.fastq.gz --outSAMmultNmax 1 --runThreadN 8 --readNameSeparator space --outSAMunmapped Within --outSAMtype BAM SortedByCoordinate --outFileNamePrefix N714_droptag --readFilesCommand gunzip -c

dropest -m -V -b -o N714_dropest -g gencode_mm10-vM22_hg38-v31.gtf -L eiEIBA -c ~/dropEst/configs/drop_seq_velocyto.xml N714_droptagAligned.sortedByCoord.out.bam

velocyto tools dropest_bc_correct N714_droptagAligned.sortedByCoord.out.tagged.bam N714_dropest.rds

Everything runs to completion except the dropest_bc_correct command, which produces the following error:

2019-10-10 11:18:54,548 - INFO - Loading `merge_targets` from N714_dropest.rds using R / rpy2
Traceback (most recent call last):
 File "~/.local/bin/velocyto", line 11, in <module>
   load_entry_point('velocyto==0.17.17', 'console_scripts', 'velocyto')()
 File "~/python/3.6.6/lib/python3.6/site-packages/click/core.py", line 716, in __call__
   return self.main(*args, **kwargs)
 File "~/python/3.6.6/lib/python3.6/site-packages/click/core.py", line 696, in main
   rv = self.invoke(ctx)
 File "~/python/3.6.6/lib/python3.6/site-packages/click/core.py", line 1060, in invoke
   return _process_result(sub_ctx.command.invoke(sub_ctx))
 File "~/python/3.6.6/lib/python3.6/site-packages/click/core.py", line 1060, in invoke
   return _process_result(sub_ctx.command.invoke(sub_ctx))
 File "~/python/3.6.6/lib/python3.6/site-packages/click/core.py", line 889, in invoke
   return ctx.invoke(self.callback, **ctx.params)
 File "~/python/3.6.6/lib/python3.6/site-packages/click/core.py", line 534, in invoke
   return callback(*args, **kwargs)
 File "~/.local/lib/python3.6/site-packages/velocyto/commands/dropest_bc_correct.py", line 64, in dropest_bc_correct
   mapping = convert_r_obj(ro.r(f"rds <- readRDS('{filename}'); rds$merge_targets"))  # a dict
UnboundLocalError: local variable 'convert_r_obj' referenced before assignment

Note that specifying the -f flag for dropEst as you recommend elsewhere fails and produces empty files (no valid CBs found).

Do you have any recommendations on how to get around this issue?

jeremymsimon avatar Oct 10 '19 15:10 jeremymsimon

The exactly same error occurred in our lab. We'll be very appreciated if anybody could solve this problem.

kubokawa-mi avatar Oct 29 '19 08:10 kubokawa-mi

The same issue happened to me.

kushtimusPrime avatar Jul 09 '20 03:07 kushtimusPrime

Having the same issue. Would appreciate any sort of solution. Thanks

bdkotton avatar Jul 28 '20 14:07 bdkotton

ditto, and bump

mtekman avatar Jul 29 '20 19:07 mtekman

So I can get around this issue by installing rpy2 in my environment (I had to dig around the source to find this), but now it errors out with AttributeError: module 'rpy2.rinterface' has no attribute 'RNULLType', which upon some searching led to this issue that suggests installing a specific version of rpy2.

Doing: pip3 install rpy2==2.9.5 appears to fix this problem

But now I am stuck on a KeyError: "tag 'CB' not present" error -- but this is another issue altogether

mtekman avatar Jul 29 '20 20:07 mtekman

I encountered the exact same issues mentioned, and I found a solution. The first problem, "UnboundLocalError: local variable 'convert_r_obj' referenced before assignment", occurred because I did not install velocyto perfectly. Reinstall it will solve the problem. Second, "AttributeError: module 'rpy2.rinterface' has no attribute 'RNULLType'" is because that script of rpy2 after version 3.0.0 have totally rewrite, so we have to install version before rpy2 3.0.0. The third problem. I have mentioned in #298.

So, to solve these problems. first of all you have to create a conda evironment with python <=3.6, then conda install rpy2=2.9.4, which will install R3.6.0 simultaneously, then install the packages in velocyto tutorials, and do not forget pysam. Modify the py files and everything goes fine with the pipeline with some easy-fixed bugs.

bettycatherine avatar Dec 28 '21 03:12 bettycatherine