void ProRataXmlProcessors::setPeptide( const QString &qsLocus, const QString &qsChromatogramId ) { setProtein( qsLocus ); if ( getText( qdeCurrentPeptideElement, QString( "CHROMATOGRAM_IDENTIFIER" ) ).trimmed() != qsChromatogramId.trimmed() ) { qdeCurrentPeptideElement = qdeCurrentProteinElement.firstChildElement( "CHROMATOGRAM" ); goToPeptideNode( qsChromatogramId ); } }
ProRataProteinTuple * ProRataXmlProcessors::getProtein( const QString & qsLocus ) { setProtein( qsLocus ); if ( ! qdeCurrentProteinElement.isNull() ) { if ( processProtein( qdeCurrentProteinElement ) ) { return prptProteinSeletedData; } } return NULL; }
ProRataPeptideTuple * ProRataXmlProcessors::getPeptide( const QString & qsLocus, const QString & qsChromatogramId ) { setProtein( qsLocus ); setPeptide( qsLocus, qsChromatogramId ); if ( ! qdeCurrentPeptideElement.isNull() ) { if ( processPeptide( qdeCurrentPeptideElement ) ) { return prdtPeptideSeletedData; } } return NULL; }
bool ProteinDatabase::getFirstProtein() { bool bnewProtein = true; //false if fail to retrieve a new protein string sline = ""; iProteinId = 1; bstayCurrentOriginalPeptide = false; bstayCurrentProtein = true; scurrentProteinName = snextProteinName; snextProteinName = ""; scurrentProtein = ""; iclCheck = 0; sline.clear(); getline(db_stream, sline); if (bScreenOutput) cout<<"Processing protein #"<<iProteinId<<"\r"; if (sline.at(0) == '>') { // cout<<sline<<endl; // cout<<sline.find_first_of(" \t\f\v\n\r")<<endl; scurrentProteinName = sline.substr(1, sline.find_first_of(" \t\f\v\n\r")-1); while (!db_stream.eof()) { sline.clear(); getline(db_stream, sline); if (sline =="") continue; if(sline.find_first_not_of(" \r\n") != string::npos) { if (sline.at(0) == '>') { snextProteinName= sline.substr(1, sline.find_first_of(" \t\f\v\n\r")-1); break; }else { RemoveIllegalResidue(sline); scurrentProtein = scurrentProtein + sline.substr(0, sline.find_last_not_of("\r\n")+1); } } } setProtein(); }else bnewProtein = false; return bnewProtein; }
int main(int argc, char** argv) { // comprimento da aresta do cubo do ligante double cubeLig_edge; char str[MAX], lig_name[MAX], aux[11]; Leaf *root, *leaf; int sum, *p_sum, a; Protein new_protein; Ligante new_ligante; LiganteList *ligant_list; // armazena o valor da aresta do cubo em volta de cada ligante fgets(str, sizeof (str), stdin); sscanf(str, " %lf", &cubeLig_edge); fgets(str, sizeof (str), stdin); sscanf(str, " %s %s", aux, lig_name); // declara a lista de Ligantes que será utilizada no final // para exibir na tela de forma ordenada. ligant_list = NULL; ligant_list = (LiganteList *) malloc( sizeof(LiganteList) ); ligant_list->header = NULL; ligant_list->header = (Ligante *) malloc( sizeof(Ligante) ); ligant_list->header->prox = NULL; // Enquanto não for inserido '-1' while (aux[0] != '-' && aux[1] != '1') { // declara uma nova raiz para a árvore root = NULL; root = (Leaf *) malloc(sizeof (Leaf)*2); root->is_leaf = 1; root->protein.isSet = 0; for(a = 0; a< 8; a++){ root->sons[a] = NULL; } //seta a soma das interações do ligante em 0 sum = 0; p_sum = ∑ // lê e insere no cubo alocado as coordenadas // de seus pontos extremos na raiz. setCubeCoords(root); fgets(str, sizeof (str), stdin); // ---- Leitura das Proteínas while (str[0] == 'P') { // cria uma nova proteína: // - aloca espaço para ela // - recebe as coordenadas do stdin new_protein = getNewProtein(str); // percorre a raiz e encontra a folha // referente às coordenadas da nova proteína. leaf = findLeaf(root, new_protein.point); // função recursiva que insere a proteína // na folha escolhida. setProtein(leaf, new_protein); fgets(str, sizeof (str), stdin); } // ---- Leitura dos Ligantes while (str[0] == 'L') { // agora recebemos os ligantes: new_ligante = getNewLigante(str); // copia o nome do ligante para ele. strcpy(new_ligante.name, lig_name); // função recursiva para somar as iterações. getPointsInsideBox(root, new_ligante, cubeLig_edge, p_sum); // recebe a soma final new_ligante.sum = sum; fgets(str, sizeof (str), stdin); } // Insere de forma ordenada o ligante na lista. putLiganteOnLiganteList(new_ligante, ligant_list); // Limpa a árvore e todos seus filhos freeLeafs(root); sscanf(str, " %s %s", aux, lig_name); } // ---- Resultado no STDOUT printResult(ligant_list); return (EXIT_SUCCESS); }