From 2a8ef7260c40617243293ee45793992f39eca3db Mon Sep 17 00:00:00 2001 From: Jacques Dainat Date: Tue, 3 Dec 2024 12:05:42 +0100 Subject: [PATCH] add test for param deflate_attribute --- t/config.t | 1 + t/config/out/agat_config.yaml | 1 + t/gff_other.t | 20 ++++++++++++++++---- t/gff_other/in/issue457.gff | 4 ++++ t/gff_other/out/issue457.gtf | 5 +++++ 5 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 t/gff_other/in/issue457.gff create mode 100644 t/gff_other/out/issue457.gtf diff --git a/t/config.t b/t/config.t index 79ecaf6f..5dfbc7d3 100644 --- a/t/config.t +++ b/t/config.t @@ -40,6 +40,7 @@ system("$script config -e \\ --gff_output_version 2 \\ --gtf_output_version 2 \\ --debug \\ + --deflate_attribute \\ --no-check_all_level1_locations \\ --no-check_identical_isoforms \\ --no-check_utrs \\ diff --git a/t/config/out/agat_config.yaml b/t/config/out/agat_config.yaml index 48715279..1537fadb 100644 --- a/t/config/out/agat_config.yaml +++ b/t/config/out/agat_config.yaml @@ -12,6 +12,7 @@ check_utrs: false clean_attributes_from_template: true create_l3_for_l2_orphan: false debug: true +deflate_attribute: true force_gff_input_version: 3 gff_output_version: 2 gtf_output_version: 2 diff --git a/t/gff_other.t b/t/gff_other.t index ae38a000..cca172a0 100644 --- a/t/gff_other.t +++ b/t/gff_other.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 8; +use Test::More tests => 9; =head1 DESCRIPTION @@ -101,7 +101,7 @@ $correct_output = "$output_folder/issue448.gtf"; system("$script_agat config --expose --output_format gtf 2>&1 1>/dev/null"); system("$script --g $input_folder/issue448.gtf -o $pathtmp 2>&1 1>/dev/null"); -ok( system("diff $pathtmp $correct_output") == 0, "issue441 check"); +ok( system("diff $pathtmp $correct_output") == 0, "issue448 check"); unlink $pathtmp; unlink $config; @@ -109,5 +109,17 @@ unlink $config; $correct_output = "$output_folder/issue448.gff"; system("$script --g $input_folder/issue448.gtf -o $pathtmp 2>&1 1>/dev/null"); -ok( system("diff $pathtmp $correct_output") == 0, "issue441 check"); -unlink $pathtmp; \ No newline at end of file +ok( system("diff $pathtmp $correct_output") == 0, "issue448 check"); +unlink $pathtmp; + +# --------- Issue 457 multi-values attributes (gene_name "26266" "MT-TL1";) can be deflated to be compliant with GTF and CellRanger + +$script = $script_prefix."bin/agat_convert_sp_gff2gtf.pl"; +$correct_output = "$output_folder/issue457.gtf"; + +system("$script_agat config --expose --deflate_attribute 2>&1 1>/dev/null"); +system("$script --gff $input_folder/issue457.gff -o $pathtmp 2>&1 1>/dev/null"); + +ok( system("diff $pathtmp $correct_output") == 0, "issue457 check"); +unlink $pathtmp; +unlink $config; \ No newline at end of file diff --git a/t/gff_other/in/issue457.gff b/t/gff_other/in/issue457.gff new file mode 100644 index 00000000..48ff345d --- /dev/null +++ b/t/gff_other/in/issue457.gff @@ -0,0 +1,4 @@ +##gff-version 3 +chrM AGAT gene 3230 3304 . + . ID=agat-gene-1;gene_id=26266;gene_name=26266,MT-TL1;gene_type=misc_RNA;hgnc_id=HGNC:7490;level=3;merged_ID=ENSG00000209082.1;merged_gene_id=ENSG00000209082.1,26266;tag=basic,Ensembl_canonical;transcript_name=26266,MT-TL1-201;transcript_support_level=NA;transcript_type=misc_RNA +chrM ENSEMBL transcript 3230 3304 . + . ID=26266;Parent=agat-gene-1;gene_id=26266;gene_name=26266;gene_type=misc_RNA;level=3;merged_ID=ENST00000386347.1;merged_Parent=ENSG00000209082.1;merged_gene_id=ENSG00000209082.1,26266;merged_gene_name=MT-TL1,26266;merged_gene_type=misc_RNA;merged_hgnc_id=HGNC:7490;merged_level=3;merged_tag=basic,Ensembl_canonical;merged_transcript_id=ENST00000386347.1,26266;merged_transcript_name=MT-TL1-201,26266;merged_transcript_support_level=NA;merged_transcript_type=misc_RNA;transcript_id=26266;transcript_name=26266;transcript_type=misc_RNA +chrM ENSEMBL exon 3230 3304 . + . ID=agat-exon-1;Parent=26266;gene_id=26266;gene_name=26266;gene_type=misc_RNA;level=3;transcript_id=26266;transcript_name=26266;transcript_type=misc_RNA diff --git a/t/gff_other/out/issue457.gtf b/t/gff_other/out/issue457.gtf new file mode 100644 index 00000000..93ba5861 --- /dev/null +++ b/t/gff_other/out/issue457.gtf @@ -0,0 +1,5 @@ +##gtf-version X +# GFF-like GTF i.e. not checked against any GTF specification. Conversion based on GFF input, standardised by AGAT. +chrM AGAT gene 3230 3304 . + . gene_id "26266"; ID "agat-gene-1"; gene_name "26266"; gene_name_1 "MT-TL1"; gene_type "misc_RNA"; hgnc_id "HGNC:7490"; level "3"; merged_ID "ENSG00000209082.1"; merged_gene_id "ENSG00000209082.1"; merged_gene_id_1 "26266"; tag "basic"; tag_1 "Ensembl_canonical"; transcript_name "26266"; transcript_name_1 "MT-TL1-201"; transcript_support_level "NA"; transcript_type "misc_RNA"; +chrM ENSEMBL transcript 3230 3304 . + . gene_id "26266"; transcript_id "26266"; ID "26266"; Parent "agat-gene-1"; gene_name "26266"; gene_type "misc_RNA"; level "3"; merged_ID "ENST00000386347.1"; merged_Parent "ENSG00000209082.1"; merged_gene_id "ENSG00000209082.1"; merged_gene_id_1 "26266"; merged_gene_name "MT-TL1"; merged_gene_name_1 "26266"; merged_gene_type "misc_RNA"; merged_hgnc_id "HGNC:7490"; merged_level "3"; merged_tag "basic"; merged_tag_1 "Ensembl_canonical"; merged_transcript_id "ENST00000386347.1"; merged_transcript_id_1 "26266"; merged_transcript_name "MT-TL1-201"; merged_transcript_name_1 "26266"; merged_transcript_support_level "NA"; merged_transcript_type "misc_RNA"; transcript_name "26266"; transcript_type "misc_RNA"; +chrM ENSEMBL exon 3230 3304 . + . gene_id "26266"; transcript_id "26266"; ID "agat-exon-1"; Parent "26266"; gene_name "26266"; gene_type "misc_RNA"; level "3"; transcript_name "26266"; transcript_type "misc_RNA";