From: Diane Trout Date: Wed, 8 Jan 2014 18:03:05 +0000 (-0800) Subject: Rename stripNamespace strip_namespace X-Git-Url: http://woldlab.caltech.edu/gitweb/?p=htsworkflow.git;a=commitdiff_plain;h=0dfb322fa79ddc57040fb13e281f5b5606e0a20c Rename stripNamespace strip_namespace --- diff --git a/htsworkflow/pipelines/sequences.py b/htsworkflow/pipelines/sequences.py index 87212dd..2aba709 100644 --- a/htsworkflow/pipelines/sequences.py +++ b/htsworkflow/pipelines/sequences.py @@ -12,7 +12,7 @@ from urlparse import urljoin, urlparse import RDF from htsworkflow.util.rdfhelp import libraryOntology as libNS from htsworkflow.util.rdfhelp import toTypedNode, fromTypedNode, rdfNS, \ - stripNamespace, dump_model, simplify_uri + strip_namespace, dump_model, simplify_uri LOGGER = logging.getLogger(__name__) @@ -222,7 +222,7 @@ class SequenceFile(object): raise KeyError(u"%s not found" % (unicode(seq_id),)) seq_type_node = model.get_target(seq_id, libNS['file_type']) - seq_type = stripNamespace(libNS, seq_type_node) + seq_type = strip_namespace(libNS, seq_type_node) path = urlparse(str(seq_id.uri)).path flowcellNode = get_one(seq_id, libNS['flowcell']) diff --git a/htsworkflow/submission/condorfastq.py b/htsworkflow/submission/condorfastq.py index 17e4633..ffbd8e0 100644 --- a/htsworkflow/submission/condorfastq.py +++ b/htsworkflow/submission/condorfastq.py @@ -16,7 +16,7 @@ from htsworkflow.pipelines import desplit_fastq from htsworkflow.submission.fastqname import FastqName from htsworkflow.util.rdfhelp import get_model, dump_model, load_into_model, \ fromTypedNode, \ - stripNamespace + strip_namespace from htsworkflow.util.rdfns import * from htsworkflow.util.conversion import parse_flowcell_id @@ -347,7 +347,7 @@ class SequenceResult(object): ispaired = property(_get_ispaired) def _get_filetype(self): - return stripNamespace(libraryOntology, self._filetype) + return strip_namespace(libraryOntology, self._filetype) filetype = property(_get_filetype) def _get_path(self): diff --git a/htsworkflow/submission/geo.py b/htsworkflow/submission/geo.py index ef8d945..1d98bd5 100644 --- a/htsworkflow/submission/geo.py +++ b/htsworkflow/submission/geo.py @@ -8,7 +8,7 @@ from htsworkflow.submission.submission import Submission from htsworkflow.util.rdfhelp import \ fromTypedNode, \ geoSoftNS, \ - stripNamespace, \ + strip_namespace, \ submissionOntology from django.conf import settings @@ -207,7 +207,7 @@ class GEOSubmission(Submission): def query_to_soft_dictionary(self, results, heading): attributes = [] for r in results: - name = stripNamespace(geoSoftNS, r['name']) + name = strip_namespace(geoSoftNS, r['name']) if name is not None: if name.lower() == heading.lower(): name = '^' + name diff --git a/htsworkflow/submission/submission.py b/htsworkflow/submission/submission.py index c5a3f34..5077996 100644 --- a/htsworkflow/submission/submission.py +++ b/htsworkflow/submission/submission.py @@ -11,7 +11,7 @@ from htsworkflow.util.rdfhelp import \ dump_model, \ fromTypedNode, \ get_model, \ - stripNamespace, \ + strip_namespace, \ toTypedNode from htsworkflow.util.rdfns import * from htsworkflow.util.hashfile import make_md5sum @@ -390,7 +390,7 @@ def list_submissions(model): query = RDF.SPARQLQuery(query_body) rdfstream = query.execute(model) for row in rdfstream: - s = stripNamespace(submissionLog, row['submission']) + s = strip_namespace(submissionLog, row['submission']) if s[-1] in ['#', '/', '?']: s = s[:-1] yield s diff --git a/htsworkflow/submission/trackhub_submission.py b/htsworkflow/submission/trackhub_submission.py index e383175..131bb15 100644 --- a/htsworkflow/submission/trackhub_submission.py +++ b/htsworkflow/submission/trackhub_submission.py @@ -11,7 +11,6 @@ from htsworkflow.submission.submission import Submission from htsworkflow.util.rdfhelp import \ fromTypedNode, \ geoSoftNS, \ - stripNamespace, \ submissionOntology from htsworkflow.util.url import parse_ssh_url from htsworkflow.util.ucsc import bigWigInfo diff --git a/htsworkflow/util/rdfhelp.py b/htsworkflow/util/rdfhelp.py index ac5f6cc..4f65d7d 100644 --- a/htsworkflow/util/rdfhelp.py +++ b/htsworkflow/util/rdfhelp.py @@ -214,7 +214,7 @@ def simplify_uri(uri): return element raise ValueError("Unable to simplify %s" % (uri,)) -def stripNamespace(namespace, term): +def strip_namespace(namespace, term): """Remove the namespace portion of a term returns None if they aren't in common diff --git a/htsworkflow/util/test/test_rdfhelp.py b/htsworkflow/util/test/test_rdfhelp.py index 3f328d8..2f14190 100644 --- a/htsworkflow/util/test/test_rdfhelp.py +++ b/htsworkflow/util/test/test_rdfhelp.py @@ -19,7 +19,7 @@ from htsworkflow.util.rdfhelp import \ rdfsNS, \ remove_schemas, \ toTypedNode, \ - stripNamespace, \ + strip_namespace, \ simplify_uri, \ sanitize_literal, \ xsdNS @@ -121,17 +121,17 @@ try: term = 'foo' node = nsOrg[term] - self.assertEqual(stripNamespace(nsOrg, node), term) - self.assertEqual(stripNamespace(nsCom, node), None) - self.assertEqual(stripNamespace(nsOrg, node.uri), term) + self.assertEqual(strip_namespace(nsOrg, node), term) + self.assertEqual(strip_namespace(nsCom, node), None) + self.assertEqual(strip_namespace(nsOrg, node.uri), term) def test_strip_namespace_exceptions(self): nsOrg = RDF.NS('example.org/example#') nsCom = RDF.NS('example.com/example#') node = toTypedNode('bad') - self.assertRaises(ValueError, stripNamespace, nsOrg, node) - self.assertRaises(ValueError, stripNamespace, nsOrg, nsOrg) + self.assertRaises(ValueError, strip_namespace, nsOrg, node) + self.assertRaises(ValueError, strip_namespace, nsOrg, nsOrg) def test_simplify_uri(self): DATA = [('http://asdf.org/foo/bar', 'bar'),