Dear all.
I have a file with lines like this.
query 210 ACTTGGACTC 219
query 311 ACTTGGACTC 320 ....
From every line, I need to extract the number coming right after 'query' and then the DNA sequence. I currently read each line as a list but was only able to write that line into a file.
for line in filein.readlines():
if line.startswith('@') or line.startswith('>'):
continue
else:
strline=str(line)
if 'query' in strline:
fileout.write(strline)
.
If I try with print strline[3], I get 'u'. I also checked with .split(). Although I did get the line split, accessing the 3rd element was not possible, since this is not an array. I must be making a mistake as there must be some way to do this. Please help.