From 4ca5e04ebda6e30f10eae4b0219bae7a119c92ee Mon Sep 17 00:00:00 2001 From: Jacques Dainat Date: Tue, 3 Dec 2024 17:09:32 +0100 Subject: [PATCH] Fix issue with Perl>5.36 (#509) * add dockerfile for AGAT with perl version 536 * replace export_to_level(2,@_) in each module called by AGAT::AGAT by AGAT::Module->export_to_level(1,@_) from AGAT::AGAT. This fix issiue related to replace export_to_level(2,@_) introduced in perl 5.36. Fix #416 #392 * add test for perl>5.36 * remove indentation in shebang * add missing semicolon * run make test for first job --- .github/workflows/main.yml | 46 +++++++++++++++++-- ...gat_sp_load_function_from_protein_align.pl | 4 +- docker/dockerfile_perl536 | 9 ++++ lib/AGAT/AGAT.pm | 10 +++- lib/AGAT/Config.pm | 4 -- lib/AGAT/Levels.pm | 4 -- lib/AGAT/OmniscientI.pm | 4 -- lib/AGAT/OmniscientO.pm | 7 +-- lib/AGAT/OmniscientStat.pm | 5 -- lib/AGAT/OmniscientToGTF.pm | 5 -- lib/AGAT/OmniscientTool.pm | 5 -- lib/AGAT/PlotR.pm | 4 -- lib/AGAT/Utilities.pm | 5 -- 13 files changed, 63 insertions(+), 49 deletions(-) create mode 100644 docker/dockerfile_perl536 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 466a9098..ee19eb7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,13 +12,51 @@ concurrency: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: + + # This workflow contains a second job called "build2" + build_perl536: + # avoid to run twice push and PR + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + + # The type of runner that the job will run on + runs-on: ubuntu-22.04 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + - name: Install libdb-dev + run: sudo apt-get -y install libdb-dev + - name: Install R + run: sudo apt-get -y install r-base + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + #- name: Checkout AGAT + - uses: actions/checkout@v2 + - name: Setup Perl + uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: '5.36' + install-modules-with: cpanm + install-modules-args: --notest --force + install-modules: File::ShareDir::Install + - uses: webiny/action-post-run@2.0.1 + id: post-run-command + if: ${{ failure() }} + with: + run: cat /home/runner/.cpanm/build.log + - name: install AGAT deps + run: cpanm --installdeps --notest --force . + - name: test + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: make test + + # This workflow contains a first job called "build" + build_perl530: # avoid to run twice push and PR if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name # The type of runner that the job will run on - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 #container: # image: perl:5.30 @@ -51,4 +89,4 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} DEVEL_COVER_OPTIONS: "+ignore,^local/" - run: cover -test -report Coveralls + run: cover -test -report Coveralls \ No newline at end of file diff --git a/bin/agat_sp_load_function_from_protein_align.pl b/bin/agat_sp_load_function_from_protein_align.pl index 8da4bf79..4dafa5db 100755 --- a/bin/agat_sp_load_function_from_protein_align.pl +++ b/bin/agat_sp_load_function_from_protein_align.pl @@ -840,10 +840,10 @@ sub check_gene_overlap_gffAlign{ my ($hash_omniscient, $prot_omniscient, $gene_id, $gene_id2, $prot_tag)=@_; # my $overlap12=undef; - my $overlap12_abs=undef + my $overlap12_abs=undef; # my $w_overlap12=undef; - my $w_overlap12_abs=undef + my $w_overlap12_abs=undef; # my $overlap21=undef; my $overlap21_abs=undef; diff --git a/docker/dockerfile_perl536 b/docker/dockerfile_perl536 new file mode 100644 index 00000000..a0d9bb93 --- /dev/null +++ b/docker/dockerfile_perl536 @@ -0,0 +1,9 @@ +From perl:5.36 + +RUN cpanm install BioPerl Graph::Directed LWP::UserAgent Carp Sort::Naturally File::Share File::ShareDir::Install Moose YAML LWP::Protocol::https Term::ProgressBar +RUN git clone https://github.com/NBISweden/AGAT.git +WORKDIR /usr/src/app/AGAT +RUN perl Makefile.PL +RUN make +RUN make test +RUN make install diff --git a/lib/AGAT/AGAT.pm b/lib/AGAT/AGAT.pm index e7b6b9e4..a9885f37 100644 --- a/lib/AGAT/AGAT.pm +++ b/lib/AGAT/AGAT.pm @@ -20,7 +20,15 @@ our $VERSION = "v1.4.1"; our @ISA = qw(Exporter); our @EXPORT = qw(get_agat_header print_agat_version get_agat_config handle_levels); sub import { - AGAT::AGAT->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) + AGAT::AGAT->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) + AGAT::OmniscientI->export_to_level(1, @_); + AGAT::OmniscientO->export_to_level(1, @_); + AGAT::OmniscientTool->export_to_level(1, @_); + AGAT::Config->export_to_level(1, @_); + AGAT::Levels->export_to_level(1, @_); + AGAT::OmniscientStat->export_to_level(1, @_); + AGAT::Utilities->export_to_level(1, @_); + AGAT::PlotR->export_to_level(1, @_); } =head1 SYNOPSIS diff --git a/lib/AGAT/Config.pm b/lib/AGAT/Config.pm index 711bff5f..dc422ae4 100644 --- a/lib/AGAT/Config.pm +++ b/lib/AGAT/Config.pm @@ -14,10 +14,6 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( load_config expose_config_file check_config get_config expose_config_hash ); -sub import { - AGAT::Config->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::Config->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} =head1 SYNOPSIS diff --git a/lib/AGAT/Levels.pm b/lib/AGAT/Levels.pm index ebfdc1f9..4678eb77 100644 --- a/lib/AGAT/Levels.pm +++ b/lib/AGAT/Levels.pm @@ -14,10 +14,6 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( get_levels_info load_levels expose_levels get_feature_type_by_agat_value ); -sub import { - AGAT::Levels->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::Levels->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} =head1 SYNOPSIS diff --git a/lib/AGAT/OmniscientI.pm b/lib/AGAT/OmniscientI.pm index 9a9884c6..bfe4d22a 100644 --- a/lib/AGAT/OmniscientI.pm +++ b/lib/AGAT/OmniscientI.pm @@ -26,10 +26,6 @@ our @ISA = qw(Exporter); our @EXPORT = qw(get_level select_gff_format modelate_utr_and_cds_features_from_exon_features_and_cds_start_stop slurp_gff3_file_JD); -sub import { - AGAT::OmniscientI->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::OmniscientI->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} =head1 SYNOPSIS diff --git a/lib/AGAT/OmniscientO.pm b/lib/AGAT/OmniscientO.pm index 200bb8d3..8d731c03 100644 --- a/lib/AGAT/OmniscientO.pm +++ b/lib/AGAT/OmniscientO.pm @@ -1,4 +1,4 @@ - #!/usr/bin/perl -w +#!/usr/bin/perl -w package AGAT::OmniscientO; @@ -18,11 +18,6 @@ our @EXPORT = qw(print_ref_list_feature print_omniscient print_omniscient_as_mat print_omniscient_from_level1_id_list webapollo_compliant embl_compliant convert_omniscient_to_ensembl_style write_top_features prepare_gffout prepare_fileout); -sub import { - AGAT::OmniscientO->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::OmniscientO->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} - =head1 SYNOPSIS This is the code to output data store in Omniscient. diff --git a/lib/AGAT/OmniscientStat.pm b/lib/AGAT/OmniscientStat.pm index 3907fb7d..947228c8 100644 --- a/lib/AGAT/OmniscientStat.pm +++ b/lib/AGAT/OmniscientStat.pm @@ -17,11 +17,6 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw( print_omniscient_statistics ); -sub import { - AGAT::OmniscientStat->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::OmniscientStat->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} - =head1 SYNOPSIS This is the code to perform statisctis of data store in Omniscient. diff --git a/lib/AGAT/OmniscientToGTF.pm b/lib/AGAT/OmniscientToGTF.pm index c08e667f..45470c0a 100644 --- a/lib/AGAT/OmniscientToGTF.pm +++ b/lib/AGAT/OmniscientToGTF.pm @@ -16,11 +16,6 @@ use Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(print_omniscient_as_gtf); -sub import { - AGAT::OmniscientToGTF->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::OmniscientToGTF->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} - # --------------------------- INFO --------------------------- # Set GTF version definitions #my @GTF3 = ("gene", "transcript", "exon", "CDS", "Selenocysteine", "start_codon", "stop_codon", "three_prime_utr", "five_prime_utr"); diff --git a/lib/AGAT/OmniscientTool.pm b/lib/AGAT/OmniscientTool.pm index 097920c3..52c22b89 100644 --- a/lib/AGAT/OmniscientTool.pm +++ b/lib/AGAT/OmniscientTool.pm @@ -33,11 +33,6 @@ remove_l1_and_relatives remove_l2_and_relatives remove_l3_and_relatives get_long check_mrna_positions check_features_overlap initialize_omni_from clean_clone create_omniscient get_cds_from_l2 merge_overlap_loci get_uniq_id ); -sub import { - AGAT::OmniscientTool->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::OmniscientTool->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} - =head1 SYNOPSIS This is the code to handle data store in Omniscient. diff --git a/lib/AGAT/PlotR.pm b/lib/AGAT/PlotR.pm index 4f73b1ec..730b4e7c 100644 --- a/lib/AGAT/PlotR.pm +++ b/lib/AGAT/PlotR.pm @@ -15,10 +15,6 @@ use AGAT::Utilities; our @ISA = qw(Exporter); our @EXPORT = qw(execute_R_command rcc_density_one_row_per_file rcc_plot_from_list may_i_plot); -sub import { - AGAT::PlotR->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::PlotR->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} =head1 SYNOPSIS diff --git a/lib/AGAT/Utilities.pm b/lib/AGAT/Utilities.pm index d1a91455..b99bfa2d 100644 --- a/lib/AGAT/Utilities.pm +++ b/lib/AGAT/Utilities.pm @@ -13,11 +13,6 @@ our @EXPORT = qw(exists_keys exists_undef_value get_proper_codon_table surround_ sizedPrint activate_warning_limit print_time dual_print file_text_line print_wrap_text string_sep_to_hash); -sub import { - AGAT::Utilities->export_to_level(1, @_); # to be able to load the EXPORT functions when direct call; (normal case) - AGAT::Utilities->export_to_level(2, @_); # to be able to load the EXPORT functions when called from one level up; -} - =head1 SYNOPSIS package containing utility tools