NBISweden / AGAT

Another Gtf/Gff Analysis Toolkit
GNU General Public License v3.0
431 stars 52 forks source link

`agat_sp_complement_annotations.pl` does not complement but concatenate? #424

Closed dirkjanvw closed 4 months ago

dirkjanvw commented 4 months ago

Describe the bug I would like to complement one GFF file with those non-overlapping genes from another GFF file. From the documentation it seems agat_sp_complement_annotations.pl is meant for this. However, when I run it, it concatenates instead of complementing.

General (please complete the following information):

To Reproduce ref.gff:

Chr1    Helixer gene    41064   54753   .   +   .   ID=Chr1_000001
Chr1    Helixer mRNA    41064   54753   .   +   .   ID=Chr1_000001.1;Parent=Chr1_000001
Chr1    Helixer exon    41064   54753   .   +   .   ID=Chr1_000001.1.exon.1;Parent=Chr1_000001.1
Chr1    Helixer five_prime_UTR  41064   41310   .   +   .   ID=Chr1_000001.1.five_prime_UTR.1;Parent=Chr1_000001.1
Chr1    Helixer CDS 41311   54435   .   +   0   ID=Chr1_000001.1.CDS.1;Parent=Chr1_000001.1
Chr1    Helixer three_prime_UTR 54436   54753   .   +   .   ID=Chr1_000001.1.three_prime_UTR.1;Parent=Chr1_000001.1

add.gff:

Chr1    Liftoff gene    41075   54676   .   +   .   ID=gene-gene1
Chr1    Liftoff mRNA    41075   54676   .   +   .   ID=rna-transcript1;Parent=gene-gene1
Chr1    Liftoff exon    41075   54676   .   +   .   ID=exon-transcript1-1;Parent=rna-transcript1
Chr1    Liftoff CDS 41311   54435   .   +   0   ID=cds-codingsequence-1.1;Parent=rna-transcript1
Chr1    Liftoff five_prime_UTR  41075   41310   .   +   .   ID=nbis-five_prime_utr-19342;Parent=rna-transcript1
Chr1    Liftoff three_prime_UTR 54436   54676   .   +   .   ID=nbis-three_prime_utr-18368;Parent=rna-transcript1

Running AGAT as:

agat_sp_complement_annotations.pl --ref ref.gff --add add.gff

Expected behavior I expected the resulting gff file to only contain the reference record instead of both.

Screenshots This is what the output of AGAT looks like instead:

image

Additional context NA

Juke34 commented 4 months ago

Hi,

Thank you for using AGAT and reporting this issue. This is indeed a bug I think Introduced quite recently. It push a fix soon.

Best regards, /Jacques

dirkjanvw commented 4 months ago

Thanks a lot for the fast fix! When do you plan on making a new release so I can easily install it via bioconda? For testing it I can create a custom singularity image but I think a new release would be easier :)

dirkjanvw commented 4 months ago

I tried creating the custom singularity image by following the manual installation instructions in the README, but I failed:

Bootstrap: docker
From: r-base:4.3.2

%post
   apt-get update
   apt-get install -y git
   apt-get install -y libbio-perl-perl libclone-perl libgraph-perl liblwp-useragent-determined-perl libstatistics-r-perl libcarp-clan-perl libsort-naturally-perl libfile-share-perl libfile-sharedir-install-perl libyaml-perl liblwp-protocol-https-perl libstatistics-r-perl

%post
   apt-get install -y perl-modules cpanminus
   cpanm Bio::DB::Fasta Bio::DB::Taxonomy Bio::OntologyIO::obo Bio::Ontology::OntologyEngineI Bio::Seq Bio::SeqIO Bio::Tools::CodonTable Bio::Tools::GFF Carp Clone Cwd Exporter File::Basename File::Copy File::Share Getopt::Long IO::File IPC::Open2 YAML LWP::UserAgent LWP::Protocol::https List::MoreUtils Moose POSIX Pod::Usage Scalar::Util Sort::Naturally Term::ProgressBar Time::Piece Time::Seconds Try::Tiny URI::Escape

%post
   cd /opt
   git clone https://github.com/NBISweden/AGAT.git
   cd AGAT
   git checkout  180374e
   perl Makefile.PL
   make
   make test
   make install

%environment
   export PERL5LIB="/opt/AGAT/blib/lib/:$PERL5LIB"

It fails at make test, but when I leave out make test it also fails because:

Undefined subroutine &main::prepare_gffout called at /usr/local/bin/agat_sp_complement_annotations.pl line 55.
Juke34 commented 4 months ago

I do not know if I will have time to make release soon. Why do you use a r-base image in your container? Maybe you will have better chance with an simple ubuntu OS. Otherwise what you can do is to install the last version via conda, activate the env then run

git clone https://github.com/NBISweden/AGAT.git cd AGAT perl Makefile.PL make make test make install

dirkjanvw commented 4 months ago

I thought the r-base would be the best choice since R is needed for some plots, but I also tested a perl base and it doesn't work either.

Anyway, with the conda install it works! I'll use that for now.