annotate Iterative_mapping/unmap.py @ 50:6747060cdfe6 draft

Uploaded
author tyty
date Mon, 27 Oct 2014 01:50:00 -0400
parents d56631911cc1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
d56631911cc1 Uploaded
tyty
parents:
diff changeset
1 #!/usr/bin/env python
d56631911cc1 Uploaded
tyty
parents:
diff changeset
2 # -*- coding: utf-8 -*-
d56631911cc1 Uploaded
tyty
parents:
diff changeset
3
d56631911cc1 Uploaded
tyty
parents:
diff changeset
4 import sys
d56631911cc1 Uploaded
tyty
parents:
diff changeset
5 from read_file import *
d56631911cc1 Uploaded
tyty
parents:
diff changeset
6 from Bio import SeqIO
d56631911cc1 Uploaded
tyty
parents:
diff changeset
7
d56631911cc1 Uploaded
tyty
parents:
diff changeset
8 map_file = sys.argv[1]
d56631911cc1 Uploaded
tyty
parents:
diff changeset
9 result_file = sys.argv[2]
d56631911cc1 Uploaded
tyty
parents:
diff changeset
10
d56631911cc1 Uploaded
tyty
parents:
diff changeset
11
d56631911cc1 Uploaded
tyty
parents:
diff changeset
12 #reads = read_t_file(read_file);
d56631911cc1 Uploaded
tyty
parents:
diff changeset
13
d56631911cc1 Uploaded
tyty
parents:
diff changeset
14 f = open(map_file);
d56631911cc1 Uploaded
tyty
parents:
diff changeset
15 h = file(result_file, 'w')
d56631911cc1 Uploaded
tyty
parents:
diff changeset
16
d56631911cc1 Uploaded
tyty
parents:
diff changeset
17 for aline in f.readlines():
d56631911cc1 Uploaded
tyty
parents:
diff changeset
18 tline = aline.strip();
d56631911cc1 Uploaded
tyty
parents:
diff changeset
19 tl = tline.split('\t');
d56631911cc1 Uploaded
tyty
parents:
diff changeset
20 if len(tl)>4:
d56631911cc1 Uploaded
tyty
parents:
diff changeset
21 if int(tl[1].strip()) != 0:
d56631911cc1 Uploaded
tyty
parents:
diff changeset
22 h.write(tl[0].strip());
d56631911cc1 Uploaded
tyty
parents:
diff changeset
23 h.write('\n');
d56631911cc1 Uploaded
tyty
parents:
diff changeset
24
d56631911cc1 Uploaded
tyty
parents:
diff changeset
25
d56631911cc1 Uploaded
tyty
parents:
diff changeset
26 f.close();
d56631911cc1 Uploaded
tyty
parents:
diff changeset
27 h.close()
d56631911cc1 Uploaded
tyty
parents:
diff changeset
28
d56631911cc1 Uploaded
tyty
parents:
diff changeset
29
d56631911cc1 Uploaded
tyty
parents:
diff changeset
30
d56631911cc1 Uploaded
tyty
parents:
diff changeset
31