Reading attributes from file node_attributes.tsv and adding them to nodes
WARNING: Attributes will be added as strings, so remember to convert them to proper types
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-51-c95ca8792c96> in <module>()
----> 1 ImportAttributes.import_node_attributes(sg,"node_attributes.tsv", sep="\t")
/home/lorenzo/miniconda3/envs/new_pynt_env/lib/python3.7/site-packages/pyntacle/io_stream/import_attributes.py in import_node_attributes(graph, file, sep)
160
161 #check if file name is properly passed
--> 162 check = check_file(graph=graph, file=file, sep=sep)
163 infile = check[0]
164 if sep is None:
/home/lorenzo/miniconda3/envs/new_pynt_env/lib/python3.7/site-packages/pyntacle/io_stream/import_attributes.py in check_file(graph, file, sep)
49 first = head.split(sep)[0]
50
---> 51 if first in graph.vs("name"):
52 sys.stdout.write("ERROR: header is not specified\n")
53 raise ValueError("header is not specified")
/home/lorenzo/miniconda3/envs/new_pynt_env/lib/python3.7/site-packages/igraph/__init__.py in __call__(self, *args, **kwds)
4139 This method simply passes all its arguments to L{VertexSeq.select()}.
4140 """
-> 4141 return self.select(*args, **kwds)
4142
4143 ##############################################################
/home/lorenzo/miniconda3/envs/new_pynt_env/lib/python3.7/site-packages/igraph/__init__.py in select(self, *args, **kwds)
4103
4104 @return: the new, filtered vertex sequence"""
-> 4105 vs = _igraph.VertexSeq.select(self, *args)
4106
4107 operators = {
TypeError: bad argument type for built-in operation
The error was due to a typo in vector indexing within the method check_file of the io_stream/import_attributes.py module.
It is fixed now and will be released in version 1.3.2
File formats guide
Command used:
ImportAttributes.import_node_attributes(sg,"node_attributes.tsv", sep="\t")
Error received:
Same error received with the following command:
ImportAttributes.import_edge_attributes(sg, "edge_attributes_standard.tsv", sep="\t", mode="standard")