"""
Package bwt is a package for performing burrows-wheeler transforms on sequences.

The BWT is a lossless compression algorithm that can be used to reduce the memory
footprint of a sequence while still maintaining the ability to search, align, and
extract the original sequence. This is useful for sequences so large that it would
be beneficial to reduce its memory footprint while also maintaining a way to analyze
and work with the sequence. BWT is used in both bioinformatics(burrows wheeler alignment)
and data compression (bzip2).

"""
# python wrapper for package github.com/bebop/poly/search/bwt within overall package poly
# This is what you import to use the package.
# File is generated by gopy. Do not edit.
# gopy pkg -vm=python3 github.com/bebop/poly

# the following is required to enable dlopen to open the _go.so file
import os,sys,inspect,collections
try:
	import collections.abc as _collections_abc
except ImportError:
	_collections_abc = collections

cwd = os.getcwd()
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
os.chdir(currentdir)
from . import _poly
from . import go

os.chdir(cwd)

# to use this code in your end-user python file, import it as follows:
# from poly import bwt
# and then refer to everything using bwt. prefix
# packages imported by this package listed below:




# ---- Types ---


#---- Enums from Go (collections of consts with same type) ---


#---- Constants from Go: Python can only ask that you please don't change these! ---


# ---- Global Variables: can only use functions to access ---


# ---- Interfaces ---


# ---- Structs ---

# Python type for struct bwt.BWT
class BWT(go.GoClass):
	"""BWT Burrows-Wheeler Transform\nCompresses and Indexes a given sequence so that it can be\nbe used for search, alignment, and text extraction. This is\nuseful for sequences so large that it would be beneficial\nto reduce its memory footprint while also maintaining a way\nto analyze and work with the sequence.\n"""
	def __init__(self, *args, **kwargs):
		"""
		handle=A Go-side object is always initialized with an explicit handle=arg
		otherwise parameters can be unnamed in order of field names or named fields
		in which case a new Go object is constructed first
		"""
		if len(kwargs) == 1 and 'handle' in kwargs:
			self.handle = kwargs['handle']
			_poly.IncRef(self.handle)
		elif len(args) == 1 and isinstance(args[0], go.GoClass):
			self.handle = args[0].handle
			_poly.IncRef(self.handle)
		else:
			self.handle = _poly.bwt_BWT_CTor()
			_poly.IncRef(self.handle)
	def __del__(self):
		_poly.DecRef(self.handle)
	def __str__(self):
		pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
		sv = 'bwt.BWT{'
		first = True
		for v in pr:
			if callable(v[1]):
				continue
			if first:
				first = False
			else:
				sv += ', '
			sv += v[0] + '=' + str(v[1])
		return sv + '}'
	def __repr__(self):
		pr = [(p, getattr(self, p)) for p in dir(self) if not p.startswith('__')]
		sv = 'bwt.BWT ( '
		for v in pr:
			if not callable(v[1]):
				sv += v[0] + '=' + str(v[1]) + ', '
		return sv + ')'
	def Count(self, pattern):
		"""Count(str pattern) int count, str err
		
		Count represents the number of times the provided pattern
		shows up in the original sequence.
		"""
		return _poly.bwt_BWT_Count(self.handle, pattern)
	def Locate(self, pattern):
		"""Locate(str pattern) []int offsets, str err
		
		Locate returns a list of offsets at which the beginning
		of the provided pattern occurs in the original
		sequence.
		"""
		return go.Slice_int(handle=_poly.bwt_BWT_Locate(self.handle, pattern))
	def Extract(self, start, end):
		"""Extract(int start, int end) str extracted, str err
		
		Extract this allows us to extract parts of the original
		sequence from the BWT.
		start is the beginning of the range of text to extract inclusive.
		end is the end of the range of text to extract exclusive.
		If either start or end are out of bounds, Extract will panic.
		"""
		return _poly.bwt_BWT_Extract(self.handle, start, end)
	def Len(self):
		"""Len() int
		
		Len return the length of the sequence used to build the BWT
		"""
		return _poly.bwt_BWT_Len(self.handle)
	def GetTransform(self):
		"""GetTransform() str
		
		GetTransform returns the last column of the BWT transform of the original sequence.
		"""
		return _poly.bwt_BWT_GetTransform(self.handle)


# ---- Slices ---


# ---- Maps ---


# ---- Constructors ---
def New(sequence):
	"""New(str sequence) object, str
	
	New returns a BWT of the provided sequence
	The provided sequence must not contain the nullChar
	defined in this package. If it does, New will return
	an error.
	"""
	return BWT(handle=_poly.bwt_New(sequence))


# ---- Functions ---


