[Debichem-commits] [SCM] massXpert mass spectrometry suite: debian packaging branch, debian, updated. upstream/3.2.0-1-g5564507

Filippo Rusconi (Debian Maintainer) rusconi-debian at laposte.net
Thu Nov 24 21:27:53 UTC 2011


The following commit has been merged in the debian branch:
commit 88a5d7843cc545f7f0743abbd41a0ab904b5e5b6
Author: Filippo Rusconi (Debian Maintainer) <rusconi-debian at laposte.net>
Date:   Wed Apr 21 15:33:39 2010 +0200

    Fixed bug with PDB file importer.

diff --git a/gui/sequenceEditorWnd.cpp b/gui/sequenceEditorWnd.cpp
index eb72f97..17c719f 100644
--- a/gui/sequenceEditorWnd.cpp
+++ b/gui/sequenceEditorWnd.cpp
@@ -2217,6 +2217,10 @@ namespace massXpert
 		chainStringList->append(codes);
 		chainStringListId->append(QString(currentId));
 
+// 		qDebug() << __FILE__ << __LINE__
+// 			 << "appending codes:"
+// 			 << codes;
+		
 		// Now clear the string so that we can start filling
 		// it with a new chain sequence.
 		codes.clear();
@@ -2279,11 +2283,15 @@ namespace massXpert
       {
 	chainStringList->append(codes);
 	chainStringListId->append(QString(currentId));
-      }
-    
-    // Clear the codes string to free memory.
-    codes.clear();
-    
+
+// 	qDebug() << __FILE__ << __LINE__
+// 		 << "appending codes:"
+// 		 << codes;
+	
+	// Clear the codes string to free memory.
+	codes.clear();
+      }    
+   
     // Now feed the chain string list to the translator. The returned
     // string list is allocated. We will transfer its ownership to the
     // dialog, if we use that dialog below.
@@ -2303,11 +2311,6 @@ namespace massXpert
 	return;
       }
     
-    // At this point, we will not need the initial list anymore, we
-    // can free it and set it to 0.
-    delete chainStringList;
-    chainStringList = 0;
-
 //     for (int iter = 0 ; iter < translatedChainStringList->size(); ++iter)
 //       {
 // 	qDebug() << __FILE__ << __LINE__ 
@@ -2315,6 +2318,11 @@ namespace massXpert
 // 		 << translatedChainStringList->at(iter);
 //       }
 
+    // At this point, we will not need the initial list anymore, we
+    // can free it and set it to 0.
+    delete chainStringList;
+    chainStringList = 0;
+
     // If there is only one sequence that's been imported (the file
     // format allows for any number of chain sequences), then we have
     // nothing more than to make an actual sequence with it.
diff --git a/gui/sequenceImportDlg.cpp b/gui/sequenceImportDlg.cpp
index feb827c..ae07c2e 100644
--- a/gui/sequenceImportDlg.cpp
+++ b/gui/sequenceImportDlg.cpp
@@ -127,7 +127,7 @@ namespace massXpert
     
     // And now add the string to the text edit widget.
     iterString = mpa_chainSequenceStringList->at(0);
-    m_ui.importedSequencesTextEdit->append(iterString);
+    m_ui.importedSequencesTextEdit->setPlainText(iterString);
   }
   
   void
@@ -139,8 +139,13 @@ namespace massXpert
     // And now put the corresponding string to the text edit widget.
     QString chainSequence = mpa_chainSequenceStringList->at(rowIndex);
 
+//     qDebug() << __FILE__ << __LINE__
+// 	     << "Current item index:" << rowIndex << "\n"
+// 	     << "Current sequence:"
+// 	     << chainSequence;
+    
     m_ui.importedSequencesTextEdit->clear();
-    m_ui.importedSequencesTextEdit->append(chainSequence);
+    m_ui.importedSequencesTextEdit->setPlainText(chainSequence);
   }
   
 
diff --git a/lib/monomerDictionary.cpp b/lib/monomerDictionary.cpp
index 3ad5d31..ed05128 100644
--- a/lib/monomerDictionary.cpp
+++ b/lib/monomerDictionary.cpp
@@ -380,42 +380,52 @@ namespace massXpert
     if (!chainStringList.isEmpty())
       m_inputChainStringList = chainStringList;
     
+    // If there is nothing to do return an empty string list so that
+    // caller knows nothing is actually wrong, only there is no
+    // sequence to translate.
     if (m_inputChainStringList.isEmpty())
       return outputChainStringList;
     
     // Iterate in each chain string of the list and perform the
     // translation.
 
-    for (int iter = 0; iter < chainStringList.size(); ++iter)
+    for (int iter = 0; iter < m_inputChainStringList.size(); ++iter)
       {
-	QString iterString = chainStringList.at(0);
+	QString iterString = chainStringList.at(iter);
 	
+// 	qDebug() << __FILE__ << __LINE__
+// 		 << "translating sequence:" << iterString;
+		
 	QStringList codeList =
 	  iterString.split(QRegExp("\\s+"), QString::SkipEmptyParts);
 	
-	//     qDebug() << __FILE__ << __LINE__ 
-	// 	     << "codeList:" << codeList;
+// 	qDebug() << __FILE__ << __LINE__ 
+// 		 << "codeList:" << codeList;
 
-	// And now iterate in each monomer code and change it according to
-	// the dictionary;
-    
-	for (int iter = 0; iter < codeList.size (); ++iter)
-	  {
-	    QString code = codeList.at (iter);
+// 	qDebug() << __FILE__ << __LINE__ 
+// 		 << "hash:"
+// 		 << m_dictionaryHash;
 	
+	for (int jter = 0; jter < codeList.size(); ++jter)
+	  {
+	    QString code = codeList.at(jter);
+
 	    QHash<QString, QString>::const_iterator hashIter = 
-	      m_dictionaryHash.find (code);
+	      m_dictionaryHash.find(code);
 	
 	    if (hashIter != m_dictionaryHash.end())
-	      codeList.replace(iter, hashIter.value ());
+	      codeList.replace(jter, hashIter.value());
 	    else
 	      {
+		// Delete the string list, set the pointer to 0 and
+		// return that pointer so that caller knows something
+		// has gone wrong.
+		
 		qDebug() << __FILE__ << __LINE__
 			 << "Monomer dictionary:"
 			 << "Failed to convert monomer code "
 			 << code;
 	    
-		
 		outputChainStringList->clear();
 
 		delete outputChainStringList;

-- 
massXpert mass spectrometry suite: debian packaging



More information about the Debichem-commits mailing list