This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Samtools view -e not work

Hi,

I recall that samtools provided a powerful expression based filtering feature samtools view -e 'filter_expression', which seemed to work fine in the past, but doesn't work anymore, and I don't know why.

$ samtools view -e 'length(seq)>30' input.bam
view: invalid option -- 'e'
[E::hts_open_format] fail to open file 'length(seq)>30'
samtools view: failed to open "length(seq)>30" for reading: No such file or directory
$ samtools --help

Program: samtools (Tools for alignments in the SAM format)
Version: 1.3.1 (using htslib 1.3.1)

Usage:   samtools <command> [options]

Commands:
  -- Indexing
     dict           create a sequence dictionary file
     faidx          index/extract FASTA
     index          index alignment
...
ngs bam sam samtools

Can you update samtools to the newest version?

I also update to 1.16.1, but it also not work. Another command --input-fmt-option is available in 1.16.1. I noted that can be used to instead samtools view -e 'filter_expression'. I still don't know why the previous command is no longer available

I checked, In fact, I also tried it with an absolute path

$ ~/bin/samtools view -e 'length(seq)>30' input.bam
samtools view: invalid option -- 'e'

Usage: samtools view [options] <in.bam>|<in.sam>|<in.cram> [region ...]
$ ~/bin/samtools --help

Program: samtools (Tools for alignments in the SAM format)
Version: 1.16.1 (using htslib 1.16)

I downloaded the source code from https://sourceforge.net/projects/samtools/ and compile it, and get the binary samtools, I think This is the lastest version

zhangfish Why did you delete this post?

I deleted my existing conda environment and recreated it, then recompiled samtools and now he is able to work, this seems to be a strange problem, I can no longer reproduce it, I don't want this post to be misleading if it cannot reproduce

The comment you added above is more informative and useful to the community than you merely deleting the post. Someone could run into the exact same unreproducible error then try your delete+recreate solution and that might work for them. Don't delete your posts unless you're sure there's no value in them. When someone's given you feedback on the subject matter and you've interacted with them, that interaction is of value and you should no longer feel the need to delete the post.

0 answers

No answers yet.

Log in to answer this question.