annotate microsatpurity.py @ 0:70f8259b0b30 draft

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