Python Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPython Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 19th, 2009, 12:56 PM
zatanelov zatanelov is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2009
Posts: 1 zatanelov User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 0
Iterating through a Fasta file Dictionary created using Biopython

I have a problem iterating through a dictionary where the sequence should be ACTGDEDQ..., but it includes some other stuff Biopython adds when it parses a FASTA file. If I just print seq_record.seq it prints the sequence, and does not include extra stuff. However, if I print the dictionary it includes extra stuff not part of the polypeptide, and the "for loop" will not iterate through it. This one step has been annoying me forever. Does anyone know what to do?


from Bio import SeqIO

file = open("Zaza.fasta.txt")
for seq_record in SeqIO.parse(file, "fasta"):
protein_dict[seq_record.id]=seq_record.seq

def Filter_By_Molecular_Weight(prot_dict):
acidsCount = {
"A": {"count":0, "weight":89.1288},
"B": {"count":0, "weight":132.64625},
"C": {"count":0, "weight":121.1888},
"D": {"count":0, "weight":133.1386},
"E": {"count":0, "weight":147.1655},
"F": {"count":0, "weight":165.2266},
"G": {"count":0, "weight":75.1019},
"H": {"count":0, "weight":155.1911},
"I": {"count":0, "weight":131.2094},
"K": {"count":0, "weight":146.2241},
"L": {"count":0, "weight":131.2094},
"M": {"count":0, "weight":149.2486},
"N": {"count":0, "weight":132.1539},
"P": {"count":0, "weight":115.1667},
"Q": {"count":0, "weight":146.1807},
"R": {"count":0, "weight":174.2375},
"S": {"count":0, "weight":105.1282},
"T": {"count":0, "weight":119.1551},
"V": {"count":0, "weight":117.1826},
"W": {"count":0, "weight":204.2632},
"X": {"count":0, "weight":145.3726364},
"Y": {"count":0, "weight":181.226},
}

for aa_name,aa_seq in protein_dict.iteritems():
acidsCount[aa_seq]["count"]=acidsCount[aa_seq]["count"]+ 1

total=0
for acid in acidsCount:
total=total+(acidsCount[acid]["count"]* acidsCount[acid]["weight"]/1000)
return total

print Filter_By_Molecular_Weight(protein_dict)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPython Programming > Iterating through a Fasta file Dictionary created using Biopython


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
Stay green...Green IT