Skip to content

Genome alignment performed entirely on the forward strand is still visualized with some twisted links. #109

Description

@GiammaFer75

Good evening, I am lost trying to find a solution regarding my circos plot for comparative genomics.

I have a nucmer table that reports the whole genome alignment coordinates.
Below a subset of the table:

[S1]	[E1]	[S2]	[E2]	[LEN 1]	[LEN 2]	[LEN R]	[LEN Q]	[COV R]	[COV Q]	[REFERENCE]	[QUERY]
33089	48558	3881024	3896487	15470	15464	6940169	3934249	0.22	0.39	CP022024.1	contig_1
116330	123218	3796367	3803260	6889	6894	6940169	3934249	0.10	0.18	CP022024.1	contig_1
2360288	2369985	189419	199138	9698	9720	2546252	1384352	0.38	0.70	CP022030.1	contig_10
2375039	2380696	204161	209759	5658	5599	2546252	1384352	0.22	0.40	CP022030.1	contig_10
2380831	2389025	209897	218099	8195	8203	2546252	1384352	0.32	0.59	CP022030.1	contig_10
2460799	2467982	221610	228815	7184	7206	2546252	1384352	0.28	0.52	CP022030.1	contig_10
4439741	4445570	430927	436763	5830	5837	6940169	1177390	0.08	0.50	CP022024.1	contig_12
4498636	4506710	464390	472465	8075	8076	6940169	1177390	0.12	0.69	CP022024.1	contig_12
4528427	4553237	494202	518974	24811	24773	6940169	1177390	0.36	2.10	CP022024.1	contig_12

I did my fuction to create the circos.link:

def make_synteny_links(nucmer_coord, circos,  all_forward = True, 
                       highlight_ref_contig = [], highlight_qry_contig = [],  
                       links_color = "grey", from_qry_highlighted_links_color = "green", from_ref_highlighted_links_color = "cyan"):
    """
    Create the circos links based on the nucmer alignments.
    If a specific contig/chromosome is provided (from reference or query genome) the link of this contig/chromosome is highlighted in a different color. 
    """
    found_reverse = False
    for _, nc in nucmer_coord.iterrows():
        # Set tuple for the reference genome
        refgenome_contig = nc["REFERENCE"]
        if (nc["S1"] < nc["E1"]) and all_forward:
            ref_start, ref_end = nc["S1"], nc["E1"]
        else:
            ref_start, ref_end = nc["E1"], nc["S1"]

        # Set tuple for the query genome
        qrygenome_contig = nc["QUERY"]
        if nc["S2"] < nc["E2"] and all_forward:
            qry_start, qry_end = nc["S2"], nc["E2"]
        else:
            qry_start, qry_end = nc["E2"], nc["S2"]

        region1 = (qrygenome_contig, qry_start, qry_end)
        region2 = (refgenome_contig, ref_start, ref_end)

        # Highlight contigs/chromosomes in the 
        if refgenome_contig in highlight_ref_contig:
            # print(f"{refgenome_contig} - {highlight_ref_contig}")
            color = from_ref_highlighted_links_color
        # Highlight from strawberry to apple 
        elif qrygenome_contig in highlight_qry_contig:
            color = from_qry_highlighted_links_color
        else:    
            color = links_color 

        circos.link(region1, region2, color=color, r1=96, r2=96, allow_twist=False)   
    return circos

However, in the Circos plot, some links remain twisted, despite attempts to fix the issue using my function, and although the entire genome alignment was already in the forward strand.

I hope you can help me.
Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions