-[
- {"pk": 5, "model": "auth.user",
+[
+ {"pk": 5, "model": "auth.user",
"fields": {
"username": "test",
"first_name": "",
"email": "bob@some.where.else"
}
},
- {"pk": 153, "model": "experiments.flowcell",
+ {"pk": 153, "model": "experiments.flowcell",
"fields": {
- "paired_end": true,
- "run_date": "2009-09-11 22:12:13",
- "read_length": 75,
+ "paired_end": true,
+ "run_date": "2009-09-11 22:12:13",
+ "read_length": 75,
"notes": "",
"advanced_run": false,
"control_lane": 2,
"sequencer": 2,
"flowcell_id": "303TUAAXX"
}
- },
+ },
{"pk": 1193, "model": "experiments.lane",
"fields": {
"comment": "No change in cluster numbers, despite slight increase in pM",
"lane_number": 1,
"pM": "8"
}
- },
+ },
{"pk": 1197, "model": "experiments.lane",
"fields": {
"comment": "stuff",
"pM": "7",
"status": 2
}
- },
- {"pk": "10981", "model": "samples.library",
+ },
+ {"pk": "10981", "model": "samples.library",
"fields": {
- "ten_nM_dilution": false,
- "gel_cut_size": 400,
- "library_name": "Paired End Multiplexed Sp-BAC",
- "creation_date": "2009-07-21",
- "cell_line": 1,
- "library_species": 2,
- "library_type": null,
- "made_by": "Igor",
+ "ten_nM_dilution": false,
+ "gel_cut_size": 400,
+ "library_name": "Paired End Multiplexed Sp-BAC",
+ "creation_date": "2009-07-21",
+ "cell_line": 1,
+ "library_species": 2,
+ "library_type": null,
+ "made_by": "Igor",
"affiliations": [
2
- ],
- "replicate": 1,
- "condition": 1,
- "hidden": false,
- "stopping_point": "Done",
- "tags": [],
- "made_for": "Andy Cameron",
- "amplified_from_sample": null,
- "notes": "Combined 10957-10968",
- "undiluted_concentration": "5.1",
- "successful_pM": null,
- "experiment_type": 10,
+ ],
+ "replicate": 1,
+ "condition": 1,
+ "hidden": false,
+ "stopping_point": "Done",
+ "tags": [],
+ "made_for": "Andy Cameron",
+ "amplified_from_sample": null,
+ "notes": "Combined 10957-10968",
+ "undiluted_concentration": "5.1",
+ "successful_pM": null,
+ "experiment_type": 10,
"antibody": null
}
- },
+ },
{
- "pk": "11016",
- "model": "samples.library",
+ "pk": "11016",
+ "model": "samples.library",
"fields": {
- "ten_nM_dilution": false,
- "gel_cut_size": 325,
- "library_name": "Paired End Pfl #3 MP 7/24/9 a",
- "creation_date": "2009-08-06",
- "cell_line": 1,
- "library_species": 9,
- "library_type": 2,
- "made_by": "Lorian",
+ "ten_nM_dilution": false,
+ "gel_cut_size": 325,
+ "library_name": "Paired End Pfl #3 MP 7/24/9 a",
+ "creation_date": "2009-08-06",
+ "cell_line": 1,
+ "library_species": 9,
+ "library_type": 2,
+ "made_by": "Lorian",
"affiliations": [
41
- ],
- "replicate": 1,
- "condition": 1,
- "hidden": false,
- "stopping_point": "1Aa",
- "tags": [],
- "made_for": "",
- "amplified_from_sample": 11006,
- "notes": "7/31/2009 16:08:22\tColor: Blue",
- "undiluted_concentration": "35.5",
- "successful_pM": null,
- "experiment_type": 8,
+ ],
+ "replicate": 1,
+ "condition": 1,
+ "hidden": false,
+ "stopping_point": "1Aa",
+ "tags": [],
+ "made_for": "",
+ "amplified_from_sample": "11003",
+ "notes": "7/31/2009 16:08:22\tColor: Blue",
+ "undiluted_concentration": "35.5",
+ "successful_pM": null,
+ "experiment_type": 8,
"antibody": null
}
- },
+ },
{
- "pk": "11039",
- "model": "samples.library",
+ "pk": "11039",
+ "model": "samples.library",
"fields": {
- "ten_nM_dilution": false,
- "gel_cut_size": 300,
- "library_name": "Paired ends 99 GM12892",
- "creation_date": "2009-08-25",
- "cell_line": 1,
- "library_species": 8,
- "library_type": 2,
- "made_by": "Brian Williams",
+ "ten_nM_dilution": false,
+ "gel_cut_size": 300,
+ "library_name": "Paired ends 99 GM12892",
+ "creation_date": "2009-08-25",
+ "cell_line": 1,
+ "library_species": 8,
+ "library_type": 2,
+ "made_by": "Brian Williams",
"affiliations": [
- 4,
- 8,
+ 4,
+ 8,
12
- ],
- "replicate": 1,
- "condition": 1,
- "hidden": false,
- "stopping_point": "1Aa",
- "tags": [],
- "made_for": "Brian Williams",
- "amplified_from_sample": null,
- "notes": "fragment size = 300 bp, Amicon filtered\r\nnanodrop: 56.3",
- "undiluted_concentration": "28.7",
- "successful_pM": null,
- "experiment_type": 4,
+ ],
+ "replicate": 1,
+ "condition": 1,
+ "hidden": false,
+ "stopping_point": "1Aa",
+ "tags": [],
+ "made_for": "Brian Williams",
+ "amplified_from_sample": null,
+ "notes": "fragment size = 300 bp, Amicon filtered\r\nnanodrop: 56.3",
+ "undiluted_concentration": "28.7",
+ "successful_pM": null,
+ "experiment_type": 4,
"antibody": null
}
},
{
- "pk": "11003",
- "model": "samples.library",
+ "pk": "11003",
+ "model": "samples.library",
"fields": {
- "ten_nM_dilution": false,
- "gel_cut_size": 325,
- "library_name": "Paired End Pfl #3 MP 7/24/9",
- "creation_date": "2009-08-05",
- "cell_line": 1,
- "library_species": 8,
- "library_type": 2,
- "made_by": "Lorian",
+ "ten_nM_dilution": false,
+ "gel_cut_size": 325,
+ "library_name": "Paired End Pfl #3 MP 7/24/9",
+ "creation_date": "2009-08-05",
+ "cell_line": 1,
+ "library_species": 8,
+ "library_type": 2,
+ "made_by": "Lorian",
"affiliations": [
41
- ],
- "replicate": 1,
- "condition": 1,
- "hidden": true,
- "stopping_point": "1A",
- "tags": [],
- "made_for": "",
- "amplified_from_sample": null,
- "notes": "7/31/2009 16:08:22\tColor: Blue",
- "undiluted_concentration": null,
- "successful_pM": null,
- "experiment_type": 8,
+ ],
+ "replicate": 1,
+ "condition": 1,
+ "hidden": true,
+ "stopping_point": "1A",
+ "tags": [],
+ "made_for": "",
+ "amplified_from_sample": null,
+ "notes": "7/31/2009 16:08:22\tColor: Blue",
+ "undiluted_concentration": null,
+ "successful_pM": null,
+ "experiment_type": 8,
"antibody": null
}
},
{
- "pk": "11005",
- "model": "samples.library",
+ "pk": "11005",
+ "model": "samples.library",
"fields": {
- "ten_nM_dilution": false,
- "gel_cut_size": 325,
- "library_name": "null cell line",
- "creation_date": "2009-08-05",
- "cell_line": null,
- "library_species": 8,
- "library_type": 2,
- "made_by": "Lorian",
+ "ten_nM_dilution": false,
+ "gel_cut_size": 325,
+ "library_name": "null cell line",
+ "creation_date": "2009-08-05",
+ "cell_line": null,
+ "library_species": 8,
+ "library_type": 2,
+ "made_by": "Lorian",
"affiliations": [
41
- ],
- "replicate": 1,
- "condition": 1,
- "hidden": true,
- "stopping_point": "1A",
- "tags": [],
- "made_for": "",
- "amplified_from_sample": null,
- "notes": "7/31/2009 16:08:22\tColor: Blue",
- "undiluted_concentration": null,
- "successful_pM": null,
- "experiment_type": 8,
+ ],
+ "replicate": 1,
+ "condition": 1,
+ "hidden": true,
+ "stopping_point": "1A",
+ "tags": [],
+ "made_for": "",
+ "amplified_from_sample": null,
+ "notes": "7/31/2009 16:08:22\tColor: Blue",
+ "undiluted_concentration": null,
+ "successful_pM": null,
+ "experiment_type": 8,
"antibody": null
}
}
fixtures = ['test_samples.json']
def test_library_info(self):
-
for lib in Library.objects.all():
lib_dict = library_dict(lib.id)
url = '/samples/library/%s/json' % (lib.id,)
self.assertEqual(fromTypedNode(r['gel_cut']), 400)
self.assertEqual(fromTypedNode(r['made_by']), u'Igor')
+ def test_library_index_rdfa(self):
+ from htsworkflow.util.rdfhelp import \
+ add_default_schemas, get_model, load_string_into_model
+
+ from htsworkflow.util.rdfinfer import Infer
+
+ model = get_model()
+ add_default_schemas(model)
+ inference = Infer(model)
+
+ response = self.client.get('/library/')
+ self.assertEqual(response.status_code, 200)
+ load_string_into_model(model, 'rdfa', response.content)
+
+ errmsgs = list(inference.run_validation())
+ self.assertEqual(len(errmsgs), 2)
+ # didn't feel like giving the index page a type since all
+ # its doing is showing a list of things.
+ for err in errmsgs:
+ self.assertEqual(err, 'Missing type for: http://localhost/')
+
+ body = """prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+ prefix libns: <http://jumpgate.caltech.edu/wiki/LibraryOntology#>
+
+ select ?library ?library_id ?name ?species
+ where {
+ ?library a libns:Library .
+ OPTIONAL { ?library libns:library_id ?library_id . }
+ OPTIONAL { ?library libns:species ?species . }
+ OPTIONAL { ?library libns:name ?name . }
+ }"""
+ bindings = set(['library', 'library_id', 'name', 'species'])
+ query = RDF.SPARQLQuery(body)
+ count = 0
+ for r in query.execute(model):
+ count += 1
+ for name, value in r.items():
+ self.assertTrue(name in bindings)
+ self.assertTrue(value is not None)
+
+ self.assertEqual(count, len(Library.objects.filter(hidden=False)))
+
# The django test runner flushes the database between test suites not cases,
# so to be more compatible with running via nose we flush the database tables
# of interest before creating our sample data.