annotate microsatpurity.py @ 0:07588b899c13 draft

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