<p>I have a single read (<strong>NOT paired</strong>) that I need to pass through the workflow described in Beauclair et al. paper (free version here <a href="https://rnajournal.cshlp.org/content/24/10/1285.long" rel="nofollow noreferrer">https://rnajournal.cshlp.org/content/24/10/1285.long</a>) for identifying defective genomes using their DI-tector program.</p>
<p>Here in Materials and methods the procedure is described as the following:</p>
<p><em>The first step of the workflow consists of an alignment of the reads against the host genome (Fig. 2i).
This step aims at discarding reads that map to the host genome and may partially map to the viral genome after segmentation, and at reducing the working file size.
For example, MV and rMV-ΔV data sets were generated from total RNA samples of infected cells and contained mostly reads mapping the human genome (≈99%).
This step uses a combination of <code>bwa mem</code> and <code>samtools</code> view with the parameters <code>–bS –f4</code>.
An additional step consists of an alignment of the reads against the viral genome of interest, in order to exclude reads perfectly mapping the viral genome.
Therefore, only unmapped reads are further analyzed.
Of note, clipped reads (i.e., CIGAR motif contain S or H) are also conserved. Some of these reads may map to viral genome recombination junctions that are present in DI genomes.</em></p>
<p>I have already been suggested to use <code>bowtie2</code> instead of <code>bwa</code> but, firstly, the output is not clear for me and secondly, I would like to test the official protocol.</p>
<p>Since the article suggests to use bwa and samtools on this very first step, that is what I have done so far:</p>
<ol start="0">
<li><p>(Optional) not sure if this is important but as suggested by someone I have transformed .fna --&gt; .fa</p>
<pre><code>cp GCF_000001405.39_GRCh38.p13_genomic.fna GCF_000001405.39_GRCh38.p13_genomic.fa
</code></pre>
</li>
<li><p>Indexed human genome with bwa</p>
<pre><code>bwa index GCF_000001405.39_GRCh38.p13_genomic.fa
</code></pre>
</li>
<li><p>aligned my only read with indexed genome from step 1</p>
<pre><code>bwa mem GCF_000001405.39_GRCh38.p13_genomic.fa /mnt/e/nastya/SLX066-02/B-dVMV-RIG-1/B-dVMV-RIG-1_ACAGTG_L008_R1_001.rc.fastq.gz &gt; whole.sam
</code></pre>
</li>
<li><p>Transform <code>.sam</code> --&gt; <code>.bam</code></p>
<pre><code>samtools view -S -b whole.sam -o whole.bam
</code></pre>
</li>
<li><p>Separated unmapped reads (as it is recommended in Materials and Methods using <code>-f4</code>)</p>
<pre><code>samtools view -f4 whole.bam &gt; sample.unmapped.sam
</code></pre>
</li>
<li><p>Converted unmapped reads into <code>.fastq</code> format (since this is the format used by the software later)</p>
<pre><code>samtools fastq sample.unmapped.sam &gt; unmatched.fastq
</code></pre>
</li>
</ol>
<p>I wonder if these steps are correct?</p>

<phylogenetics><samtools><bwa><bowtie2>
How to extract unmatched reads using bwa and samtools?
# How to extract unmatched reads using bwa and samtools?

(Asked by: username_0 on 2020-06-21)

I have a single read (NOT paired) that I need to pass through the workflow described in Beauclair et al. paper (free version here https://rnajournal.cshlp.org/content/24/10/1285.long) for identifying defective genomes using their DI-tector program.
Here in Materials and methods the procedure is described as the following:
The first step of the workflow consists of an alignment of the reads against the host genome (Fig. 2i).
This step aims at discarding reads that map to the host genome and may partially map to the viral genome after segmentation, and at reducing the working file size.
For example, MV and rMV-ΔV data sets were generated from total RNA samples of infected cells and contained mostly reads mapping the human genome (≈99%).
This step uses a combination of bwa mem and samtools view with the parameters –bS –f4.
An additional step consists of an alignment of the reads against the viral genome of interest, in order to exclude reads perfectly mapping the viral genome.
Therefore, only unmapped reads are further analyzed.
Of note, clipped reads (i.e., CIGAR motif contain S or H) are also conserved. Some of these reads may map to viral genome recombination junctions that are present in DI genomes.
I have already been suggested to use bowtie2 instead of bwa but, firstly, the output is not clear for me and secondly, I would like to test the official protocol.
Since the article suggests to use bwa and samtools on this very first step, that is what I have done so far:

(Optional) not sure if this is important but as suggested by someone I have transformed .fna --> .fa
cp GCF_000001405.39_GRCh38.p13_genomic.fna GCF_000001405.39_GRCh38.p13_genomic.fa


Indexed human genome with bwa
bwa index GCF_000001405.39_GRCh38.p13_genomic.fa


aligned my only read with indexed genome from step 1
bwa mem GCF_000001405.39_GRCh38.p13_genomic.fa /mnt/e/nastya/SLX066-02/B-dVMV-RIG-1/B-dVMV-RIG-1_ACAGTG_L008_R1_001.rc.fastq.gz > whole.sam


Transform .sam --> .bam
samtools view -S -b whole.sam -o whole.bam


Separated unmapped reads (as it is recommended in Materials and Methods using -f4)
samtools view -f4 whole.bam > sample.unmapped.sam


Converted unmapped reads into .fastq format (since this is the format used by the software later)
samtools fastq sample.unmapped.sam > unmatched.fastq



I wonder if these steps are correct?

**Tags:** phylogenetics, samtools, bwa, bowtie2

---

## 0 answers

