Beispiel #1
0
void toNormalizedNEXUS(ifstream & inf, ostream *os)
	{
	NxsTaxaBlock taxa;
	NxsTreesBlock trees(&taxa);
	NxsAssumptionsBlock assumptions(&taxa);
	NxsCharactersBlock character(&taxa, &assumptions);
	NxsDataBlock data(&taxa, &assumptions);
	NxsDistancesBlock distances(&taxa);
	NxsUnalignedBlock unaligned(&taxa, &assumptions);

	NormalizingReader nexus(os);
	nexus.Add(&taxa);
	nexus.Add(&trees);
	nexus.Add(&assumptions);
	nexus.Add(&character);
	nexus.Add(&data);
	nexus.Add(&distances);
	nexus.Add(&unaligned);

	if (os)
		{
		*os << "#NEXUS\n";
		}
	NormalizingToken token(inf, os);
	
	nexus.Execute(token);
	}
int main(int argc, char const *argv[]){
	pthread_mutex_init(&lock, NULL);
	pthread_create(&thread_id, NULL, checkIDLE, (void*)NULL);
	if(argc==4) nexus(argv);
	else {printf("Format: %s <username> <server> <port>\n", argv[0]); exit(EXIT_FAILURE);}
	pthread_mutex_destroy(&lock);
	pthread_join(thread_id, NULL);
	return 0;
}
Beispiel #3
0
int main(int , char *argv[])
	{
	taxa = new NxsTaxaBlock();
	trees = new NxsTreesBlock(taxa);

	MyReader nexus(argv[1], argv[2]);
	nexus.Add(taxa);
	nexus.Add(trees);

	MyToken token(nexus.inf, nexus.outf);
	nexus.Execute(token);

	taxa->Report(nexus.outf);
	trees->Report(nexus.outf);

	return 0;
	}
Beispiel #4
0
string nexus(int i,Pr* pr,Node** nodes){
    ostringstream b,date;
    if (i>0){
        b<<nodes[i]->B;
    }
    date<<nodes[i]->D;
    if (i>=pr->nbINodes) return nodes[i]->L+"[&date="+date.str()+"]:"+b.str();
    else{
        string newLabel="(";
        for (vector<int>::iterator iter=nodes[i]->suc.begin(); iter!=nodes[i]->suc.end(); iter++) {
            int s = *iter;
            string l=nexus(s,pr,nodes);
            if (iter==nodes[i]->suc.begin()) newLabel+=l;
            else newLabel+=","+l;
        }
        if (i>0) {
            if (myabs(nodes[i]->B)>toCollapse) return newLabel+")"+nodes[i]->L+"[&date="+date.str()+"]:"+b.str();
            else return newLabel+")"+nodes[i]->L+":"+b.str();
        }
        else{
            return newLabel+")"+nodes[i]->L+"[&date="+date.str()+"];\n";
        }
    }
}