Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #34

Merged
merged 6 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bin/csv_adorn.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@ def csv_adorn(path: str, header: str) -> None:
"""
print(f"id,{header}")
with open(path) as f:
any_data = False
for line in f:
any_data = True
print(line.strip() + ",1")
if not any_data:
# this is a stupid hack, but the only way we found that does not break modularity
print("nothing,0")


def main() -> None:
Expand Down
3 changes: 3 additions & 0 deletions bin/make_score_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ def main() -> None:

# Print the data
for i, row in enumerate(data):
# this if cleans up the stupid hack from csv_adorn
if scores[i] == 0:
continue
print(row[0] + "," + id_formats[i] + "," + ",".join(row[1:]) + "," + str(scores[i]))


Expand Down
8 changes: 4 additions & 4 deletions bin/make_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def make_stats(score_table: str) -> None:

# calculate stats
n = len(scores)
mode = max(set(scores), key=scores.count)
mean = sum(scores) / n
mode = max(set(scores), key=scores.count) if scores else 0
mean = sum(scores) / n if n else 0
goodness = mean / max_score
percent_max = sum(score == max_score for score in scores) / n
percent_privates = sum(score == 1 for score in scores) / n
percent_max = sum(score == max_score for score in scores) / n if n else 0
percent_privates = sum(score == 1 for score in scores) / n if n else 0

# print stats as yaml
print(f"n: {n}")
Expand Down
4 changes: 4 additions & 0 deletions bin/plot_orthologs.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ empty_plots <- function(e) {
}
data <- tryCatch(read.csv(args[1], header = TRUE, stringsAsFactors = FALSE), error = empty_plots)

if (nrow(data) == 0) {
empty_plots()
}

# Melt the data keeping ID and score
melted_data <- melt(data, id.vars = c("id", "id_format", "score"), variable.name = "method", value.name = "support") %>%
filter(support == 1) %>%
Expand Down
2 changes: 1 addition & 1 deletion bin/score_hits.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def filter_centroid(data) -> list:
if sum([column[i] for column in columns]) > 1:
for j in range(len(columns[i])):
scores[i] += columns[i][j]
ratios = [scores[i] / sum(columns[i]) for i in range(len(columns))]
ratios = [scores[i] / sum(columns[i]) if sum(columns[i]) else 0 for i in range(len(columns))]

# get index of highest ratio
centroid = ratios.index(max(ratios))
Expand Down
2 changes: 1 addition & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ process {
}

withName: 'MERGE_HITS' {
ext.args = "-u NA"
ext.args = "-u 0 -k"
ext.prefix = "aggregated_hits"
publishDir = [
path: { "${params.outdir}/orthologs/hits" },
Expand Down
5 changes: 0 additions & 5 deletions modules/local/fetch_eggnog_group_local.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ process FETCH_EGGNOG_GROUP_LOCAL {
tag "$meta.id"
label 'process_single'

conda "conda-forge::python=3.11.0 conda-forge::biopython=1.83.0 conda-forge::requests=2.31.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' :
'biocontainers/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' }"

conda "conda-forge::python=3.11.0 conda-forge::biopython=1.83.0 conda-forge::requests=2.31.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' :
Expand Down
5 changes: 0 additions & 5 deletions modules/local/fetch_oma_group_local.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ process FETCH_OMA_GROUP_LOCAL {
tag "$meta.id"
label 'process_single'

conda "conda-forge::python=3.11.0 conda-forge::biopython=1.83.0 conda-forge::requests=2.31.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' :
'biocontainers/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' }"

conda "conda-forge::python=3.11.0 conda-forge::biopython=1.83.0 conda-forge::requests=2.31.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' :
Expand Down
5 changes: 0 additions & 5 deletions modules/local/fetch_panther_group_local.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ process FETCH_PANTHER_GROUP_LOCAL {
tag "$meta.id"
label 'process_single'

conda "conda-forge::python=3.10.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/python:3.10' :
'biocontainers/python:3.10' }"

conda "conda-forge::python=3.11.0 conda-forge::biopython=1.83.0 conda-forge::requests=2.31.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' :
Expand Down
5 changes: 0 additions & 5 deletions modules/local/filter_fasta.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ process FILTER_FASTA {
tag "$meta.id"
label 'process_single'

conda "conda-forge::python=3.11.0 conda-forge::biopython=1.83.0 conda-forge::requests=2.31.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' :
'biocontainers/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' }"

conda "conda-forge::python=3.11.0 conda-forge::biopython=1.83.0 conda-forge::requests=2.31.0"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mulled-v2-bc54124b36864a4af42a9db48b90a404b5869e7e:5258b8e5ba20587b7cbf3e942e973af5045a1e59-0' :
Expand Down