Build mutation Script
From Bioinformatikpedia
Usage: ./script.py file.fasta mutation.file
#! /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") f.write(tmp[i] + str(i+1) + "W\n") f.write(tmp[i] + str(i+1) + "Y\n") f.write(tmp[i] + str(i+1) + "V\n") f.close()