question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

run10x Trouble creating loom files : cellsorted file not found

See original GitHub issue

Hi,

I ran this command

velocyto run -b “/path/barcodes.tsv” -m “/path/hg38_rmsk.gtf” “/path/outs/possorted_genome_bam.bam” “/path/refdata-cellranger-GRCh38-3.0.0/genes/genes.gtf”

and received the following errors:

2019-06-21 14:42:09,834 - INFO - Starting the sorting process of /path/outs/possorted_genome_bam.bam the output will be at: /path/outs/cellsorted_possorted_genome_bam.bam 2019-06-21 14:42:09,834 - INFO - Command being run is: samtools sort -l 7 -m 2000M -t CB -O BAM -@ 16 -o /path/outs/cellsorted_possorted_genome_bam.bam /path/outs/possorted_genome_bam.bam 2019-06-21 14:42:09,834 - INFO - While the bam sorting happens do other things… 2019-06-21 14:42:09,834 - INFO - Load the annotation from /path/refdata-cellranger-GRCh38-3.0.0/genes/genes.gtf sort: invalid option – ‘t’ sort: invalid option – ‘O’ open: No such file or directory [bam_sort_core] fail to open file CB

2019-06-21 15:59:20,518 - DEBUG - End of file. Reset index: start scanning from initial position. 2019-06-21 15:59:20,519 - DEBUG - 3416460 reads were skipped because no apropiate cell or umi barcode was found 2019-06-21 15:59:20,519 - INFO - Now just waiting that the bam sorting process terminates 2019-06-21 15:59:20,519 - INFO - bam file #0 has been sorted 2019-06-21 15:59:20,519 - DEBUG - Start molecule counting!

Failed to open file /path/outs/cellsorted_possorted_genome_bam.bam Traceback (most recent call last): File “/mnt/software/unstowable/miniconda3-4.6.14/envs/mamba/bin/velocyto”, line 10, in <module> sys.exit(cli()) File “/mnt/software/unstowable/miniconda3-4.6.14/envs/mamba/lib/python3.7/site-packages/click/core.py”, line 764, in call return self.main(*args, **kwargs) File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/click/core.py”, line 717, in main rv = self.invoke(ctx) File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/click/core.py”, line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/click/core.py”, line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/click/core.py”, line 555, in invoke return callback(*args, **kwargs) File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/velocyto/commands/run.py”, line 116, in run samtools_memory=samtools_memory, dump=dump, loom_numeric_dtype=dtype, verbose=verbose, additional_ca=additional_ca) File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/velocyto/commands/_run.py”, line 229, in _run results = exincounter.count(bamfile_cellsorted, multimap=multimap) # NOTE: we would avoid some millions of if statements evaluations if we write two function count and count_with output File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/velocyto/counter.py”, line 756, in count for r in self.iter_alignments(bamfile, unique=not multimap): File “/mnt/software/unstowable/miniconda3-4.6.14/envs/ma/lib/python3.7/site-packages/velocyto/counter.py”, line 251, in iter_alignments fin = pysam.AlignmentFile(bamfile) # type: pysam.AlignmentFile File “pysam/libcalignmentfile.pyx”, line 736, in pysam.libcalignmentfile.AlignmentFile.cinit File “pysam/libcalignmentfile.pyx”, line 935, in pysam.libcalignmentfile.AlignmentFile._open FileNotFoundError: [Errno 2] could not open alignment file /path/outs/cellsorted_possorted_genome_bam.bam: No such file or directory

Does anyone know the solution to this? I cannot find the file called cellsorted_postsorted_genome_bam.bam in the output folder it listed.

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

2reactions
reginawonggcommented, Oct 14, 2019

Hi,

I realized there was an issue with samtools sort. Thus I ran this command separately first:

samtools sort -t CB -O BAM -o ~/outputfolder/cellsorted_possorted_genome_bam.bam ~path/possorted_genome_bam.bam

This requires samtools to be installed separately. Once this cellsorted file was generated, I placed it/outputted it in the expected folder where cellsorted is supposed to be found. Then, I subsequently ran velocyto run where it was able to skip this step as the file already exists.

Hope this helps!

0reactions
sidrahmaryamcommented, Sep 2, 2020

Hi,

I realized there was an issue with samtools sort. Thus I ran this command separately first:

samtools sort -t CB -O BAM -o ~/outputfolder/cellsorted_possorted_genome_bam.bam ~path/possorted_genome_bam.bam

This requires samtools to be installed separately. Once this cellsorted file was generated, I placed it/outputted it in the expected folder where cellsorted is supposed to be found. Then, I subsequently ran velocyto run where it was able to skip this step as the file already exists.

Hope this helps!

Hello, I did the same. I firstly executed samtools sort command and then tried velocyto run. However, I am getting a big issue. I am doing it without UMI-barcode file, and also i am using -U tag.

My command line is :

velocyto run --without-umi -o /5TB-storage/gaurav.ahuja/sidrah/Data/b_mouse_linda/trimmed/bams/cellsorted/loom -m /5TB-storage/gaurav.ahuja/sidrah/Data/filesforvelocyto/mm10_rmsk.gtf /5TB-storage/gaurav.ahuja/sidrah/Data/b_mouse_linda/trimmed/bams/cellsorted/$line1.bam /5TB-storage/gaurav.ahuja/sidrah/Data/filesforvelocyto/Mus_musculus.GRCm38.101.gtf I got this error.

ile “/home/gaurav.ahuja/anaconda2/envs/velocyto/bin/velocyto”, line 8, in sys.exit(cli()) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/click/core.py”, line 764, in call return self.main(*args, **kwargs) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/click/core.py”, line 717, in main rv = self.invoke(ctx) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/click/core.py”, line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/click/core.py”, line 555, in invoke return callback(*args, **kwargs) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/velocyto/commands/run.py”, line 116, in run samtools_memory=samtools_memory, dump=dump, loom_numeric_dtype=dtype, verbose=verbose, additional_ca=additional_ca) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/velocyto/commands/_run.py”, line 159, in _run exincounter.peek(bamfile[0]) File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/velocyto/counter.py”, line 158, in peek raise IOError(“The bam file does not contain cell and umi barcodes appropriatelly formatted. If you are runnin UMI-less data you should use the -U flag.”) OSError: The bam file does not contain cell and umi barcodes appropriatelly formatted. If you are running UMI-less data you should use the -U flag. ^CTraceback (most recent call last): File “/home/gaurav.ahuja/anaconda2/envs/velocyto/lib/python3.6/site-packages/llvmlite/ir/_utils.py”, line 48, in str return self.__cached_str AttributeError: ‘GEPInstr’ object has no attribute ‘_StrCaching__cached_str’

Please help me in this regard. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CLI Usage Guide — velocyto 0.17.16 documentation
Commands: run Runs the velocity analysis outputting a loom file run10x Runs the velocity analysis for a Chromium Sample run-dropest Runs the velocity ......
Read more >
API Walkthrough — loompy 3.0.6 documentation
Creating Loom files ¶. To create a loom file from data, you need to supply a main matrix (numpy ndarray or scipy sparse...
Read more >
Trajectory Analysis using 10x Genomics Single Cell Gene ...
This tutorial provides users with the instructions to import results obtained with Cell Ranger and Loupe Browser into community-developed ...
Read more >
single-cell RNA-seq analysis — HemTools latest documentation
RNA velocity¶. Make sure we have most recent samtools version, otherwise we will see “cellsorted file not found” error. module load ...
Read more >
Tutorial 4 : How to work with Loom files created by ASAP
What is a Loom file (.loom extension) ? · All matrix/vectors/metadata datasets can be stored in a unique . · Matrices can be...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found