Hi all,
I ´m a Python Newbie. Just 48 hrs into Python.
I am trying to parse a file which is tab spaced.
head -5 of the file in question.
1 rs3094315 0 792429
1 rs6672353 0 817376
1 rs4040617 0 819185
1 rs2980300 0 825852
1 rs2905036 0 832343
1 rs4245756 0 839326
1 rs4075116 0 1043552
1 rs9442385 0 1137258
1 rs10907175 0 1170650
1 rs2887286 0 1196054
column[0] increments [1-22].
column [1] has values I´m interested in
columns [2] Its a Zero
column [3] has values which I pass for range boundary.
My Python code
#/bin/python
import sys, csv, re
# This programme finds the SNPs from the range passed from
the select option
## But first for fixed values.
gen = 16
rval0l = 6009890
rval0u = 6009939
rval1l = 0
rval1u = 0
types = (int, str, int, int)
fis = csv.reader(open("divs.map", "rb"), delimiter='\t',
quoting=csv.QUOTE_NONE) # csv splits columns and this file
is tab spaced
# Reading file line by line and using Regex to match the
gene.
for row in fis:
#if re.search("^[1-9]\-^[1-9]\:^[1-9]\-^[1-9]", row
[3]):
if (str(gen) == str(row[0])):
print 'Match for 16 found looking for SNPs
in range between '+ str(rval0l),str(rval0u)+' '
for row[2] in range (rval0l,rval0u):
print row
My Python code is not behaving as I want it to be.
When I pass the range values .
The Code should parse the file.
Match the value of Col3.
look for values in col(3) within the range limit (Which it
does)
print rows Matching the criteria.(which it does not).
It prints rows which are not even the file.
Can somebody point me in the right direction.
Thanks in advance
yogesh
____________________________________________________________________________________
You rock. That's why Blockbuster's offering you one month of Blockbuster Total
Access, No Cost.
http://tc.deals.yahoo.com/tc/blockbuster/text5.com
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor