
pnt="NTER"
pct="CTER"

p5t="5TER"
p3t="3TER"

tell nseg select="ALL"
iseg=0
while($iseg<$nseg) {
  tell seg $iseg select="ALL"
  if($segtype=="protein") {
     segment patch segn=$segn first=$pnt last=$pct
     echo -hs "patched $segn first $pnt last $pct"
  }
  else if($segtype=="DNA" || $segtype=="RNA") {
     segment patch segn=$segn first=$p5t last=$p3t
     echo -hs "patched $segn first $p5t last $p3t"
  }
  iseg++
}

