<p><a href="http://www.griv.org/shapeit/pages/snps.html" rel="nofollow noreferrer" title="SHAPEIT Manual">The manual</a> suggests that each &quot;chromosome&quot; needs to have its own input file.</p>
<blockquote>
<p>You have to split the dataset by chromosomes. ShapeIT can just phase one chromosome at a time. If you are working on GWA data, you can proceed as follows:</p>
<blockquote>
<p><code>for chr in $(seq 1 22) ; do plink --file example --chr $chr --recode --out example_chr$chr ; done</code></p>
</blockquote>
<p>You will obtain 44 files; <code>example_chr1.ped, example_chr1.map, ..., example_chr22.ped, example_chr22.map</code> that you can phase separately.</p>
</blockquote>

CC BY-SA 3.0
2017-11-20T08:15:57.080Z
ok, indeed it's written in big in the manual ! When you don't want to see something ....  Thanks a lot to both of you for your help !
G. Dumont
CC BY-SA 3.0
2017-11-20T09:50:10.877Z
@G.Dumont If this answer solved your issue, please take a moment and [accept it](http://bioinformatics.stackexchange.com/help/someone-answers) by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites.
terdon
CC BY-SA 4.0
2021-02-03T22:11:44.140Z
what format does the file `example` need to be in? i.e. what order of columns? header? my map is in order `pos    chr     cM'
Brian Wiley
CC BY-SA 3.0
2017-11-17T17:24:46.010Z
2017-11-20T09:50:50.233Z
2020-06-18T08:30:41.743Z
Bioathlete
<p>I'm trying to phase my data (whole genome resequencing SNPs) with Shapeit (from ped file) and I get this error message : </p>

<pre><code>[33mERROR:[0m Wrong ordering in physical positions curr_pos=54 prev_pos=65
</code></pre>

<p>I found that it's due to the fact that my .map file is like this (4 columns):  </p>

<pre><code>Chromosome_number    SNP_ID   SNP_genetic_position    SNP_physical_position  
Contig100131            .              0                        65  
Contig100220            .              0                        54  
</code></pre>

<p>And Shapeit only looks at <code>SNP_physical_position</code> but does not check if the SNPs are on the same contig or not and so it says it is not happy because position 54 is after 65! </p>

<p>How could I make it understand that the positions are not in the same contig and so there is no mistake? Must I run Shapeit per contig (I have a lot of them so I hope not)?  </p>

CC BY-SA 3.0
2017-11-17T16:19:52.360Z
Why don't you just sort the index file? Will that work? It might still complain if you have multiple instances of the same position, I guess, but try: `sed 's/  */\t/g' foo.map | sort -nk4 > new.map` and then using the `new.map` file. If that works, let me know and I will post an answer.
terdon
CC BY-SA 3.0
2017-11-17T18:00:35.757Z
On second thought, that shouldn't work. That would mean you would have the contigs not in order and if the program doesn't take the contig name into account, that would mess everything up.
terdon
<ngs><software-recommendation><errors>
problem of "ordering in physical positions" phasing SNPs with Shapeit
# problem of "ordering in physical positions" phasing SNPs with Shapeit

(Asked by: username_0 on 2017-11-17)

I'm trying to phase my data (whole genome resequencing SNPs) with Shapeit (from ped file) and I get this error message : 
[33mERROR:[0m Wrong ordering in physical positions curr_pos=54 prev_pos=65

I found that it's due to the fact that my .map file is like this (4 columns):  
Chromosome_number    SNP_ID   SNP_genetic_position    SNP_physical_position  
Contig100131            .              0                        65  
Contig100220            .              0                        54  

And Shapeit only looks at SNP_physical_position but does not check if the SNPs are on the same contig or not and so it says it is not happy because position 54 is after 65! 
How could I make it understand that the positions are not in the same contig and so there is no mistake? Must I run Shapeit per contig (I have a lot of them so I hope not)?

**Tags:** ngs, software-recommendation, errors
> **Comments:**
> **username_1**: Why don't you just sort the index file? Will that work? It might still complain if you have multiple instances of the same position, I guess, but try: `sed 's/  */\t/g' foo.map | sort -nk4 > new.map` and then using the `new.map` file. If that works, let me know and I will post an answer.  
> **username_1**: On second thought, that shouldn't work. That would mean you would have the contigs not in order and if the program doesn't take the contig name into account, that would mess everything up.  

---

## 1 answers

### Answer by username_2 on 2017-11-17. Score: 5 | Accepted answer

[The manual](http://www.griv.org/shapeit/pages/snps.html "SHAPEIT Manual") suggests that each "chromosome" needs to have its own input file.

> You have to split the dataset by chromosomes. ShapeIT can just phase one chromosome at a time. If you are working on GWA data, you can proceed as follows:
>
> > `for chr in $(seq 1 22) ; do plink --file example --chr $chr --recode --out example_chr$chr ; done`
>
> You will obtain 44 files; `example_chr1.ped, example_chr1.map, ..., example_chr22.ped, example_chr22.map` that you can phase separately.

> **Comments:**
> **username_0**: ok, indeed it's written in big in the manual ! When you don't want to see something ....  Thanks a lot to both of you for your help !  
> **username_1**: @G.Dumont If this answer solved your issue, please take a moment and [accept it](http://bioinformatics.stackexchange.com/help/someone-answers) by clicking on the check mark to the left. That will mark the question as answered and is the way thanks are expressed on the Stack Exchange sites.  
> **username_3**: what format does the file `example` need to be in? i.e. what order of columns? header? my map is in order `pos    chr     cM'  

---

