Skip to content

Commit 8d233bb

Browse files
authored
Add files via upload
1 parent 7e828e9 commit 8d233bb

File tree

101 files changed

+10134
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+10134
-0
lines changed

Python/ANISEED_ISHparse2.py

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#-------------------------------------------------------------------------------
2+
# Name: module1
3+
# Purpose:
4+
#
5+
# Author: Eli
6+
#
7+
# Created: 14/04/2015
8+
# Copyright: (c) Eli 2015
9+
# Licence: <your licence>
10+
#-------------------------------------------------------------------------------
11+
12+
def main():
13+
pass
14+
15+
if __name__ == '__main__':
16+
main()
17+
18+
import sys
19+
20+
#Read data
21+
f_in = open("C:/users/eli/downloads/ish/ish_ci.xml")
22+
23+
#Print header row
24+
sys.stdout.write("gene" +"\t"+ "stage" +"\t"+ "tissue" +"\t"+ "pattern" +"\t"+ "original" +"\t"+ "source" +"\t"+ "exp" +"\t"+ "note" +'\n')
25+
26+
#Set number of header rows to skip
27+
headers = 3
28+
count = 1
29+
source = False
30+
31+
for line in f_in:
32+
33+
#Skip specified number of header lines
34+
if count <= headers:
35+
count+=1
36+
pass
37+
38+
#Parse desired information
39+
else:
40+
if "experiment id" in line:
41+
exp = "NA"
42+
stage = "NA"
43+
stage_source = "NA"
44+
gene = "NA"
45+
tissue = "NA"
46+
note = "NA"
47+
pattern = "NA"
48+
original = "NA"
49+
exp = line.split('"')[1]
50+
if "developmental_stage" in line and source == False:
51+
stage = line.split(">")[1].split('<')[0]
52+
source = True
53+
54+
if "developmental_stage" in line and source == True:
55+
stage_source = line.split(">")[1].split('<')[0]
56+
source = False
57+
58+
if "probe_gene_predicted" in line:
59+
gene = line.split(">")[1].split('<')[0]
60+
61+
if "staining_localization" in line:
62+
tissue = line.split(">")[1].split('<')[0]
63+
64+
if "image_note" in line:
65+
note = line.split(">")[1].split('<')[0]
66+
if "Expression pattern:" in note:
67+
pattern = note.split("Expression pattern:")[1].split("<")[0]
68+
69+
if "Original annotation:" in note:
70+
original = note.split("Original annotation:")[1].split(".")[0]
71+
72+
else:
73+
pass
74+
75+
#Output information for parsed record
76+
if "/experiment" in line:
77+
#results = [gene, stage, tissue, pattern, original, exp, note]
78+
output = "\t".join([gene, stage, tissue, pattern, original, stage_source, exp, note])
79+
sys.stdout.write(output + '\n')

Python/ANISEED_ISHparseET.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#-------------------------------------------------------------------------------
2+
# Name: module2
3+
# Purpose:
4+
#
5+
# Author: Eli
6+
#
7+
# Created: 14/04/2015
8+
# Copyright: (c) Eli 2015
9+
# Licence: <your licence>
10+
#-------------------------------------------------------------------------------
11+
12+
def main():
13+
pass
14+
15+
if __name__ == '__main__':
16+
main()
17+
18+
#http://effbot.org/zone/element.htm
19+
20+
import elementtree.ElementTree as ET
21+
import sys
22+
23+
tree = ET.parse("C:/users/eli/downloads/ish/ish_ci.xml")
24+
25+
# the tree root is the toplevel html element
26+
print tree.findtext("experiment")
27+
28+
# if you need the root element, use getroot
29+
root = tree.getroot()
30+
31+
print root

Python/DE_compare.py

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
#-------------------------------------------------------------------------------
2+
# Name: module1
3+
# Purpose:
4+
#
5+
# Author: Eli
6+
#
7+
# Created: 09/04/2014
8+
# Copyright: (c) Eli 2014
9+
# Licence: <your licence>
10+
#-------------------------------------------------------------------------------
11+
12+
def main():
13+
pass
14+
15+
if __name__ == '__main__':
16+
main()
17+
18+
f1 = open("C:/rnaseq/polyA_data/clusters/1dpa_DE_fdr05_redo.txt", "r")
19+
f2 = open("C:/rnaseq/polyA_data/clusters/3dpa_DE_fdr05_redo.txt", "r")
20+
f3 = open("C:/rnaseq/polyA_data/clusters/8dpa_DE_fdr05_redo.txt", "r")
21+
22+
#Loop through files and extract ID's to lists
23+
f1_ids = []
24+
f2_ids = []
25+
f3_ids = []
26+
27+
count = 1
28+
for line in f1:
29+
if count == 1: #skip header row
30+
count += 1
31+
pass
32+
else:
33+
f1_ids.append(str(line.split("\t")[0]))
34+
count = 1
35+
for line in f2:
36+
if count == 1: #skip header row
37+
count += 1
38+
pass
39+
else:
40+
f2_ids.append(str(line.split("\t")[0]))
41+
count = 1
42+
for line in f3:
43+
if count == 1: #skip header row
44+
count += 1
45+
pass
46+
else:
47+
f3_ids.append(str(line.split("\t")[0]))
48+
49+
#Cross check ID lists, errors can occur if the files aren't formatted properly.
50+
#print f1_ids, f2_ids, f3_ids
51+
52+
f1 = open("C:/rnaseq/polyA_data/clusters/1dpa_DE_fdr05_redo.txt", "r")
53+
f2 = open("C:/rnaseq/polyA_data/clusters/3dpa_DE_fdr05_redo.txt", "r")
54+
f3 = open("C:/rnaseq/polyA_data/clusters/8dpa_DE_fdr05_redo.txt", "r")
55+
56+
linecount = 1
57+
for line in f1: # check whether ids in first condition matched others
58+
added = 0
59+
if linecount == 1:
60+
linecount += 1
61+
else:
62+
for ids2 in f2_ids:
63+
if ids2 in line: # 1dpa id matched to 3dpa id
64+
for ids3 in f3_ids:
65+
if ids3 in line: #1dpa id also matched to 8dpa
66+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1-3-8dpa_redo.txt", "a") as file_out:
67+
file_out.write("1dpa" + "\t" + line)
68+
file_out.close()
69+
added = 1
70+
break
71+
72+
else: #1dpa id only matched to 3dpa id
73+
pass
74+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1-3dpa_redo.txt", "a") as file_out:
75+
file_out.write("1dpa" + "\t" + line)
76+
file_out.close()
77+
added = 1
78+
break
79+
# id is unique to 1st condition
80+
for ids3 in f3_ids:
81+
if ids3 in line: #1dpa matched only to 8dpa
82+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1-8dpa_redo.txt", "a") as file_out:
83+
file_out.write("1dpa" + "\t" + line)
84+
file_out.close()
85+
added = 1
86+
break
87+
else:
88+
#print "unique to first condition"
89+
pass
90+
if added == 0:
91+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1dpa_unique_redo.txt", "a") as file_out:
92+
file_out.write("1dpa" + "\t" + line)
93+
file_out.close()
94+
continue
95+
96+
linecount = 1
97+
for line in f2: # check whether ids in second condition matched others
98+
added = 0
99+
if linecount == 1:
100+
linecount += 1
101+
else:
102+
for ids1 in f1_ids:
103+
if ids1 in line: # 3dpa id matched to 1dpa id
104+
for ids3 in f3_ids:
105+
#print "8dpa", ids
106+
if ids3 in line: #1dpa id also matched to 8dpa
107+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1-3-8dpa_redo.txt", "a") as file_out:
108+
file_out.write("3dpa" + "\t" + line)
109+
file_out.close()
110+
added = 1
111+
break
112+
else: #3dpa id only matched to 1dpa id
113+
pass
114+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1-3dpa_redo.txt", "a") as file_out:
115+
file_out.write("3dpa" + "\t" + line)
116+
file_out.close()
117+
added = 1
118+
break
119+
for ids3 in f3_ids:
120+
if ids3 in line: #3dpa matched only to 8dpa
121+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_3-8dpa_redo.txt", "a") as file_out:
122+
file_out.write("3dpa" + "\t" + line)
123+
file_out.close()
124+
added = 1
125+
break
126+
else:
127+
pass
128+
if added == 0:
129+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_3dpa_unique_redo.txt", "a") as file_out:
130+
file_out.write("3dpa" + "\t" + line)
131+
file_out.close()
132+
continue
133+
134+
135+
linecount = 1
136+
for line in f3: # check whether ids in 3rd condition matched others
137+
added = 0
138+
if linecount == 1:
139+
linecount += 1
140+
else:
141+
for ids1 in f1_ids:
142+
if ids1 in line: # 8dpa id matched to 1dpa id
143+
for ids2 in f2_ids:
144+
#print "3dpa", ids
145+
if ids2 in line: #8dpa id also matched to 3dpa
146+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1-3-8dpa_redo.txt", "a") as file_out:
147+
file_out.write("8dpa" + "\t" + line)
148+
file_out.close()
149+
added = 1
150+
break
151+
else: #8dpa id only matched to 1dpa id
152+
pass
153+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_1-8dpa_redo.txt", "a") as file_out:
154+
file_out.write("8dpa" + "\t" + line)
155+
file_out.close()
156+
added = 1
157+
break
158+
for ids2 in f2_ids:
159+
if ids2 in line: #8dpa matched only to 3dpa
160+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_3-8dpa_redo.txt", "a") as file_out:
161+
file_out.write("8dpa" + "\t" + line)
162+
file_out.close()
163+
added = 1
164+
break
165+
else:
166+
pass
167+
if added == 0:
168+
with open("C:/RNAseq/polyA_data/clusters/edgeR_de_8dpa_unique_redo.txt", "a") as file_out:
169+
file_out.write("8dpa" + "\t" + line)
170+
file_out.close()
171+
continue
172+
173+
f1.close
174+
f2.close
175+
f3.close

0 commit comments

Comments
 (0)