Fixelcfestats: input files and design matrix error

Dear experts,

I am trying to run fixelcfestats and I keep getting an error message:
[Error] number of input files does not match number of rows in design matrix.

Here are the contents of the input files:
ctrl_bb_FC.msf
ctrl_ck_FC.msf
ctrl_mh_FC.msf
pat1_ad_FC.msf
pat1_sn_FC.msf
pat3_rb_FC.msf

And here is the design:
1 0
1 0
1 0
0 1
0 1
0 1

Contrast is: 1 -1

I have tried different versions of the design matrix and even tried to include a trailing blank row in the text files but this does not solve the problem.
Could you please help me to know what I am doing wrong and how to rectify it.

Thank you.
Isaac

Hi Isaac,
Your set up looks ok. Not sure what is going on here. Before this error message occurs, the each line of the input files text file will be read and checked that the file exists, so an extra line should not cause this error. I also don’t think an extra blank line (row) in the design matrix would have cause this, but I’d recommend taking any out to be sure.

Can you supply the output with the -debug option?

You could also insert some print statements before this line, to try and work out what is going on. If you are not familiar with C++ this should do the trick:

// Load design matrix:
  Eigen::Matrix<value_type, Eigen::Dynamic, Eigen::Dynamic> design = load_matrix<value_type> (argument[2]);
  CONSOLE ("design rows: " + str(design.rows()));
  CONSOLE ("num of input files: " + str(filenames.size()));
  CONSOLE ("design matrix: " + str(design));
  CONSOLE ("input files: " + str(filenames));
  if (design.rows() != (ssize_t)filenames.size())
    throw Exception ("number of input files does not match number of rows in design matrix");

Just checking, is this your actual design matrix? or a cut down version posted as an example? Running fixelcfestats with 3v3 won’t be possible since it employs permutation testing. 3x3 will only give 20 permutations, which is not enough to build a permutation distribution.

Cheers,
Dave

Hi Dave,

Thanks for responding to my message.

I copied the C++ code but it did not print anything to the console. I also tried the -debug option and this was the output:

fixelcfestats: [DEBUG] No config file found at "/etc/mrtrix.conf"
fixelcfestats: [DEBUG] No config file found at ".mrtrix.conf"
fixelcfestats: [DEBUG] loading matrix file "design.txt"...
**fixelcfestats: [DEBUG] found 1x136 matrix in file "design.txt"**
fixelcfestats: [ERROR] number of input files does not match number of rows in design matrix

The actual design has 68 inputs. So I am not sure why it detects 136 inputs in the matrix.

Thanks.
Isaac

Isaac,

That looks like a newline (EOL) encoding problem: the matrix text file import code is reading all of the text as a single “line” of text before converting to a numerical matrix (hence why it comes out as 1x136 rather than 2x68). The import code relies on a standard function std::getline() for splitting text files into lines, so it’s not really something I’d have expected to fall over…

Some advanced text editors offer one-click EOL conversion: Personally I use Notepad++ on my Windows machine which has it. You can also get it to visually show what encoding characters are present in the file. Hopefully you can use such a program to investigate / fix the contents of that text file.

Rob

1 Like

Hi Rob,

I used Sublime Text to format the EOL and it now works.

Thank you Dave, thank you Rob.

Isaac.