[Chimera-users]

Sabuj Pattanayek sabuj.pattanayek at vanderbilt.edu
Tue Aug 9 12:55:36 PDT 2005


Hi,

I'm getting the following error:

  File "/usr/local/sbin/chimera/share/MultAlignViewer/SeqCanvas.py", 
line 1057
     self.rulerTexts.append(text)
     ^
SyntaxError: invalid syntax

I had to modify the file manually since the line numbers didn't match. 
This is my diff (unified format):

--- SeqCanvas.py        2005-08-09 14:45:57.000000000 -0500
+++ SeqCanvas.py.bak    2005-08-09 14:34:01.000000000 -0500
@@ -1045,19 +1045,13 @@
          x = self.labelWidth + self.letterGaps[0] + self.fontPixels[0]/2
          y = self.topY + self.fontPixels[1] + self.letterGaps[1]

-         end = min(self.seqOffset + self.lineWidth, len (self.seqs[0]))
-             for chunkStart in range(self.seqOffset, end, 10):
-                 seq1index = self.seqs[0].gapped2ungapped (chunkStart)
-                       if seq1index is None:
-                               dispText = "?"
-                       else:
-                  dispText = str(seq1index+1)
-                  text = self.mainCanvas.create_text(x, y,  anchor='s',
-                         font=self.font, text="%s" % (dispText))
-                         self.rulerTexts.append(text)
-                         x += self.chunkGap + 10 * (self.fontPixels[0]
-                                                  + self.letterGaps[0])
-
+          end = min(self.seqOffset + self.lineWidth, len(self.seqs[0]))
+               for chunkStart in range(self.seqOffset, end, 10):
+                   text = self.mainCanvas.create_text(x, y, anchor='s',
+                          font=self.font, text="%d" % (chunkStart+1))
+                       self.rulerTexts.append(text)
+                       x += self.chunkGap + 10 * (self.fontPixels[0]
+                                                  +self.letterGaps[0])
               if not rerule:
                  self.bottomY += self.fontPixels[1] + self.letterGaps[1]
                  self.bottomRulerY = self.bottomY

Thanks,
Sabuj

Eric Pettersen wrote:
> Hi Sabuj,
>     I've appended a context diff for MAV's SeqCanvas.py file.  It  makes 
> the ruler use the ungapped numbering of the first sequence.   For 
> positions where there is a gap in the first sequence it uses  '?'.  I 
> think this is what you wanted, but let me know if I got that  wrong.
>     On another note, the new AL2CO conservation measures in the  1.2154 
> snapshot don't work on the Mac and possibly on Linux  (depending on your 
> execution path).  If you want to get them to work,  I've also appended a 
> context diff for Conservation.py below and have  also made the entire 
> replacement file available at http:// 
> www.cgl.ucsf.edu/home/pett/chimera/Conservation.py (which, on a Mac,  
> you put in Chimera.app/Contents/Resources/share/MultAlignViewer  [which 
> you may have to use Terminal.app to access] and on Linux in  <your 
> install dir>/share/MultAlignViewer).
> 
> --Eric
> 
> On Aug 9, 2005, at 10:04 AM, Pattanayek, Sabuj wrote:
> 
>> Hi all,
>>
>> Is there a modification I can do to the multi-align viewer code so  
>> that "-"
>> (gaps) characters are not counted in the alignment numbering (but  are 
>> still
>> displayed for alignment purposes) from a fasta file in the multi- 
>> align viewer?
>> The numbering should correspond to the first sequence found in the  
>> fasta file
>> (i.e. I don't care about the numbering due to gaps in the second,  
>> third, etc
>> sequences).
>>
>> Thanks,
>> Sabuj Pattanayek
>>
>> _______________________________________________
>> Chimera-users mailing list
>> Chimera-users at cgl.ucsf.edu
>> http://www.cgl.ucsf.edu/mailman/listinfo/chimera-users
>>
> 
> *** SeqCanvas.py        6 Aug 2005 00:08:50 -0000       1.59
> --- SeqCanvas.py        9 Aug 2005 17:57:45 -0000
> ***************
> *** 1056,1063 ****
> 
>                 end = min(self.seqOffset + self.lineWidth, len 
> (self.seqs[0]))
>                 for chunkStart in range(self.seqOffset, end, 10):
>                         text = self.mainCanvas.create_text(x, y,  
> anchor='s',
> !                               font=self.font, text="%d" %  
> (chunkStart+1))
>                         self.rulerTexts.append(text)
>                         x += self.chunkGap + 10 * (self.fontPixels[0]
>                                                         +  
> self.letterGaps[0])
> --- 1056,1068 ----
> 
>                 end = min(self.seqOffset + self.lineWidth, len 
> (self.seqs[0]))
>                 for chunkStart in range(self.seqOffset, end, 10):
> +                       seq1index = self.seqs[0].gapped2ungapped 
> (chunkStart)
> +                       if seq1index is None:
> +                               dispText = "?"
> +                       else:
> +                               dispText = str(seq1index+1)
>                         text = self.mainCanvas.create_text(x, y,  
> anchor='s',
> !                               font=self.font, text="%s" % (dispText))
>                         self.rulerTexts.append(text)
>                         x += self.chunkGap + 10 * (self.fontPixels[0]
>                                                         +  
> self.letterGaps[0])
> 
> 
> *** Conservation.py     3 Aug 2005 20:19:15 -0000       1.16
> --- Conservation.py     9 Aug 2005 18:28:45 -0000
> ***************
> *** 56,62 ****
>                 tf = open(tfName, "w")
>                 save(tf, None, self.seqs, None)
>                 tf.close()
> !               command = "al2co -i %s -f %d -c %d -w %d -g %g" %  (tfName,
>                         prefs[AL2CO_FREQ], prefs[AL2CO_CONS],
>                         prefs[AL2CO_WINDOW], prefs[AL2CO_GAP])
>                 if prefs[AL2CO_CONS] == 2:
> --- 56,65 ----
>                 tf = open(tfName, "w")
>                 save(tf, None, self.seqs, None)
>                 tf.close()
> !               import os, os.path
> !               chimeraRoot = os.environ.get("CHIMERA")
> !               command = os.path.join(chimeraRoot, 'bin', 'al2co') + \
> !                       " -i %s -f %d -c %d -w %d -g %g" % (tfName,
>                         prefs[AL2CO_FREQ], prefs[AL2CO_CONS],
>                         prefs[AL2CO_WINDOW], prefs[AL2CO_GAP])
>                 if prefs[AL2CO_CONS] == 2:
> 



More information about the Chimera-users mailing list