int Application::main(int argc,char *argv[]) { // Process command line cmd=new CommandLine(argc,argv,""); if(cmd->numArgs()!=2) throw String("\ndelete-target-gaps <in.maf> <target-name>\n"); String mafFile=cmd->arg(0); String targetName=cmd->arg(1); // Setting up alphabet alphabet=&DnaDashDotAlphabet::global(); gapSymbols.addMember(alphabet->lookup('-')); gapSymbols.addMember(alphabet->lookup('.')); gapSymbols.addMember(alphabet->lookup('N')); alphabetMap=new DropGapMapping(*alphabet,PureDnaAlphabet::global()); // Load the alignments //int rootID=phylogeny->getRoot()->getID(); alignment=NULL; ifstream is(mafFile.c_str()); if(!is.good()) throw String("Can't open file ")+mafFile; while(!is.eof()) { MultiAlignment *a=new MultiAlignment; a->loadMAF(is); if(a->getNumTracks()>0) { a->toupper(); MultSeqAlignment *m=new MultSeqAlignment(*a,*alphabet,gapSymbols); int rootID=m->getTrackByName(targetName).getID(); m->deleteTargetGaps(rootID); if(!alignment) alignment=m; else { alignment->append(*m); delete m; } } delete a; } is.close(); // Emit the processed alignment alignment->printSlice(cout,0,alignment->getLength(),'+',60); return 0; }