ogilo package

Submodules

ogilo.checks module

Functions for checking potential sequence problems.

ogilo.checks.re_sites(row, seq)[source]

ogilo.cli module

Command-line interface for ogilo.

ogilo.cli.main() None[source]

ogilo.io module

Functions for file input and output.

ogilo.io.extract_col(f: TextIO, col: str | int, sep: str = '\t', is_seq: bool = False) Tuple[str][source]

Get a column from a CSV or TSV by number or name.

Reads a CSV or TSV file and returns the named or numbered column. If a number is used, then it is assumed that there is no header, and the first line is included. If a column name is used, then it is assumed that there is a header, and the first line is skipped.

Parameters:
  • f (file or file-like) – File to read

  • col (str or int) – The column to return

  • sep (str) – Delimiter character for the columns

  • is_seq (bool, optional) – If True, checks that only nucleic acid symbols are present

Returns:

The entries of the requested column

Return type:

tuple of str

ogilo.io.write_constructs(x: ~typing.Sequence[~typing.Sequence[~ogilo.types.Seq]], file: ~typing.TextIO = <_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) None[source]

Write oligos to a table.

Takes a list of Oligo objects and writes them to a file, one per line. Properties are calculated and checks are carried out.

Parameters:
  • x (list) – Oligo objects to write.

  • file (file or file-like) – File to write to. Default STDOUT

Return type:

None

ogilo.types module

Custom types and objects used in ogilo.

class ogilo.types.Input(type, seq, f1, f2, f3, reverse)

Bases: tuple

f1

Alias for field number 2

f2

Alias for field number 3

f3

Alias for field number 4

reverse

Alias for field number 5

seq

Alias for field number 1

type

Alias for field number 0

class ogilo.types.PCRHandle(name, f, r)

Bases: tuple

f

Alias for field number 1

name

Alias for field number 0

r

Alias for field number 2

class ogilo.types.Seq(name, type, seq, group, reverse)

Bases: tuple

group

Alias for field number 3

name

Alias for field number 0

reverse

Alias for field number 4

seq

Alias for field number 2

type

Alias for field number 1

ogilo.utils module

Miscellaneous utilities used in ogilo.

ogilo.utils.find_all(p: str, s: str) Sequence[int][source]

Find all instances of pattern p in the string s.

Parameters:
  • p (str) – Pattern to find

  • s (str) – String in which to find pattern

Yields:

int – Position in s of each instance of p

ogilo.utils.grouping_key(x: Sequence[Seq]) str[source]

Use as key parameter for sort() or itertools.groupby() to sort a list of list of Seq objects by their group attribute.

When the group attribute is not set for a given Seq object, then it is ignored.

The group strings within the inner list of Seq objects are concatenated to allow sorting.

Parameters:

x (list of Seq objects) –

Returns:

Concatenated group attributes, where the group is not None

Return type:

str

ogilo.utils.n_found(p: str, s: str, with_rc: bool = True) int[source]

Count the occurences of a pattern in a string.

Parameters:
  • p (str) – Pattern to find

  • s (str) – String in which to find pattern

  • with_rc (bool) – Whether to also search the reverse complement of s

Returns:

The number of occurences of p in s

Return type:

int

Module contents