Problem in single cell RNA velocity analysis using kb_python
2
0
Entering edit mode
3.4 years ago
Mohamed Omar ▴ 10

Hi, I am trying to do a velocity analysis of single-cell RNA-Seq data using kb_python. I built the velocity reference using this command :

 kb ref -i index.idx -g t2g.txt -f1 cdna.fa -f2 intron.fa -c1 cdna_t2c.txt -c2 intron_t2c.txt --workflow lamanno \
fasta.fa \
gtf.gtf

Which worked just fine but I encountered a problem with the next step which is generating the RNA velocity count matrices using kb count

I used this command:

    kb count -i index.idx -o MAD2_Velo -g t2g.txt -x 10xv3 --workflow lamanno --loom -c1 cdna_t2c.txt -c2 intron_t2c.txt --filter bustools -m 60G -t 12 \
MAD2/MAD2_S2_L001_R1_001.fastq.gz \
MAD2/MAD2_S2_L001_R2_001.fastq.gz \
MAD2/MAD2_S2_L002_R1_001.fastq.gz \
MAD2/MAD2_S2_L002_R2_001.fastq.gz

The process was working fine until the last step (writing the loom file) when I got this error

loompy does not accept empty matrices as data

This is the complete log:

kb count -i index.idx -o MAD2_Velo -g t2g.txt -x 10xv3 --workflow lamanno --loom -c1 cdna_t2c.txt -c2 intron_t2c.txt --filter bustools -m 60G -t 12 \
    MAD2/MAD2_S2_L001_R1_001.fastq.gz \
    MAD2/MAD2_S2_L001_R2_001.fastq.gz \
    MAD2/MAD2_S2_L002_R1_001.fastq.gz \
    MAD2/MAD2_S2_L002_R2_001.fastq.gz

    [2020-12-07 09:57:20,955]    INFO Using index index.idx to generate BUS file to MAD2_Velo2 from
    [2020-12-07 09:57:20,955]    INFO         MAD2/MAD2_S2_L001_R1_001.fastq.gz
    [2020-12-07 09:57:20,955]    INFO         MAD2/MAD2_S2_L001_R2_001.fastq.gz
    [2020-12-07 09:57:20,955]    INFO         MAD2/MAD2_S2_L002_R1_001.fastq.gz
    [2020-12-07 09:57:20,955]    INFO         MAD2/MAD2_S2_L002_R2_001.fastq.gz
    [2020-12-07 11:23:58,066]    INFO Sorting BUS file MAD2_Velo2/output.bus to MAD2_Velo2/tmp/output.s.bus
    [2020-12-07 11:26:02,310]    INFO Whitelist not provided
    [2020-12-07 11:26:02,310]    INFO Copying pre-packaged 10XV3 whitelist to MAD2_Velo2
    [2020-12-07 11:26:02,919]    INFO Inspecting BUS file MAD2_Velo2/tmp/output.s.bus
    [2020-12-07 11:27:50,834]    INFO Correcting BUS records in MAD2_Velo2/tmp/output.s.bus to MAD2_Velo2/tmp/output.s.c.bus with whitelist MAD2_Velo2/10xv3_whitelist.txt
    [2020-12-07 11:28:44,251]    INFO Sorting BUS file MAD2_Velo2/tmp/output.s.c.bus to MAD2_Velo2/output.unfiltered.bus
    [2020-12-07 11:30:21,574]    INFO Capturing records from BUS file MAD2_Velo2/output.unfiltered.bus to MAD2_Velo2/tmp/spliced.bus with capture list intron_t2c.txt
    [2020-12-07 11:31:54,277]    INFO Sorting BUS file MAD2_Velo2/tmp/spliced.bus to MAD2_Velo2/spliced.unfiltered.bus
    [2020-12-07 11:36:45,406]    INFO Inspecting BUS file MAD2_Velo2/spliced.unfiltered.bus
    [2020-12-07 12:14:39,721]    INFO Generating count matrix MAD2_Velo2/counts_unfiltered/spliced from BUS file MAD2_Velo2/spliced.unfiltered.bus
    [2020-12-07 12:16:46,502]    INFO Capturing records from BUS file MAD2_Velo2/output.unfiltered.bus to MAD2_Velo2/tmp/unspliced.bus with capture list cdna_t2c.txt
    [2020-12-07 12:17:52,328]    INFO Sorting BUS file MAD2_Velo2/tmp/unspliced.bus to MAD2_Velo2/unspliced.unfiltered.bus
    [2020-12-07 12:18:34,412]    INFO Inspecting BUS file MAD2_Velo2/unspliced.unfiltered.bus
    [2020-12-07 12:19:22,924]    INFO Generating count matrix MAD2_Velo2/counts_unfiltered/unspliced from BUS file MAD2_Velo2/unspliced.unfiltered.bus
    [2020-12-07 12:20:40,802]    INFO Reading matrix MAD2_Velo2/counts_unfiltered/spliced.mtx
    [2020-12-07 12:21:24,876]    INFO Reading matrix MAD2_Velo2/counts_unfiltered/unspliced.mtx
    [2020-12-07 12:21:43,009]    INFO Combining matrices
    [2020-12-07 12:21:44,149]    INFO Writing matrices to loom MAD2_Velo2/counts_unfiltered/adata.loom
    [2020-12-07 12:21:44,157]   ERROR An exception occurred
    Traceback (most recent call last):
      File "/Users/mohamedomar/opt/anaconda3/lib/python3.8/site-packages/kb_python/main.py", line 785, in main
        COMMAND_TO_FUNCTION[args.command](parser, args, temp_dir=temp_dir)
      File "/Users/mohamedomar/opt/anaconda3/lib/python3.8/site-packages/kb_python/main.py", line 195, in parse_count
        count_velocity(
      File "/Users/mohamedomar/opt/anaconda3/lib/python3.8/site-packages/kb_python/count.py", line 1573, in count_velocity
        convert_matrices(
      File "/Users/mohamedomar/opt/anaconda3/lib/python3.8/site-packages/kb_python/count.py", line 795, in convert_matrices
        adata.write_loom(loom_path)
      File "/Users/mohamedomar/opt/anaconda3/lib/python3.8/site-packages/anndata/_core/anndata.py", line 1889, in write_loom
        write_loom(filename, self, write_obsm_varm=write_obsm_varm)
      File "/Users/mohamedomar/opt/anaconda3/lib/python3.8/site-packages/anndata/_io/write.py", line 90, in write_loom
        raise ValueError("loompy does not accept empty matrices as data")
    ValueError: loompy does not accept empty matrices as data

Can you please point to me what is wrong here?

single cell Velocity KB_python Kallisto bustools • 1.5k views
ADD COMMENT
0
Entering edit mode

Thank you, Jared. Yes, I have seen the other issue you are referring to but I still don't understand what is wrong. Also, I loaded both matrices (spliced.mtx and unspliced.mtx) in R and there are 311253 cells and 55421 genes in common so maybe that is not the problem.

ADD REPLY
0
Entering edit mode

Please use ADD COMMENT/ADD REPLY when responding to existing posts to keep threads logically organized. SUBMIT ANSWER is for new answers to original question.

ADD REPLY
0
Entering edit mode
3.4 years ago

I see you've opened an issue on their Github page. This other issue is identical, and may be helpful.

In short, it seems your two matrices likely have no overlapping cells or genes.

ADD COMMENT
0
Entering edit mode
3.4 years ago
Mohamed Omar ▴ 10

I opened an issue on their Github: https://github.com/pachterlab/kb_python/issues/91 and they pushed some update that seems to fix the problem. The loom file is created smoothly now.

ADD COMMENT

Login before adding your answer.

Traffic: 1479 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6