-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed instance blacklist from gitignore
- Loading branch information
1 parent
c5bdb7f
commit 00a2d7f
Showing
3 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,7 +62,6 @@ db.sqlite3 | |
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import re | ||
|
||
class ModeBuilder: | ||
def __init__(self,builder): | ||
self._builder = builder | ||
|
||
def tree(self): | ||
tree_edges = [] | ||
node_attrs = {} | ||
seen = [] | ||
max_key = max([node for node in self._builder.v_nodes]) | ||
for n,v,e in self._builder.v_edges: | ||
node_attrs[v] = self._builder.nodes[v] | ||
node_attrs[n] = self._builder.nodes[n] | ||
v_copy = v | ||
if v in seen: | ||
max_key +=1 | ||
v = max_key | ||
node_attrs[v] = self._builder.nodes[v_copy] | ||
seen.append(v) | ||
else: | ||
seen.append(v) | ||
edge = self._create_edge_dict(e) | ||
tree_edges.append((n,v,e,edge)) | ||
tree_graph = self._builder.sub_graph(tree_edges,node_attrs) | ||
return tree_graph | ||
|
||
def network(self): | ||
return self._builder.view | ||
|
||
def _create_edge_dict(self,key,weight=1): | ||
edge = {'weight': weight, | ||
'display_name': self._get_name(str(key))} | ||
return edge | ||
|
||
def _get_name(self,subject): | ||
split_subject = self._split(subject) | ||
if len(split_subject[-1]) == 1 and split_subject[-1].isdigit(): | ||
return split_subject[-2] | ||
elif len(split_subject[-1]) == 3 and _isfloat(split_subject[-1]): | ||
return split_subject[-2] | ||
else: | ||
return split_subject[-1] | ||
|
||
def _split(self,uri): | ||
return re.split('#|\/|:', uri) | ||
|
||
def _isfloat(x): | ||
try: | ||
float(x) | ||
return True | ||
except ValueError: | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#from utility.nv_identifiers import identifiers | ||
import re | ||
|
||
class ViewBuilder: | ||
def __init__(self,builder): | ||
self._builder = builder | ||
|
||
def full(self): | ||
return self._builder._graph | ||
|
||
def pruned(self): | ||
edges = [] | ||
node_attrs = {} | ||
w_predicates = [] | ||
for n,v,k,e in self._builder.edges(keys=True,data=True): | ||
if k not in w_predicates: | ||
continue | ||
node_attrs[n] = self._builder.nodes[n] | ||
node_attrs[v] = self._builder.nodes[v] | ||
edges.append((n,v,k,e)) | ||
return self._builder.sub_graph(edges,node_attrs) | ||
|
||
def heirarchy(self): | ||
edges = [] | ||
node_attrs = {} | ||
for entity,data in self._builder.get_entities(): | ||
sub_entities = self._builder.get_entities(entity) | ||
if len(sub_entities) == 0: | ||
continue | ||
node_attrs[entity] = data | ||
|
||
for s_entity in sub_entities: | ||
key = identifiers.predicates.contains | ||
s_entity,s_e_data = s_entity | ||
node_attrs[s_entity] = s_e_data | ||
edge = self._build_edge_attr(key) | ||
edges.append((entity,s_entity,key,edge)) | ||
return self._builder.sub_graph(edges,node_attrs) | ||
|
||
def interaction_verbose(self): | ||
edges = [] | ||
node_attrs = {} | ||
return self._builder.sub_graph(edges,node_attrs) | ||
|
||
def interaction(self): | ||
edges = [] | ||
node_attrs = {} | ||
return self._builder.sub_graph(edges,node_attrs) | ||
|
||
def interaction_genetic(self): | ||
edges = [] | ||
node_attrs = {} | ||
return self._builder.sub_graph(edges,node_attrs) | ||
|
||
def ppi(self): | ||
edges = [] | ||
node_attrs = {} | ||
return self._builder.sub_graph(edges,node_attrs) | ||
|
||
def module(self): | ||
edges = [] | ||
node_attrs = {} | ||
return self._builder.sub_graph(edges,node_attrs) | ||
|
||
def _build_edge_attr(self,key): | ||
return {"display_name" : self._get_name(key)} | ||
|
||
def _get_name(self,subject): | ||
split_subject = self._split(subject) | ||
if len(split_subject[-1]) == 1 and split_subject[-1].isdigit(): | ||
return split_subject[-2] | ||
elif len(split_subject[-1]) == 3 and _isfloat(split_subject[-1]): | ||
return split_subject[-2] | ||
else: | ||
return split_subject[-1] | ||
|
||
def _split(self,uri): | ||
return re.split('#|\/|:', uri) | ||
|
||
def _isfloat(x): | ||
try: | ||
float(x) | ||
return True | ||
except ValueError: | ||
return False |