User:ShawnDouglas/scripts: Difference between revisions

From OpenWetWare
Jump to navigationJump to search
mNo edit summary
mNo edit summary
Line 13: Line 13:
cat foo | tr '\r' '\n' > bar
cat foo | tr '\r' '\n' > bar
mv bar foo
mv bar foo
</pre>
*print first n chars of STDIN
<pre>
#!/usr/bin/python
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])
else:
  sys.exit("usage: " + sys.argv[0] + " [length]")
# read in sequence
for line in fileinput.input("-"):
  seq = seq + nowhite(line)
# print last n chars
#print seq[-n:]
# print first n chars
print seq[:n]
</pre>
</pre>

Revision as of 08:26, 27 June 2006

PCR

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

Nanostructures

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

Misc

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

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])
else:
  sys.exit("usage: " + sys.argv[0] + " [length]")

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

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

# print first n chars
print seq[:n]