def __init__(self, filename, sepn=None, use_sa=1, print_flag=0): self.thisown = 0 if sepn == None: sepn = [] # Need to change directory because the C code works only on UNIX old_workdir = os.getcwd() new_workdir, new_filename = os.path.split(filename) if len(new_workdir): os.chdir(new_workdir) self.this = FS.new_Index(new_filename, sepn, use_sa, print_flag) # Return to old working directory if len(new_workdir): os.chdir(old_workdir) self.thisown = 1 self.__dict__.update(FS.Index_get_data(self))
def kNN_srch(self, qseq, M, kNN, stype=FS_BINS, ptype=SARRAY, qdef=""): hits_dict = FS.Index_kNN_srch(self, qseq, M, kNN, stype, ptype, qdef) return HitList(hits_dict)
def rng_srch(self, qseq, M, rng, stype=FS_BINS, ptype=SARRAY, qdef=""): hits_dict = FS.Index_rng_srch(self, qseq, M, rng, M.conv_type, stype, ptype, qdef) return HitList(hits_dict)
def get_unique_bin_size(self, bin): return FS.Index_get_unique_bin_size(self, bin)
def print_stats(self, options=3): return FS.Index_print_stats(self, options)
def print_bin(self, bin, options=1): return FS.Index_print_bin(self, bin, options)
def seq2bin(self, seq): return FS.Index_seq2bin(self, seq)
def __str__(self): return FS.Index___str__(self)
def save(self, filename): return FS.Index_save(self, filename)
def __del__(self): if self.thisown: FS.delete_Index(self)
def _get_ix_data(I): return FS.Index_get_data(I)
def _get_db(I): return db(FS.Index_s_db_get(I), new=False, own=False)
def threaded_search(self, srch_args): results = FS.Index_threaded_search(self, srch_args) return [HitList(r) for r in results]