Skip to content
Snippets Groups Projects
main.py 1.69 KiB
#!/home/nina/annotpangenome/.venv/bin/python

# created by Nina Marthe 2023 - nina.marthe@ird.fr
# licensed under MIT

from Graph_gff import *
from Functions_output import *
#from inference import *


import sys
if not(len(sys.argv)>=4) :# intersect, gfa, pos_seg (target_genome_name)
        print("expected input : intersect, gfa file  with walks, bed file with positions of the segments on the target genome, and the name of the walk of the target genome")
        sys.exit(1)
elif (sys.argv[1]=="-h") :
    print("expected input : intersect, gfa file  with walks, bed file with positions of the segments on the target genome, and the name of the walk of the target genome")
    print("output : graph gff, graph gaf, target genome gff+variations")
    sys.exit(1)

intersect=sys.argv[1]
gfa=sys.argv[2]
pos_seg=sys.argv[3]

out_graph_gff=gfa.split("/")[-1].split(".")[0:-1][0]+".gff"
out_graph_gaf=gfa.split("/")[-1].split(".")[0:-1][0]+".gaf"
out_target_gff=pos_seg.split("/")[-1].split(".")[0:-1][0]+".gff"
out_target_var=pos_seg.split("/")[-1].split(".")[0:-1][0]+"_variations.txt"
out_clustal=pos_seg.split("/")[-1].split(".")[0:-1][0]+"_clustal.txt"
if len(sys.argv)==5:
    target_genome_name=sys.argv[4]
else:
    target_genome_name=pos_seg.split("/")[-1].split(".")[0:-1][0]

load_intersect(intersect)

# outputs the gff and gaf of the graph for chr10
graph_gff(out_graph_gff)
graph_gaf(out_graph_gaf,gfa)

# outputs the gff of a genome for the chr10
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.
transfer_on_target(pos_seg,gfa,out_target_gff,out_target_var,out_clustal,target_genome_name,max_diff)