BenoitMorel / Asteroid

GNU Affero General Public License v3.0
10 stars 1 forks source link

Fix non-mandatory prefix option #9

Open nylander opened 8 months ago

nylander commented 8 months ago

Dear @BenoitMorel !

Currently, the -p (prefix) parameter is non mandatory and not set with a default value. When running your minimal example ./asteroid -i GENE_TREES, this will result in "hidden" output files (.allTrees.newick, .bestTree.newick, .scores.txt).

One can solve this in several ways: Check for prefix as a mandatory parameter and stop if not provided, or set a fixed default prefix string if prefix is not provided, or base the prefix on the input. Adding the lines below to Arguments.cpp will do the latter.

Cheers Johan


Change (starting at line 56):

  if (inputBSGeneTreeFile.size() == 0) {
    inputBSGeneTreeFile = inputGeneTreeFile;
  }   

to

  if (inputBSGeneTreeFile.size() == 0) {
    inputBSGeneTreeFile = inputGeneTreeFile;
  }
  if (prefix.empty()) {
    prefix = inputGeneTreeFile;
  }
BenoitMorel commented 8 months ago

Hi Johan, Thank you very much for spotting this! I just applied the fix that you suggested. Best, Benoit

Le jeu. 15 févr. 2024 à 15:36, Johan Nylander @.***> a écrit :

Dear @BenoitMorel https://github.com/BenoitMorel !

Currently, the -p (prefix) parameter is non mandatory and not set with a default value. When running your minimal example ./asteroid -i GENE_TREES https://github.com/BenoitMorel/Asteroid#running-asteroid, this will result in "hidden" output files (.allTrees.newick, .bestTree.newick, .scores.txt).

One can solve this in several ways: Check for prefix as a mandatory parameter and stop if not provided, or set a fixed default prefix string if prefix is not provided, or base the prefix on the input. Adding the lines below to Arguments.cpp https://github.com/BenoitMorel/Asteroid/blob/main/src/asteroid/Arguments.cpp will do the latter.

Cheers Johan

Change (starting at line 56):

if (inputBSGeneTreeFile.size() == 0) { inputBSGeneTreeFile = inputGeneTreeFile; }

to

if (inputBSGeneTreeFile.size() == 0) { inputBSGeneTreeFile = inputGeneTreeFile; } if (prefix.empty()) { prefix = inputGeneTreeFile; }

— Reply to this email directly, view it on GitHub https://github.com/BenoitMorel/Asteroid/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADJJ3UJZA5DSH2FS5LWS3KDYTYMOPAVCNFSM6AAAAABDKL7H36VHI2DSMVQWIX3LMV43ASLTON2WKOZSGEZTMNRZGQYTONQ . You are receiving this because you were mentioned.Message ID: @.***>