<p>A few years ago I used AlignGraph (<a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4058956/" rel="nofollow noreferrer">paper</a> and <a href="https://github.com/baoe/AlignGraph" rel="nofollow noreferrer">code</a>) for a task like this. I gave AlignGraph my raw reads, so I'm not sure if it accepts SAM/BAM input or if you have to go back to the original Fastq reads.</p>

<p>I'm not sure if any related/improved tools have been published since AlignGraph. Internet searches for "reference-guided assembly" return mostly transcriptome assembly tools. It might be worth looking for <a href="https://www.ncbi.nlm.nih.gov/pubmed?linkname=pubmed_pubmed_citedin&amp;from_uid=24932000" rel="nofollow noreferrer">articles that cite the AlignGraph paper</a>.</p>

CC BY-SA 4.0
2019-04-11T01:40:13.683Z
It seems like AlignGraph takes reads in fasta format. Does it accept fastq format ? What tool do you use to convert fastq to fasta format ?
LoveVirology
CC BY-SA 4.0
2019-04-11T13:06:15.483Z
`cat reads.fastq | paste - - - - | cut -f 1-2 | sed 's/^@/>/' | tr '\t' '\n' > reads.fasta`. You can replace `cat` with `gunzip -c` if your Fastqs are compressed.
Daniel Standage
CC BY-SA 4.0
2019-04-10T19:52:57.977Z
2019-04-10T19:52:57.977Z
Daniel Standage
<p>I am trying to perform reference-based assembly. Most of the tutorials teach how to create a bam file and view alignemnts in IGV or Tablet. But, I want a assembled genome sequence in fasta format. How can I do that ? Is there any tool or linux syntax available for this purpose ?</p>

CC BY-SA 4.0
2019-04-10T20:39:37.013Z
Cross-posted on biostars: https://www.biostars.org/p/374352/
Ram RS
<sam><genome><assembly>
Consensus sequence from SAM or BAM file?
# Consensus sequence from SAM or BAM file?

(Asked by: username_0 on 2019-04-10)

I am trying to perform reference-based assembly. Most of the tutorials teach how to create a bam file and view alignemnts in IGV or Tablet. But, I want a assembled genome sequence in fasta format. How can I do that ? Is there any tool or linux syntax available for this purpose ?

**Tags:** sam, genome, assembly
> **Comments:**
> **username_1**: Cross-posted on biostars: https://www.biostars.org/p/374352/  

---

## 1 answers

### Answer by username_2 on 2019-04-10. Score: 1

A few years ago I used AlignGraph ([paper](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4058956/) and [code](https://github.com/baoe/AlignGraph)) for a task like this. I gave AlignGraph my raw reads, so I'm not sure if it accepts SAM/BAM input or if you have to go back to the original Fastq reads.

I'm not sure if any related/improved tools have been published since AlignGraph. Internet searches for "reference-guided assembly" return mostly transcriptome assembly tools. It might be worth looking for [articles that cite the AlignGraph paper](https://www.ncbi.nlm.nih.gov/pubmed?linkname=pubmed_pubmed_citedin&from_uid=24932000).

> **Comments:**
> **username_0**: It seems like AlignGraph takes reads in fasta format. Does it accept fastq format ? What tool do you use to convert fastq to fasta format ?  
> **username_2**: `cat reads.fastq | paste - - - - | cut -f 1-2 | sed 's/^@/>/' | tr '\t' '\n' > reads.fasta`. You can replace `cat` with `gunzip -c` if your Fastqs are compressed.  

---

