Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
FernandoDuarteF authored Oct 29, 2024
2 parents a6fd2a4 + 3a29414 commit 5e88fd9
Show file tree
Hide file tree
Showing 18 changed files with 275 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ results/
test.xml
testing*
testing/
work/
work/
1 change: 1 addition & 0 deletions bin/busco_2_table.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/python3
import pandas as pd
import argparse

Expand Down
1 change: 1 addition & 0 deletions bin/plot_tree_summary.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/Rscript
# Load necessary libraries
if (!requireNamespace("argparse", quietly = TRUE)) {
install.packages("argparse")
Expand Down
1 change: 1 addition & 0 deletions bin/plot_tree_summary2.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/Rscript
# Load necessary libraries
if (!requireNamespace("argparse", quietly = TRUE)) {
install.packages("argparse")
Expand Down
1 change: 1 addition & 0 deletions bin/quast_2_table.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/python3
import pandas as pd
import argparse
import os
Expand Down
7 changes: 7 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,11 @@ process {
]
}

withName: 'LONGEST' {
publishDir = [
path: { "$params.outdir/output_data/longest" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
]
}
}
2 changes: 1 addition & 1 deletion conf/test_full.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

params {
config_profile_name = 'Full test profile'
config_profile_description = 'Full test dataset of hymenpotera genomes'
config_profile_description = 'Full test dataset of Hymenoptera genomes'

input = 'assets/samplesheet.csv'

Expand Down
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
"https://github.com/nf-core/modules.git": {
"modules": {
"nf-core": {
"agat/convertspgxf2gxf": {
"branch": "master",
"git_sha": "666652151335353eef2fcd58880bcef5bc2928e1",
"installed_by": ["modules"]
},
"agat/spstatistics": {
"branch": "master",
"git_sha": "666652151335353eef2fcd58880bcef5bc2928e1",
Expand Down
6 changes: 3 additions & 3 deletions modules/local/gffread.nf
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ process GFFREAD {
fi
${projectDir}/bin/gff_to_genetranshash.2.pl
${projectDir}/bin/prot_fasta_to_longest.pl ${prefix}.prot.fa ${prefix}_longestisoform.txt
${projectDir}/bin/fasta_topIsoform.pl ${prefix}.splicedcds.fa ${prefix}_longestisoform.txt
gff_to_genetranshash.2.pl
prot_fasta_to_longest.pl ${prefix}.prot.fa ${prefix}_longestisoform.txt
fasta_topIsoform.pl ${prefix}.splicedcds.fa ${prefix}_longestisoform.txt
#This part checks if longest isoform worked, if not we will continue with all proteins into Orthofinder. Warning sent to screen.
Expand Down
1 change: 0 additions & 1 deletion modules/local/longest.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ process LONGEST {
label 'process_med_memory'

container = 'biocontainers/agat:1.3.0--pl5321hdfd78af_0'
publishDir "$params.outdir/output_data/longest" , mode: "${params.publish_dir_mode}", pattern:"*.txt"

input:
tuple val (meta), path(gff)
Expand Down
8 changes: 4 additions & 4 deletions modules/local/tree_summary.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ process TREE_SUMMARY {
cut -f 1,3,4,5,6,7 Busco_combined >> Busco_combined_cut
sed -i \'s/\\.fasta//g\' Busco_combined_cut
python3 ${projectDir}/bin/busco_2_table.py Busco_combined_cut Busco_to_plot.tsv
busco_2_table.py Busco_combined_cut Busco_to_plot.tsv
# Combine QUAST ouput
python3 ${projectDir}/bin/quast_2_table.py *quast.tsv -o Quast_to_plot.tsv -col N50,N90 -plot_types bar,bar
quast_2_table.py *quast.tsv -o Quast_to_plot.tsv -col N50,N90 -plot_types bar,bar
#Remove unwanted extensions from Busco tables
sed \'s/.prot.fa.largestIsoform.fa//g\' Busco_to_plot.tsv > Busco_to_plot_final.tsv
sed \'s/.prot.fa.largestIsoform.fa//g\' Quast_to_plot.tsv > Quast_to_plot_final.tsv
# Run summary plot
/usr/bin/Rscript ${projectDir}/bin/plot_tree_summary2.R tree.nw Busco_to_plot_final.tsv --tree_size 0.6
/usr/bin/Rscript ${projectDir}/bin/plot_tree_summary.R tree.nw Quast_to_plot_final.tsv --tree_size 0.6
plot_tree_summary2.R tree.nw Busco_to_plot_final.tsv --tree_size 0.6
plot_tree_summary.R tree.nw Quast_to_plot_final.tsv --tree_size 0.6
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
5 changes: 5 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
channels:
- conda-forge
- bioconda
dependencies:
- bioconda::agat=1.4.0
48 changes: 48 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
process AGAT_CONVERTSPGXF2GXF {
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(gxf)

output:
tuple val(meta), path("*.agat.gff") , emit: output_gff
tuple val(meta), path("*.log") , emit: log
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}"
"""
agat_convert_sp_gxf2gxf.pl \\
--gxf $gxf \\
--output ${prefix}.agat.gff \\
$args
cat <<-END_VERSIONS > versions.yml
"${task.process}":
agat: \$(agat_convert_sp_gxf2gxf.pl --help | sed -n 's/.*(AGAT) - Version: \\(.*\\) .*/\\1/p')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.agat.gff
touch ${gxf}.agat.log
cat <<-END_VERSIONS > versions.yml
"${task.process}":
agat: \$(agat_convert_sp_gxf2gxf.pl --help | sed -n 's/.*(AGAT) - Version: \\(.*\\) .*/\\1/p')
END_VERSIONS
"""
}
56 changes: 56 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: agat_convertspgxf2gxf
description: |
Fixes and standardizes GFF/GTF files and outputs a cleaned GFF/GTF file
keywords:
- genome
- gff
- gtf
- conversion
tools:
- agat:
description: "AGAT is a toolkit for manipulation and getting information from
GFF/GTF files"
homepage: "https://github.com/NBISweden/AGAT"
documentation: "https://agat.readthedocs.io/"
tool_dev_url: "https://github.com/NBISweden/AGAT"
doi: "10.5281/zenodo.3552717"
licence: ["GPL v3"]
identifier: biotools:AGAT
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- gxf:
type: file
description: Annotation file in GFF3/GTF format
pattern: "*.{gff, gtf}"
output:
- output_gff:
- meta:
type: file
description: Cleaned annotation file in GFF3 format
pattern: "*.{gff}"
- "*.agat.gff":
type: file
description: Cleaned annotation file in GFF3 format
pattern: "*.{gff}"
- log:
- meta:
type: file
description: Log file of the conversion process
pattern: "*.{log}"
- "*.log":
type: file
description: Log file of the conversion process
pattern: "*.{log}"
- versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@toniher"
maintainers:
- "@toniher"
60 changes: 60 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "agat"
tag "agat/convertspgxf2gxf"

test("sarscov2 genome [gtf]") {

when {
process {
"""
input[0] = [
[ id: 'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gtf', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out.output_gff,
process.out.versions).match() },
{ assert path(process.out.log[0][1]).exists() }
)
}

}

test("sarscov2 genome [gtf] - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id: 'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.gtf', checkIfExists: true)
]
"""
}
}

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

}

}
71 changes: 71 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"sarscov2 genome [gtf] - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"test.agat.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
[
{
"id": "test"
},
"genome.gtf.agat.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"2": [
"versions.yml:md5,5ec6166c5c080ec4bc08a8fe55ada486"
],
"log": [
[
{
"id": "test"
},
"genome.gtf.agat.log:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"output_gff": [
[
{
"id": "test"
},
"test.agat.gff:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,5ec6166c5c080ec4bc08a8fe55ada486"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-12T12:25:34.583294"
},
"sarscov2 genome [gtf]": {
"content": [
[
[
{
"id": "test"
},
"test.agat.gff:md5,7d7e9bcd82a2f0bb7d8a38f85e82f0bc"
]
],
[
"versions.yml:md5,5ec6166c5c080ec4bc08a8fe55ada486"
]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-12T12:21:21.310464"
}
}
2 changes: 2 additions & 0 deletions modules/nf-core/agat/convertspgxf2gxf/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
agat/convertspgxf2gxf:
- "modules/nf-core/agat/convertspgxf2gxf/**"
Loading

0 comments on commit 5e88fd9

Please sign in to comment.