<p>If you are interested in a particular viral sequence, it seems wasteful to request bams that are aligned to the human genome, but you could request bams aligned to the human genome with unaligned reads retained. As an alternative, you can generate unaligned bams, where all of the same reads are present that would be present in a fastq but in a bam format. You can revert this to a fastq or align the fastq directly to a viral reference yourself. Aligning to small references is fast. </p>

CC BY-SA 4.0
2019-05-02T15:24:24.787Z
2019-05-02T15:49:54.820Z
2019-05-02T15:49:54.820Z
mattm
<p>Most read aligners will report unaligned reads as well, which presumably will include your viral sequences. I would ask them to formally confirm that the BAM files will contain unaligned reads before choosing that option.</p>

CC BY-SA 4.0
2019-05-02T15:37:11.000Z
Thank you !! Will check with the company to be sure
h3ab74
CC BY-SA 4.0
2019-05-02T15:24:34.007Z
2019-05-02T15:24:34.007Z
Daniel Standage
<p>I was wondering if anyone had any experience 'counting' the frequency of a particular viral sequence in an individual's fastq sequence. So basically, counting the number of occurrences of a particular sequence given someone's fastq file.</p>

<p>The thing is, we must speak with the sequencing company regarding what format we'd like the files and must choose between <code>.bam</code> and <code>.fastq</code> - both would be extra $. Usually I'd choose <code>.bam</code> out of convenience but I was wondering, given that it has already been aligned the human genome I might not be able to proceed with this 'counting' process. So, my question is: if I were to use <code>samtools</code> - or any other program - to convert the <code>.bam</code> files to <code>.fastq</code>, is there any possibility that I could lose such information - e.g. viral seqs - that would have otherwise been available should I have just gotten the <code>.fastq</code> files directly? </p>

CC BY-SA 4.0
2019-05-02T18:09:40.083Z
Rule of thumb is: never go with FASTQ if you can avoid it, it’s a net waste of space. Post-alignment BAMs are as small, or smaller, than gzipped FASTQ, despite containing more information.
Konrad Rudolph
<phylogenetics><samtools><fastq><covid-19><sars-cov-2>
Frequency of specific viral sequence in .BAM or .fastq
# Frequency of specific viral sequence in .BAM or .fastq

(Asked by: username_0 on 2019-05-02)

I was wondering if anyone had any experience 'counting' the frequency of a particular viral sequence in an individual's fastq sequence. So basically, counting the number of occurrences of a particular sequence given someone's fastq file.

The thing is, we must speak with the sequencing company regarding what format we'd like the files and must choose between `.bam` and `.fastq` - both would be extra $. Usually I'd choose `.bam` out of convenience but I was wondering, given that it has already been aligned the human genome I might not be able to proceed with this 'counting' process. So, my question is: if I were to use `samtools` - or any other program - to convert the `.bam` files to `.fastq`, is there any possibility that I could lose such information - e.g. viral seqs - that would have otherwise been available should I have just gotten the `.fastq` files directly?

**Tags:** phylogenetics, samtools, fastq, covid-19, sars-cov-2
> **Comments:**
> **username_1**: Rule of thumb is: never go with FASTQ if you can avoid it, it’s a net waste of space. Post-alignment BAMs are as small, or smaller, than gzipped FASTQ, despite containing more information.  

---

## 2 answers

### Answer by username_3 on 2019-05-02. Score: 6

Most read aligners will report unaligned reads as well, which presumably will include your viral sequences. I would ask them to formally confirm that the BAM files will contain unaligned reads before choosing that option.

> **Comments:**
> **username_0**: Thank you !! Will check with the company to be sure  

---

### Answer by username_2 on 2019-05-02. Score: 3

If you are interested in a particular viral sequence, it seems wasteful to request bams that are aligned to the human genome, but you could request bams aligned to the human genome with unaligned reads retained. As an alternative, you can generate unaligned bams, where all of the same reads are present that would be present in a fastq but in a bam format. You can revert this to a fastq or align the fastq directly to a viral reference yourself. Aligning to small references is fast.


---

