Skip to content

Weird edge patterns in inferred datasets #5

@hyanwong

Description

@hyanwong

If I infer an ARG using ARGneedle from data based on a simulated selective sweep, and then export the results to a tree sequence, I get slightly weird U-shaped patterns in the times of each edge child. I guess this is to do with how nodes can be stored associated with different times in ARGneedle?

import arg_needle_lib
import matplotlib.pyplot as plt
from matplotlib.collections import LineCollection 
argneedle = arg_needle_lib.deserialize_arg("examples/" + "arg_needle.argn")
argn_ts = arg_needle_lib.arg_to_tskit(argneedle, mutations=True)

def edges_plot(ts, use="child", title="Edge plot"):
    lines =  [
        [(e.left, ts.nodes_time[getattr(e, use)]), (e.right, ts.nodes_time[getattr(e, use)])] for e in ts.edges()
    ]
    line_segments = LineCollection(lines, alpha=0.5)
    fig, ax = plt.subplots(figsize=(15, 7))
    ax.set_xlim(0, ts.sequence_length)
    ax.set_ylim(1, ts.max_time)
    ax.set_yscale("log")
    ax.set_ylabel("Time of edge child")
    ax.set_xlabel("Genome position")
    ax.set_title(title)
    ax.add_collection(line_segments)
    plt.show()

edges_plot(argn_ts)
Screenshot 2023-12-11 at 18 09 04
edges_plot(argn_ts, use="parent")
Screenshot 2023-12-11 at 18 09 27

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions