Skip to content

Commit

Permalink
xlsx, float threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
emarinier committed Dec 12, 2024
1 parent 0699fca commit 4c18be3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
14 changes: 9 additions & 5 deletions bin/process_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def main(argv=None):
"--threshold",
action="store",
dest="threshold",
type=int,
type=float,
help="distance threshold to be included in output",
default=None,
required=True,
Expand All @@ -47,22 +47,26 @@ def main(argv=None):
action="store",
dest="output",
type=str,
help="output in query-reference format",
help="output prefix (without extension)",
default=None,
required=True,
)

args = parser.parse_args(argv)

input = Path(args.input)
output = Path(args.output)
tsv_path = Path(args.output + ".tsv")
excel_path = Path(args.output + ".xlsx")
threshold = args.threshold

data = pd.read_csv(input, sep="\t")
data = data[data['Distance'] <= threshold]
data.to_csv(output, sep="\t", index=False)
data.to_csv(tsv_path, sep="\t", index=False)
data.to_excel(excel_path)

print(f"Output written to [{output}]")
print("Output written to:")
print(tsv_path)
print(excel_path)

return 0

Expand Down
9 changes: 5 additions & 4 deletions modules/local/process_output/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ process PROCESS_OUTPUT {
label 'process_single'

container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pandas:2.2.1' :
'biocontainers/pandas:2.2.1' }"
'https://depot.galaxyproject.org/singularity/staramr:0.10.0--pyhdfd78af_0':
'biocontainers/staramr:0.10.0--pyhdfd78af_0' }"

input:
path distances
val threshold

output:
path "results.tsv", emit: results
path "results.tsv", emit: tsv
path "results.xlsx", emit: excel
path "versions.yml", emit: versions

when:
Expand All @@ -22,7 +23,7 @@ process PROCESS_OUTPUT {
process_output.py \\
$args \\
--input $distances \\
--output results.tsv \\
--output results \\
--threshold $threshold
cat <<-END_VERSIONS > versions.yml
Expand Down

0 comments on commit 4c18be3

Please sign in to comment.