<p>I think the standard way of doing this is to make a <a href="http://genomewiki.ucsc.edu/index.php/LiftOver_Howto" rel="noreferrer">chain file</a>, then use it to do a <a href="http://crossmap.sourceforge.net" rel="noreferrer">liftOver</a> of the annotations:</p>

<pre><code>mkdir psl
for i in ../ci3/rm/masked/*.masked; do blat ../ci2.2bit $i -tileSize=12 -fastMap -minIdentity=98 psl/`basename $i .fa.masked`.psl -noHead -minScore=100; done
</code></pre>

<p>Translate psl files to chains in the directory chain: </p>

<pre><code>mkdir chain
for i in psl/*.psl; do axtChain -linearGap=medium -psl $i ../ci2.2bit ../ci3/ci3.2bit chain/`basename $i .psl`.chain; done
</code></pre>

<p>Merge short chains into longer ones into the directory chainMerge: </p>

<pre><code>mkdir chainMerge
chainMergeSort chain/*.chain | chainSplit chainMerge stdin -lump=50
</code></pre>

<p>concat and sort the chains: </p>

<pre><code>cat chainMerge/*.chain &gt; all.chain
chainSort all.chain all.sorted.chain
</code></pre>

<p>Need info about chromosome sizes for netting: </p>

<pre><code>twoBitInfo ../ci3/ci3.2bit ci3.chromInfo
twoBitInfo ../ci2.2bit ci2.chromInfo
</code></pre>

<p>Netting: identify alignable regions from chains: </p>

<pre><code>mkdir net
chainNet all.sorted.chain ci2.chromInfo ci3.chromInfo net/all.net /dev/null
</code></pre>

<p>Finally, select the right alignable regions using the nets, creating a "liftOver" file: </p>

<pre><code>netChainSubset net/all.net all.chain ci2ToCi3.liftOver
</code></pre>

<p>Run liftOver:</p>

<pre><code>CrossMapy.py bed ci2ToCi3.liftOver test.hg18.bed
</code></pre>

CC BY-SA 3.0
2017-11-22T15:33:25.090Z
Thanks for the quick answer, will test it and report back.
BioNaab
CC BY-SA 3.0
2017-11-22T11:42:11.453Z
2017-11-22T11:42:11.453Z
heathobrien
<p>In addition to the answer by <a href="https://bioinformatics.stackexchange.com/a/2910/196">heathobrien</a> you might take a look at <a href="http://ratt.sourceforge.net/" rel="nofollow noreferrer">RATT: Rapid Annotation Transfer Tool</a>. The approach is essentially the same, only using more modern approaches to for instance whole genome alignments. It uses <a href="https://github.com/mummer4/mummer" rel="nofollow noreferrer">nucmer</a>, which when using the latest version (4.0) allows you to do whole genome alignments using parallel computing.</p>

CC BY-SA 4.0
2020-03-23T23:12:51.167Z
Are there any resources that show how to do this? The documentation seems really non-user friendly.
O.rka
CC BY-SA 3.0
2017-11-30T08:07:50.947Z
2017-11-30T08:07:50.947Z
holmrenser
<p>I have a eukaryotic genome for which an updated sequence for a chromosome  was recently obtained. I want to map RNAseq reads on the genome (and perform other downstream analyses) and would like to use the most up-to-date information possible (so the 'new' sequence of that chromosome). </p>

<p>However, before performing the read mapping, I'd like to update the annotation of my genome (GFF3) to match with the 'new' coordinates of this chromosome. </p>

<p>Basically, I would like to transfer information from the 'old-coordinates' GFF3 to obtain a 'new-coordinates' GFF3, and if possible conserve all the information/hierarchy of the file (gene, mRNA, exon, etc.). </p>

<p><strong>Example:</strong></p>

<pre><code>chrXX   source  gene    222 5942    .   -   .   ID=gene_1;Name=gene_1;length=5720
chrXX   source  mRNA    222 5942    .   -   .   ID=gene_1.1;Parent=gene_1;Name=gene_1.1;length=5720
chrXX   source  exon    222 5794    .   -   .   ID=gene_1.1.2;Parent=gene_1.1
chrXX   source  exon    5889    5942    .   -   .   ID=gene_1.1.1;Parent=gene_1.1
chrXX   source  CDS 222 5794    .   -   1   ID=CDS:gene_1.1.2;Parent=gene_1.1;Name=gene_1.1
chrXX   source  CDS 5889    5942    .   -   0   ID=CDS:gene_1.1.1;Parent=gene_1.1;Name=gene_1.1
</code></pre>

<p>... should be updated to ...</p>

<pre><code>chrXX   source  gene    333 6053    .   -   .   ID=gene_1;Name=gene_1;length=5720
chrXX   source  mRNA    333 6053    .   -   .   ID=gene_1.1;Parent=gene_1;Name=gene_1.1;length=5720
chrXX   source  exon    333 5905    .   -   .   ID=gene_1.1.2;Parent=gene_1.1
chrXX   source  exon    6000    6053    .   -   .   ID=gene_1.1.1;Parent=gene_1.1
chrXX   source  CDS 333 5905    .   -   1   ID=CDS:gene_1.1.2;Parent=gene_1.1;Name=gene_1.1
chrXX   source  CDS 6000    6053    .   -   0   ID=CDS:gene_1.1.1;Parent=gene_1.1;Name=gene_1.1
</code></pre>

<p><strong>The approach I tried</strong> (but I am not sure it is the way to do it): </p>

<ol>
<li>Extract sequence of all the features that are going to be updated to fasta (<code>bedtools getfasta</code>)</li>
<li>Map these sequences to the genome with the updated chromosome (<code>gmap</code> with <code>--nosplicing</code> since sequences we are mapping correspond to genomic regions). </li>
<li>Create the updated GFF3 file. When doing that, I apply one supplementary rule: if a feature mapped on another chromosome, but there was also another alignment on the updated chromosome, prioritize the one that correspond to the same (updated) chromosome. </li>
</ol>

<p>What would be the proper way to do such a thing?  Any suggestion of methods/tools is welcome! </p>

CC BY-SA 3.0
2017-11-22T10:58:39.770Z
I'd suggest to paste the full code used for each step, so people can advise you better.
llrs
<gff3><gmap>
Transferring genomic features on new coordinates
# Transferring genomic features on new coordinates

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

I have a eukaryotic genome for which an updated sequence for a chromosome  was recently obtained. I want to map RNAseq reads on the genome (and perform other downstream analyses) and would like to use the most up-to-date information possible (so the 'new' sequence of that chromosome). 
However, before performing the read mapping, I'd like to update the annotation of my genome (GFF3) to match with the 'new' coordinates of this chromosome. 
Basically, I would like to transfer information from the 'old-coordinates' GFF3 to obtain a 'new-coordinates' GFF3, and if possible conserve all the information/hierarchy of the file (gene, mRNA, exon, etc.). 
Example:
chrXX   source  gene    222 5942    .   -   .   ID=gene_1;Name=gene_1;length=5720
chrXX   source  mRNA    222 5942    .   -   .   ID=gene_1.1;Parent=gene_1;Name=gene_1.1;length=5720
chrXX   source  exon    222 5794    .   -   .   ID=gene_1.1.2;Parent=gene_1.1
chrXX   source  exon    5889    5942    .   -   .   ID=gene_1.1.1;Parent=gene_1.1
chrXX   source  CDS 222 5794    .   -   1   ID=CDS:gene_1.1.2;Parent=gene_1.1;Name=gene_1.1
chrXX   source  CDS 5889    5942    .   -   0   ID=CDS:gene_1.1.1;Parent=gene_1.1;Name=gene_1.1

... should be updated to ...
chrXX   source  gene    333 6053    .   -   .   ID=gene_1;Name=gene_1;length=5720
chrXX   source  mRNA    333 6053    .   -   .   ID=gene_1.1;Parent=gene_1;Name=gene_1.1;length=5720
chrXX   source  exon    333 5905    .   -   .   ID=gene_1.1.2;Parent=gene_1.1
chrXX   source  exon    6000    6053    .   -   .   ID=gene_1.1.1;Parent=gene_1.1
chrXX   source  CDS 333 5905    .   -   1   ID=CDS:gene_1.1.2;Parent=gene_1.1;Name=gene_1.1
chrXX   source  CDS 6000    6053    .   -   0   ID=CDS:gene_1.1.1;Parent=gene_1.1;Name=gene_1.1

The approach I tried (but I am not sure it is the way to do it): 

Extract sequence of all the features that are going to be updated to fasta (bedtools getfasta)
Map these sequences to the genome with the updated chromosome (gmap with --nosplicing since sequences we are mapping correspond to genomic regions). 
Create the updated GFF3 file. When doing that, I apply one supplementary rule: if a feature mapped on another chromosome, but there was also another alignment on the updated chromosome, prioritize the one that correspond to the same (updated) chromosome. 

What would be the proper way to do such a thing?  Any suggestion of methods/tools is welcome!

**Tags:** gff3, gmap
> **Comments:**
> **username_1**: I'd suggest to paste the full code used for each step, so people can advise you better.  

---

## 2 answers

### Answer by username_2 on 2017-11-22. Score: 4

I think the standard way of doing this is to make a chain file, then use it to do a liftOver of the annotations:
mkdir psl
for i in ../ci3/rm/masked/*.masked; do blat ../ci2.2bit $i -tileSize=12 -fastMap -minIdentity=98 psl/`basename $i .fa.masked`.psl -noHead -minScore=100; done

Translate psl files to chains in the directory chain: 
mkdir chain
for i in psl/*.psl; do axtChain -linearGap=medium -psl $i ../ci2.2bit ../ci3/ci3.2bit chain/`basename $i .psl`.chain; done

Merge short chains into longer ones into the directory chainMerge: 
mkdir chainMerge
chainMergeSort chain/*.chain | chainSplit chainMerge stdin -lump=50

concat and sort the chains: 
cat chainMerge/*.chain > all.chain
chainSort all.chain all.sorted.chain

Need info about chromosome sizes for netting: 
twoBitInfo ../ci3/ci3.2bit ci3.chromInfo
twoBitInfo ../ci2.2bit ci2.chromInfo

Netting: identify alignable regions from chains: 
mkdir net
chainNet all.sorted.chain ci2.chromInfo ci3.chromInfo net/all.net /dev/null

Finally, select the right alignable regions using the nets, creating a "liftOver" file: 
netChainSubset net/all.net all.chain ci2ToCi3.liftOver

Run liftOver:
CrossMapy.py bed ci2ToCi3.liftOver test.hg18.bed

> **Comments:**
> **username_0**: Thanks for the quick answer, will test it and report back.  

---

### Answer by username_3 on 2017-11-30. Score: 2

In addition to the answer by [heathobrien](https://bioinformatics.stackexchange.com/a/2910/196) you might take a look at [RATT: Rapid Annotation Transfer Tool](http://ratt.sourceforge.net/). The approach is essentially the same, only using more modern approaches to for instance whole genome alignments. It uses [nucmer](https://github.com/mummer4/mummer), which when using the latest version (4.0) allows you to do whole genome alignments using parallel computing.

> **Comments:**
> **username_4**: Are there any resources that show how to do this? The documentation seems really non-user friendly.  

---

