Reputation: 9
Samtools version: samtools 1.13 Using htslib 1.13+ds
uname -m
on Linux/Mac OS or wmic os get OSArchitecture
on Windows)Hi, I am trying to separate a bam/sam file based on directionality of reads. Samtools does not have a way to do this from an aligned sam/bam file to a reference sequence that I can find. My attempted workaround was to use samtools view -F or -f options to attempt to separate reads based on alignment flags. I am using the -o option because I need an output to occur if any changes are to happen. The big issue I am running into is that it would appear that my commands are not doing anything at all.
$samtools view -o -F aligned-input.bam No output message of any kind, no error, no new file produced in my file explorer, no modifications to the existing file in my file explorer
Similarly, the -f version did the same thing: $samtools view -o -f aligned-input.bam No output message of any kind, no error, no new file produced in my file explorer, no modifications to the existing file in my file explorer
I tried the verbose version of the command: $samtools view -o --require-flags aligned-input.bam No output message or error, this one did produce a new output file, but it's not a SAM or BAM file, it's just listed as file type "file", and its name is "--require-flags," clearly indicating that that option did not function as intended.
Same thing for the other verbose version: $samtools view -o --excl-flags aligned-input.bam No output message or error, this one did produce a new output file, but it's not a SAM or BAM file, it's just listed as file type "file", and its name is "--excl-flags," clearly indicating that that option did not function as intended.
I tried to specify a flag (just to try to get it to do anything) in multiple different ways: $samtools view -o -f 0x4 aligned-input.bam Output in return: "[E::hts_open_format] Failed to open file "0x4" : No such file or directory samtools view: failed to open "0x4" for reading: No such file or directory"
^This same output happens no matter what tag I try, whether in hexidecimal format or octadecimal formatting, and it also does the same thing for -F and -f.
How do I get the $samtools view -o -F (or -f) aligned-input.bam to do something? Alternatively, if I am barking up the wrong tree, does anyone have a good idea on how to separate a .bam or .sam file based on flags. Thank you for your time, and I hope to get an answer!
Upvotes: -3
Views: 193
Reputation: 9
Answered on github 'issues' for samtools: https://github.com/samtools/samtools/issues/1994#issuecomment-1952477530
Flipping the order changes nothing. It was the lack of a parameter that mattered.
-o FILE -F FLAG
, not-o -F
or-F -o
.
Upvotes: 0