This is a test version of Biostars. For the public version, visit https://www.biostars.org.
exonerate error while building index

Hello, I want to use exonerate-server. Therefore I've created database file using fasta2esd and then I've tried to build the index using esd2esi, but I didn't work for me. It prints error while running esd2esi:

esd2esi Chr1.esd Chr1.esi

** Message: Building index

* FATAL ERROR *: Unknown or irregular fasta line length

exiting ...

While I'm pretty sure that fasta file is fine. Do you know how to solve this issue?

software error exonerate

I also run into this problem, don't know if you've figured it our?

1 answer

I think I've figure this out. It because that the sequences in the fasta file are output in one line. Some are too long for the exonerate. Here is a perl script to re-type the fasta so each sequence would be output in multiple lines

#!/usr/bin/perl -w
use strict;
use Getopt::Long;
my ($chr,$help);
my $width="0";
my $infile="";
my $outfile="";

GetOptions(
                "help|h"     => \&USAGE,
                "infile:s"   => \$infile,
                "outfile:s"  => \$outfile,
                "width=i"    => \$width,
);

die "please give me a number between 10 and 200\n" unless 10<= $width and $width <=200;
open IN,"<$infile"||die;
open OUT,">$outfile";


$/=">";<IN>;$/="\n";
while(<IN>){
    my $chr=$1 if /^(\S+)/;
    $/=">";
    chomp(my $seq=<IN>);
    $/="\n";
    $seq=~s/\n+//g;
    print OUT ">$chr\n";
    my $start=0;
    my $len=length($seq);
    while($start+$width<$len){
    $b=substr($seq,$start,$width);
    print OUT "$b\n";
    $start=$start+$width;}
    while($start+$width>=$len){
    $b=substr($seq,$start,$width);
    print OUT "$b\n";
    last;}
}
sub USAGE{
                my $usage=<<"USAGE";

------------------------------------------------------------------------------------
       Program: thir_test.pl
       Date:2017-05-19
       Usage:
                 -infile    <fasta format> infile
                 -outfile   <fasta format> outfile
                 -width     <int>  seq length
                 -h          help


       Example1: perl thir_test.pl -infile data.fa -outfile out.fa -width 10
       Example2: perl thir_test.pl -h
------------------------------------------------------------------------------------
USAGE
        print $usage;
        exit;
}

the script is from: https://blog.csdn.net/niuhuihui_fei/article/details/72636679

Log in to answer this question.