Add ENTREZDIRECT/ESUMMARY (#1833)

* first commit

* entrezdirect/esummary fixed version definition

* resolved suggestion

* updated main.nf

* changed output definition

* output: XML file

* output definition:  XML file

* updated XML format in tests

* updated test file

* version: esummary instead of entrezdirect

* output file pattern: *.esummary.xml

* updated test file

* updated versions

* restored versions stdout

* updated test file

* changed xml_esummary pattern

* changed entrezdirect to  esummary version

* updated test file

* Update modules/entrezdirect/esummary/meta.yml

changed output file pattern: "*.xml"

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/entrezdirect/esummary/meta.yml

updated keywords

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/entrezdirect/esummary/main.nf

Output file pattern: *.xml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/entrezdirect/esummary/main.nf

Output file pattern: *.xml

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/entrezdirect/esummary/main.nf

database as separate input channel

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* removed blank spaces in input definition

* database as separate channel

* conditional script for stdin

* updated input definition

* entrez-direct version:16.2_1

* all input channels are separate

* ignore stderr, catch xml stdout

* removed blank lines

* added ids file input

* updated test

* conditional script for input

* removed bad definition of input file

* updated test file

* Update modules/entrezdirect/esummary/main.nf

changed input definition: ui, uids_file

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/entrezdirect/esummary/meta.yml

added uids_file description

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* Update modules/entrezdirect/esummary/main.nf

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* input: uid or uids_file

* updated input

* added uids_file to input

* input file as optional input

* input file as optional input in each test

* new conditional script

* unpdated test file

* single input definition

* added error messages

* updated test

* removed cat from command output

* Update modules/entrezdirect/esummary/main.nf

added comment on use of grep in output

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>

* added comment

* removed blank spaces

* input file: empty list

* input file: empty list

* removed comment at wrong position

* optional file defined as empty list

* updated successful test

* Apply suggestions from code review

Accepted suggestions.

Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk>

* Update modules/entrezdirect/esummary/main.nf

Fixed comment.

Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk>

* Update modules/entrezdirect/esummary/main.nf

Updated grep in output file.

Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk>

* added tail -n+3 before output

* updated successful test

Co-authored-by: James A. Fellows Yates <jfy133@gmail.com>
Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk>
This commit is contained in:
Alexander Ramos Díaz 2022-07-13 11:26:58 -06:00 committed by GitHub
parent d8bef6057b
commit b4452a4881
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 184 additions and 0 deletions

View file

@ -0,0 +1,39 @@
process ENTREZDIRECT_ESUMMARY {
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), val(uid), path(uids_file)
val database
output:
tuple val(meta), path("*.xml"), emit: xml_esummary
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}"
input = uids_file ? "-input ${uids_file}" : "-id ${uid}"
if (!uid && !uids_file) error "No input. Valid input: an identifier or a .txt file with identifiers"
if (uid && uids_file) error "Only one input is required: a single identifier or a .txt file with identifiers"
// use of 'tail -n+3' is to ensure a clean XML file. Otherwise an irrelevant Perl compilation error ends up in the XML
"""
esummary \\
$args \\
-db $database \\
$input | tail -n+3 > ${prefix}.xml
cat <<-END_VERSIONS > versions.yml
"${task.process}":
esummary: \$(esummary -version)
END_VERSIONS
"""
}

View file

@ -0,0 +1,57 @@
name: "entrezdirect_esummary"
description: Queries an NCBI database using Unique Identifier(s)
keywords:
- public datasets
- ncbi
- entrez
- metadata
- query
- 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 ]
- database:
type: value
description: Value must be a valid Entrez database name ('assembly', etc).
- uid:
type: value
description: Unique Identifier (UID) of record in NCBI database. Cannot be used at the same time as uids_file
- uids_file:
type: file
description: Text file containing multiple UIDs. Cannot be used at the same time as uid.
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"
- xml_esummary:
type: file
description: Query result in XML format
pattern: "*.xml"
authors:
- "@alxndrdiaz"

View file

@ -679,6 +679,10 @@ ensemblvep:
- modules/ensemblvep/**
- tests/modules/ensemblvep/**
entrezdirect/esummary:
- modules/entrezdirect/esummary/**
- tests/modules/entrezdirect/esummary/**
expansionhunter:
- modules/expansionhunter/**
- tests/modules/expansionhunter/**

View file

@ -0,0 +1,53 @@
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
include { ENTREZDIRECT_ESUMMARY } from '../../../../modules/entrezdirect/esummary/main.nf'
//
// Test with SRA database
//
workflow test_entrezdirect_esummary_sra {
input = [
[ id:'test_sra' ], // meta map
uid = '5135484',
[]
]
database = 'sra'
ENTREZDIRECT_ESUMMARY ( input, database )
}
//
// Test with Genome database
//
workflow test_entrezdirect_esummary_genome {
input = [
[ id:'test_genome' ], // meta map
uid = '768',
[]
]
database = 'genome'
ENTREZDIRECT_ESUMMARY ( input, database )
}
//
// Test with Assembly database
//
workflow test_entrezdirect_esummary_assembly {
input = [
[ id:'test_assembly' ], // meta map
uid = '191021',
[]
]
database = 'assembly'
ENTREZDIRECT_ESUMMARY ( input, database )
}

View file

@ -0,0 +1,5 @@
process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
}

View file

@ -0,0 +1,26 @@
- name: entrezdirect esummary test_entrezdirect_esummary_sra
command: nextflow run ./tests/modules/entrezdirect/esummary -entry test_entrezdirect_esummary_sra -c ./tests/config/nextflow.config -c ./tests/modules/entrezdirect/esummary/nextflow.config
tags:
- entrezdirect
- entrezdirect/esummary
files:
- path: output/entrezdirect/test_sra.xml
md5sum: aeb7f5710a5447a8de89b9e6fc464606
- name: entrezdirect esummary test_entrezdirect_esummary_genome
command: nextflow run ./tests/modules/entrezdirect/esummary -entry test_entrezdirect_esummary_genome -c ./tests/config/nextflow.config -c ./tests/modules/entrezdirect/esummary/nextflow.config
tags:
- entrezdirect
- entrezdirect/esummary
files:
- path: output/entrezdirect/test_genome.xml
md5sum: 2abea497bcef9312105b23ed78b72f62
- name: entrezdirect esummary test_entrezdirect_esummary_assembly
command: nextflow run ./tests/modules/entrezdirect/esummary -entry test_entrezdirect_esummary_assembly -c ./tests/config/nextflow.config -c ./tests/modules/entrezdirect/esummary/nextflow.config
tags:
- entrezdirect
- entrezdirect/esummary
files:
- path: output/entrezdirect/test_assembly.xml
md5sum: b381959a000c1f3e8c18e7b35d7b2d0a