-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextract imp info from selected files.py
64 lines (61 loc) · 2.17 KB
/
extract imp info from selected files.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 04 14:55:00 2016
@author: Krishna
"""
import os
import io
ccount = 0
uncount = 0
count = 0
wcount = 0
a=''
for path, dirs, files in os.walk(r'L:\My Online Documents\MTech\GEO_website\series\newer series'):
#print 44
for file in files:
#print 5
read_f = io.open(os.path.join(path,file), encoding="utf8")
#print file
a=str(file)
if a=='README.txt':
break
# b=a[3:8]
# b=int(b)
# if b in range(14881,17721):
output = io.open(os.path.join(r'E:\F DRIVE\M.Tech\for assigning cl\series_imp_info_lll', file + 'imp_info.txt'),'w', encoding="utf8");
for line in read_f:
line = line.rstrip()
if line.startswith('!Series_title'):
output.write(line);
output.write('\n');
if line.startswith('!Series_summary'):
output.write(line);
output.write('\n');
if line.startswith(r'!Series_type'):
output.write(line);
output.write('\n');
if line.startswith('!Sample_organism_ch1'):
output.write(line);
output.write('\n');
if line.startswith('!Series_overall_design'):
output.write(line);
output.write('\n');
if line.startswith('!Sample_title'):
output.write(line);
output.write('\n');
if line.startswith('!Sample_source_name_ch1'):
output.write(line);
output.write('\n');
if line.startswith('!Sample_characteristics_ch1'):
output.write(line);
output.write('\n');
if line.startswith('!Sample_treatment_protocol_ch1'):
output.write(line);
output.write('\n');
if line.startswith('!Sample_description'):
output.write(line);
output.write('\n');
if line == '!series_matrix_table_begin':
break
output.close()
read_f.close()