### functions to generate a genome's gff from the graph's gff
# functions to get the detailed gff with all the fragments of the features
# outputs each fragment of the feature in a gff
defgff_detail(list_seg,feature_id):
# loop that goes through all the segments that have the current feature
# keeps the first segment present in the genome found, and when it finds a segment absent in the genome, prints the current part of the fragment, and resets the first segment present.
# continues to go through the segments, keeps the next segment present in the genome, and when it finds a segment absent, prints the second part of the feature, etc.
# at the end of the loop, prints the last part of the fragment.
[feat_start,seg_start,last_seg]=["","",""]# first segment of the feature, first segment of the current part of the feature, last segment in the part of the feature, for loop below
forsegmentinlist_seg:
ifsegment[1:]insegments_on_target_genome:
iffeat_start=="":
feat_start=segment[1:]
ifseg_start=="":# if we dont have a start, take the current segment for the start of the part of the feature
seg_start=segment[1:]
#else: if we already have a start, keep going though the segments until we find a stop (segment not in target genome)
else:
ifseg_start!="":# found a stop and we have a start. print the line, reset seg_start, and keep going through the segments to find the next seg_start
max_diff=2# maximum size difference (n times bigger or smaller) between the gene on the source genome and the gene on the target genome for the gene to be transfered.
max_diff=2# maximum size difference (n times bigger or smaller) between the gene on the source genome and the gene on the target genome for the gene to be transfered.