DEIB-GECO / PyGMQL

Python Library for data analysis based on GMQL
Apache License 2.0
13 stars 5 forks source link

Error when a field of the dataset is called *index* #15

Closed lucananni93 closed 6 years ago

lucananni93 commented 6 years ago

When a dataset that has the region field index the following error occurs:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-15-c63d645cfc40> in <module>()
      1 all_h3k27ac_peaks_gmql = gl.from_pandas(all_h3k27ac_peaks, chr_name="chr", 
      2                                         start_name="start", stop_name="end",
----> 3                                         strand_name="strand").to_GMQLDataset()

~/software/PyGMQL/gmql/dataset/GDataframe.py in to_GMQLDataset(self, local_path, remote_path)
     75 
     76         if local is not None:
---> 77             return Loader.load_from_path(local_path=local)
     78         elif remote is not None:
     79             raise NotImplementedError("The remote loading is not implemented yet!")

~/software/PyGMQL/gmql/dataset/loaders/Loader.py in load_from_path(local_path, parser, all_load)
     89                                        location="local", path_or_name=local_path,
     90                                        local_sources=local_sources,
---> 91                                        meta_profile=meta_profile)
     92 
     93 

~/software/PyGMQL/gmql/dataset/GMQLDataset.py in __init__(self, parser, index, location, path_or_name, local_sources, remote_sources, meta_profile)
     56         # setting the schema as properties of the dataset
     57         for field in self.schema:
---> 58             self.__setattr__(field, self.RegField(field))
     59         # add also left and right
     60         self.left = self.RegField("left")

~/software/PyGMQL/gmql/dataset/GMQLDataset.py in RegField(self, name)
    127         :return: a RegField instance
    128         """
--> 129         return RegField(name=name, index=self.index)
    130 
    131     def select(self, meta_predicate=None, region_predicate=None,

~/software/PyGMQL/gmql/dataset/DataStructures/RegField.py in __init__(self, name, index, region_condition, reNode)
     12         self.region_condition = region_condition
     13         pymg = get_python_manager()
---> 14         self.exp_build = pymg.getNewExpressionBuilder(self.index)
     15         # check that the name is not already complex
     16         if not (name.startswith("(") and name.endswith(")")) and reNode is None:

~/anaconda3/envs/bio/lib/python3.6/site-packages/py4j/java_gateway.py in __call__(self, *args)
   1149 
   1150     def __call__(self, *args):
-> 1151         args_command, temp_args = self._build_args(*args)
   1152 
   1153         command = proto.CALL_COMMAND_NAME +\

~/anaconda3/envs/bio/lib/python3.6/site-packages/py4j/java_gateway.py in _build_args(self, *args)
   1119 
   1120         args_command = "".join(
-> 1121             [get_command_part(arg, self.pool) for arg in new_args])
   1122 
   1123         return args_command, temp_args

~/anaconda3/envs/bio/lib/python3.6/site-packages/py4j/java_gateway.py in <listcomp>(.0)
   1119 
   1120         args_command = "".join(
-> 1121             [get_command_part(arg, self.pool) for arg in new_args])
   1122 
   1123         return args_command, temp_args

~/anaconda3/envs/bio/lib/python3.6/site-packages/py4j/protocol.py in get_command_part(parameter, python_proxy_pool)
    288             command_part += ";" + interface
    289     else:
--> 290         command_part = REFERENCE_TYPE + parameter._get_object_id()
    291 
    292     command_part += "\n"

AttributeError: 'RegField' object has no attribute '_get_object_id'