rnaglib.dataset_transforms.EdgeLoaderGenerator

class rnaglib.dataset_transforms.EdgeLoaderGenerator(graph_loader, inner_batch_size=50, sampler_layers=2, neg_samples=1)[source]

This turns a graph dataloader or dataset into an edge data loader generator. It needs to be reinitialized every epochs because of the double iteration pattern

Iterates over batches of base pairs and generates negative samples for each. Negative sampling is just uniform for the moment (eventually we should change it to only sample edges at a certain backbone distance.

timing : - num workers should be used to load the graphs not in the inner loop - The inner batch size yields huge speedups (probably generating all MFGs is tedious)

Initialize the loader.

Parameters:
  • graph_loader – A GraphLoader or GraphDataset. We will iterate over its graphs and then over its basepairs

  • inner_batch_size – The amount of base-pairs to sample in each batch on each graph

  • sampler_layers – The size of the neighborhood

  • neg_samples – The number of negative sample to use per positive ones

__init__(graph_loader, inner_batch_size=50, sampler_layers=2, neg_samples=1)[source]

Initialize the loader.

Parameters:
  • graph_loader – A GraphLoader or GraphDataset. We will iterate over its graphs and then over its basepairs

  • inner_batch_size – The amount of base-pairs to sample in each batch on each graph

  • sampler_layers – The size of the neighborhood

  • neg_samples – The number of negative sample to use per positive ones

Methods

__init__(graph_loader[, inner_batch_size, ...])

Initialize the loader.

get_base_pairs(g)

Get edge IDS of edges in a base pair (non-backbone or unpaired).

get_edge_loader()

Simply get the loader for one epoch.