Skip to content

Commit

Permalink
repair bio input
Browse files Browse the repository at this point in the history
  • Loading branch information
Reed Nelson committed Dec 2, 2023
1 parent 94e308a commit 9ef1c86
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 34 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ This utility has the form `./minaa.exe <G> <H> [-B=bio] [-a=alpha] [-b=beta]`.
- Default: the algorithm will run using only topological calculations.
- **-a=**: alpha; the GDV-edge weight balancer.
- Require: a real number in range [0, 1].
- Default: 1
- Default: 1 (100% GDV data).
- **-b=**: beta; the topological-biological cost matrix balancer.
- Require: a real number in range [0, 1].
- Default: 1
- Default: 1 (100% topological data).

#### Uncommon

Expand Down
16 changes: 15 additions & 1 deletion src/file_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,16 +418,30 @@ namespace FileIO
throw std::runtime_error("Unable to open file " + filepath);
}

// Parse the file directly into a matrix
// Parse the file directly into a matrix, skipping the first row and column
std::vector<std::vector<double>> matrix;
std::string line;
auto first_row = true;
while (std::getline(fin, line))
{
if (first_row)
{
first_row = false;
continue;
}

std::stringstream ss(line);
std::string cell;
std::vector<double> row;
auto first_col = true;
while (std::getline(ss, cell, delim))
{
if (first_col)
{
first_col = false;
continue;
}

try
{
row.push_back(std::stod(cell));
Expand Down
4 changes: 2 additions & 2 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ namespace Util
std::vector<std::vector<unsigned>> binarify(std::vector<std::vector<double>> double_matrix)
{
std::vector<std::vector<unsigned>> binary_matrix;
for (unsigned i = 1; i < double_matrix.size(); ++i)
for (unsigned i = 0; i < double_matrix.size(); ++i)
{
std::vector<unsigned> row;
for (unsigned j = 1; j < double_matrix[i].size(); ++j)
for (unsigned j = 0; j < double_matrix[i].size(); ++j)
{
if (double_matrix[i][j] != 0)
{
Expand Down
9 changes: 0 additions & 9 deletions test/B.csv

This file was deleted.

9 changes: 0 additions & 9 deletions test/G.csv

This file was deleted.

11 changes: 0 additions & 11 deletions test/H.csv

This file was deleted.

0 comments on commit 9ef1c86

Please sign in to comment.