def __init__(self, inarg, Stype=FS.SIMILARITY, new=True): self.thisown = 0 if isinstance(inarg, FS_Smatrix): if new: self.this = FS.Smatrix_copy(inarg) self.thisown = 1 else: self.this = inarg self.thisown = 1 elif isinstance(inarg, list): # List - Biopython PSSM self.this = FS.Smatrix_pssm(inarg) self.thisown = 1 elif isinstance(inarg, ProfileMatrix): # Instance of ProfileMatrix self.this = FS.Smatrix_copy(inarg.this) self.thisown = 1 else: raise TypeError, "Constructor only accepts"\ " a Biopython PSSM"\ " and an instance of ProfileMatrix." self.mean = self._calc_mean() self.alphabet = FS.Smatrix_alphabet_get(self) self._len = FS.Smatrix_len_get(self) self.qseq = FS.Smatrix_qseq_get(self)
def __init__(self, inarg, Stype=FS.SIMILARITY, new=True): self.thisown = 0 # First check if we are passing the SWIG wrapped type. if isinstance(inarg, FS_Smatrix): if new: self.this = FS.Smatrix_copy(inarg) self.thisown = 1 else: self.this = inarg self.thisown = 1 elif isinstance(inarg, str): # Load from file self.this = FS.Smatrix_load(inarg) self.thisown = 1 # Dictionary - Biopython matrix elif isinstance(inarg, dict): self.this = FS.new_Smatrix(inarg, Stype) self.thisown = 1 # Instance of ScoreMatrix elif isinstance(inarg, ScoreMatrix): self.this = FS.Smatrix_copy(inarg.this) self.thisown = 1 else: raise TypeError, "Constructor only accepts"\ " a filename, a dictionary"\ " and an instance of ScoreMatrix." self.alphabet = FS.Smatrix_alphabet_get(self) self.mean = self._calc_mean()