Hi,
I'm a beginner at Python and I'm trying to extract some information from a
textfile where I have a lot of data.
The table looks something like this, but with many more columns and rows:
# chr Pos ID REF ALT . . . . . . . . . . .
1 13645 - C T
. . . . .
. . . . .
I want to extract certain data from this table above and make it to a sentence
looking something like this: chr1:13645 C/T
I have created a pseudo code, just to get an overview of want I want to do,
looking like this:
import OS
open vcf_file.vcf
for each line
words = split(line)
# words[0] = 1 , words[1]=Pos ,
words[3]=REF , words[4]=ALT
if(words[0] not "#"):
#Sometimes the word starts with a
hash and I don't want that to be included.
str="chr" + words[0] + ":" + words[1] + "\t" + words[3] + "/" +
words[4]
score = OS.system(str)
vcf_file.close()
print result
return score
I'm not exactly sure how to proceed from here.
Best,
Anna
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor