472,114 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,114 software developers and data experts.

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 1035

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

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.