Skip to content

Commit

Permalink
Merge pull request #211 from Ensembl/mbarba/restructure
Browse files Browse the repository at this point in the history
Restructure: move and rename python files and entrypoints
  • Loading branch information
MatBarba authored Nov 15, 2023
2 parents d597130 + 7c59cc9 commit 987b43b
Show file tree
Hide file tree
Showing 65 changed files with 230 additions and 108 deletions.
6 changes: 3 additions & 3 deletions pipelines/nextflow/modules/database/db_factory.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ process DB_FACTORY {
path "dbs.json"

script:
brc_mode = params.brc_mode ? '--brc_mode 1' : ''
dbname_re = filter_map.dbname_re ? "--dbname_re $filter_map.dbname_re" : ''
brc_mode = params.brc_mode ? '--brc_mode' : ''
dbname_re = filter_map.dbname_re ? "--db_regex $filter_map.dbname_re" : ''
"""
db_factory --host '${server.host}' \
database_factory --host '${server.host}' \
--port '${server.port}' \
--user '${server.user}' \
--password '${server.password}' \
Expand Down
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/download/download_asm_data.nf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ process DOWNLOAD_ASM_DATA {

shell:
'''
retrieve_assembly_data --accession !{meta.accession} --asm_download_dir ./
assembly_download --accession !{meta.accession} --asm_download_dir ./
'''
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/download/download_genbank.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ process DOWNLOAD_GENBANK {
shell:
output_file = "output.gb"
'''
download_genbank --accession !{meta.accession} --output_file !{output_file}
genbank_download --accession !{meta.accession} --output_file !{output_file}
'''
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/events/dump_events.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ process DUMP_EVENTS {
script:
"""
touch "events.txt"
events_dumper --host '${server.host}' \
events_dump --host '${server.host}' \
--port '${server.port}' \
--user '${server.user}' \
--password '${server.password}' \
Expand Down
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/fasta/process_fasta_data.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ process PROCESS_FASTA {
output_fasta = pep_mode == 1 ? "fasta_pep.fa" : "fasta_dna.fa"
pep_mode_flag = pep_mode == 0 ? "" : "--peptide_mode"
'''
prep_fasta_data --fasta_infile !{fasta_file} \
fasta_process --fasta_infile !{fasta_file} \
--genbank_infile !{gbff_file} \
--fasta_outfile !{output_fasta} \
!{pep_mode_flag}
Expand Down
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/files/collect_files_db.nf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ process MANIFEST {

script:
"""
manifest_maker --manifest_dir ${collect_dir}
manifest_generate --manifest_dir ${collect_dir}
"""
}

Expand Down
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/genbank/extract_from_gb.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ process EXTRACT_FROM_GB {

shell:
'''
extract_from_gb --prefix !{meta.prefix} --prod_name !{meta.production_name} --gb_file !{gb_file}
genbank_extract_data --prefix !{meta.prefix} --prod_name !{meta.production_name} --gb_file !{gb_file}
'''
}

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ process AMEND_GENOME_DATA {

shell:
'''
amend_genomic_data --genome_infile !{genome_json} \
genome_metadata_extend --genome_infile !{genome_json} \
--report_file !{asm_report} \
--genbank_infile !{genbank_gbff} \
--genome_outfile genome.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ process DUMP_GENOME_META {

script:
"""
touch $output
genome_meta_dumper --host '${server.host}' \
genome_metadata_dump --host '${server.host}' \
--port '${server.port}' \
--user '${server.user}' \
--password '${server.password}' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ process DUMP_GENOME_STATS {

script:
"""
genome_stats_dumper --host '${server.host}' \
genome_stats_dump --host '${server.host}' \
--port '${server.port}' \
--user '${server.user}' \
--password '${server.password}' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ process PREPARE_GENOME_METADATA {
shell:
output_json = "genome.json"
'''
prepare_genome_metadata --input_file !{input_json} --output_file !{output_json}
genome_metadata_prepare --input_file !{input_json} --output_file !{output_json}
'''
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/gff3/process_gff3.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ process PROCESS_GFF3 {
out_func = "functional_annotation.json"
out_gff = "gene_models.gff3"
'''
process_gff3 --genome_data !{genome} --in_gff_path !{gff3} --out_gff_path !{out_gff} \
gff3_process --genome_data !{genome} --in_gff_path !{gff3} --out_gff_path !{out_gff} \
--out_func_path !{out_func}
'''
}
4 changes: 2 additions & 2 deletions pipelines/nextflow/modules/manifest/check_integrity_db.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ process CHECK_INTEGRITY {
tuple val(db), path(manifest_dir, includeInputs: true)

script:
brc_mode = params.brc_mode ? '--brc_mode 1' : ''
brc_mode = params.brc_mode ? '--brc_mode' : ''
"""
check_integrity --manifest_file ${manifest_dir}/manifest.json $brc_mode
manifest_check_integrity --manifest_file ${manifest_dir}/manifest.json $brc_mode
"""
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/manifest/integrity.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ process CHECK_INTEGRITY {
shell:
brc_mode = params.brc_mode ? '--brc_mode' : ''
'''
check_integrity --manifest_file ./manifest.json !{brc_mode}
manifest_check_integrity --manifest_file ./manifest.json !{brc_mode}
'''
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/manifest/manifest_maker.nf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ process MANIFEST {

shell:
'''
manifest_maker --manifest_dir .
manifest_generate --manifest_dir .
'''
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/manifest/manifest_stats.nf
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ process MANIFEST_STATS {
if [ "!{ncbi_check}" == 1 ]; then
CHECK_ASSEMBLY=" --datasets_bin !{datasets} --accession !{meta.accession}"
fi
manifest_stats --manifest_dir ./ $CHECK_ASSEMBLY
manifest_compute_stats --manifest_dir ./ $CHECK_ASSEMBLY
'''
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/patch_build/format_events.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ process FORMAT_EVENTS {
script:
def final_events = "events.tab"
"""
format_events \\
events_format \\
--input_file $events \\
--map $new_genes \\
--deletes $deletes \\
Expand Down
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/patch_build/load_events.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ process LOAD_EVENTS {

script:
"""
events_loader \\
events_load \\
--host $server.host \\
--user $server.user \\
--port $server.port \\
Expand Down
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/schema/check_json_schema.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ process CHECK_JSON_SCHEMA {
shell:
schema = params.json_schemas[json_file.baseName]
'''
check_json_schema --json_file !{json_file} --json_schema !{schema}
schemas_json_validate --json_file !{json_file} --json_schema !{schema}
'''
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/schema/check_json_schema_db.nf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ process CHECK_JSON_SCHEMA {
script_dir = workflow.projectDir.toString()
schema_path = new File(script_dir + "/../../../../schemas", schema_name + "_schema.json")
"""
check_json_schema --json_file ${json_file} --json_schema ${schema_path}
schemas_json_validate --json_file ${json_file} --json_schema ${schema_path}
"""
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/schema/json_schema_factory.nf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ process JSON_SCHEMA_FACTORY {

script:
"""
json_schema_factory --manifest_dir ${manifest_dir} --metadata_types "${metadata_types}"
schemas_json_factory --manifest_dir ${manifest_dir} --metadata_types "${metadata_types}"
"""
}
2 changes: 1 addition & 1 deletion pipelines/nextflow/modules/seq_region/dump_seq_regions.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ process DUMP_SEQ_REGIONS {
script:
"""
touch seq_region.json
seq_region_dumper --host '${server.host}' \
seq_region_dump --host '${server.host}' \
--port '${server.port}' \
--user '${server.user}' \
--password '${server.password}' \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ process PROCESS_SEQ_REGION {
shell:
brc_mode = params.brc_mode ? '--brc_mode' : ''
'''
prepare_seq_region \
seq_region_prepare \
--genome_file !{genome_json} \
--report_file !{assembly_report} \
--gbff_file !{genomic_gbff} \
Expand Down
62 changes: 33 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,41 @@ homepage = "https://www.ensembl.org"
repository = "https://github.com/Ensembl/ensembl-genomio"

[project.scripts]
# Download
retrieve_assembly_data = "ensembl.io.genomio.assembly.get_assembly_data:main"
# Genbank
extract_from_gb = "ensembl.io.genomio.genbank.extract_from_genbank:main"
download_genbank = "ensembl.io.genomio.genbank.get_genbank:main"
# Prepare
amend_genomic_data = "ensembl.io.genomio.metadata.update_genome_metadata:main"
prep_fasta_data = "ensembl.io.genomio.fastaprep.process_fasta:main"
prepare_genome_metadata = "ensembl.io.genomio.metadata.prepare_genome:main"
prepare_seq_region = "ensembl.io.genomio.metadata.prepare_seq_region:main"
process_gff3 = "ensembl.io.genomio.gff3.process_gff3:main"
# Schema
check_json_schema = "ensembl.io.genomio.schemas.json_schema_validator:main"
json_schema_factory = "ensembl.io.genomio.schemas.json_schema_factory:main"
# Assembly
assembly_download = "ensembl.io.genomio.assembly.download:main"
# Database
database_factory = "ensembl.io.genomio.database.factory:main"
# Events
events_dump = "ensembl.io.genomio.events.dump:main"
events_load = "ensembl.io.genomio.events.load:main"
events_format = "ensembl.io.genomio.events.format:main"
# Fasta
fasta_process = "ensembl.io.genomio.fasta.process:main"
# GenBank
genbank_download = "ensembl.io.genomio.genbank.download:main"
genbank_extract_data = "ensembl.io.genomio.genbank.extract_data:main"
# Genome metadata
genome_metadata_dump = "ensembl.io.genomio.genome_metadata.dump:main"
genome_metadata_extend = "ensembl.io.genomio.genome_metadata.extend:main"
genome_metadata_prepare = "ensembl.io.genomio.genome_metadata.prepare:main"
# Genome statistics
genome_stats_compare = "ensembl.io.genomio.genome_stats.compare:main"
genome_stats_dump = "ensembl.io.genomio.genome_stats.dump:main"
# GFF3
gff3_extract_annotation = "ensembl.io.genomio.gff3.extract_annotation:main"
gff3_process = "ensembl.io.genomio.gff3.process:main"
# Manifest
manifest_check_integrity = "ensembl.io.genomio.manifest.check_integrity:main"
manifest_compute_stats = "ensembl.io.genomio.manifest.compute_stats:main"
manifest_generate = "ensembl.io.genomio.manifest.generate:main"
# Schemas
schemas_json_factory = "ensembl.io.genomio.schemas.json.factory:main"
schemas_json_validate = "ensembl.io.genomio.schemas.json.validate:main"
# Sequence region
seq_region_dump = "ensembl.io.genomio.seq_region.dump:main"
seq_region_prepare = "ensembl.io.genomio.seq_region.prepare:main"
# Utils
extract_file = "ensembl.io.genomio.utils.archive_utils:extract_file_cli"
# Manifest
check_integrity = "ensembl.io.genomio.integrity:main"
manifest_maker = "ensembl.io.genomio.manifest_maker:main"
manifest_stats = "ensembl.io.genomio.manifest_stats:main"
# DB
db_factory = "ensembl.io.genomio.db_factory:main"
# Dump
seq_region_dumper = "ensembl.io.genomio.seq_region_dumper:main"
genome_meta_dumper = "ensembl.io.genomio.genome_metadata.dump_genome_metadata:main"
genome_stats_dumper = "ensembl.io.genomio.genome_metadata.dump_genome_stats:main"
genome_stats_compare = "ensembl.io.genomio.genome_metadata.compare_genome_stats:main"
# Events
events_dumper = "ensembl.io.genomio.events_dumper:main"
events_loader = "ensembl.io.genomio.events_loader:main"
format_events = "ensembl.io.genomio.events.format_events:main"

[tool.setuptools]
package-dir = {"" = "src/python"}
Expand Down
3 changes: 1 addition & 2 deletions src/python/ensembl/io/genomio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""GenomIO modules."""
"""Genome Input/Output (GenomIO) handling library."""

__version__ = "0.1"
5 changes: 2 additions & 3 deletions src/python/ensembl/io/genomio/assembly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Assembly preparation module."""

"""GenomIO assembly preparation modules."""

from .get_assembly_data import *
from .download import *
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Ensembl core database interface module."""

"""GenomIO FASTA preparation modules."""

from .process_fasta import *
from .factory import *
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Gene events handling module."""

"""GenomIO prepare modules."""

from .prepare_genome import *
from .prepare_seq_region import *
from .update_genome_metadata import *
from .dump import *
from .format import *
from .load import *
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import re
from typing import Dict, List

from ensembl.io.genomio.events_loader import EventCollection
from ensembl.io.genomio.events.load import EventCollection
from ensembl.utils.argparse import ArgumentParser


Expand Down
17 changes: 17 additions & 0 deletions src/python/ensembl/io/genomio/fasta/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Fasta files processing module."""

from .process import *
18 changes: 18 additions & 0 deletions src/python/ensembl/io/genomio/genbank/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""GenBank fetching and data manipulation module."""

from .download import *
from .extract_data import *
19 changes: 19 additions & 0 deletions src/python/ensembl/io/genomio/genome_metadata/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See the NOTICE file distributed with this work for additional information
# regarding copyright ownership.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Genome metadata handling module."""

from .dump import *
from .prepare import *
from .extend import *
Loading

0 comments on commit 987b43b

Please sign in to comment.