annotate microsatpurity.py @ 0:20ab85af9505

Uploaded
author arkarachai-fungtammasan
date Fri, 03 Oct 2014 20:54:30 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
1 import sys
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
2 # remove all read that have impure microsat
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
3 # check only one line at a time
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
4
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
5
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
6 fd=open(sys.argv[1])
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
7 lines=fd.xreadlines()
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
8 ##motifIx=int(sys.argv[2])
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
9 period=int(sys.argv[2])
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
10 tr_ref_seqIx=int(sys.argv[3])-1
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
11 ##output=(sys.argv[4])
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
12 ##fout=open(output,'w')
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
13 for line in lines:
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
14 temp=line.strip().split('\t')
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
15 temp=filter(None,temp)
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
16 #motif=temp[motifIx]
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
17 tr_ref_seq=temp[tr_ref_seqIx]
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
18 ##period=len(motif)
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
19 cand_motif=tr_ref_seq[:period]
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
20 len_microsat=len(tr_ref_seq)
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
21 expand_microsat_cand=cand_motif*(len_microsat/period) + cand_motif[:(len_microsat%period)]
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
22 if tr_ref_seq == expand_microsat_cand:
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
23 print line.strip()
20ab85af9505 Uploaded
arkarachai-fungtammasan
parents:
diff changeset
24 ##print line.strip() >> fout