From OpenWetWare

Jump to: navigation, search


  • / - given target sequence, generate oligos that can be used for PCR assembly of that sequence
  • / - generate random DNA sequence of specified length
  • / - given upstream and downstream sense sequence of region to amplify, print out correct primers


  • / - given input sequence generate N-mers orthogonal (to seq and its complement) to be used as toeholds
  • / - Tk GUI for honeycomb lattice program


  • replace mac return character ('\r') with unix return ('\n')
cat foo | tr '\r' '\n' > bar
mv bar foo
  • print first n chars of STDIN

import string
import sys
import fileinput

def nowhite(s):
  return ''.join([c for c in s if c in string.letters])

seq = ''

if len(sys.argv) > 1:
  n = int(sys.argv[1])
  sys.exit("usage: " + sys.argv[0] + " [length]")

# read in sequence
for line in fileinput.input("-"):
  seq = seq + nowhite(line)

#seq = seq[offset:] + seq[:offset]     # wrap around first offset bases

# print last n chars
#print seq[-n:]

# print first n chars
print seq[:n]

Personal tools