diff --git a/qiita_pet/handlers/qiita_redbiom.py b/qiita_pet/handlers/qiita_redbiom.py
index 8ec56d769..12f3e0269 100644
--- a/qiita_pet/handlers/qiita_redbiom.py
+++ b/qiita_pet/handlers/qiita_redbiom.py
@@ -34,14 +34,15 @@ def _redbiom_metadata_search(self, query, contexts):
query = query.lower()
try:
samples = redbiom.search.metadata_full(query, False)
- except TypeError:
- message = (
- 'Not a valid search: "%s", are you sure this is a '
- 'valid metadata value?' % query)
except ValueError:
message = (
'Not a valid search: "%s", your query is too small '
'(too few letters), try a longer query' % query)
+ except:
+ message = (
+ 'The query ("%s") did not work and may be malformed. Please '
+ 'check the search help for more information on the queries.'
+ % query)
if not message:
study_samples = defaultdict(list)
for s in samples:
@@ -96,16 +97,16 @@ def _redbiom_search(self, query, search_on, callback):
if search_on in search_f:
message, study_artifacts = search_f[search_on](query, contexts)
if not message:
- keys = study_artifacts.keys()
- if keys:
+ studies = study_artifacts.keys()
+ if studies:
results = generate_study_list_without_artifacts(
- study_artifacts.keys(), True)
+ studies, True)
# inserting the artifact_biom_ids to the results
for i in range(len(results)):
results[i]['artifact_biom_ids'] = study_artifacts[
str(results[i]['study_id'])]
else:
- message = "No samples where found! Try again ..."
+ message = "No samples were found! Try again ..."
else:
message = ('Incorrect search by: you can use metadata, '
'features or taxon and you passed: %s' % search_on)
diff --git a/qiita_pet/templates/redbiom.html b/qiita_pet/templates/redbiom.html
index 62869e1aa..f189ae40f 100644
--- a/qiita_pet/templates/redbiom.html
+++ b/qiita_pet/templates/redbiom.html
@@ -24,7 +24,7 @@
artifacts += 1;
samples += value.length;
});
- return [artifacts, samples]}, [0, 0]);
+ return [artifacts + a[0], samples + a[1]]}, [0, 0]);
var artifacts = artifacts_samples[0];
var samples = artifacts_samples[1];
$('.footer').addClass("col-md-12 text-right");
@@ -48,7 +48,12 @@
{"render": function ( data, type, row, meta ) {
if (data !== null && data !== undefined){
var artifacts = 0, samples = 0;
- for (var d in data) { if (data.hasOwnProperty(d)) { artifacts++; } }
+ for (var d in data) {
+ if (data.hasOwnProperty(d)) {
+ artifacts++;
+ samples += data[d].length
+ }
+ }
if (artifacts != 0) {
return '
';
@@ -153,21 +158,89 @@
{%block content%}
Redbiom only searches on public data and the data is updated nightly. Note that you will only be able to expand and add artifacts to analyses if you are signed into Qiita.
+
+
+
+
+
We have 3 search options:
-
Metadata: The search will be on the full metadata and will return any ocurrances of the search.
-
Feature: The seach will be on all the features, in specific: OTU ids for close reference and exact sequences for deblur
-
Taxon: The search will be only on close reference and based on the taxonomies available
+
+ Metadata
+ The search will be on the full metadata.
+
+ The metadata search engine uses natural language processing to search for
+ word stems within a samples metadata. A word stem disregards modifiers and
+ plurals, so for instance, a search for "antibiotics" will actually perform
+ a search for "antibiot". Similarly, a search for "crying" will actually
+ search for "cry". The words specified can be combined with set-based
+ operations, so for instance, a search for "antibiotics & crying" will
+ obtain the set of samples in which each sample has "antibiot" in its
+ metadata as well as "cry". N.B., the specific category in which a stem is
+ found is not assured to be the same, "antibiot" could be in one category
+ and "cry" in another. A set intersection can be performed with "&", a
+ union with "|" and a difference with "-".
+
+ In addition to the stem-based search, value based searches can also be a
+ applied. These use a Python-like grammar and allow for a rich set of
+ comparisons to be performed based on a metadata category of interest. For
+ example, "where qiita_study_id == 10317" will find all samples which have
+ the qiita_study_id metadata category, and in which the value for that
+ sample is "10317."
+
+ Examples:
+
+
+
+ Find all samples in which the word infant exists, as well as antibiotics,
+ where the infants are under a certain number of days old:
+ "infant & antibiotics where age_days < 30"
+
+
+ Find all samples only beloging to the EMP in which the ph in under 7:
+ "where ph < 7 & emp_release1 == True"
+
+
+
+
+ Feature:
+ The seach will be on all the features, in specific: OTU ids for close reference and exact sequences for deblur.
+
+ Examples:
+
+
+
+ Find all samples in which the Greengenes feature 4479944 is found: "4479944"
+
+
+
+
Taxon:
+ The search will be only on closed reference and based on the taxonomies available.
+ Only exact matches are returned. Note that currently only the Greengenes taxonomy is
+ searchable, and that it requires nomenclature of a rank prefix, two underscores, and then the
+ name.
+
+ Examples:
+
+
+
+ Find all samples in which the genera Escherichia is found: "g__Escherichia"
+
+
+ Find all samples in which the order Clostridiales is found: "o__Clostridiales"
+