<div dir="ltr">This was easier to fix than I thought it would be; I've pushed a fix to the ensembl-variation GitHub repo, it's available on the release/75 branch.<div><br></div><div>Will</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On 30 April 2014 10:32, mag <span dir="ltr"><<a href="mailto:mr6@ebi.ac.uk" target="_blank">mr6@ebi.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi Will,<br>
    <br>
    Chromosomes in Ensembl have a 'karyotype_rank' attribute that gives
    the expected chromosome ordering (1-22, X, Y, MT)<br>
    <br>
    I don't know how applicable it is to VEP, but it might be something
    to bear in mind.<br>
    <br>
    <br>
    Cheers,<br>
    mag<div><div class="h5"><br>
    <br>
    <div>On 30/04/2014 09:18, Will McLaren
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Guillermo,
        <div><br>
        </div>
        <div>Currently the VEP internally sorts each buffer of 5000
          variants that it reads in before writing the output. The sort
          is done alphanumerically, so it will order e.g. 1-22,M,X,Y.</div>
        <div><br>
        </div>
        <div>It looks like the buffer partially overlaps your input
          groups, such that, in your example, the first buffer read
          would be</div>
        <div><br>
        </div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">chrX
            variant1</span><br style="font-family:arial,sans-serif;font-size:13px">
          <span style="font-family:arial,sans-serif;font-size:13px">chrX
            variant2</span><br>
        </div>
        <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">These
            are parsed, sorted and written out. Then the buffer reads in
            the next batch:</span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">chrX
            variant3</span><br style="font-family:arial,sans-serif;font-size:13px">
          <span style="font-family:arial,sans-serif;font-size:13px">chrX
            variant4</span><br style="font-family:arial,sans-serif;font-size:13px">
          <span style="font-family:arial,sans-serif;font-size:13px">chrM
            variant1</span><br style="font-family:arial,sans-serif;font-size:13px">
          <span style="font-family:arial,sans-serif;font-size:13px">chrM
            variant2</span><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><font face="arial, sans-serif">which then get sorted to</font></div>
        <div><font face="arial, sans-serif"><br>
          </font></div>
        <div>
          <span style="font-family:arial,sans-serif;font-size:13px">chrM
            variant1</span><br style="font-family:arial,sans-serif;font-size:13px">
          <span style="font-family:arial,sans-serif;font-size:13px">chrM
            variant2</span><br style="font-family:arial,sans-serif;font-size:13px">
          <span style="font-family:arial,sans-serif;font-size:13px">chrX
            variant3</span><br style="font-family:arial,sans-serif;font-size:13px">
          <span style="font-family:arial,sans-serif;font-size:13px">chrX
            variant4</span><font face="arial, sans-serif"><br>
          </font></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px">since
            M is before X alphabetically. So, I'm afraid this explains
            but doesn't fix your problem! You could ensure that your
            chrM variants appear before your chrX and chrY variants in
            the file, and this problem shouldn't appear.</span></div>
        <div><span style="font-family:arial,sans-serif;font-size:13px"><br>
          </span></div>
        <div><font face="arial, sans-serif">For the next VEP release
            I'll look into retaining the input sorting when using VCF as
            the output format as I think this would be preferable for
            most users.</font></div>
        <div><font face="arial, sans-serif"><br>
          </font></div>
        <div><font face="arial, sans-serif">Regards</font></div>
        <div><font face="arial, sans-serif"><br>
          </font></div>
        <div><font face="arial, sans-serif">Will McLaren</font></div>
        <div><font face="arial, sans-serif">Ensembl Variation</font></div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On 30 April 2014 07:47, Guillermo Marco
          Puche <span dir="ltr"><<a href="mailto:guillermo.marco@sistemasgenomicos.com" target="_blank">guillermo.marco@sistemasgenomicos.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000066"> Dear developers,<br>
              <br>
              I'm experiencing a strange behavior when annotating a full
              sorted VCF file.<br>
              My chr order is the following: chr1 to chr22, chrX, chrY,
              chrM.<br>
              <br>
              I've noticed when I've variants in chrX then in chrM the
              vep scripts annotates the full vcf file but it changes the
              order of some of the lines. See example below:<br>
              <br>
              Imagine I've the following variants in my vcf:<br>
              <br>
              chrX variant1<br>
              chrX variant2<br>
              chrX variant3<br>
              chrX variant4<br>
              chrM variant1<br>
              chrM variant2<br>
              <br>
              After annotating the VCF the order remains like this:<br>
              <br>
              chrX variant1<br>
              chrX variant2<br>
              chrM variant1<br>
              chrM variant2<br>
              chrX variant3<br>
              chrX variant4<br>
              <br>
              This is just a graphical example. I would like to fix
              this, because it's a bit tricky to get a non sorted VCF
              annotated file. I've not experienced this issue with other
              chrX and chrM. Already tried to debug this disabling all
              the plugins and the issue reproduces itself.<br>
              <br>
              Thank very much.<br>
              <br>
              Best regards,<br>
              Guillermo.<br>
            </div>
            <br>
            _______________________________________________<br>
            Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a><br>
            Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
            Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
            <br>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Dev mailing list    <a href="mailto:Dev@ensembl.org" target="_blank">Dev@ensembl.org</a>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

<br>_______________________________________________<br>
Dev mailing list    <a href="mailto:Dev@ensembl.org">Dev@ensembl.org</a><br>
Posting guidelines and subscribe/unsubscribe info: <a href="http://lists.ensembl.org/mailman/listinfo/dev" target="_blank">http://lists.ensembl.org/mailman/listinfo/dev</a><br>
Ensembl Blog: <a href="http://www.ensembl.info/" target="_blank">http://www.ensembl.info/</a><br>
<br></blockquote></div><br></div>