mark the example submission rule files as being raw, so the escapes dont get confused
[htsworkflow.git] / encode_submission / encode_find.py
index 70f280f7e4f4f18c46c8206674ab27960001a82f..7589f5487aef5ef85a6c4ec65072aa3d025ef5bc 100644 (file)
@@ -26,18 +26,14 @@ if not 'DJANGO_SETTINGS_MODULE' in os.environ:
 from htsworkflow.submission import daf, ucsc
 
 from htsworkflow.util import api
+from htsworkflow.util.rdfns import *
 from htsworkflow.util.rdfhelp import \
-     dafTermOntology, \
-     dublinCoreNS, \
      get_model, \
      get_serializer, \
      sparql_query, \
      submissionOntology, \
      libraryOntology, \
-     load_into_model, \
-     rdfNS, \
-     rdfsNS, \
-     xsdNS
+     load_into_model
 TYPE_N = rdfNS['type']
 CREATION_DATE = libraryOntology['date']
 
@@ -186,7 +182,7 @@ def make_parser():
 
 
 def load_my_submissions(model, limit=None, cookie=None):
-    """Parse all the submissions from UCSC into model
+    """Parse all of my submissions from encodesubmit into model
     It will look at the global USER_URL to figure out who to scrape
     cookie contains the session cookie, if none, will attempt to login
     """
@@ -538,6 +534,8 @@ def load_encodedcc_files(model, genome, composite):
     if file_index is None:
         return
 
+    lib_term = submissionOntology['library_urn']
+    sub_term = submissionOntology['submission_urn']
     for filename, attributes in file_index.items():
         s = RDF.Node(RDF.Uri(filename))
         model.add_statement(
@@ -546,6 +544,13 @@ def load_encodedcc_files(model, genome, composite):
             p = RDF.Node(DCC_NS[name])
             o = RDF.Node(value)
             model.add_statement(RDF.Statement(s,p,o))
+            if name.lower() == 'labexpid':
+                model.add_statement(
+                    RDF.Statement(s, lib_term, LIBRARY_NS[value+'/']))
+            elif name.lower() == 'subid':
+                sub_url = RDF.Uri(submission_view_url(value))
+                model.add_statement(
+                    RDF.Statement(s, sub_term, sub_url))
 
 
 def load_library_detail(model, libraryUrn):