def __init__( self, amount=None, amount_percent=None, minimum=None, minimum_percent=None, location=None, indices=None, reference=None, boost=1.0, ): """Initialize.""" # raise NotImplementedError("This class is not yet implemented") # if location is None and (indices is not None): # location = (min(indices), max(indices) + 1) self.location = Location.from_data(location) if (self.location is not None) and self.location.strand == -1: self.location.strand = 1 self.indices = np.array(indices) if (indices is not None) else None self.reference = reference # self.passive_objective = passive_objective self.amount = amount self.amount_percent = amount_percent self.minimum = minimum self.minimum_percent = minimum_percent if isinstance(amount, str) and amount.endswith("%"): self.amount = None self.amount_percent = float(amount[:-1]) if isinstance(minimum, str) and minimum.endswith("%"): self.minimum = None self.minimum_percent = float(minimum[:-1]) self.boost = boost
def __init__( self, location=None, tmin=50, tmax=70, max_homology_length=6, avoid_heterodim_with=None, max_heterodim_tm=5, avoided_repeats=((2, 5), (3, 4), (4, 3)), ): location = Location.from_data(location) specs = { "unique_sequence": UniquifyAllKmers( k=max_homology_length, location=location ), "melting_temperature": EnforceMeltingTemperature( mini=tmin, maxi=tmax, location=location ), **{ "repeats_%d_%d" % (k, n): AvoidPattern( RepeatedKmerPattern(k, n), location=location ) for (k, n) in avoided_repeats }, } if avoid_heterodim_with is not None: specs["avoid_heterodimerization"] = AvoidHeterodimerization( other_primers_sequences=avoid_heterodim_with, tmax=max_heterodim_tm, location=location, ) self.register_specifications(specs)
def __init__( self, stem_size=20, hairpin_window=200, location=None, boost=1.0 ): """Initialize.""" self.stem_size = stem_size self.hairpin_window = hairpin_window self.location = Location.from_data(location) self.boost = boost
def __init__(self, species=None, location=None, codon_usage_table=None, boost=1.0): self.boost = boost self.location = Location.from_data(location) self.species = species self.codon_usage_table = self.get_codons_table(species, codon_usage_table)
def __init__( self, pattern=None, occurences=1, location=None, center=True, boost=1.0 ): """Initialize.""" if isinstance(pattern, str): pattern = SequencePattern.from_string(pattern) self.pattern = pattern self.location = Location.from_data(location) self.occurences = occurences self.center = center self.boost = boost
def __init__(self, choices=None, location=None, boost=1.0): """Initialize.""" choices = [ SequencePattern.from_string(c) if isinstance(c, str) else c for c in choices ] # PRECOMPUTE ALL VARIANTS choices = [ variant for choice in choices for variant in choice.all_variants() ] self.choices = choices self.location = Location.from_data(location) self.boost = boost
def __init__( self, max_edits=0, max_edits_percent=None, location=None, indices=None, target_sequence=None, boost=1.0, ): """Initialize.""" if location is None and (indices is not None): location = (min(indices), max(indices) + 1) self.location = Location.from_data(location) if (self.location is not None) and self.location.strand == -1: self.location.strand = 1 self.indices = np.array(indices) if (indices is not None) else None self.target_sequence = target_sequence self.max_edits = max_edits self.max_edits_percent = max_edits_percent self.boost = boost
def __init__(self, mini=None, maxi=None, target=None, location=None, boost=1.0): """Initialize.""" if isinstance(mini, str) and mini.endswith('C'): # PROCESS CASES "45-55%" and "45%" split = mini[:-1].split('-') if len(split) == 2: mini, maxi = float(split[0]), float(split[1]) else: target = float(split[0]) if target is not None: mini = maxi = target else: target = 0.5 * (mini + maxi) self.mini = mini self.maxi = maxi self.target = target self.location = Location.from_data(location) self.boost = boost
def __init__( self, mini=0, maxi=1.0, target=None, window=None, location=None, boost=1.0, ): """Initialize.""" if isinstance(mini, str): mini, maxi, target, window = self.string_to_parameters(mini) if target is not None: mini = maxi = target self.target = target self.mini = mini self.maxi = maxi self.window = window location = Location.from_data(location) if location is not None and (location.strand == -1): location = Location(location.start, location.end, 1) self.location = location self.boost = boost
def __init__(self, sequence=None, location=None, boost=1.0): """Initialize.""" self.sequence = sequence self.location = Location.from_data(location) self.boost = boost