Difference between revisions of "Build mutation Script"
From Bioinformatikpedia
(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…") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | Usage: ./script.py file.fasta mutation.file |
||
+ | |||
#! /usr/bin/env python |
#! /usr/bin/env python |
||
Line 40: | Line 42: | ||
f.write(tmp[i] + str(i+1) + "S\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) + "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() |
Latest revision as of 16:44, 11 June 2012
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()