[Tutor] Simple string processing problem

2005-05-13 Thread cgw501
Hi, i am a Biology student taking some early steps with programming. I'm currently trying to write a Python script to do some simple processing of a gene sequence file. A line in the file looks like: SCER ATCGATCGTAGCTAGCTATGCTCAGCTCGATCagctagtcgatagcgat Ther are many lines like this. What I

Re: [Tutor] Simple string processing problem

2005-05-13 Thread cgw501
Thanks! Your help has made me realise the problem is more complex than I first though though...I've included a small sample of an actual file I need to process. The structure is the same as in the full versions though; some lowercase, some uppercase, then some more lowercase. One is that I nee

[Tutor] pattern matching problem

2005-05-26 Thread cgw501
Hi, I have to write a function that will return the index of a line like this: gvcdgvcgdvagTVTVTVTVTVTHUXHYGSXUHXSU where it first becomes capital letters. I've had about a hundred different ideas of the best way to do this, but always seem to hit a fatal flaw. Any thoughts? Thanks, Chris __

Re: [Tutor] pattern matching problem

2005-05-26 Thread cgw501
One of the worst I think was doing loads of real spazzy stuff trying to split whole files in to lists of letters and use string methods to find the first uppercase one. The re tutorial has sorted it out for me. I figured this was the way to go, I just couldn't work out how to get the index valu

[Tutor] List processing

2005-06-01 Thread cgw501
Hi, I have a load of files I need to process. Each line of a file looks something like this: eYAL001C1 Spar81 3419451845192 1 So basically its a table, separated with tabs. What I need to do is make a new file where all the entries in the table are those

[Tutor] int uncallable

2005-07-18 Thread cgw501
Hi, This code: for line in satFile: lineListed = line.split() start = int(lineListed[5])-1 end = int(lineListed[6]) hitLength = end - start extra = len(lineListed[9]) total = hitLength + 2(extra) gives an error: Traceback (most recent call last): File "test2.py",

[Tutor] String slicing from tuple list

2005-07-21 Thread cgw501
Hi, I have a list of tuples like this: [(1423, 2637),(6457, 8345),(9086, 10100),(12304, 15666)] Each tuple references coordinates of a big long string and they are in the 'right' order, i.e. earliest coordinate first within each tuple, and eearliest tuple first in the list. What I want to do i

[Tutor] counting problem

2005-08-01 Thread cgw501
hi, I have large txt file with lines like this: ['DDB0216437'] 116611749 ZZZ 100 What I want to do is quickly count the number of lines that share a value in the 4th column and 5th (i.e. in this line I would count all the line that have '9' and 'ZZZ'). Anyone got any ideas for t