-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_targets_frame.py
29 lines (27 loc) · 1.02 KB
/
make_targets_frame.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
import os
import re
with open("targets.txt", "w") as targets_file:
fields = ["SlideName","fraction", "knockdown", "time", "replicate", "FileName"]
print "\t".join(fields)
for line in open("fofn"):
F = line.strip().split("/")
fraction = F[0]
try:
Cy3 = re.match("(?:CYTO|TOTAL)_(.+)\.", F[1]).groups()[0]
except AttributeError:
print "Cannot match '(?:CYTO|TOTAL)_(.+)\.' in %s" % F[1]
raise
try:
time = re.search("\.([0-9]+)hrs", F[1]).groups()[0]
except AttributeError:
print "Cannot match '\.([0-9]+)hrs' in %s" % F[1]
print line
raise
try:
replicate = re.search("R([0-9])", F[2]).groups()[0]
except AttributeError:
print "Cannot match 'R([0-9])' in %s" % F[2]
raise
filename = line.strip()
SlideName=".".join([fraction[0], Cy3, time, replicate])
print "\t".join([SlideName,fraction, Cy3, time, replicate, filename])