469,616 Members | 1,823 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,616 developers. It's quick & easy.

Matching strings with a dictionary built from a flat file

Hello again,

I am still working on my same project and have run into another little problem. I have created a flat file with data from a server, each line looks like this:

BLAT Search Results
ACTIONS QUERY SCORE START END QSIZE IDENTITY CHRO STRAND START END SPAN
---------------------------------------------------------------------------------------------------
browser details Musmusculuslet-7g 21 1 21 21 100.0% 22 + 46884872 46884892 21
browser details Musmusculuslet-7i 21 1 21 21 100.0% 5 + 50605174 50605194 21

My original input looked like this:

>Musmusculuslet-7g
UGAGGUAGUAGUUUGUACAGU
>Musmusculuslet-7i
UGAGGUAGUAGUUUGUGCUGU

As you can see, the original RNA codes were deleted in the reply. Also, my replies are sorted differently and have multiple matches in some cases, so I want to create a library that has all of my matches, and then feed in the above file and add the RNA codes whenever it finds the matching Musmusculus statements. I have the following code, but it just matches an exact string:

Expand|Select|Wrap|Line Numbers
  1. DictionaryMaker ( filename ):
  2.     dict = {}
  3.     for i in dict.keys(practice):
  4.     if  i == string:
  5.         print 'Yes there is a match!'
  6.         string = string + ' ' + practice[i]
  7.  
  8.  
  9.  
I also need to read in the data I have for the dictionary somehow to build my dictionary from my flat file. The key should be '>Musmusculuslet-7g' and the value 'UGAGGUAGUAGUUUGUACAGU' from above. Is there an easy way to read this in from a file containing all of these sequences?

Any help would be appreciated!

Mark
Aug 2 '07 #1
0 979

Post your reply

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

Similar topics

2 posts views Thread by Christopher Boomer | last post: by
17 posts views Thread by Andrew McLean | last post: by
12 posts views Thread by Antoon Pardon | last post: by
12 posts views Thread by David W. Thorell | last post: by
2 posts views Thread by Berimor | last post: by
2 posts views Thread by Ole Nielsby | last post: by
9 posts views Thread by Chris | last post: by
2 posts views Thread by Joe Strout | last post: by
reply views Thread by Joe Strout | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.