# utils

class integron_finder.utils.FastaIterator(path, replicon_name=None, dist_threshold=4000, alphabet=None)

  Allow to parse over a multi fasta file, and iterate over it

  Warning

  The sequences order is not guarantee.

  __init__(path, replicon_name=None, dist_threshold=4000, alphabet=None)
    Parameters:

      - path (str) – The path to the file containing the sequences.

      - alphabet (Bio.SeqIUPAC member) – The authorized alphabet

      - replicon_name (str) – The name of the replicon, if this specify all sequence.name will have this value

      - dist_threshold (int) – The minimum length for a replicon to be considered as circular. Under this threshold even the provided topology is ‘circular’ the computation will be done with a ‘linear’ topology.

  __len__()
    Returns:

      The number of sequence in the file

  __next__()
    Returns:

      The next sequence (the order of sequences is not guaranteed).

    Return type:

      a `Bio.SeqRecord` object or None if the sequence is not compliant with the alphabet.

  __weakref__

    list of weak references to the object

  _check_seq_alphabet_compliance(seq)
    Parameters:

      seq (`Bio.Seq.Seq` instance) – the sequence to check

    Returns:

      True if sequence letters are a subset of the alphabet, False otherwise.

  _set_topologies(topologies)
    Parameters:

      topologies (`integron_finder.Topology` onject)

    Returns:

class integron_finder.utils.MultiFastaReader(path)

  Iterate over sequence of a fasta file

  __init__(path)
    Parameters:

      path (str) – the path to the fasta file

  __next__()
    Returns:

      The next sequence in the file

    Return type:

      `Bio.Seq.SeqRecord` object

  __weakref__

    list of weak references to the object

  close()

    Close the file handle on the fasta file If it iterate until the end of the file, the file handle is automatically closed But if it stop before the end it is the responsability of the caller to close it. :return: None

integron_finder.utils.get_name_from_path(path)
  Parameters:

    path – The path to extract name for instance the fasta file to the replicon

  Returns:

    the name of replicon for instance if path = /path/to/replicon.fasta name = replicon

integron_finder.utils.log_level(verbose, quiet)
  Returns:

    the level to apply to loggers. 0 <= level <=50

  Return type:

    int

integron_finder.utils.model_len(path)
  Parameters:

    path (str) – the path to the covariance model file

  Returns:

    the length of the model

  Return type:

    int