mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 02:58:17 +00:00
new (fixed) module: entrezdirect/xtract (#1926)
* first commit: module files * last version main.nf * modules/entrezdirect/xtract/meta.yml * updated file * updated test * Update modules/entrezdirect/xtract/main.nf changed name of output file Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update modules/entrezdirect/xtract/meta.yml Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> * Update tests/modules/entrezdirect/xtract/main.nf Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk> * Update tests/modules/entrezdirect/xtract/main.nf Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk> * updated test, removed esummary input file Co-authored-by: James A. Fellows Yates <jfy133@gmail.com> Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk>
This commit is contained in:
parent
f420d97ca2
commit
ad426cb18c
6 changed files with 170 additions and 0 deletions
39
modules/entrezdirect/xtract/main.nf
Normal file
39
modules/entrezdirect/xtract/main.nf
Normal file
|
@ -0,0 +1,39 @@
|
|||
process ENTREZDIRECT_XTRACT {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::entrez-direct=16.2" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/entrez-direct:16.2--he881be0_1':
|
||||
'quay.io/biocontainers/entrez-direct:16.2--he881be0_1' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(xml_input)
|
||||
val pattern
|
||||
val element
|
||||
val sep
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.txt"), emit: txt
|
||||
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}"
|
||||
"""
|
||||
cat $xml_input | xtract \\
|
||||
-pattern $pattern \\
|
||||
-tab $sep \\
|
||||
-element $element \\
|
||||
$args \\
|
||||
> ${prefix}.txt
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
xtract: \$(xtract -version)
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
59
modules/entrezdirect/xtract/meta.yml
Normal file
59
modules/entrezdirect/xtract/meta.yml
Normal file
|
@ -0,0 +1,59 @@
|
|||
name: "entrezdirect_xtract"
|
||||
description: Queries an NCBI database using an UID
|
||||
keywords:
|
||||
- public datasets
|
||||
- entrez
|
||||
- search
|
||||
- ncbi
|
||||
- database
|
||||
tools:
|
||||
- entrezdirect:
|
||||
description: |
|
||||
Entrez Direct (EDirect) is a method for accessing the NCBI's set of
|
||||
interconnected databases (publication, sequence, structure, gene,
|
||||
variation, expression, etc.) from a UNIX terminal window. Functions
|
||||
take search terms from command line arguments. Individual operations
|
||||
are combined to build multi-step queries. Record retrieval and
|
||||
formatting normally complete the process.
|
||||
homepage: https://www.ncbi.nlm.nih.gov/books/NBK179288/
|
||||
documentation: https://www.ncbi.nlm.nih.gov/books/NBK25501/
|
||||
tool_dev_url: https://www.ncbi.nlm.nih.gov/books/NBK25498/
|
||||
doi: 10.1016/S0076-6879(96)66012-1
|
||||
licence: ["PUBLIC DOMAIN"]
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- xml_input:
|
||||
type: file
|
||||
description: XML text file containing query results from database.
|
||||
- pattern:
|
||||
type: value
|
||||
description: String in xml_input that encloses element to search.
|
||||
- element:
|
||||
type: value
|
||||
description: Space-delimited strings that will be converted to columns.
|
||||
- sep:
|
||||
type: value
|
||||
description: Separator/delimiter between columns (for instance "," or "\t").
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- xtract_table:
|
||||
type: file
|
||||
description: TXT file containing columns searched from element.
|
||||
pattern: "*.txt"
|
||||
|
||||
authors:
|
||||
- "@alxndrdiaz"
|
|
@ -695,6 +695,10 @@ entrezdirect/esummary:
|
|||
- modules/entrezdirect/esummary/**
|
||||
- tests/modules/entrezdirect/esummary/**
|
||||
|
||||
entrezdirect/xtract:
|
||||
- modules/entrezdirect/xtract/**
|
||||
- tests/modules/entrezdirect/xtract/**
|
||||
|
||||
expansionhunter:
|
||||
- modules/expansionhunter/**
|
||||
- tests/modules/expansionhunter/**
|
||||
|
|
46
tests/modules/entrezdirect/xtract/main.nf
Normal file
46
tests/modules/entrezdirect/xtract/main.nf
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env nextflow
|
||||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { ENTREZDIRECT_ESUMMARY } from '../../../../modules/entrezdirect/esummary/main.nf'
|
||||
include { ENTREZDIRECT_XTRACT } from '../../../../modules/entrezdirect/xtract/main.nf'
|
||||
|
||||
//
|
||||
// Test with Assembly database
|
||||
//
|
||||
workflow test_entrezdirect_xtract_assembly {
|
||||
|
||||
input = [
|
||||
[ id:'test_assembly' ], // meta map
|
||||
uid = '191021',
|
||||
[]
|
||||
]
|
||||
database = 'assembly'
|
||||
|
||||
pattern_in = 'DocumentSummary'
|
||||
element_in = 'SpeciesName BioprojectAccn FtpPath_GenBank'
|
||||
delim = ","
|
||||
|
||||
ENTREZDIRECT_ESUMMARY ( input, database )
|
||||
ENTREZDIRECT_XTRACT ( ENTREZDIRECT_ESUMMARY.out.xml, pattern_in, element_in, delim )
|
||||
}
|
||||
|
||||
//
|
||||
// Test with Genome database
|
||||
//
|
||||
workflow test_entrezdirect_xtract_genome {
|
||||
|
||||
input = [
|
||||
[ id:'test_genome' ], // meta map
|
||||
uid = '768',
|
||||
[]
|
||||
]
|
||||
database = 'genome'
|
||||
|
||||
pattern_in = 'DocumentSummary'
|
||||
element_in = 'TaxId Organism_Name Project_Accession Assembly_Accession'
|
||||
delim = ","
|
||||
|
||||
ENTREZDIRECT_ESUMMARY ( input, database )
|
||||
ENTREZDIRECT_XTRACT ( ENTREZDIRECT_ESUMMARY.out.xml, pattern_in, element_in, delim )
|
||||
}
|
5
tests/modules/entrezdirect/xtract/nextflow.config
Normal file
5
tests/modules/entrezdirect/xtract/nextflow.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
process {
|
||||
|
||||
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
|
||||
|
||||
}
|
17
tests/modules/entrezdirect/xtract/test.yml
Normal file
17
tests/modules/entrezdirect/xtract/test.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
- name: entrezdirect xtract test_entrezdirect_xtract_assembly
|
||||
command: nextflow run ./tests/modules/entrezdirect/xtract -entry test_entrezdirect_xtract_assembly -c ./tests/config/nextflow.config -c ./tests/modules/entrezdirect/xtract/nextflow.config
|
||||
tags:
|
||||
- entrezdirect/xtract
|
||||
- entrezdirect
|
||||
files:
|
||||
- path: output/entrezdirect/test_assembly.xml
|
||||
md5sum: 32f81147eea61df5814e87c2df1092a9
|
||||
|
||||
- name: entrezdirect xtract test_entrezdirect_xtract_genome
|
||||
command: nextflow run ./tests/modules/entrezdirect/xtract -entry test_entrezdirect_xtract_genome -c ./tests/config/nextflow.config -c ./tests/modules/entrezdirect/xtract/nextflow.config
|
||||
tags:
|
||||
- entrezdirect/xtract
|
||||
- entrezdirect
|
||||
files:
|
||||
- path: output/entrezdirect/test_genome.xml
|
||||
md5sum: af6242f231bdc147d6197edfd0954585
|
Loading…
Reference in a new issue