Skip to content
Permalink
5ab4ed8e4a
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
40 lines (32 sloc) 1.13 KB
from util import *
data_source_file = f'./csp_stats.csv'
parsed_data = parse_csv(data_source_file)
bounds = [data['holo_pdb'] for data in parsed_data]
res_ranges = [ data['Well_Defined_Residues'] for data in parsed_data ]
for i, bound in enumerate(bounds):
fasta_file = './input_fastas/'+bound.lower()+'.fasta'
res_range = res_ranges[i]
print(bound)
print(res_range)
start_index = int(res_range.split(':')[1].split('..')[0])-1
end_index = int(res_range.split(':')[1].split('..')[1])
original_text = ""
str_o = ""
next_l = False
with open(fasta_file, 'r') as in_f:
for l in in_f:
original_text += l
if next_l:
str_o += l[start_index:end_index] + '\n'
next_l = False
continue
if l.endswith(res_range[0]+'\n'):
next_l = True
str_o += l
continue
str_o += l
print("original = " + original_text)
print("trimmed = " + str_o)
output_file = './input_fastas_trimmed/'+bound.lower()+'.fasta'
with open(output_file, 'w') as out_f:
out_f.write(str_o)