annotate neo4j.py @ 23:1c926de292e1 draft

planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 1a80071ba86f5b7730740a04e73059de3a108c04
author sanbi-uwc
date Sat, 25 Jun 2016 21:04:43 -0400
parents 9a98be1659c7
children d7253c66512d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
1 """
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
2 Neo4j Composite Dataset
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
3 """
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
4 import logging
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
5 import sys
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
6
13
7f63bb1dd162 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit c70e817056b8b40ca30339792cc8457670bbf9eb
sanbi-uwc
parents: 11
diff changeset
7 from galaxy.datatypes.images import Html
7f63bb1dd162 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit c70e817056b8b40ca30339792cc8457670bbf9eb
sanbi-uwc
parents: 11
diff changeset
8 from galaxy.datatypes.data import Data, Text
20
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
9
19
2287178087eb planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 0f90b9e2eae026ccea40bcc164f142313af7d397
sanbi-uwc
parents: 18
diff changeset
10 import shutil
2287178087eb planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 0f90b9e2eae026ccea40bcc164f142313af7d397
sanbi-uwc
parents: 18
diff changeset
11 import os
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
12
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
13 gal_Log = logging.getLogger(__name__)
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
14 verbose = True
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
15
5
7f262236d352 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit ebd884bad7609048e02d1ef04985cf812ab142a3
sanbi-uwc
parents: 4
diff changeset
16
15
ec3016ba76f2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 002030d20f30ca916e883b64e332dcbdfa0d10a0
sanbi-uwc
parents: 14
diff changeset
17 class Neo4j(Html):
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
18 """
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
19 base class to use for neostore datatypes
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
20 derived from html - composite datatype elements
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
21 stored in extra files path
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
22 """
21
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
23 def __init__(self):
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
24 Html.__init__( self, **kwd )
11
6a177f046b73 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2de149508da75c935142db2fcba5e62c3faf2070
sanbi-uwc
parents: 10
diff changeset
25
22
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
26 def generate_primary_file( self, dataset=None ):
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
27 """
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
28 This is called only at upload to write the html file
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
29 cannot rename the datasets here - they come with the default unfortunately
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
30 """
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
31 rval = [
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
32 '<html><head><title>Files for Composite Dataset (%s)</title></head><p/>\
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
33 This composite dataset is composed of the following files:<p/><ul>' % (
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
34 self.file_ext)]
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
35 for composite_name, composite_file in self.get_composite_files(dataset=dataset).iteritems():
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
36 opt_text = ''
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
37 if composite_file.optional:
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
38 opt_text = ' (optional)'
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
39 rval.append('<li><a href="%s">%s</a>%s' % (composite_name, composite_name, opt_text))
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
40 rval.append('</ul></html>')
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
41 return "\n".join(rval)
9a98be1659c7 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6e53bcb4fd10d4fed3ea95322c13a5f95ca1eac9
sanbi-uwc
parents: 21
diff changeset
42
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
43 def get_mime(self):
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
44 """Returns the mime type of the datatype"""
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
45 return 'text/html'
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
46
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
47 def set_peek(self, dataset, is_multi_byte=False):
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
48 """Set the peek and blurb text"""
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
49 if not dataset.dataset.purged:
1
9f8e04bd6fa9 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 3f5361a7226127ec8b8d6cb5591b5bb4f52bb6fe
sanbi-uwc
parents: 0
diff changeset
50 dataset.peek = 'Neo4j database (multiple files)'
9f8e04bd6fa9 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 3f5361a7226127ec8b8d6cb5591b5bb4f52bb6fe
sanbi-uwc
parents: 0
diff changeset
51 dataset.blurb = 'Neo4j database (multiple files)'
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
52 else:
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
53 dataset.peek = 'file does not exist'
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
54 dataset.blurb = 'file purged from disk'
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
55
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
56 def display_peek(self, dataset):
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
57 """Create HTML content, used for displaying peek."""
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
58 try:
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
59 return dataset.peek
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
60 except Exception:
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
61 return "NEO4J database (multiple files)"
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
62
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
63 def display_data(self, trans, data, preview=False, filename=None,
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
64 to_ext=None, size=None, offset=None, **kwd):
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
65 """Documented as an old display method, but still gets called via tests etc
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
66 This allows us to format the data shown in the central pane via the "eye" icon.
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
67 """
21
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
68 if preview == False:
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
69 trans.response.set_content_type(data.get_mime())
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
70 trans.log_event( "Display dataset id: %s" % str( data.id ) )
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
71
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
72 # the target directory name
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
73 dir_name = str(os.path.dirname( trans.app.object_store.get_filename(data.dataset) )) + '/dataset_{}_files/neo4jdb'.format( data.dataset.id )
19
2287178087eb planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 0f90b9e2eae026ccea40bcc164f142313af7d397
sanbi-uwc
parents: 18
diff changeset
74
21
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
75 # generate unique filename for this dataset
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
76 valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
77 fname = ''.join(c in valid_chars and c or '_' for c in data.name)[0:150]
19
2287178087eb planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 0f90b9e2eae026ccea40bcc164f142313af7d397
sanbi-uwc
parents: 18
diff changeset
78
21
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
79 # zip the target directory (dir_name) using the fname
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
80 shutil.make_archive(fname, 'zip', dir_name)
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
81 download_zip = fname + '.zip'
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
82
21
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
83 # setup headers for the download
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
84 trans.response.headers['Content-Length'] = int( os.stat( download_zip ).st_size )
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
85 trans.response.set_content_type( "application/octet-stream" ) # force octet-stream so Safari doesn't append mime extensions to filename
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
86 trans.response.headers["Content-Disposition"] = 'attachment; filename="Galaxy%s-[%s].%s"' % (data.hid, download_zip , "zip")
19
2287178087eb planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 0f90b9e2eae026ccea40bcc164f142313af7d397
sanbi-uwc
parents: 18
diff changeset
87
21
c48ea98bd3b2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 84f212526ffc0d9206dcabc86d214860c2c03db5
sanbi-uwc
parents: 20
diff changeset
88 return open( download_zip )
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
89
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
90 class Neo4jDB(Neo4j, Data):
1
9f8e04bd6fa9 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 3f5361a7226127ec8b8d6cb5591b5bb4f52bb6fe
sanbi-uwc
parents: 0
diff changeset
91 """Class for neo4jDB database files."""
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
92 file_ext = 'neostore'
23
1c926de292e1 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 1a80071ba86f5b7730740a04e73059de3a108c04
sanbi-uwc
parents: 22
diff changeset
93 composite_type = 'auto_primary_file'
15
ec3016ba76f2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 002030d20f30ca916e883b64e332dcbdfa0d10a0
sanbi-uwc
parents: 14
diff changeset
94 allow_datatype_change = False
ec3016ba76f2 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 002030d20f30ca916e883b64e332dcbdfa0d10a0
sanbi-uwc
parents: 14
diff changeset
95
17
969c57578047 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 249c86259729c03d2be69b1e74d8257a43eb8e18
sanbi-uwc
parents: 16
diff changeset
96
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
97 def __init__(self, **kwd):
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
98 Data.__init__(self, **kwd)
20
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
99 self.add_composite_file('neostore', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
100 self.add_composite_file('neostore.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
101 self.add_composite_file('neostore.counts.db.a', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
102 self.add_composite_file('neostore.counts.db.b', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
103 self.add_composite_file('neostore.labeltokenstore.db', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
104 self.add_composite_file('neostore.labeltokenstore.db.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
105 self.add_composite_file('neostore.labeltokenstore.db.names', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
106 self.add_composite_file('neostore.labeltokenstore.db.names.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
107 self.add_composite_file('neostore.nodestore.db', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
108 self.add_composite_file('neostore.nodestore.db.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
109 self.add_composite_file('neostore.nodestore.db.labels', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
110 self.add_composite_file('neostore.nodestore.db.labels.id', is_binary=True)
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
111
20
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
112 self.add_composite_file('neostore.propertystore.db', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
113 self.add_composite_file('neostore.propertystore.db.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
114 self.add_composite_file('neostore.propertystore.db.arrays', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
115 self.add_composite_file('neostore.propertystore.db.arrays.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
116 self.add_composite_file('neostore.propertystore.db.index', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
117 self.add_composite_file('neostore.propertystore.db.index.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
118 self.add_composite_file('neostore.propertystore.db.index.keys', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
119 self.add_composite_file('neostore.propertystore.db.index.keys.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
120 self.add_composite_file('neostore.propertystore.db.strings', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
121 self.add_composite_file('neostore.propertystore.db.strings.id', is_binary=True)
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
122
20
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
123 self.add_composite_file('neostore.relationshipgroupstore.db', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
124 self.add_composite_file('neostore.relationshipgroupstore.db.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
125 self.add_composite_file('neostore.relationshipstore.db', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
126 self.add_composite_file('neostore.relationshipstore.db.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
127 self.add_composite_file('neostore.relationshiptypestore.db.names', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
128 self.add_composite_file('neostore.relationshiptypestore.db.names.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
129 self.add_composite_file('neostore.schemastore.db', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
130 self.add_composite_file('neostore.schemastore.db.id', is_binary=True)
45b969e6ff9a planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 2056c35a6d070fe6c56129a5a4b6fe400e5c9c8d
sanbi-uwc
parents: 19
diff changeset
131 self.add_composite_file('neostore.transaction.db.0', is_binary=True)
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
132
5
7f262236d352 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit ebd884bad7609048e02d1ef04985cf812ab142a3
sanbi-uwc
parents: 4
diff changeset
133
0
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
134 if __name__ == '__main__':
ba6fe46519e4 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 6f0defa160a42559d15bc47768b845f24227dc03
sanbi-uwc
parents:
diff changeset
135 import doctest
17
969c57578047 planemo upload for repository https://github.com/SANBI-SA/tools-sanbi-uwc/tree/master/datatypes/neo4j_datatypes commit 249c86259729c03d2be69b1e74d8257a43eb8e18
sanbi-uwc
parents: 16
diff changeset
136 doctest.testmod(sys.modules[__name__])