Beispiel #1
0
if len(argv) < 3:
    print("usage: python makeoligo.py <fasta> <list>")
    exit()

with open(argv[1], 'r') as f:
    gene = f.readlines()[0].strip()

with open(argv[2], 'r') as l:
    lis = [i.strip() for i in l.readlines() if i != '\n']

for line in lis:
    seq = [gene[i:i + 3] for i in range(0, len(gene), 3)]
    l = []
    switches = re.split(r'\+', line)
    for switch in switches:
        old = switch[0]
        i = int(''.join(switch[1:-1]))
        new = switch[-1]
        ori = aa_from_codon(seq[i - 1])
        if old is ori:
            seq[i - 1] = ecoli_codon[new].upper()
            l += [i]
        else:
            e = 'error: you say ' + old + ' but seq has ' + ori
            break
    if l:
        e = rc(''.join(seq[min(l) - 6:max(l) + 4]))
        e = re.sub(r'([atcg]{15})[atcg]{0,}([atcg]{15})', r'\1,\2', e)
    print '+'.join(switches) + ',' + e
Beispiel #2
0
    codons = [cds[i : i + 3] for i in range(0, len(cds), 3)]
    l = []

    for switch in m:
        old, i, new = switch
        new1, old1 = (THREE_to_one(new), THREE_to_one(old))
        ori = one_to_THREE(aa[codons[i]])
        if old == ori:
            codons[i] = ecoli_codon[new1].upper()
            l += [i]
        else:
            print "error: mismatch when trying", old, i, new

    if l:
        e = rc("".join(codons[min(l) - 5 : max(l) + 6]))
        e = re.sub(r"([atcg]{15})[atcg]{0,}([atcg]{15})", r"\1,\2", e)

    handle = "+".join(["%s%s%s" % (THREE_to_one(s[0]), s[1], THREE_to_one(s[2])) for s in m])
    orders += [{"name": handle, "oligos": [{"sequence": ee for ee in e.split(",")}]}]

# transcriptic output format
print json.dumps(
    {
        "parameters": {"ssDNA": "ssDNA/0", "mutants": orders},
        "refs": {
            "ssDNA": {
                "aliquots": {"0": {"volume": "50:microliter"}},
                "id": "<ssDNA to use>",
                "store": "cold_20",
                "type": "micro-1.5",
Beispiel #3
0
if len(argv) < 3: 
  print("usage: python makeoligo.py <fasta> <list>")
  exit()

with open(argv[1], 'r') as f:
  gene = f.readlines()[0].strip() 

with open(argv[2], 'r') as l:
  lis = [ i.strip() for i in l.readlines() if i != '\n' ]

for line in lis:
  seq = [gene[i:i+3] for i in range(0, len(gene), 3)]
  l = []
  switches = re.split(r'\+', line)
  for switch in switches:
    old = switch[0]
    i = int(''.join( switch[ 1:-1] ))
    new = switch[-1]
    ori = aa_from_codon( seq[i-1] )
    if old is ori:
      seq[i-1] = ecoli_codon[new].upper()
      l += [i]
    else :
      e = 'error: you say ' + old + ' but seq has ' + ori
      break
  if l:
    e = rc(''.join(seq[min(l)-6:max(l)+4]))
    e = re.sub(r'([atcg]{15})[atcg]{0,}([atcg]{15})', r'\1,\2', e)
  print '+'.join(switches) + ',' + e