473,466 Members | 1,357 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Print column numbers that are 100% conserved

13 New Member
how can i write a Python program that prints the column numbers in a FASTA format multiple alignment that are 100% conserved. im really having trouble getting a grip of this concept...For example in the multiple alignment below

>human
ACC
>mouse
ACC
>cat
TCC
>dog
ACA

column 2 is 100% conserved but columns 1 and 3 are not 100% conserved.
Nov 12 '10 #1
8 2466
bvdet
2,851 Recognized Expert Moderator Specialist
What is the output supposed to look like? I don't know what a Fasta format multiple alignment is. :(
Nov 12 '10 #2
CCGG26
13 New Member
the fasta format multiple alignment is just a name i believe, i do not think it is anything significant..
Nov 12 '10 #3
bvdet
2,851 Recognized Expert Moderator Specialist
What is the output supposed to look like?
Nov 12 '10 #4
CCGG26
13 New Member
output: column 2 = 100%
Nov 14 '10 #5
bvdet
2,851 Recognized Expert Moderator Specialist
What is column 2? 100% of what? Please be specific.
Nov 15 '10 #6
CCGG26
13 New Member
A 100% conserved column is
one that has the exact same nucleotide in every sequence. For example if the
user enters 1 and the the multiple alignment below is given as input

>human
ACC
>mouse
ACC
>cat
TCC
>dog
ACA

then the output should be "No". But if the user enters 2 then the output
should be "Yes".
Nov 17 '10 #7
bvdet
2,851 Recognized Expert Moderator Specialist
Following is a test script that show's how it can be done using set().
Expand|Select|Wrap|Line Numbers
  1. import random
  2.  
  3. data = '''>human
  4. ACC
  5. >mouse
  6. ACC
  7. >cat
  8. TCC
  9. >dog
  10. ACA'''
  11.  
  12. def conserved(col, seq):
  13.     colList = set([item[col] for item in seq])
  14.     if len(colList) == 1:
  15.         return True
  16.     return False
  17.  
  18. dataList = data.split("\n")
  19. sequences =[list(dataList[i]) for i in range(1, len(dataList), 2)]
  20.  
  21. column = random.choice([0,1,2])
  22.  
  23. result = conserved(column, sequences)
  24. print "Column %s %s conserved" % (column, ["IS", "IS NOT"][not result or 0])
The three columns are 0, 1 and 2 which is consistent with a list index.
Nov 17 '10 #8
dwblas
626 Recognized Expert Contributor
Shouldn't it be true for 1 or 2, and false for 3 or 4?
Nov 17 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: vronskij | last post by:
Hi, A C program can be hundreds of thousands lines of code big. C++ millions. How about Python? Suppose , you are a sole programmer (lonewolf). How many lines can one handle? Thanks,
33
by: Nick Evans | last post by:
Hello there, I have been on and off learning to code (with python being the second language I have worked on after a bit of BASIC). What I really want to know is, if you are going to actually...
17
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
1
by: Jim Langston | last post by:
Windows. Situation: Using a Python program called OpenRPG. I have a program that displays form data (a character sheet) in C++. I am able in the C++ program to build a string and copy it into the...
18
by: W. Watson | last post by:
See Subject. It's a simple txt file, each line is a Python stmt, but I need up to four digits added to each line with a space between the number field and the text. Perhaps someone has already done...
19
by: pitamber kumar | last post by:
Write a program to find the number of and sum of all intergers greater than 100 & less than 200 that are divisible by 7.
8
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the tkinter-2.2.2-36.i386.rpm alone from the CD 3 to...
2
by: WP | last post by:
Hello, below is my very first python program. I have some questions regarding it and would like comments in general. I won't be able to get my hands on a good python book until tomorrow at the...
1
by: altaey | last post by:
Question Details: Write a program to find and print a Fibonacci sequence of numbers. The Fibonacci sequence is defined as follow: Fn = Fn-2 + Fn-1, n >= 0 F0 = 0, F1 = 1, F2 = 1 Your...
7
by: habsy | last post by:
The below are the question given; Please help. (Payroll) Write a program that reads the following information and prints payroll statements in show message dialog box. These are the...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.