Skip to content
Snippets Groups Projects
Commit 786d72f2 authored by nina.marthe_ird.fr's avatar nina.marthe_ird.fr
Browse files

adapted the code to the changes made to handle several chromosomes

parent 7eb24644
No related branches found
No related tags found
No related merge requests found
......@@ -206,12 +206,12 @@ def graph_gff(graph_gff_file):
graph_gff_file.close()
def graph_gaf(graph_gaf_file,gfa_file):
def graph_gaf(graph_gaf_file,segments_file):
print("generation of the graph's gaf")
graph_gaf_file = open(graph_gaf_file, 'w')
output_graph_gaf[2]=graph_gaf_file
seg_len=get_segments_length(gfa_file)
seg_len=get_segments_length(segments_file)
for feature_id in Features:
feature=Features[feature_id]
feature_segments=feature.segments_list_source
......@@ -231,22 +231,14 @@ def graph_gaf(graph_gaf_file,gfa_file):
graph_gaf_file.close()
def get_segments_length(gfa):
file_gfa=open(gfa,'r')
lines_gfa=file_gfa.readlines()
file_gfa.close()
seg_len={}
segment_encountered=False
for line in lines_gfa:
line=line.split()
if (line[0]=="S"): # get the length of the segment
segment_encountered=True
seg_id='s'+line[1]
seg_len[seg_id]=len(line[2])
elif segment_encountered==True: # so we don't have to go through all the L lines. once we found one S, if we find something else than S it stops
return seg_len
return seg_len
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment