void xmlWriter::removeBuild(int buildID){ QMap <QString,QString> tmpID; QMap <QString,QString> tmpName; QMap <QString,QString> tmpDesc; QMap <QString,QString> tmpDir; QMapIterator<QString, QString> i(buildUniqueID); QMapIterator<QString, QString> j(buildName); QMapIterator<QString, QString> k(buildDescription); QMapIterator<QString, QString> l(buildDirectory); int m = 0; while (i.hasNext() && j.hasNext() && k.hasNext() && l.hasNext()) { i.next(); j.next(); k.next(); l.next(); if(buildUniqueID.values().at(m).compare(QString::number(buildID))){ //if the build is not the same include the build tmpID.insertMulti("buildUniqueID",buildUniqueID.values().at(m)); tmpName.insertMulti("buildName",buildName.values().at(m)); tmpDesc.insertMulti("buildDescription",buildDescription.values().at(m)); tmpDir.insertMulti("buildDirectory",buildDirectory.values().at(m)); } m++; } //replace the current values buildUniqueID = tmpID; buildName = tmpName; buildDescription = tmpDesc; buildDirectory = tmpDir; createXMLFile(); }
void getTransFromFile(FILE* infile, char *path) { FILE* outfile = NULL; int start, end, tmNumber, count, seqLength; char *line, *token; struct dyString *proteinID = newDyString(24); start = end = tmNumber = count = seqLength = 0; while( ( line = readLine(infile) ) != NULL ) { /*grab the protein ID after each <PRE> tag*/ while( (token = nextWord(&line)) != NULL ) { if( sameString(token,"<PRE>#")) { /*create a new xml file*/ token = nextWord(&line); dyStringAppend(proteinID, token); token = lastWordInLine(line); seqLength = atoi(token); } if( sameString(token,"predicted") ) { /*grab the number of transmembrane helices*/ token = lastWordInLine(line); tmNumber = atoi(token); if(tmNumber > 0) { outfile = createXMLFile(proteinID->string, path); populateXMLFile(outfile, tmNumber, proteinID->string, path); } } if( sameString(token,"</PRE>") ) { /*close the xml file*/ carefulClose(&outfile); dyStringClear(proteinID); count = 0; } if( sameString(token,"TMhelix") ) { if( (token = nextWord(&line)) != NULL ) { /*get the start*/ start = atoi(token); if( (token = nextWord(&line)) != NULL ) end = atoi(token); } if( count == 0) addCoordinatesToXMLFile(outfile, 1, start-1, "N-term", count); count++; addCoordinatesToXMLFile(outfile, start, end, "TM", count); if( count == tmNumber && outfile != NULL ) { addCoordinatesToXMLFile(outfile,end+1,seqLength,"C-term",count); finishXMLFile(outfile, proteinID->string, seqLength); } } } /*end inner while*/ } /*end outer while*/ freeMem(line); freeDyString(&proteinID); }
void xmlWriter::updateBuildDir(int buildID, QString newBuildDir){ int index = findBuildIndex(buildID); if(index <= -1 || index >= buildUniqueID.values().size()){ return; } QString theBuildName = buildName.values().at(index); QString buildDescr = buildDescription.values().at(index); QString theBuildID = buildUniqueID.values().at(index); RemoveBuildToBeUpdated(buildID); buildUniqueID.insertMulti("buildUniqueID",theBuildID); buildName.insertMulti("buildName",theBuildName); buildDescription.insertMulti("buildDescription",buildDescr); buildDirectory.insertMulti("buildDirectory",newBuildDir); createXMLFile(); }