Commit 4956f8ea authored by Martino Bertoni's avatar Martino Bertoni 🌋
Browse files

added option to get signature as a pandas dataframe with inchikeys as indexes...

added option to get signature as a pandas dataframe with inchikeys as indexes and features as columns
parent c58eea9a
Pipeline #2711 passed with stages
in 27 minutes and 34 seconds
......@@ -50,6 +50,7 @@ import json
import shutil
import itertools
import numpy as np
import pandas as pd
from glob import glob
from pathlib import Path
......@@ -448,10 +449,13 @@ class ChemicalChecker():
on the cctype passed.
signature_path = self.get_signature_path(cctype, molset, dataset_code)
as_dataframe = kwargs.pop('as_dataframe', False)
# the factory will return the signature with the right class
data = DataFactory.make_data(
cctype, signature_path, dataset_code, *args, **kwargs)
if as_dataframe:
df = pd.DataFrame(data[:],columns=data.features, index=data.keys)
return df
return data
def get_data_signature(self, cctype, dataset_code):
......@@ -481,9 +485,10 @@ class ChemicalChecker():
return None
return DataSignature(data.data_path)
def signature(self, dataset, cctype):
def signature(self, dataset, cctype, as_dataframe=False):
return self.get_signature(cctype=cctype, molset="full",
def link_h5(self, custom_data_path):
"""Link H5 files from a given custom directory.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment