-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpreprocessTELL-Seq.py
48 lines (40 loc) · 1 KB
/
preprocessTELL-Seq.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import sys
import re
import csv
import os
r1 = open(sys.argv[1]);
r2 = open(sys.argv[2]);
i1 = open(sys.argv[3]);
o1 = open(os.path.splitext(sys.argv[1])[0] + "_barcodes_in_headers" + os.path.splitext(sys.argv[1])[1], "w");
o2 = open(os.path.splitext(sys.argv[2])[0] + "_barcodes_in_headers" + os.path.splitext(sys.argv[2])[1], "w");
header1 = r1.readline()[:-1];
while header1 != '':
line = r1.readline();
data1 = line;
line = r1.readline();
data1 += line;
line = r1.readline();
data1 += line;
header2 = r2.readline()[:-1];
line = r2.readline();
data2 = line;
line = r2.readline();
data2 += line;
line = r2.readline();
data2 += line;
header3 = i1.readline();
barcode = i1.readline();
i1.readline();
i1.readline();
h = header1.split(" ")[0].split("\t")[0];
o1.write(h + "\tBX:Z:" + barcode);
o1.write(data1);
h = header2.split(" ")[0].split("\t")[0];
o2.write(h + "\tBX:Z:" + barcode);
o2.write(data2);
header1 = r1.readline()[:-1]
r1.close();
r2.close();
i1.close();
o1.close();
o2.close();