Hello Florent,
I had forgot to report this bug. I have a table with 81 population abundances, but I only wanted to generate a library for the first one. The problem is that the "-num_libraries" value I use is completely ignored and Grinder always generates all 81 libraries.
This is the initial setup:
my $factory = Grinder->new( -reference_file => 'stool_species.fa',
-forward_reverse => 'degenerate_primers.txt',
-length_bias => 0,
-unidirectional => 1,
-fastq_output => 1,
-qual_levels => '35 20',
-abundance_file => 'summary_table_grinder.txt',
-total_reads => 8250,
-read_dist => (150.86, 'normal', 0.39),
-num_libraries => 1,
-insert_dist => 5000,
-mate_orientation => 'FR'
);
I think that the problem is in the code of subroutine "community_structures" at Grinder.pm, there are 2 issues there. The first one would be "if ($nof_indep != 1)", because it will not print the warning message that I specified to only make 1 library while the table have data for 81 (while a value of 2 will print for example). The second and more important problem is that it its ignoring the number of libraries I specify, which means that the extraneous communities will not be ignored like the warning message says.
In the beginning I thought that the problem was here:
my $got_indep = scalar @$c_structs;
if ($nof_indep != 1) { # 1 is the default value
if ($nof_indep > $got_indep) {
die "Error: $nof_indep communities were requested but the abundance file".
" specified the abundances for only $got_indep.\n";
} elsif ($nof_indep < $got_indep) {
warn "Warning: $nof_indep communities were requested by the abundance ".
"file specified the abundances for $got_indep. Ignoring extraneous ".
"communities specified in the file.\n";
}
}
$nof_indep = $got_indep; # <--- overwrite specified num_libraries with the table data (scalar @$c_structs;)
$self->{num_libraries} = $nof_indep;
But commenting out the last 2 lines did not solve the problem because the extra libraries were still generated, although {num_libraries} was this time set lower (I experimented with -num_libraries 1 and 2). Interestingly, when I commented out those lines and set "-num_libraries 1", it only generated 1 output file that I could deduced, by the constant change in the modified data, that it was being overwrited again and again for each library.
Cheers,
Anonymous