cell2net.preprocessing.random_seq#

cell2net.preprocessing.random_seq(seq_len, bases=None)#

Generate a random nucleotide sequence of a specified length.

This function creates a random sequence of nucleotides (or other bases) by selecting characters from a provided list of bases. If no base list is provided, the default bases are adenine (A), cytosine (C), guanine (G), and thymine (T).

Parameters:
  • seq_len (int) – The length of the random sequence to generate.

  • bases (list[str], optional) – A list of characters to use as the base set for the sequence. Defaults to [“A”, “C”, “G”, “T”].

Return type:

str

Returns:

str A randomly generated sequence of the specified length using the provided bases.

Examples

>>> random_seq(10)
'ACGTGCTAGC'
>>> random_seq(5, bases=["A", "T"])
'TATTA'