7fa855ffa92c3f42a8b3fec8e5c2b7ac1753deb7
wong
  Wed Jan 11 12:31:49 2012 -0800
wrong method used to add stanzas into raFile object
diff --git python/lib/ucscgenomics/ra.py python/lib/ucscgenomics/ra.py
index 8493008..7f5031b 100644
--- python/lib/ucscgenomics/ra.py
+++ python/lib/ucscgenomics/ra.py
@@ -217,59 +217,59 @@
         one with identical values being preserved,
         differences are marked with a >>> and <<<
         '''
 
         mergedKeys = ucscUtils.mergeList(list(self), list(other))
         selfKeys = set(self)
         otherKeys = set(other)
         newCommon = RaFile()
         p = re.compile('^\s*#')
         p2 = re.compile('^\s*$')
         for i in mergedKeys:
             if p.match(i) or p2.match(i):
                 newCommon.append(i)
                 continue
             if i not in selfKeys:
-                newCommon.append(other[i])
+                newCommon[i] = other[i]
                 continue
             if i not in otherKeys:
-                newCommon.append(self[i])
+                newCommon[i] = self[i]
                 continue
             if i in otherKeys and i in selfKeys:
                 newStanza = RaStanza()
                 selfStanzaKeys = set(self[i].iterkeys())
                 otherStanzaKeys = set(other[i].iterkeys())
                 stanzaKeys = ucscUtils.mergeList(list(self[i]), list(other[i]))
                 for j in stanzaKeys:
                     if p.match(j):
                         newStanza.append(j)
                         continue
                     if j not in selfStanzaKeys:
                         newStanza[j] = other[i][j]
                         continue
                     if j not in otherStanzaKeys:
                         newStanza[j] = self[i][j]
                         continue
                     if j in selfStanzaKeys and j in otherStanzaKeys:
                         if self[i][j] == other[i][j]:
                             newStanza[j] = self[i][j]
                         else:
                             in_j = '>>>>>%s' % j
                             out_j = '<<<<<%s' % j
                             newStanza[out_j] = self[i][j]
                             newStanza[in_j] = other[i][j]
-                newCommon.append(newStanza)
+                newCommon[i] = newStanza
         return newCommon
 
 
     def summaryDiff(self, other):
         '''
         Input:
             RaFile object being compared.
         Output: RaFile with differences.
 
         Returns ***partial*** stanzas of ***anything*** different
         from the self dictionary compared to the other dictionary.
         For versatility, it only returns stanzas from the self Ra file. In other
         words, it returns the self dictionary lines that are either not present
         in or different from the other dictionary.