From 99af299197dfc527155cd3257388b784810518c4 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 8 Jul 2020 00:16:23 -0400 Subject: Split upload tab. Add upload status tab. Add more direct links on download page. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- bh20simplewebuploader/templates/resource.html | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 bh20simplewebuploader/templates/resource.html (limited to 'bh20simplewebuploader/templates/resource.html') diff --git a/bh20simplewebuploader/templates/resource.html b/bh20simplewebuploader/templates/resource.html new file mode 100644 index 0000000..e0d344f --- /dev/null +++ b/bh20simplewebuploader/templates/resource.html @@ -0,0 +1,26 @@ + + + {% include 'header.html' %} + + {% include 'banner.html' %} + {% include 'menu.html' %} + +
+

+

All sequences (FASTA) relabled and deduplicated

+

Metadata (RDF) for all sequences

+

All sequences in Graphical Fragment Assembly (GFA) - More about GFA

+

All sequences in Optimized Dynamic Genome/Graph Implementation (ODGI) - More about ODGI

+

All sequences in RDF using spodgi - More about spodgi

+ + +

SPARQL endpoint - Sample query for accessions + + {{ embed|safe }} + +

+ +{% include 'footer.html' %} + + + -- cgit v1.2.3 From cbb191cb23f4e40b1a1d3024401960939fda9bc3 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 8 Jul 2020 14:02:11 -0400 Subject: Get count from arvados Separate pending/rejected tables "Lastest results" is latest successful run. Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- bh20seqanalyzer/main.py | 10 +-- bh20simplewebuploader/main.py | 93 +++++++++++++++++---------- bh20simplewebuploader/templates/resource.html | 1 + 3 files changed, 65 insertions(+), 39 deletions(-) (limited to 'bh20simplewebuploader/templates/resource.html') diff --git a/bh20seqanalyzer/main.py b/bh20seqanalyzer/main.py index 1746587..ce9a723 100644 --- a/bh20seqanalyzer/main.py +++ b/bh20seqanalyzer/main.py @@ -187,14 +187,15 @@ def get_workflow_output_from_project(api, uuid): cr = api.container_requests().list(filters=[['owner_uuid', '=', uuid], ["requesting_container_uuid", "=", None]]).execute() if cr["items"] and cr["items"][0]["output_uuid"]: - return cr["items"][0] - else: - return None + container = api.containers().get(uuid=cr["items"][0]["container_uuid"]).execute() + if container["state"] == "Complete" and container["exit_code"] == 0: + return cr["items"][0] + return None def copy_most_recent_result(api, analysis_project, latest_result_uuid): most_recent_analysis = api.groups().list(filters=[['owner_uuid', '=', analysis_project]], - order="created_at desc", limit=1).execute() + order="created_at desc").execute() for m in most_recent_analysis["items"]: wf = get_workflow_output_from_project(api, m["uuid"]) if wf: @@ -220,6 +221,7 @@ def move_fastq_to_fasta_results(api, analysis_project, uploader_project): body={"owner_uuid": uploader_project}).execute() p["properties"]["moved_output"] = True api.groups().update(uuid=p["uuid"], body={"properties": p["properties"]}).execute() + break def upload_schema(api, workflow_def_project): diff --git a/bh20simplewebuploader/main.py b/bh20simplewebuploader/main.py index d602288..d4adbda 100644 --- a/bh20simplewebuploader/main.py +++ b/bh20simplewebuploader/main.py @@ -20,6 +20,7 @@ from markupsafe import Markup ARVADOS_API = 'lugli.arvadosapi.com' ANONYMOUS_TOKEN = '5o42qdxpxp5cj15jqjf7vnxx5xduhm4ret703suuoa3ivfglfh' UPLOADER_PROJECT = 'lugli-j7d0g-n5clictpuvwk8aa' +VALIDATED_PROJECT = 'lugli-j7d0g-5ct8p1i1wrgyjvp' logging.basicConfig(level=logging.DEBUG) log = logging.getLogger(__name__ ) @@ -457,6 +458,47 @@ def download_page(): buf = get_html_body('doc/web/download.html') return render_template('resource.html',menu='DOWNLOAD',embed=buf) +def pending_table(output, items): + output.write( +""" + + + +""") + for r in items: + if r["status"] != "pending": + continue + output.write("") + output.write("" % (r["uuid"], r["uuid"])) + output.write("" % Markup.escape(r["sequence_label"])) + output.write("") + output.write( +""" +
CollectionSequence label
%s%s
+""") + +def rejected_table(output, items): + output.write( +""" + + + + +""") + for r in items: + if r["status"] != "rejected": + continue + output.write("") + output.write("" % (r["uuid"], r["uuid"])) + output.write("" % Markup.escape(r["sequence_label"])) + output.write("" % Markup.escape("\n".join(r.get("errors", [])))) + output.write("") + output.write( +""" +
CollectionSequence labelErrors
%s%s
%s
+""") + + @app.route('/status') def status_page(): """ @@ -477,27 +519,18 @@ def status_page(): status[prop["status"]] = status.get(prop["status"], 0) + 1 output = io.StringIO() - for s in status: - output.write("

%s sequences %s QC

" % (status[s], s)) - output.write( -""" - - - - - -""") - for r in out: - output.write("") - output.write("" % (r["uuid"], r["uuid"])) - output.write("" % Markup.escape(r["sequence_label"])) - output.write("" % r["status"]) - output.write("" % Markup.escape("\n".join(r.get("errors", [])))) - output.write("") - output.write( -""" -
CollectionSequence labelStatusErrors
%s%s%s
%s
-""") + + validated = api.collections().list(filters=[["owner_uuid", "=", VALIDATED_PROJECT]], limit=1).execute() + status["passed"] = validated["items_available"] + + for s in (("passed", "/download"), ("pending", "#pending"), ("rejected", "#rejected")): + output.write("

%s sequences QC %s

" % (s[1], status.get(s[0], 0), s[0])) + + output.write("

Pending

") + pending_table(output, out) + + output.write("

Rejected

") + rejected_table(output, out) return render_template('status.html', table=Markup(output.getvalue()), menu='STATUS') @@ -534,20 +567,10 @@ baseURL='http://sparql.genenetwork.org/sparql/' @app.route('/api/getCount', methods=['GET']) def getCount(): - query=""" -PREFIX pubseq: -select (COUNT(distinct ?dataset) as ?num) -{ - ?dataset pubseq:submitter ?id . - ?id ?p ?submitter -} -""" - payload = {'query': query, 'format': 'json'} - r = requests.get(baseURL, params=payload) - result = r.json()['results']['bindings'] - # [{'num': {'type': 'typed-literal', 'datatype': 'http://www.w3.org/2001/XMLSchema#integer', 'value': '1352'}}] - # print(result, file=sys.stderr) - return jsonify({'sequences': int(result[0]["num"]["value"])}) + api = arvados.api(host=ARVADOS_API, token=ANONYMOUS_TOKEN) + c = api.collections().list(filters=[["owner_uuid", "=", VALIDATED_PROJECT]], limit=1).execute() + + return jsonify({'sequences': c["items_available"]}) @app.route('/api/getAllaccessions', methods=['GET']) def getAllaccessions(): diff --git a/bh20simplewebuploader/templates/resource.html b/bh20simplewebuploader/templates/resource.html index e0d344f..91b6c20 100644 --- a/bh20simplewebuploader/templates/resource.html +++ b/bh20simplewebuploader/templates/resource.html @@ -7,6 +7,7 @@