[med-svn] [Git][med-team/roguenarok][upstream] New upstream version 1.0.1

Andreas Tille (@tille) gitlab at salsa.debian.org
Thu Oct 7 10:53:56 BST 2021



Andreas Tille pushed to branch upstream at Debian Med / roguenarok


Commits:
db6f4ec9 by Andreas Tille at 2021-10-07T10:23:41+02:00
New upstream version 1.0.1
- - - - -


18 changed files:

- Makefile
- README
- RogueNaRok.c
- Tree.c
- Tree.h
- common.c
- + example/150.bs
- + example/150.tre
- legacy.h
- newFunctions.c
- newFunctions.h
- parallel.c
- rnr-lsi.c
- rnr-mast.c
- rnr-prune.c
- rnr-tii.c
- sharedVariables.h
- + utils/pruneWrapper.sh


Changes:

=====================================
Makefile
=====================================
@@ -1,12 +1,12 @@
 CC = gcc 
 
-CFLAGS = -Wall -D_GNU_SOURCE # -DNDEBUG
+CFLAGS = -Wall -D_GNU_SOURCE
 LFLAGS = -lm
 
 ifeq ($(mode), debug)
  CFLAGS += -g
 else
- CFLAGS += -O3 # -march=native
+ CFLAGS += -O3 -DNDEBUG # -march=native
 ifeq ($(mode), profile)
  CFLAGS += -pg -g
 endif
@@ -33,20 +33,20 @@ mast-objs = rnr-mast.o common.o List.o Tree.o BitVector.o HashTable.o legacy.o n
 prune-objs = rnr-prune.o common.o Tree.o BitVector.o HashTable.o  legacy.o newFunctions.o List.o
 
 rnr-lsi: $(lsi-objs)
-	$(CC) $(LFLAGS) -o $@   $^ $(CFLAGS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) 
 rnr-tii: $(tii-objs)
-	$(CC) $(LFLAGS) -o $@   $^ $(CFLAGS)
+	$(CC) $(CFLAGS)  -o $@ $^ $(LFLAGS) 
 rnr-mast: $(mast-objs)
-	$(CC) $(LFLAGS) -o $@   $^ $(CFLAGS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) 
 rnr-prune: $(prune-objs)
-	$(CC) $(LFLAGS) -o $@   $^ $(CFLAGS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) 
 
 ifeq ($(mode),parallel)
 RogueNaRok: $(rnr-objs)
-	$(CC) $(LFLAGS) -o $@-parallel   $^ $(CFLAGS)
+	$(CC) $(CFLAGS) -o $@-parallel $^ $(LFLAGS) 
 else
 RogueNaRok: $(rnr-objs)
-	$(CC) $(LFLAGS) -o $@   $^ $(CFLAGS)
+	$(CC) $(CFLAGS) -o $@ $^ $(LFLAGS) 
 endif
 
 %.o : %.c $(DEPS)


=====================================
README
=====================================
@@ -11,4 +11,22 @@ trigger the help message. Just follow the instructions..
 
 More info is available on
 https://github.com/aberer/RogueNaRok/wiki/RogueNaRok . Also, use this
-site for reporting bugs, ask questions of how to employ RogueNaRok.
+site for reporting bugs or ask questions of how to employ RogueNaRok.
+
+QUICK START: 
+Have a look in the "example"-directory. For calling RogueNaRok, simply execute  
+./RogueNaRok -i example/150.bs  -n id
+in the command line. 
+
+Searching for rogues based on bootstrap values drawn onto a ML tree
+(from a bootstrap tree set) is done with
+ ./RogueNaRok -i example/150.bs -t example/150.tre -n id
+
+Also notice the script utils/pruneWrapper.sh. It facilitates the
+process of obtaining pruned trees from the RogueNaRok search. Call
+without arguments and follow the instructions in the help message.
+
+
+CITATION: 
+If RogueNaRok has been useful for your work, please cite as: 
+* A.J. Aberer, D. Krompass, A. Stamatakis: "Pruning Rogue Taxa Improves Phylogenetic Accuracy: An Efficient Algorithm and Webservice", Systematic Biology, in press.


=====================================
RogueNaRok.c
=====================================
@@ -1079,7 +1079,9 @@ void printRogueInformationToFile( All *tr, FILE *rogueOutput, int bestCumEver, i
       printIndexListToFile(rogueOutput, dropsetInRound[i]->taxaToDrop); 
       fprintf(rogueOutput, "\t");
       fprintRogueNames(tr, rogueOutput, dropsetInRound[i]->taxaToDrop);
-      fprintf(rogueOutput, "\t%f\t%f\n", (double)(cumScores[i]  - cumScores[i-1] )/ (double)tr->numberOfTrees,(double)cumScores[i] / (double)((computeSupport ? numberOfTrees : 1 ) * (mxtips-3)) ); 
+      fprintf(rogueOutput, "\t%f\t%f\n", 
+	      (double)(cumScores[i]  - cumScores[i-1] )/ (double)(computeSupport ? tr->numberOfTrees : 1.0),
+	      (double)cumScores[i] / (double)((computeSupport ? numberOfTrees : 1 ) * (mxtips-3)) ); 
       reached = bestCumEver == cumScores[i];
       ++i;
     }
@@ -1570,10 +1572,10 @@ Dropset *evaluateEvents(HashTable *mergingHash, Array *bipartitionsById, Array *
 	  
 	  double oldQuality =  labelPenalty == 0.0  
 	    ? result->improvement * drSize 
-	    :  (double)(result->improvement / (double)(computeSupport ?  numberOfTrees : 1.0)) - (double)resSize;
+	    :  (double)(result->improvement / (double)(computeSupport ?  numberOfTrees : 1.0)) - labelPenalty * (double)resSize;
 	  double newQuality = labelPenalty == 0.0 
 	    ? dropset->improvement * resSize
-	    : (double)(dropset->improvement / (double)(computeSupport ? numberOfTrees : 1.0)) - (double)drSize; 
+	    : (double)(dropset->improvement / (double)(computeSupport ? numberOfTrees : 1.0)) - labelPenalty * (double)drSize; 
 	  
 	  if( (newQuality  >  oldQuality) )
 	    result = dropset;	  
@@ -1584,11 +1586,15 @@ Dropset *evaluateEvents(HashTable *mergingHash, Array *bipartitionsById, Array *
   free(allDropsets->arrayTable);
   free(allDropsets);
 
-  if(labelPenalty == 0.0 && result->improvement > 0)
+  if((result->improvement / (computeSupport ? numberOfTrees : 1.0) - labelPenalty * lengthIndexList(result->taxaToDrop))  > 0.0 )
     return result;
-  else if(labelPenalty != 0.0 && (result->improvement / (computeSupport ? numberOfTrees : 1.0) - lengthIndexList(result->taxaToDrop))  > 0.0 )
-    return result; 
-  else 
+
+  /* if(labelPenalty == 0.0 && result->improvement > 0) */
+  /*   return result; */
+  /* else if(labelPenalty != 0.0 && (result->improvement / (computeSupport ? numberOfTrees : 1.0) - labelPenalty * lengthIndexList(result->taxaToDrop))  > 0.0 ) */
+  /*   return result; */
+
+  else
     return NULL;
 }
 
@@ -1917,8 +1923,7 @@ void doomRogues(All *tr, char *bootStrapFileName, char *dontDropFile, char *tree
 
   bestLastTime = cumScore;
   fprintf(rogueOutput, "num\ttaxNum\ttaxon\trawImprovement\tRBIC\n");
-  fprintf(rogueOutput, "%d\tNA\tNA\t%d\t%f\n", 0, 0, (double)cumScore /(numberOfTrees * (mxtips-3)) );
-
+  fprintf(rogueOutput, "%d\tNA\tNA\t%d\t%f\n", 0, 0, (double)cumScore /( (computeSupport ? numberOfTrees : 1 )  * (mxtips-3)) ); 
   PR("[%f] initialisation done (initScore = %f, numBip=%d)\n", updateTime(&timeInc), (double)cumScore / (double)((tr->mxtips-3) * (computeSupport ? tr->numberOfTrees : 1 ) ), bipartitionsById->length);
 
   boolean firstMerge= TRUE;
@@ -2162,7 +2167,7 @@ int main(int argc, char *argv[])
   programVersion = PROG_VERSION;
   programReleaseDate  = PROG_RELEASE_DATE;
   
-  while ((c = getopt (argc, argv, "i:t:n:x:whc:s:bT:L:")) != -1)
+  while ((c = getopt (argc, argv, "i:t:n:x:w:hc:s:bT:L:")) != -1)
     switch (c)
       {
       case 'i':


=====================================
Tree.c
=====================================
@@ -326,6 +326,21 @@ nodeptr findAnyTip(nodeptr p, int numsp)
 } 
 
 
+void hookupAdd(nodeptr p, nodeptr q, int numBranches)
+{
+  int i ; 
+  
+  p->back = q; 
+  q->back = p; 
+
+  for(i = 0; i < numBranches; ++i)
+    {
+      p->z[i] += q->z[i]; 
+      q->z[i] = p->z[i]; 
+    }
+  
+}
+
 void hookup (nodeptr p, nodeptr q, double *z, int numBranches)
 {
   int i;
@@ -944,7 +959,7 @@ static boolean treeNeedCh (FILE *fp, int c1, char *where)
   putchar('\n');
 
   if(c1 == ':')    
-    printf("RAxML may be expecting to read a tree that contains branch lengths\n");
+    printf("RogueNaRok may be expecting to read a tree that contains branch lengths\n");
 
   return FALSE;
 }
@@ -1163,8 +1178,8 @@ int treeReadLen (FILE *fp, All *tr,
 	{
 	  if(completeTree)
 	    {
-	      printBothOpen("Hello this is your friendly RAxML tree parsing routine\n");
-	      printBothOpen("The RAxML option you are uisng requires to read in only complete trees\n");
+	      printBothOpen("Hello this is your friendly RogueNaRok tree parsing routine\n");
+	      printBothOpen("The RogueNaRok option you are uisng requires to read in only complete trees\n");
 	      printBothOpen("with %d taxa, there is at least one tree with %d taxa though ... exiting\n", tr->mxtips, tr->ntips);
 	      exit(-1);
 	    }


=====================================
Tree.h
=====================================
@@ -49,6 +49,7 @@ boolean setupTree (All *tr, char *bootstrapTrees);
 void readBestTree(All *tr, FILE *file);  
 void readBootstrapTree(All *tr, FILE *file);
 void hookupDefault (nodeptr p, nodeptr q, int numBranches);
+void hookupAdd (nodeptr p, nodeptr q, int numBranches);
 nodeptr findAnyTip(nodeptr p, int numsp);
 int treeFindTipByLabelString(char  *str, All *tr);
 int getTreeStringLength(char *fileName);


=====================================
common.c
=====================================
@@ -31,7 +31,7 @@
 
 #include "common.h"
 
-#define ALLOW_OVERWRITE_INFO_FILE TRUE
+#define ALLOW_OVERWRITE_INFO_FILE FALSE
 
 extern void printHelpFile();
 
@@ -129,7 +129,7 @@ FILE *myfopen(const char *path, const char *mode)
       else
 	{
 	  if(processID == 0)
-	    printf("The file %s RAxML wants to open for writing or appending can not be opened [mode: %s], exiting ...\n",
+	    printf("The file %s RogueNaRok wants to open for writing or appending can not be opened [mode: %s], exiting ...\n",
 		   path, mode);
 	  exit(-1);
 	  return (FILE *)NULL;
@@ -142,6 +142,13 @@ void setupInfoFile()
 {
   char *result = CALLOC(1024, sizeof(char));
   strcpy(result,         workdir);
+
+  if(strcmp(workdir, "")) 
+    {
+      /* TODO not windows compatible */      
+      strcat(result,         "/");
+    }
+
   strcat(result,         programName);
   strcat(result,         "_info");
   strcat(result,         ".");
@@ -149,7 +156,7 @@ void setupInfoFile()
   
   if( NOT ALLOW_OVERWRITE_INFO_FILE && filexists(result))
     {
-      printf("The run-id >%s< you specified already exists. Aborting in order to protect the output of this previous run.\n", run_id);
+      printf("The run-id >%s< you specified already exists in folder >%s<. Aborting in order to protect the output of this previous run.\n", run_id, workdir);
       exit(-1);
     }
 
@@ -182,6 +189,12 @@ FILE *getOutputFileFromString(char *fileName)
 
   char result[1024];
   strcpy(result,         workdir);
+
+  if(strcmp(workdir, ""))
+    {
+      strcat(result, "/") ; 
+    } 
+
   strcat(result,         programName);
   strcat(result,         "_");
   strcat(result,         fileName);


=====================================
example/150.bs
=====================================
The diff for this file was not included because it is too large.

=====================================
example/150.tre
=====================================
@@ -0,0 +1 @@
+(Species223:0.10167067874101318181,((((((Species003:0.02885845688515585247,Species081:0.02366007644437243332):0.01294473315506602072,(Species086:0.02889623396833742794,((Species180:0.01130259274235604489,Species082:0.00588430659940250220):0.00981390388086450342,(Species065:0.00646683874069644074,Species004:0.01539670034795830554):0.01619225310325838815):0.00429514506342924384):0.01971746273545336645):0.00831177461738581355,((Species125:0.05085075934513810098,((Species014:0.49797318153312469802,((((Species011:1.23308538517097043830,(Species194:0.14277715768862139778,((Species161:0.07693527997946790487,Species226:0.08279880317510759924):0.03473670874692073168,(Species101:0.18362307169916605720,Species084:0.04516914418689594451):0.02600460300574566549):0.16302716763912183939):0.17152603152321063695):0.29181069263101583333,(((Species067:0.07436559248911303599,(Species066:0.16358806787391069748,Species188:0.06727442521066734349):0.03143305333089802672):0.42058509774974650597,((Species139:0.02755893932934918786,Species138:0.00927623378224346797):0.31291243044378824756,(Species135:0.05355187624018638293,(Species225:0.04095925546627367242,Species136:0.04529428377253751775):0.02264909429426772633):0.10853612397239845166):0.66486369152103907965):0.30397382688577473386,((Species229:0.11967685776574145395,Species072:0.11440477386882896838):0.33916096231786774240,(Species064:0.20266166198809190679,Species071:0.14493450751437683688):0.21858983245942087414):0.25666638095603350189):0.27358515136283018121):0.07415813760549078149,(Species227:0.25061592278519256860,Species228:0.33552464317357100221):0.52574389080471883862):0.10756188842616883072,((((Species012:0.01417722547707581278,Species010:0.04034675130093703932):0.16904419090996167241,(Species061:0.09506350436512521485,Species013:0.12421437508335884947):0.06353262550134237963):0.07673489121367255139,Species050:0.41201708114686891316):0.27147070082890234488,Species142:0.41539748717590579963):0.50972915079833658325):0.09759638563324000982):0.99230472005323211437,Species201:0.07266950601481036998):0.08368818168222916243):0.08661336847999560884,Species126:0.02856780795792028538):0.02727351043682214177):0.00554677692418998128,((Species070:0.03640110525322296647,(((((((Species056:0.05810146368000065897,(Species193:0.15527480906281457274,Species103:0.02587352836178205551):0.02205993706280176200):0.08626560337949243373,(Species192:0.08228987525224805422,Species195:0.01857892203414495888):0.01470797268224145402):0.01543578392835846802,(Species078:0.04106610111964105470,Species190:0.02903751298979457759):0.05771760873020609361):0.04702978953187943179,((Species043:0.09507147866835705119,(Species046:0.02035057958620751714,((Species069:0.01518990555238271777,Species063:0.02517606796483481957):0.04662020858163388320,(Species232:0.00591839728771769401,Species144:0.02170953083404570522):0.04424175790032577188):0.02982797999134110048):0.04395678894111249013):0.03621104380457264293,(Species008:0.01814609097843261631,Species023:0.04200898296839167961):0.08106701587147051302):0.00441465903382823929):0.01373025854248415348,(Species022:0.02672670461500788186,(((Species191:0.01619226906191993318,(Species034:0.03901491474236817858,Species038:0.09306202168426473686):0.02646811159994764615):0.00694110928044117895,(Species105:0.03628664324670868163,Species137:0.05602046049874488676):0.00798710843626010934):0.00512799958104748991,Species132:0.02743939045371524693):0.00560621124187029966):0.00535275732403040026):0.00145271493784958653,Species175:0.15438504415258511027):0.00458822419427611095,Species122:0.02798633843870117557):0.00780564792301203635):0.00312224678707470659,(Species120:0.05902402956750785884,(((Species073:0.02708812772465343799,Species114:0.06035918102667164886):0.02335100292363243360,(Species173:0.08473561568135122568,(Species099:0.10639514904357490199,(Species117:0.08649659485712282714,Species181:0.04475646988096785434):0.01574305223840075443):0.00715281952797727251):0.00965263800183392348):0.02942778338316406547,((Species196:0.16305716817873328051,(Species179:0.08295252148450747709,Species119:0.03445856197247401664):0.02103572893837889202):0.01020118422265344459,(Species058:0.01649265380172335732,Species005:0.03540157947407617661):0.02730045183405632042):0.02685130245022435830):0.01955698773156188883):0.01401521366387832417):0.00645864506977414984):0.01452668071274556584,((Species202:0.02560241781269579839,Species164:0.03436623016886058285):0.00611998201561592039,((Species060:0.00823394383196080631,(((((Species090:0.02288034169619141203,(Species177:0.00380275336783937514,Species104:0.00891618894771329523):0.00451130671569329334):0.00592183447845993395,(Species054:0.02249379127832184036,Species159:0.00938914355909220219):0.00413880610036351359):0.00340936612896344717,(Species231:0.08782358907112357282,Species155:0.15110968039987382472):0.01816672189179855887):0.00619962611770736444,(Species027:0.01017648464661234306,(Species040:0.02419170078610901817,Species160:0.01582552616302460025):0.00307272981273634021):0.00504792844503300451):0.01587508857134335705,(((Species149:0.02456293535704322240,(Species222:0.01593092584983984983,(Species121:0.01742766560084648558,(Species221:0.01203159178961116238,Species096:0.01174813117198075275):0.00256822225669620183):0.00147467129330136311):0.00152732627947161042):0.00214395031344726504,Species106:0.00709458924511567873):0.00355499908993614543,((((Species205:0.03780862472536613422,Species165:0.00574514696903898406):0.00735030986862113267,(Species178:0.02069427427683053627,Species020:0.01335887950746087252):0.00359514932158400136):0.00349650587521058327,((Species077:0.06774240895066102608,(Species053:0.05762110739940663057,(Species215:0.01039541192225369205,(Species097:0.01088180909866066567,Species018:0.03662723786639326962):0.00463492838189998122):0.03345732164720750801):0.00243875731856450480):0.00473493982509201519,((Species162:0.00534810254592453255,(Species171:0.00372685565063133294,Species007:0.00698428242799109880):0.02481596395684755596):0.00402289897130766842,Species109:0.02283164677880734558):0.02268986175362040433):0.00337235063786545499):0.00112492417519326985,(((Species048:0.03520229825660406431,Species131:0.02477190663243260260):0.00896683395555238245,((Species151:0.00709726687664876104,Species230:0.02914767697135457747):0.00483697231855858330,(Species032:0.02509692085760267463,Species150:0.01265937049189783288):0.03996875028390258627):0.00191021640433795131):0.03315337626636837703,Species187:0.01397280440264643195):0.00818937053700946431):0.00443174475401844365):0.01739298106226166638):0.00242331101016178855):0.01439468245972241878,Species186:0.02596773698879356607):0.00119160488913344284):0.01769902841844431945):0.02718792451188355164,((((Species074:0.02131632104175187892,(((Species116:0.01404465446013053627,Species174:0.01175004751616906713):0.05516776291765884688,(Species197:0.10866775547034493443,Species113:0.06277252252033939384):0.02019891061535894483):0.01125343713368806911,Species095:0.07261835322204401866):0.01286534646220929834):0.05350923171249892529,(Species213:0.01204502311921869934,(((Species047:0.01958998153081058929,Species214:0.01374787283357588492):0.01104444267440839525,Species212:0.02061440779645130547):0.00173384162625168882,Species026:0.01281861836457923870):0.00733385312165394342):0.02993782878585551227):0.00943945991487802304,(((((Species154:0.01956745166752000761,Species211:0.00289823533098370082):0.00399414695847872484,(Species092:0.03010499199888659952,(Species019:0.01999894043941413679,Species041:0.01576099006281200116):0.00307156842269135739):0.00858183342536548814):0.00399379826517143061,((((Species167:0.01128506640219148136,(Species157:0.00363946282468859302,((Species158:0.06371705276288056052,Species107:0.02491205146946682755):0.00759974515912122985,Species030:0.21893364550058469487):0.00991264985610998406):0.00642802812043929712):0.00334853407508450959,(Species207:0.01326813335558400114,Species100:0.02071072080320971592):0.01101107745099734470):0.00007266570835168550,Species025:0.01601536516061466062):0.00614577735580579005,Species172:0.04029942652473690601):0.00510238485662389135):0.00920849852185886067,((Species182:0.01361059720199178126,(Species006:0.01193297320698090760,(Species042:0.01788504353601367072,(Species146:0.01321156393212195510,Species111:0.00387077628481737089):0.00144005715866454354):0.00100123649241730373):0.00364349790853042785):0.00908360368056565157,Species124:0.01889549313212684351):0.00526896454960861481):0.00902393386804753797,(Species110:0.02556350242448524740,Species123:0.00778926050432065566):0.00812067765460857023):0.00000120864601189306):0.01245044718514196937,Species028:0.04148202043227425251):0.00192941658283290476):0.01842943983492426746,Species209:0.02925761418773950573):0.0;


=====================================
legacy.h
=====================================
@@ -138,6 +138,6 @@ ProfileElem *addProfileElem(entry *helem, int vectorLength, int treeVectorLength
 
 
 BitVector *neglectThoseTaxa(All *tr, char *toDrop);
-void pruneTaxon(All *tr, unsigned int k);
+void pruneTaxon(All *tr, unsigned int k, boolean considerBranchLengths);
 BitVector **initBitVector(All *tr, BitVector *vectorLength);
 #endif


=====================================
newFunctions.c
=====================================
@@ -49,7 +49,7 @@ IndexList *parseToDrop(All *tr, FILE *toDrop)
   return result;
 }
 
-void pruneTaxon(All *tr, unsigned int k) 
+void pruneTaxon(All *tr, unsigned int k, boolean considerBranchLengths) 
 {
   assert(k > 0 && k <= ((unsigned int)(tr->mxtips)));
 
@@ -58,8 +58,11 @@ void pruneTaxon(All *tr, unsigned int k)
     q = p->back,
     q1 = q->next->back,
     q2 = q->next->next->back;
-
-  hookupDefault(q1, q2, tr->numBranches);
+  
+  if(considerBranchLengths)
+    hookupAdd(q1,q2,tr->numBranches); 
+  else
+    hookupDefault(q1,q2,tr->numBranches);
   
   tr->start = findAnyTip(q1, tr->mxtips);
   


=====================================
newFunctions.h
=====================================
@@ -38,7 +38,7 @@
 #include "ProfileElem.h"
 
 IndexList *parseToDrop(All *tr, FILE *toDrop);
-void pruneTaxon(All *tr, unsigned int k);
+void pruneTaxon(All *tr, unsigned int k, boolean considerBranchLengths) ;
 BitVector *neglectThoseTaxa(All *tr, char *toDrop);
 Array *getOriginalBipArray(All *tr, FILE *bestTree, FILE *treeFile) ;
 


=====================================
parallel.c
=====================================
@@ -54,7 +54,7 @@ void pinToCore(int tid)
   if(pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpuset) != 0)
     {
       printBothOpen("\n\nThere was a problem finding a physical core for thread number %d to run on.\n", tid);
-      printBothOpen("Probably this happend because you are trying to run more threads than you have cores available,\n");
+      printBothOpen("Probably this happened because you are trying to run more threads than you have cores available,\n");
       printBothOpen("which is a thing you should never ever do again, good bye .... \n\n");
       assert(0);
     }


=====================================
rnr-lsi.c
=====================================
@@ -47,8 +47,8 @@
 
 
 #define PROG_NAME "RnR-lsi"
-#define PROG_VERSION "1.0"
-#define PROG_RELEASE_DATE "2011-10-25"
+#define PROG_VERSION "1.0.1"
+#define PROG_RELEASE_DATE "2021-06-07"
 
 #define FLIP_NTH_BIT(bitVector,n) (bitVector[(n) / MASK_LENGTH] |= mask32[ (n) % MASK_LENGTH ])
 #define NTH_BIT_IS_SET(bitVector,n) (bitVector[(n) / MASK_LENGTH] & mask32[(n) % MASK_LENGTH])
@@ -244,7 +244,7 @@ void calculateLeafStability(All *tr, char *bootstrapFileName, char *excludeFileN
 	  readBootstrapTree(tr,bootstrapFile);
 	  FOR_0_LIMIT(k,tr->mxtips)
 	    if( NOT NTH_BIT_IS_SET(neglectThose, k))
-	      pruneTaxon(tr,k+1);
+	      pruneTaxon(tr,k+1, FALSE);
 	  extractQuadruplesRecursively(tr, tr->nodep[i+1], quadruples, neglectThose, TRUE);
 	}
  
@@ -362,6 +362,7 @@ int main(int argc, char *argv[])
 	  strcpy(run_id, optarg);
 	  break; 
 	case 'w':
+	  /* printf("optarg : %s\n", optarg);  */
 	  strcpy(workdir, optarg);
 	  break;
 	case 'x':
@@ -402,7 +403,9 @@ int main(int argc, char *argv[])
       PR("Something went wrong during tree initialisation. Sorry.\n");
       exit(-1);
     }   
- 
+
+  tr->bitVectorLength = GET_BITVECTOR_LENGTH(tr->mxtips);
+
   calculateLeafStability(tr, bootTrees, excludeFile); 
 
   return 0;


=====================================
rnr-mast.c
=====================================
@@ -208,7 +208,7 @@ BitVector*** getIntersectionOfRootedTriples(FILE *bootstrapFile, All *tr, int st
       
       FOR_0_LIMIT(i, tr->mxtips)
 	if( NOT NTH_BIT_IS_SET(neglectThose, i))
-	  pruneTaxon(tr, i+1);
+	  pruneTaxon(tr, i, FALSE );
       
       /* reset bit-vectors */
       FOR_0_LIMIT(i, (tr->mxtips+1))
@@ -652,7 +652,7 @@ void verifyMasts(All *tr, FILE *bootstrapFile, BitVector *taxaToKeep)
       /* prune taxa */
       for(j = 1; j <= tr->mxtips; ++j)
 	if( NOT (NTH_BIT_IS_SET(taxaToKeep, j)) )
-	  pruneTaxon(tr, j+1);
+	  pruneTaxon(tr, j, FALSE);
       
       if(i == 1 )
 	commonStart = tr->start;
@@ -701,7 +701,10 @@ void printMastToFile(All *tr, FILE *bootstrapFile,  BitVector *mast, FILE *resul
 {
   int
     droppedTaxaNum = 0, 
-    tips, i; 
+#ifdef DEBUG
+    tips,
+#endif
+    i;
 
   rewind(bootstrapFile);  
   readBootstrapTree(tr,bootstrapFile);
@@ -709,12 +712,15 @@ void printMastToFile(All *tr, FILE *bootstrapFile,  BitVector *mast, FILE *resul
   for(i = 1; i <= tr->mxtips; ++i)
     if( NOT NTH_BIT_IS_SET(mast,i) )
       {
-	pruneTaxon(tr,i+1);
+	/* printf("intending to prune: %d\n", i)	;  */
+
+	pruneTaxon(tr,i, FALSE);
 	droppedTaxaNum++;
       }
-  
+#ifdef DEBUG  
   tips = countTips(tr->start, tr->mxtips) + countTips(tr->start->back, tr->mxtips);
   assert((unsigned)tips == ((unsigned)tr->mxtips - droppedTaxaNum));
+#endif
   char *tmp = writeTreeToString(tr, FALSE);
   fprintf(result, "%s", tmp);
   printBothOpen("MAST tree: %s", tmp);


=====================================
rnr-prune.c
=====================================
@@ -40,7 +40,6 @@
 #include <assert.h>
 #include <string.h>
 
-#include "common.h"
 #include "Tree.h"
 #include "List.h"
 #include "BitVector.h"
@@ -53,7 +52,6 @@
 
 
 extern char run_id[128];
-extern char *workdir;
 extern double masterTime;
 extern int tid;
 extern int NumberOfThreads; 
@@ -111,7 +109,7 @@ void pruneTaxaFromTreeset(char *bootstrapFileName, char *bestTreeFile, char *toD
 
 	  iter = indicesToDrop;
 	  FOR_LIST(iter)
-	    pruneTaxon(tr, iter->index);
+	    pruneTaxon(tr, iter->index, FALSE );
 
 	  char *tmp = writeTreeToString(tr , FALSE);	
 	  fprintf(outf, "%s", tmp);
@@ -129,7 +127,7 @@ void pruneTaxaFromTreeset(char *bootstrapFileName, char *bestTreeFile, char *toD
       readBestTree(tr, bestTree);
       iter = indicesToDrop;
       FOR_LIST(iter)
-	pruneTaxon(tr, iter->index);
+	pruneTaxon(tr, iter->index, TRUE );
       
       char *tmp = writeTreeToString(tr, TRUE); 
       fprintf(outf, "%s", tmp);	  
@@ -168,7 +166,7 @@ int main(int argc, char *argv[])
   programVersion = PROG_VERSION;
   programReleaseDate = PROG_RELEASE_DATE; 
 
-  while((c = getopt(argc,argv, "hi:t:x:n:")) != -1)
+  while((c = getopt(argc,argv, "hi:t:x:n:w:")) != -1)
     {
       switch(c)
 	{


=====================================
rnr-tii.c
=====================================
@@ -208,7 +208,7 @@ void getTaxonomicInstability(All *tr, char *treesFileName, char *excludeFile)
       
       FOR_0_LIMIT(j,tr->mxtips)
 	if( NOT NTH_BIT_IS_SET(neglectThose, j))
-	  pruneTaxon(tr,j+1);
+	  pruneTaxon(tr,j+1, FALSE);
 
       /* assert that we get the right labels */
       iter = gatherDistances(tr, tr->nodep[1], distances[i], TRUE);


=====================================
sharedVariables.h
=====================================
@@ -39,7 +39,7 @@ pthread_mutex_t mutex;
 
 extern char *infoFileName,
   run_id[128],
-  *workdir, 
+  workdir[1024], 
   *programName,
   *programVersion, 
   *programReleaseDate;


=====================================
utils/pruneWrapper.sh
=====================================
@@ -0,0 +1,52 @@
+#! /bin/bash
+
+PRUNE="../rnr-prune"
+
+NUM=$1
+RNR_FILE=$2
+BS_FILE=$3
+TRE_FILE=$4
+
+
+if [ $# -lt 3 ]; then
+    echo -e  "This is a tiny helper script for obtaining pruned trees from a RogueNaRok search. \n
+Call it as follows:\n
+./pruneWrapper.sh <numToPrune> <RogueNaRok_droppedRogues-file> <bootstrap-tree-file>  <ML-tree-file>\n
+* <numToPrune> prune the first x rogues that RogueNaRok identified (the order in the output is important). \n  If you want to prune all rogues as identified by RogueNaRok, simply enter an arbitrarily large number in this position \n
+* further arguments are self-explainatory.\n
+* output is written to stdout\n" 
+    exit
+fi
+
+id=$(echo $RNR_FILE  |awk -F . '{print $NF}')
+
+excludeFile=$id.$NUM.exclude
+
+cat $RNR_FILE | tail -n +3  | head -n $NUM | cut -f 3  > $excludeFile
+
+
+
+if [ "$TRE_FILE" ==  "" ]; then
+    $PRUNE -x $excludeFile -i  $BS_FILE  -n $id > /dev/null
+    if [ $? == 0 ]; then
+	echo "wrote file RnR-prune_prunedBootstraps.$id"
+    else
+	echo "something went wrong, maybe file RnR-prune_prunedBootstraps.$id already exists (delete it to re-run)"
+    fi
+    
+else
+    $PRUNE -x $excludeFile -i  $BS_FILE -t $TRE_FILE  -n $id  > /dev/null
+    if [ $? == 0 ]; then
+	echo "wrote file RnR-prune_prunedBootstraps.$id and RnR-prune_prunedBestTree.$id"
+    else
+	echo "something went wrong, maybe file RnR-prune_prunedBootstraps.$id or RnR-prune_prunedBestTree.$id already exist (delete them to re-run)"
+    fi
+    
+fi
+
+
+
+
+
+
+



View it on GitLab: https://salsa.debian.org/med-team/roguenarok/-/commit/db6f4ec9b3cb94d1b7af09cc9ed2be94940f4fa6

-- 
View it on GitLab: https://salsa.debian.org/med-team/roguenarok/-/commit/db6f4ec9b3cb94d1b7af09cc9ed2be94940f4fa6
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20211007/eb1e6333/attachment-0001.htm>


More information about the debian-med-commit mailing list