示例#1
0
static boolean treeProcessLength (FILE *fp, double *dptr, int *branchLabel, boolean storeBranchLabels, tree *tr)
{
  int
    ch;
  
  if((ch = treeGetCh(fp)) == EOF)  
    return FALSE;    /*  Skip comments */
  (void) ungetc(ch, fp);
  
  if(fscanf(fp, "%lf", dptr) != 1) 
    {
      printf("ERROR: treeProcessLength: Problem reading branch length\n");
      treeEchoContext(fp, stdout, 40);
      printf("\n");
      return  FALSE;
    }
    
  if((ch = getc(fp)) != EOF)
    {
      if(ch == '[')
	{
	  if(fscanf(fp, "%d", branchLabel) != 1)
	    goto handleError;	      

	  //printf("Branch label: %d\n", *branchLabel);
	  
	  if((ch = getc(fp)) != ']')
	    {
	    handleError:
	      printf("ERROR: treeProcessLength: Problem reading branch label\n");
	      treeEchoContext(fp, stdout, 40);
	      printf("\n");
	      return FALSE;
	    }	    

	  if(storeBranchLabels)
	    tr->branchLabelCounter = tr->branchLabelCounter + 1;

	}
      else
	(void)ungetc(ch, fp);
    }
  
  return  TRUE;
}
示例#2
0
static boolean treeProcessLength (FILE *fp, double *dptr)
{
  int  ch;
  
  if ((ch = treeGetCh(fp)) == EOF)  return FALSE;    /*  Skip comments */
  (void) ungetc(ch, fp);
  
  if (fscanf(fp, "%lf", dptr) != 1) {
    printf("ERROR: treeProcessLength: Problem reading branch length\n");
    treeEchoContext(fp, stdout, 40);
    printf("\n");
    return  FALSE;
  }
  
  return  TRUE;
}
示例#3
0
static boolean treeNeedCh (FILE *fp, int c1, char *where)
{
  int  c2;
  
  if ((c2 = treeGetCh(fp)) == c1)  return TRUE;
  
  printf("ERROR: Expecting '%c' %s tree; found:", c1, where);
  if (c2 == EOF) 
    {
      printf("End-of-File");
    }
  else 
    {      	
      ungetc(c2, fp);
      treeEchoContext(fp, stdout, 40);
    }
  putchar('\n');
    
  printf("RAxML may be expecting to read a tree that contains branch lengths\n");

  return FALSE;
}