Skip to content

Commit

Permalink
Added agat/spfilterfeaturefromkilllist (#5771)
Browse files Browse the repository at this point in the history
* Added agat/spfilterfeaturefromkilllist

* Added AGAT config

* Included test with agat config
  • Loading branch information
GallVp authored Jul 3, 2024
1 parent 859ab06 commit d153588
Show file tree
Hide file tree
Showing 6 changed files with 331 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "agat_spfilterfeaturefromkilllist"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::agat=1.4.0"
53 changes: 53 additions & 0 deletions modules/nf-core/agat/spfilterfeaturefromkilllist/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
process AGAT_SPFILTERFEATUREFROMKILLLIST {
tag "$meta.id"
label 'process_single'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/agat:1.4.0--pl5321hdfd78af_0':
'biocontainers/agat:1.4.0--pl5321hdfd78af_0' }"

input:
tuple val(meta), path(gff)
path kill_list
path config

output:
tuple val(meta), path("*.gff"), emit: gff
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def config_param = config ? "--config $config" : ''
if( "$gff" == "${prefix}.gff" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
agat_sp_filter_feature_from_kill_list.pl \\
--gff $gff \\
--kill_list $kill_list \\
$config_param \\
$args \\
--output "${prefix}.gff"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
agat: \$(agat_sp_filter_feature_from_kill_list.pl -h | sed -n 's/.*(AGAT) - Version: \\(.*\\) .*/\\1/p')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
if( "$gff" == "${prefix}.gff" ) error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
"""
touch "${prefix}.gff"
cat <<-END_VERSIONS > versions.yml
"${task.process}":
agat: \$(agat_sp_filter_feature_from_kill_list.pl -h | sed -n 's/.*(AGAT) - Version: \\(.*\\) .*/\\1/p')
END_VERSIONS
"""
}
60 changes: 60 additions & 0 deletions modules/nf-core/agat/spfilterfeaturefromkilllist/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "agat_spfilterfeaturefromkilllist"
description: |
The script aims to remove features based on a kill list. The default behaviour is to look at the features's ID.
If the feature has an ID (case insensitive) listed among the kill list it will be removed. /!\ Removing a level1
or level2 feature will automatically remove all linked subfeatures, and removing all children of a feature will
automatically remove this feature too.
keywords:
- genomics
- gff
- remove
- feature
tools:
- "agat":
description: "Another Gff Analysis Toolkit (AGAT). Suite of tools to handle gene annotations in any GTF/GFF format."
homepage: "https://agat.readthedocs.io/en/latest/"
documentation: "https://agat.readthedocs.io/en/latest/tools/agat_sp_filter_feature_from_kill_list.html"
tool_dev_url: "https://github.com/NBISweden/AGAT"
doi: "10.5281/zenodo.3552717"
licence: ["GPL v3"]
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- gff:
type: file
description: Input GFF3 file that will be read
pattern: "*.{gff,gff3}"
- kill_list:
type: file
description: Kill list. One value per line.
pattern: "*.txt"
- config:
type: file
description: |
Input agat config file. By default AGAT takes as input agat_config.yaml file from the working directory if any, otherwise it takes the orignal agat_config.yaml shipped with AGAT. To get the agat_config.yaml locally type: "agat config --expose". The --config option gives you the possibility to use your own AGAT config file (located elsewhere or named differently).
pattern: "*.yaml"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- gff:
type: file
description: Output GFF file.
pattern: "*.gff"

authors:
- "@GallVp"
maintainers:
- "@GallVp"
104 changes: 104 additions & 0 deletions modules/nf-core/agat/spfilterfeaturefromkilllist/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
nextflow_process {

name "Test Process AGAT_SPFILTERFEATUREFROMKILLLIST"
script "../main.nf"
process "AGAT_SPFILTERFEATUREFROMKILLLIST"

tag "modules"
tag "modules_nfcore"
tag "agat"
tag "agat/spfilterfeaturefromkilllist"

test("sarscov2 - gff3") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3', checkIfExists: true)
]
def kill_list = "unknown_transcript_1"
def kill_list_file = new File('kill.list.txt')
kill_list_file.text = kill_list
input[1] = kill_list_file.toPath()
input[2] = []
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2 - gff3 - config") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3', checkIfExists: true)
]
def kill_list = "unknown_transcript_1"
def kill_list_file = new File('kill.list.txt')
kill_list_file.text = kill_list
input[1] = kill_list_file.toPath()
input[2] = file(params.modules_testdata_base_path + 'generic/config/agat_config.yaml', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("sarscov2 - gff3 - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gff3', checkIfExists: true)
]
def kill_list = "unknown_transcript_1"
def kill_list_file = new File('kill.list.txt')
kill_list_file.text = kill_list
input[1] = kill_list_file.toPath()
input[2] = []
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"sarscov2 - gff3 - config": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.gff:md5,df19e1b84ba6f691d20c72b397c88abf"
]
],
"1": [
"versions.yml:md5,e2962240799182aee69421c746be183a"
],
"gff": [
[
{
"id": "test"
},
"test.gff:md5,df19e1b84ba6f691d20c72b397c88abf"
]
],
"versions": [
"versions.yml:md5,e2962240799182aee69421c746be183a"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-03T15:32:54.707393"
},
"sarscov2 - gff3 - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,e2962240799182aee69421c746be183a"
],
"gff": [
[
{
"id": "test"
},
"test.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,e2962240799182aee69421c746be183a"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-03T15:32:59.888053"
},
"sarscov2 - gff3": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.gff:md5,df19e1b84ba6f691d20c72b397c88abf"
]
],
"1": [
"versions.yml:md5,e2962240799182aee69421c746be183a"
],
"gff": [
[
{
"id": "test"
},
"test.gff:md5,df19e1b84ba6f691d20c72b397c88abf"
]
],
"versions": [
"versions.yml:md5,e2962240799182aee69421c746be183a"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-03T15:32:47.772624"
}
}
7 changes: 4 additions & 3 deletions tests/config/test_data.config
Original file line number Diff line number Diff line change
Expand Up @@ -744,9 +744,10 @@ params {
seed_file = "${params.test_data_base}/data/delete_me/estsfs/seedfile.txt"
}
'config' {
ncbi_user_settings = "${params.test_data_base}/data/generic/config/ncbi_user_settings.mkfg"
config_test_datavzrd = "${params.test_data_base}/data/generic/config/config_test.datavzrd.yaml"
agat_config = "${params.test_data_base}/data/generic/config/agat_config.yaml"
config_network_datavzrd = "${params.test_data_base}/data/generic/config/config_network.datavzrd.yaml"
config_test_datavzrd = "${params.test_data_base}/data/generic/config/config_test.datavzrd.yaml"
ncbi_user_settings = "${params.test_data_base}/data/generic/config/ncbi_user_settings.mkfg"
}
'unsorted_data' {
'unsorted_text' {
Expand Down Expand Up @@ -774,7 +775,7 @@ params {
}
'parameter' {
maxquant = "${params.test_data_base}/data/proteomics/parameter/mqpar.xml"
sage_base_config = "${params.test_data_base}/data/proteomics/parameter/sage_base_config.json"
sage_base_config = "${params.test_data_base}/data/proteomics/parameter/sage_base_config.json"
}
'openms' {
idxml1 = "${params.test_data_base}/data/proteomics/openms/HepG2_rep1_small.idXML"
Expand Down

0 comments on commit d153588

Please sign in to comment.