Sunday 6 August 2017

How to create a codon list of a DNA sequence in a single line of code in Python 3.5 ?

creating codon lists of a DNA sequence would need you to write methods in a class to generate the output in a list of triplets. However, with python, one can perform such a process in a single line of code. below is the syntax for codon lists.

>>> user_input = input("please enter your DNA sequence below: \n") # this asks the user to enter data. an example is shown below
please enter your DNA sequence below:
AAATCGGGGATGCCCGGGATTTAAGGGCGA
>>> codons = ([user_input[start:start+3]for start in range(0,len(user_input),3)])
>>> print(codons)
['AAA', 'TCG', 'GGG', 'ATG', 'CCC', 'GGG', 'ATT', 'TAA', 'GGG', 'CGA']

Project Genetic Analysis Toolpack (GAT V1.0)

The name GAT stands for Genetic Analysis Toolpack and we are aiming to make it a useful molecular data analysis tool, and more importantly...