<p>An alignment can be the result of two slightly different analyses:</p>
<p>There is <strong>multiple sequence alignment</strong> (which is what you get from MAFFT) where sequences are aligned so that similar regions are on top of each other. This may require introducing indels (insertions / deletions) if a particular region is absent in some of the sequences.<br />
Then there is <strong>alignment to a reference sequence</strong>. This is usually how you get variant data and most of the tools deal with this use case. Therefore, in the link you provided the solution includes aligning the data to a reference sequence. Usually the refernce sequence is much larger (e.g. the human genome) and after alignment the result is a file (.bam) that tells you where the query sequences match in the reference.</p>
<p>I did a quick search for ways of converting a multiple sequence alignment (MSA) to VCF. There is a tool called <code>msa2vcf</code> in the <a href="http://lindenb.github.io/jvarkit/" rel="nofollow noreferrer">Jvarkit</a> collection of utilities that can do this. The example is for the CLUSTAW format but FASTA is accepted as well.<br />
You shoud check that indels were treated correctly because these are most likely to cause trouble.
Then you can simply <a href="https://stackoverflow.com/questions/39671015/how-to-convert-vcf-file-to-ped-file-using-plink">convert the VCF to PLINK format</a>  using PLINK.</p>

CC BY-SA 4.0
2020-07-29T12:04:09.680Z
2020-07-29T16:05:13.987Z
2020-07-29T16:05:13.987Z
PPK
<p>I have an alignment of multiple sequences in a FASTA file (output from MAFFT), for which I would like to simulate a phenotype using plink, but for that I need to have my alignment in a PED file or plink BED. There's plenty online about converting in the other direction, but the <a href="https://www.biostars.org/p/284123/" rel="nofollow noreferrer">only mention I found of converting FASTA to BED</a> is about aligning a raw FASTQ file for use in plink - my data is already aligned! How can I do this conversion?</p>

<p>Note that <a href="https://bioinformatics.stackexchange.com/questions/91/how-to-convert-fasta-to-bed">How to convert FASTA to BED</a> is about the UCSC BED format, not the plink binary PED.</p>

CC BY-SA 4.0
2020-05-28T21:04:33.030Z
FASTA file contains sequences, whereas PED file contains variants. Usually, you need to do variant-calling on sequencing file to get variant file. I do not know that is contained in your FASTA file.
Phoenix Mu
CC BY-SA 4.0
2020-07-25T19:47:40.813Z
I have the same challenge, I have aligned sequences but not vcfs, bams or fastqs. Any ideas?
San Emmanuel James
<fasta><format-conversion><plink>
Converting aligned fasta to plink ped/bed
# Converting aligned fasta to plink ped/bed

(Asked by: username_0 on 2020-05-28)

I have an alignment of multiple sequences in a FASTA file (output from MAFFT), for which I would like to simulate a phenotype using plink, but for that I need to have my alignment in a PED file or plink BED. There's plenty online about converting in the other direction, but the [only mention I found of converting FASTA to BED](https://www.biostars.org/p/284123/) is about aligning a raw FASTQ file for use in plink - my data is already aligned! How can I do this conversion?

Note that [How to convert FASTA to BED](https://bioinformatics.stackexchange.com/questions/91/how-to-convert-fasta-to-bed) is about the UCSC BED format, not the plink binary PED.

**Tags:** fasta, format-conversion, plink
> **Comments:**
> **username_1**: FASTA file contains sequences, whereas PED file contains variants. Usually, you need to do variant-calling on sequencing file to get variant file. I do not know that is contained in your FASTA file.  
> **username_2**: I have the same challenge, I have aligned sequences but not vcfs, bams or fastqs. Any ideas?  

---

## 1 answers

### Answer by username_3 on 2020-07-29. Score: 2 | Accepted answer

An alignment can be the result of two slightly different analyses:

There is **multiple sequence alignment** (which is what you get from MAFFT) where sequences are aligned so that similar regions are on top of each other. This may require introducing indels (insertions / deletions) if a particular region is absent in some of the sequences.  
Then there is **alignment to a reference sequence**. This is usually how you get variant data and most of the tools deal with this use case. Therefore, in the link you provided the solution includes aligning the data to a reference sequence. Usually the refernce sequence is much larger (e.g. the human genome) and after alignment the result is a file (.bam) that tells you where the query sequences match in the reference.

I did a quick search for ways of converting a multiple sequence alignment (MSA) to VCF. There is a tool called `msa2vcf` in the [Jvarkit](http://lindenb.github.io/jvarkit/) collection of utilities that can do this. The example is for the CLUSTAW format but FASTA is accepted as well.  
You shoud check that indels were treated correctly because these are most likely to cause trouble.
Then you can simply [convert the VCF to PLINK format](https://stackoverflow.com/questions/39671015/how-to-convert-vcf-file-to-ped-file-using-plink) using PLINK.


---

