annotate test-data/microsatpurity.py @ 5:b27006b0a953

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