Build mutation Script

From Bioinformatikpedia
Revision as of 16:42, 11 June 2012 by Wagnerr (talk | contribs) (Created page with " #! /usr/bin/env python import sys sequence_fasta = sys.argv[1] mutation_file = sys.argv[2] f = open (sequence_fasta, 'r') sequence = "" sequence = f.read() sequ…")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
#! /usr/bin/env python

import sys

sequence_fasta = sys.argv[1]
mutation_file = sys.argv[2]

f = open (sequence_fasta, 'r')

sequence = ""
sequence = f.read()

sequence = sequence.split('\n')

header = sequence[0]

tmp = ""
for i in range(1,len(sequence)):
        tmp += sequence[i]

f.close()

f = open(mutation_file, 'wb')
for i in range(len(tmp)):
        f.write(tmp[i] + str(i+1) + "A\n")
        f.write(tmp[i] + str(i+1) + "R\n")
        f.write(tmp[i] + str(i+1) + "N\n")
        f.write(tmp[i] + str(i+1) + "D\n")
        f.write(tmp[i] + str(i+1) + "C\n")
        f.write(tmp[i] + str(i+1) + "E\n")
        f.write(tmp[i] + str(i+1) + "Q\n")
        f.write(tmp[i] + str(i+1) + "G\n")
        f.write(tmp[i] + str(i+1) + "H\n")
        f.write(tmp[i] + str(i+1) + "I\n")
        f.write(tmp[i] + str(i+1) + "L\n")
        f.write(tmp[i] + str(i+1) + "K\n")
        f.write(tmp[i] + str(i+1) + "M\n")
        f.write(tmp[i] + str(i+1) + "F\n")
        f.write(tmp[i] + str(i+1) + "P\n")
        f.write(tmp[i] + str(i+1) + "S\n")
        f.write(tmp[i] + str(i+1) + "T\n")