473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 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 1093

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

Similar topics

2
by: Christopher Boomer | last post by:
Until now I have been using XSLT to translate from a known foreign XML format to a local XML format for import to Postgres. Now I need to be able to let others define the relationship from new...
17
by: Andrew McLean | last post by:
I have a problem that is suspect isn't unusual and I'm looking to see if there is any code available to help. I've Googled without success. Basically, I have two databases containing lists of...
12
by: Antoon Pardon | last post by:
Well at least I find them missing. For the moment I frequently come across the following cases. 1) Two files, each with key-value pairs for the same dictionary. However it is an error if the...
12
by: David W. Thorell | last post by:
I am trying to write a basic spell check function, one which has as its parameters two strings arrays, one is an article from a file source which needs to be checked for valid words, in this case...
2
by: Berimor | last post by:
Hey guys, has anybody scripted online translators? I got the task to build one but it should traslate big pieces of text at once - up to 5000 words!!! Traslation is simple - just words...
2
by: Ole Nielsby | last post by:
First, bear with my xpost. This goes to comp.lang.c++ comp.lang.functional with follow-up to comp.lang.c++ - I want to discuss an aspect of using C++ to implement a functional language, and...
9
by: Chris | last post by:
Is anyone aware of any prior work done with searching or matching a pattern over nested Python lists? I have this problem where I have a list like: , 9, 9], 10] and I'd like to search for the...
2
by: Joe Strout | last post by:
Catching up on what's new in Python since I last used it a decade ago, I've just been reading up on template strings. These are pretty cool! However, just as a template string has some advantages...
0
by: Joe Strout | last post by:
On Oct 9, 2008, at 7:05 AM, skip@pobox.com wrote: Right. Well, what do y'all think? It wouldn't be too hard to write this for myself, but it seems like the sort of thing Python ought to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.