Skip to content

Commit

Permalink
Remove "ReadRootDataset"
Browse files Browse the repository at this point in the history
  • Loading branch information
JATC1024 authored and trile965 committed Apr 4, 2022
1 parent 5771cb9 commit dbf41f8
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 109 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export(Read10XH5Content)
export(ReadColSumSpMt)
export(ReadDoubleVector)
export(ReadIntegerVector)
export(ReadRootDataset)
export(ReadRowSumSpMt)
export(ReadSpMt)
export(ReadSpMtAsS4)
Expand Down
11 changes: 0 additions & 11 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@ WriteRootDataset <- function(filePath, datasetName, datasetVal) {
invisible(.Call(`_Signac_WriteRootDataset`, filePath, datasetName, datasetVal))
}

#' ReadRootDataset
#'
#' Read a string vector from root group
#'
#' @param filePath A fiel path
#' @param datasetName A dataset name
#' @export
ReadRootDataset <- function(filePath, datasetName) {
.Call(`_Signac_ReadRootDataset`, filePath, datasetName)
}

#' ReadIntegerVector
#'
#' This function is used to read a integer vector from hdf5 file
Expand Down
17 changes: 0 additions & 17 deletions src/Hdf5Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,23 +234,6 @@ void WriteRootDataset(const std::string &filePath, const std::string &datasetNam
oHdf5Util.Close(file);
}

//' ReadRootDataset
//'
//' Read a string vector from root group
//'
//' @param filePath A fiel path
//' @param datasetName A dataset name
//' @export
// [[Rcpp::export]]
Rcpp::StringVector ReadRootDataset(const std::string &filePath, const std::string &datasetName) {
com::bioturing::Hdf5Util oHdf5Util(filePath);
HighFive::File *file = oHdf5Util.Open(1);
std::vector<std::string> dataVec;
oHdf5Util.ReadRootDataset(file, datasetName, dataVec);
oHdf5Util.Close(file);
return Rcpp::wrap(dataVec);
}

//' ReadIntegerVector
//'
//' This function is used to read a integer vector from hdf5 file
Expand Down
67 changes: 0 additions & 67 deletions src/Hdf5Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,73 +282,6 @@ class Hdf5Util {
}
}

template <typename T>
void ReadRootDataset(HighFive::File *file, const std::string &datasetName, std::vector<T> &datasetVal) {
if(file == nullptr) {
std::stringstream ostr;
ostr << "Can not read dataset, please open file :" << file_name;
::Rf_error(ostr.str().c_str());
throw;
}

try {
if(file->exist(datasetName) == false) {
std::stringstream ostr;
ostr << "Can not exist dataset :" << datasetName;
::Rf_error(ostr.str().c_str());
Close(file);
throw;
}

HighFive::DataSet datasetVec = file->getDataSet(datasetName);

#ifdef DEBUG
HighFive::DataSpace dataSpace = datasetVec.getSpace();
auto dims = dataSpace.getDimensions();
HighFive::DataType dataType = datasetVec.getDataType();
size_t str_size = H5Tget_size(dataType.getId());
std::stringstream ostr;
ostr << "Read dataset (T) : [" << datasetName << "] with str_size=" << str_size << ", dims[0]=" << dims[0];
::Rf_warning(ostr.str().c_str());
#endif

datasetVec.read(datasetVal);
} catch (HighFive::Exception& err) {
std::stringstream ostr;
ostr << "ReadRootDataset HDF5 format, error=" << err.what() ;
::Rf_error(ostr.str().c_str());
Close(file);
throw;
}
}

void ReadRootDataset(HighFive::File *file, const std::string &datasetName, std::vector<std::string> &datasetVal) {
if(file == nullptr) {
std::stringstream ostr;
ostr << "Can not read dataset, please open file :" << file_name;
::Rf_error(ostr.str().c_str());
throw;
}

try {
if(file->exist(datasetName) == false) {
std::stringstream ostr;
ostr << "Can not exist dataset :" << datasetName;
::Rf_error(ostr.str().c_str());
Close(file);
throw;
}
//TODO: Change this?
ReadDatasetVector<256>(file, "", datasetName, datasetVal);
} catch (HighFive::Exception& err) {
std::stringstream ostr;
ostr << "ReadRootDataset HDF5 format, error=" << err.what() ;
::Rf_error(ostr.str().c_str());
Close(file);
throw;
}
}

void GetListAttributes(HighFive::File *file, const std::string &groupName, const std::string &datasetName, std::vector<std::string> &arrList) {
if(file == nullptr) {
std::stringstream ostr;
Expand Down
13 changes: 0 additions & 13 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,18 +173,6 @@ BEGIN_RCPP
return R_NilValue;
END_RCPP
}
// ReadRootDataset
Rcpp::StringVector ReadRootDataset(const std::string& filePath, const std::string& datasetName);
RcppExport SEXP _Signac_ReadRootDataset(SEXP filePathSEXP, SEXP datasetNameSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< const std::string& >::type filePath(filePathSEXP);
Rcpp::traits::input_parameter< const std::string& >::type datasetName(datasetNameSEXP);
rcpp_result_gen = Rcpp::wrap(ReadRootDataset(filePath, datasetName));
return rcpp_result_gen;
END_RCPP
}
// ReadIntegerVector
Rcpp::NumericVector ReadIntegerVector(const std::string& filePath, const std::string& groupName, const std::string& datasetName);
RcppExport SEXP _Signac_ReadIntegerVector(SEXP filePathSEXP, SEXP groupNameSEXP, SEXP datasetNameSEXP) {
Expand Down Expand Up @@ -687,7 +675,6 @@ static const R_CallMethodDef CallEntries[] = {
{"_Signac_GetListRootObjectNames", (DL_FUNC) &_Signac_GetListRootObjectNames, 1},
{"_Signac_Read10XH5Content", (DL_FUNC) &_Signac_Read10XH5Content, 3},
{"_Signac_WriteRootDataset", (DL_FUNC) &_Signac_WriteRootDataset, 3},
{"_Signac_ReadRootDataset", (DL_FUNC) &_Signac_ReadRootDataset, 2},
{"_Signac_ReadIntegerVector", (DL_FUNC) &_Signac_ReadIntegerVector, 3},
{"_Signac_ReadDoubleVector", (DL_FUNC) &_Signac_ReadDoubleVector, 3},
{"_Signac_FastMatMult", (DL_FUNC) &_Signac_FastMatMult, 2},
Expand Down

0 comments on commit dbf41f8

Please sign in to comment.