# HG changeset patch # User azomics # Date 1595508618 14400 # Node ID f70f75e89890e429b5d1795126abc59bf13c6998 # Parent fb0ee82f686d2e72736169ea1541f17e87056a4b "planemo upload for repository https://github.com/ImmPortDB/immport-galaxy-tools/tree/master/flowtools/flowcl commit d59d95d2bc6a64eb5c37b8291a7c314754c2067f" diff -r fb0ee82f686d -r f70f75e89890 flowcl/getOntology.R --- a/flowcl/getOntology.R Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -# Cell Ontology Module for Galaxy -# FlowCL -###################################################################### -# Copyright (c) 2016 Northrop Grumman. -# All rights reserved. -###################################################################### -# -# Version 1 -# Cristel Thomas -# -# - -library(flowCL) -library(base) - -getOntology <- function(output_file, markers) { - res <- flowCL(markers, ResetArch = TRUE) - if (length(res) == 6) { - report <- capture.output(res$Table) - sink(output_file) - cat(report, sep = "\n") - sink() - } -} - -args <- commandArgs(trailingOnly = TRUE) -markers <- paste(args[3:length(args)], collapse="") -getOntology(args[2], markers) diff -r fb0ee82f686d -r f70f75e89890 flowcl/getOntology.py --- a/flowcl/getOntology.py Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,135 +0,0 @@ -#!/usr/bin/env python -###################################################################### -# Copyright (c) 2016 Northrop Grumman. -# All rights reserved. -###################################################################### -from __future__ import print_function -import sys -import os - -from collections import defaultdict -from argparse import ArgumentParser -from jinja2 import Environment, FileSystemLoader - - -def generate_flowCL_query(list_markers, list_types): - if (len(list_markers) != len(list_types)): - return("pb with headers") - query = [] - # go through both lists, remove fsc/ssc - for i in range(0, len(list_markers)): - if not list_markers[i].startswith("FSC") and not list_markers[i].startswith("SSC"): - query.append(list_markers[i].upper()) - query.append(list_types[i]) - # return concatenated string - return("".join(query)) - - -def run_flowCL(phenotype, output_file, output_dir, tool_dir): - os.mkdir(output_dir) - tool = "/".join([tool_dir, "getOntology.R"]) - output_txt = "".join([output_dir, "/flowCL_run_summary.txt"]) - output_table = "".join([output_dir, "/flowCL_table.txt"]) - output_pdf = "".join([output_dir, "/flowCL_res.pdf"]) - run_command = " ". join(["Rscript --slave --vanilla", tool, "--args", output_txt, phenotype]) - os.system(run_command) - - table = defaultdict(list) - labels = [] - nb_match = 0 - if os.path.isfile(output_txt): - with open(output_txt, "r") as txt: - check = txt.readline().strip() - if (not check): - sys.exit(2) - else: - i = -1 - for lines in txt: - data = lines.strip("\n").split("\"") - if data[0].strip(): - labels.append(data[0].strip()) - i += 1 - if data[0].startswith("Score"): - count_matches = data[1].split(") ") - nb_match = len(count_matches) - 1 - table[i].append(data[1]) - else: - sys.stderr.write("There are no results with this query. Please check your markers if you believe there should be.") - sys.exit(2) - - with open(output_table, "w") as tbl: - tbl.write("1\t2\nQuery\t" + phenotype + "\n") - for j in table: - newline = " ".join(table[j]) - for k in range(1, nb_match + 1): - cur_stg = "".join([str(k+1), ")"]) - new_stg = "".join(["
", cur_stg]) - newline = newline.replace(cur_stg, new_stg) - - if labels[j] == "Cell ID": - cls = newline.split(" ") - for m in range(0, len(cls)): - if cls[m].startswith("CL"): - cl_id = cls[m].replace("_", ":") - link = "".join(['']) - cls[m] = "".join([link, cls[m], ""]) - newline = " ".join(cls) - tbl.write("\t".join([labels[j], newline]) + "\n") - - get_graph = " ".join(["mv flowCL_results/*.pdf", output_pdf]) - os.system(get_graph) - - env = Environment(loader=FileSystemLoader(tool_dir + "/templates")) - template = env.get_template("flowCL.template") - - real_directory = output_dir.replace("/job_working_directory", "") - context = {'outputDirectory': real_directory} - overview = template.render(**context) - with open(output_file, "w") as outf: - outf.write(overview) - return - - -if __name__ == "__main__": - parser = ArgumentParser( - prog="getOntology", - description="runs flowCL on a set of markers.") - - parser.add_argument( - '-m', - dest="markers", - required=True, - action='append', - help="marker queries.") - - parser.add_argument( - '-y', - dest="marker_types", - required=True, - action='append', - help="marker queries.") - - parser.add_argument( - '-o', - dest="output_file", - required=True, - help="Name of the output html file.") - - parser.add_argument( - '-d', - dest="output_dir", - required=True, - help="Path to the html supporting directory") - - parser.add_argument( - '-t', - dest="tool_dir", - required=True, - help="Path to the tool directory") - - args = parser.parse_args() - - markers = [m.strip() for m in args.markers] - query = generate_flowCL_query(markers, args.marker_types) - run_flowCL(query, args.output_file, args.output_dir, args.tool_dir) - sys.exit(0) diff -r fb0ee82f686d -r f70f75e89890 flowcl/getOntology.xml --- a/flowcl/getOntology.xml Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ - - given a phenotype using flowCL. - - jinja2 - r - bioconductor-flowcl - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10.1093/bioinformatics/btu807 - - diff -r fb0ee82f686d -r f70f75e89890 flowcl/static/flowtools/css/flowCL.css --- a/flowcl/static/flowtools/css/flowCL.css Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -** DataTables config -*/ -div.dt-buttons { - float: right; -} - -th { - font-size:16px; - text-align: left; -} - -body td { - max-width: 50px; - font-size: 14px; - overflow: hidden; - text-overflow: ellipsis; -} - -.cltable thead { - display:none; -} - -.cltable td { - max-width: 40px; - word-break: break-all; - word-wrap: break-word; -} - -.firstcol { - width: 160px; -} - -.smallcols { - width: 100px; -} - -div.dataTables_wrapper { - width: 95%; - margin: 0 auto; -} - - diff -r fb0ee82f686d -r f70f75e89890 flowcl/static/flowtools/js/flowcl_table.js --- a/flowcl/static/flowtools/js/flowcl_table.js Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -// Copyright (c) 2016 Northrop Grumman. -// All rights reserved. - -var flowcl_table = './flowCL_table.txt'; - -var displayFlowCLTable = function(){ - d3.tsv(flowcl_table, function(error, data){ - if (error){ - alert("Problem retrieving data"); - return; - } - var fclHTML = ''; - $('#flowcl').html(fclHTML); - - var fclTableData = $.extend(true, [], data); - var fclTable = $('#flowcltable').DataTable({ - columns: [ - {"data":"1", className: 'firstcol'}, - {"data":"2"} - ], - dom: 't', - data: fclTableData, - buttons: [ - 'copy', 'pdfHtml5','csvHtml5' - ] - }); - }); -}; diff -r fb0ee82f686d -r f70f75e89890 flowcl/static/images/flowtools/flowcl_graph.png Binary file flowcl/static/images/flowtools/flowcl_graph.png has changed diff -r fb0ee82f686d -r f70f75e89890 flowcl/static/images/flowtools/flowcl_summary.png Binary file flowcl/static/images/flowtools/flowcl_summary.png has changed diff -r fb0ee82f686d -r f70f75e89890 flowcl/templates/flowCL.template --- a/flowcl/templates/flowCL.template Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ - - - -Flow CL Results - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
-
-
-
-
-
- -
-
-
-
- - -
- - - - - - diff -r fb0ee82f686d -r f70f75e89890 flowcl/test-data/flowCL_res.pdf Binary file flowcl/test-data/flowCL_res.pdf has changed diff -r fb0ee82f686d -r f70f75e89890 flowcl/test-data/flowCL_run_summary.txt --- a/flowcl/test-data/flowCL_run_summary.txt Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,24 +0,0 @@ - [,1] -Short marker names "CD4+" -Ontology marker names "CD4 molecule" -Experiment markers "CD4" -Ontology exper. names "CD4 molecule" -Successful Match? "No" -Marker ID "1) PR_000001004 2) PR_000001004 3) PR_000001004 4) PR_000001004 5)" - "PR_000001004 + more" -Marker Label "1) CD4 molecule 2) CD4 molecule 3) CD4 molecule 4) CD4 molecule 5)" - "CD4 molecule + more" -Marker Key "1) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell" - "receptor co-receptor CD8+ ] 2) { } CD4+ ( ) [ alpha-beta T cell" - "receptor complex+, T cell receptor co-receptor CD8+ ] 3) { } CD4+ ( )" - "[ alpha-beta T cell receptor complex+, T cell receptor co-receptor" - "CD8+ ] 4) { } CD4+ ( ) [ T-cell surface glycoprotein CD8 alpha" - "chain-, alpha-beta T cell receptor complex+ ] 5) { } CD4+ ( ) [ T" - "cell receptor co-receptor CD8-, alpha-beta T cell receptor complex+," - "CD3+ ] + more" -Score (Out of 1) "1) 0.333 2) 0.333 3) 0.333 4) 0.333 5) 0.25 + more" -Cell ID "1) CL_0000809 2) CL_0002427 3) CL_0002428 4) CL_0000810 5) CL_0000492" - "+ more" -Cell Label "1) double-positive, alpha-beta thymocyte 2) resting double-positive" - "thymocyte 3) double-positive blast 4) CD4-positive, alpha-beta" - "thymocyte 5) CD4-positive helper T cell + more" diff -r fb0ee82f686d -r f70f75e89890 flowcl/test-data/flowCL_table.txt --- a/flowcl/test-data/flowCL_table.txt Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -1 2 -Short marker names CD4+ -Ontology marker names CD4 molecule -Experiment markers CD4 -Ontology exper. names CD4 molecule -Successful Match? No -Marker ID 1) PR_000001004
2) PR_000001004
3) PR_000001004
4) PR_000001004
5) PR_000001004 + more -Marker Label 1) CD4 molecule
2) CD4 molecule
3) CD4 molecule
4) CD4 molecule
5) CD4 molecule + more -Marker Key 1) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell receptor co-receptor CD8+ ]
2) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell receptor co-receptor CD8+ ]
3) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell receptor co-receptor CD8+ ]
4) { } CD4+ ( ) [ T-cell surface glycoprotein CD8 alpha chain-, alpha-beta T cell receptor complex+ ]
5) { } CD4+ ( ) [ T cell receptor co-receptor CD8-, alpha-beta T cell receptor complex+, CD3+ ] + more -Score (Out of 1) 1) 0.333
2) 0.333
3) 0.333
4) 0.333
5) 0.25 + more -Cell ID 1) CL_0000809
2) CL_0002427
3) CL_0002428
4) CL_0000810
5) CL_0000492 + more -Cell Label 1) double-positive, alpha-beta thymocyte
2) resting double-positive thymocyte
3) double-positive blast
4) CD4-positive, alpha-beta thymocyte
5) CD4-positive helper T cell + more diff -r fb0ee82f686d -r f70f75e89890 flowcl/test-data/out.html --- a/flowcl/test-data/out.html Mon Feb 27 12:56:34 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ - - - -Flow CL Results - - - - - - - - - - - - - - - - - - - - -
-
-
- - -
-
-
-
-
-
-
-
- -
-
-
-
- - -
- - - - - - \ No newline at end of file diff -r fb0ee82f686d -r f70f75e89890 getOntology.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/getOntology.R Thu Jul 23 08:50:18 2020 -0400 @@ -0,0 +1,29 @@ +#!/usr/bin/Rscript --vanilla +# Cell Ontology Module for Galaxy +# FlowCL +###################################################################### +# Copyright (c) 2016 Northrop Grumman. +# All rights reserved. +###################################################################### +# +# Version 1 +# Cristel Thomas +# +# + +suppressWarnings(suppressMessages(library(flowCL))) +suppressWarnings(suppressMessages(library(base))) + +getOntology <- function(output_file, markers) { + res <- flowCL(markers, ResetArch = TRUE) + if (length(res) == 6) { + report <- capture.output(res$Table) + sink(output_file) + cat(report, sep = "\n") + sink() + } +} + +args <- commandArgs(trailingOnly = TRUE) +markers <- paste(args[2:length(args)], collapse="") +getOntology(args[1], markers) diff -r fb0ee82f686d -r f70f75e89890 getOntology.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/getOntology.py Thu Jul 23 08:50:18 2020 -0400 @@ -0,0 +1,134 @@ +#!/usr/bin/env python +###################################################################### +# Copyright (c) 2016 Northrop Grumman. +# All rights reserved. +###################################################################### +from __future__ import print_function +import sys +import os + +from collections import defaultdict +from argparse import ArgumentParser +from jinja2 import Environment, FileSystemLoader + + +def generate_flowCL_query(list_markers, list_types): + if (len(list_markers) != len(list_types)): + return("pb with headers") + query = [] + # go through both lists, remove fsc/ssc + for i in range(0, len(list_markers)): + if not list_markers[i].startswith("FSC") and not list_markers[i].startswith("SSC"): + query.append(list_markers[i].upper()) + query.append(list_types[i]) + # return concatenated string + return("".join(query)) + + +def run_flowCL(phenotype, output_file, output_dir, tool_dir): + os.mkdir(output_dir) + tool = "/".join([tool_dir, "getOntology.R"]) + output_txt = "".join([output_dir, "/flowCL_run_summary.txt"]) + output_table = "".join([output_dir, "/flowCL_table.txt"]) + output_pdf = "".join([output_dir, "/flowCL_res.pdf"]) + run_command = " ". join(["Rscript --slave --vanilla", tool, output_txt, phenotype]) + os.system(run_command) + + table = defaultdict(list) + labels = [] + nb_match = 0 + if os.path.isfile(output_txt): + with open(output_txt, "r") as txt: + check = txt.readline().strip() + if (not check): + sys.exit(2) + else: + i = -1 + for lines in txt: + data = lines.strip("\n").split("\"") + if data[0].strip(): + labels.append(data[0].strip()) + i += 1 + if data[0].startswith("Score"): + count_matches = data[1].split(") ") + nb_match = len(count_matches) - 1 + table[i].append(data[1]) + else: + sys.stderr.write("There are no results with this query. Please check your markers if you believe there should be.") + sys.exit(2) + + with open(output_table, "w") as tbl: + tbl.write("1\t2\nQuery\t" + phenotype + "\n") + for j in table: + newline = " ".join(table[j]) + for k in range(1, nb_match + 1): + cur_stg = "".join([str(k+1), ")"]) + new_stg = "".join(["
", cur_stg]) + newline = newline.replace(cur_stg, new_stg) + + if labels[j] == "Cell ID": + cls = newline.split(" ") + for m in range(0, len(cls)): + if cls[m].startswith("CL"): + cl_id = cls[m].replace("_", ":") + link = "".join(['']) + cls[m] = "".join([link, cls[m], ""]) + newline = " ".join(cls) + tbl.write("\t".join([labels[j], newline]) + "\n") + + get_graph = " ".join(["mv flowCL_results/*.pdf", output_pdf]) + os.system(get_graph) + + env = Environment(loader=FileSystemLoader(tool_dir + "/templates")) + template = env.get_template("flowCL.template") + + real_directory = output_dir.replace("/job_working_directory", "") + context = {'outputDirectory': real_directory} + overview = template.render(**context) + with open(output_file, "w") as outf: + outf.write(overview) + return + + +if __name__ == "__main__": + parser = ArgumentParser( + prog="getOntology", + description="runs flowCL on a set of markers.") + + parser.add_argument( + '-m', + dest="markers", + required=True, + action='append', + help="marker queries.") + + parser.add_argument( + '-y', + dest="marker_types", + required=True, + action='append', + help="marker queries.") + + parser.add_argument( + '-o', + dest="output_file", + required=True, + help="Name of the output html file.") + + parser.add_argument( + '-d', + dest="output_dir", + required=True, + help="Path to the html supporting directory") + + parser.add_argument( + '-t', + dest="tool_dir", + required=True, + help="Path to the tool directory") + + args = parser.parse_args() + + markers = [m.strip() for m in args.markers] + query = generate_flowCL_query(markers, args.marker_types) + run_flowCL(query, args.output_file, args.output_dir, args.tool_dir) diff -r fb0ee82f686d -r f70f75e89890 getOntology.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/getOntology.xml Thu Jul 23 08:50:18 2020 -0400 @@ -0,0 +1,102 @@ + + given a phenotype using flowCL + + jinja2 + bioconductor-flowcl + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10.1093/bioinformatics/btu807 + + diff -r fb0ee82f686d -r f70f75e89890 static/images/flowtools/flowcl_graph.png Binary file static/images/flowtools/flowcl_graph.png has changed diff -r fb0ee82f686d -r f70f75e89890 static/images/flowtools/flowcl_summary.png Binary file static/images/flowtools/flowcl_summary.png has changed diff -r fb0ee82f686d -r f70f75e89890 templates/flowCL.template --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/flowCL.template Thu Jul 23 08:50:18 2020 -0400 @@ -0,0 +1,79 @@ + + + +Flow CL Results + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+
+
+
+
+
+
+ +
+
+
+
+ + +
+ + + + + + diff -r fb0ee82f686d -r f70f75e89890 test-data/flowCL_res.pdf Binary file test-data/flowCL_res.pdf has changed diff -r fb0ee82f686d -r f70f75e89890 test-data/flowCL_run_summary.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/flowCL_run_summary.txt Thu Jul 23 08:50:18 2020 -0400 @@ -0,0 +1,24 @@ + [,1] +Short marker names "CD4+" +Ontology marker names "CD4 molecule" +Experiment markers "CD4" +Ontology exper. names "CD4 molecule" +Successful Match? "No" +Marker ID "1) PR_000001004 2) PR_000001004 3) PR_000001004 4) PR_000001004 5)" + "PR_000001004 + more" +Marker Label "1) CD4 molecule 2) CD4 molecule 3) CD4 molecule 4) CD4 molecule 5)" + "CD4 molecule + more" +Marker Key "1) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell" + "receptor co-receptor CD8+ ] 2) { } CD4+ ( ) [ alpha-beta T cell" + "receptor complex+, T cell receptor co-receptor CD8+ ] 3) { } CD4+ ( )" + "[ alpha-beta T cell receptor complex+, T cell receptor co-receptor" + "CD8+ ] 4) { } CD4+ ( ) [ T-cell surface glycoprotein CD8 alpha" + "chain-, alpha-beta T cell receptor complex+ ] 5) { } CD4+ ( ) [ T" + "cell receptor co-receptor CD8-, alpha-beta T cell receptor complex+," + "CD3+ ] + more" +Score (Out of 1) "1) 0.333 2) 0.333 3) 0.333 4) 0.333 5) 0.25 + more" +Cell ID "1) CL_0000809 2) CL_0002427 3) CL_0002428 4) CL_0000810 5) CL_0000492" + "+ more" +Cell Label "1) double-positive, alpha-beta thymocyte 2) resting double-positive" + "thymocyte 3) double-positive blast 4) CD4-positive, alpha-beta" + "thymocyte 5) CD4-positive helper T cell + more" diff -r fb0ee82f686d -r f70f75e89890 test-data/flowCL_table.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/flowCL_table.txt Thu Jul 23 08:50:18 2020 -0400 @@ -0,0 +1,12 @@ +1 2 +Short marker names CD4+ +Ontology marker names CD4 molecule +Experiment markers CD4 +Ontology exper. names CD4 molecule +Successful Match? No +Marker ID 1) PR_000001004
2) PR_000001004
3) PR_000001004
4) PR_000001004
5) PR_000001004 + more +Marker Label 1) CD4 molecule
2) CD4 molecule
3) CD4 molecule
4) CD4 molecule
5) CD4 molecule + more +Marker Key 1) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell receptor co-receptor CD8+ ]
2) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell receptor co-receptor CD8+ ]
3) { } CD4+ ( ) [ alpha-beta T cell receptor complex+, T cell receptor co-receptor CD8+ ]
4) { } CD4+ ( ) [ T-cell surface glycoprotein CD8 alpha chain-, alpha-beta T cell receptor complex+ ]
5) { } CD4+ ( ) [ T cell receptor co-receptor CD8-, alpha-beta T cell receptor complex+, CD3+ ] + more +Score (Out of 1) 1) 0.333
2) 0.333
3) 0.333
4) 0.333
5) 0.25 + more +Cell ID 1) CL_0000809
2) CL_0002427
3) CL_0002428
4) CL_0000810
5) CL_0000492 + more +Cell Label 1) double-positive, alpha-beta thymocyte
2) resting double-positive thymocyte
3) double-positive blast
4) CD4-positive, alpha-beta thymocyte
5) CD4-positive helper T cell + more diff -r fb0ee82f686d -r f70f75e89890 test-data/out.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/out.html Thu Jul 23 08:50:18 2020 -0400 @@ -0,0 +1,79 @@ + + + +Flow CL Results + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+
+
+
+
+
+
+
+ +
+
+
+
+ + +
+ + + + + +