seqwalk.generation

Functions

rc(seq)

reverse complement of DNA sequence

partition_path(seq, L, k)

partitions self-avoiding walk into appropriate length sequences

is_necklace(seq)

computes if a sequence is a necklace (as defined in Wong 2017)

f(seq, k)

helper function defined in Wong 2017

simple_shift(n, k)

simple shift rule from Wong 2017

out_edges(v, alphabet)

lists outedges for a node in a kmer graph

adapted_hierholzer(k, alphabet)

finds RC-free path through 4-letter kmer graph using modified hierholzer

Module Contents

seqwalk.generation.rc(seq)[source]

reverse complement of DNA sequence

Parameters:

seq – string with letters in {A, C, G, T}

Returns:

string corresponding to reverse complement

seqwalk.generation.partition_path(seq, L, k)[source]

partitions self-avoiding walk into appropriate length sequences

Parameters:
  • seq – self avoiding walk (string or list)

  • L – length of desired sequences

  • k – SSM k-value

Returns:

list of strings, each a length L seq

Return type:

seqs

seqwalk.generation.is_necklace(seq)[source]

computes if a sequence is a necklace (as defined in Wong 2017)

Parameters:

seq – typically list of ints

seqwalk.generation.f(seq, k)[source]

helper function defined in Wong 2017 * note confusing notation switch

Parameters:
  • seq – list of ints

  • k – alphabet length

Returns:

int corresponding to next element of seq

seqwalk.generation.simple_shift(n, k)[source]

simple shift rule from Wong 2017 * note confusing notation switch

Parameters:
  • n – SSM k value

  • k – alphabet size

Returns:

list of integers corresponding to H. path

seqwalk.generation.out_edges(v, alphabet)[source]

lists outedges for a node in a kmer graph

Parameters:
  • v – string corresponding to node

  • alphabet – string containing all valid letters

Returns:

list of outedges represented as strings

seqwalk.generation.adapted_hierholzer(k, alphabet)[source]

finds RC-free path through 4-letter kmer graph using modified hierholzer (see Supplementary Note X)

Parameters:
  • k – SSM k (integer)

  • alphabet – string containing all valid letters

Returns:

string corresponding to RC-free self-avoiding walk

Return type:

path