Tool to generate a chain file from an agp file
1
2
Entering edit mode
4.8 years ago

Hi all,

here is some background to my question in the title: I have two genome versions, a scaffolded and unscaffolded one; as luck has it, the annotated version is the unscaffolded one. I would like to update the coordinates in the GFF file to the scaffolded version. I wanted to use crossMap (http://crossmap.sourceforge.net) for this, but I need a chain file. I already have an AGP file describing how the scaffolds were generated. I am thus looking for a tool that would convert the AGP tile to a chain file. Does such a tool exist?

agp crossmap gff chain • 2.6k views
0
Entering edit mode

Hi - did you figure this out?

0
Entering edit mode

No, I gave up on it. Sorry!

0
Entering edit mode

There is a bunch of scripts here, in particular, formats/chain.py may do what you want.

0
Entering edit mode

liftUp from the Kent tools should do the job if I only could fire the right command! Anyone a working example from .agp to .chain?

liftUp - change coordinates of .psl, .agp, .gap, .gl, .out, .align, .gff, .gtf
.bscore .tab .gdup .axt .chain .net, .gp, .genepred, .wab, .bed, or .bed8 files to
parent coordinate system.

usage:
liftUp [-type=.xxx] destFile liftSpec how sourceFile(s)
The optional -type parameter tells what type of files to lift
If omitted the type is inferred from the suffix of destFile
Type is one of the suffixes described above.
DestFile will contain the merged and lifted source files,
with the coordinates translated as per liftSpec.  LiftSpec
is tab-delimited with each line of the form:
offset oldName oldSize newName newSize
LiftSpec may optionally have a sixth column specifying + or - strand,
but strand is not supported for all input types.
The 'how' parameter controls what the program will do with
items which are not in the liftSpec.  It must be one of:
carry - Items not in liftSpec are carried to dest without translation
drop  - Items not in liftSpec are silently dropped from dest
warn  - Items not in liftSpec are dropped.  A warning is issued
error - Items not in liftSpec generate an error
If the destination is a .agp file then a 'large inserts' file
also needs to be included in the command line:
liftUp dest.agp liftSpec how inserts sourceFile(s)
This file describes where large inserts due to heterochromitin
should be added. Use /dev/null and set -gapsize if there's not inserts file.

options:
-dots=N Output a dot every N lines processed
-pslQ  Lift query (rather than target) side of psl
-axtQ  Lift query (rather than target) side of axt
-chainQ  Lift query (rather than target) side of chain
-netQ  Lift query (rather than target) side of net
-wabaQ  Lift query (rather than target) side of waba alignment
(waba lifts only work with query side at this time)
-nosort Don't sort bed, gff, or gdup files, to save memory
-gapsize change contig gapsize from default
-ignoreVersions - Ignore NCBI-style version number in sequence ids of input files
-extGenePred lift extended genePred

1
Entering edit mode
3.9 years ago
Malcolm.Cook ★ 1.3k

Yes. ALLMAPS has chain.py which can do this.

Example:

chain.py fromagp my.agp unscaffolded.fa scaffolded.fa > my.chain