Ejemplo n.º 1
0
void Tree::ReadMrBayes(string filename)	{

	ifstream is(filename.c_str());
	mRoot = new PolyNode();
	PolyNode* currentNode = mRoot;
	char c = ' ';
	while ((!is.eof()) && (c != '=')) is >> c;
	ReadPhylip(is,currentNode);
	// SetLabelOffset(0);
	mRoot->SetSuper(this);

}
Ejemplo n.º 2
0
/* Function: MSAFileRead()
 * Date:     SRE, Fri May 28 16:01:43 1999 [St. Louis]
 *
 * Purpose:  Read the next msa from an open alignment file.
 *           This is a wrapper around format-specific calls.
 *
 * Args:     afp     - open alignment file
 *
 * Returns:  next alignment, or NULL if out of alignments 
 */
MSA *
MSAFileRead(MSAFILE *afp)
{
  MSA *msa = NULL;

  switch (afp->format) {
  case MSAFILE_STOCKHOLM: msa = ReadStockholm(afp); break;
  case MSAFILE_MSF:       msa = ReadMSF(afp);       break;
  case MSAFILE_A2M:       msa = ReadA2M(afp);       break;
  case MSAFILE_CLUSTAL:   msa = ReadClustal(afp);   break;
  case MSAFILE_SELEX:     msa = ReadSELEX(afp);     break;
  case MSAFILE_PHYLIP:    msa = ReadPhylip(afp);    break;
  default:
    Die("MSAFILE corrupted: bad format index");
  }
  return msa;
}
Ejemplo n.º 3
0
int Tree::ReadFromStream(istream& is, int header)	{

	mRoot = new PolyNode();
	PolyNode* currentNode = mRoot;
	/*
	char c = is.peek();
	while (c != '(')	{
		c = is.get();
		if (c == '[')	{
			do {
				c = is.get();
			}
			while (c != ']');
		}
		c = is.peek();
	}
	*/
	int ok = ReadPhylip(is,currentNode);
	SetLabelOffset(0);
	mRoot->SetSuper(this);
	return (ok && (GetSize() > 1));
}
Ejemplo n.º 4
0
/*****************************************************************
 * phylip.c test driver:
 * 
 */
int 
main(int argc, char **argv)
{
  MSAFILE *afp;
  MSA     *msa;
  char    *file;
  
  file = argv[1];

  if ((afp = MSAFileOpen(file, MSAFILE_UNKNOWN, NULL)) == NULL)
    Die("Couldn't open %s\n", file);

  printf("format %d\n", afp->format);

  while ((msa = ReadPhylip(afp)) != NULL)
    {
      WritePhylip(stdout, msa);
      MSAFree(msa); 
    }
  
  MSAFileClose(afp);
  exit(0);
}