Example #1
0
    def test_moclo_compatible(self):
        # alpha and omega  vectors have recsites for this enzymes
        feature = Feature.objects.get(uniquename='pDGB1_alpha1')
        assert has_rec_sites(feature.residues, enzymes=('BpiI', 'BsaI'))
        feature = Feature.objects.get(uniquename='pUPD')
        assert has_rec_sites(feature.residues, enzymes=('BpiI', 'BsaI'))

        feature = Feature.objects.get(uniquename='pAn11')
        assert feature.moclo_compatible
        feature = Feature.objects.get(uniquename='pDGB1_alpha1')
        assert feature.moclo_compatible == 'not_evaluable'

        f1 = Feature.objects.get(uniquename='pDelila')
        assert not f1.moclo_compatible
Example #2
0
def domestication_crispr(seq, category=None, prefix=None, suffix=None):
    if len(seq) < 20:
        raise ValueError('Seq length must be at least 20')

    if len(seq) != 20 and category:
        msg = 'To domesticate with the given target type, the CRISPR target '
        msg += 'size must be 20'
        raise ValueError(msg)

    if category == TARGET_DICOT and str(seq[0]).upper() != 'G':
        raise ValueError('First nucleotide must be G for target dicot category')
    if category == TARGET_MONOCOT and str(seq[0]).upper() != 'A':
        raise ValueError('First nucleotide must be G for target monocot category')

    if has_rec_sites(seq):
        msg = 'This secuence can not be domesticated. It has internal restriction sites'
        raise ValueError(msg)

    if category:
        prefix = prefix[:3]

    try:
        count = Count.objects.get(name=CRYSPER_SEQ)
    except Count.DoesNotExist:
        count = Count.objects.create(name=CRYSPER_SEQ, value=1)
    next_value = count.next

    prepared_seq = Seq(prefix + seq + suffix)
    seq_name = CRYSPER_SEQ + '_' + next_value
    new_seq_record = SeqRecord(prepared_seq, name=seq_name, id=seq_name)
    return new_seq_record
Example #3
0
    def moclo_compatible(self):
        if not self.level or self.level != LEVEL_0 or self.type.name in (TARGET_DICOT, TARGET_MONOCOT):
            return 'not_evaluable'
        if self.vector.resistance not in (MOCLO_INCOMPATIBLE_RESISTANCES):
            enzyme = self.enzyme_out[0]
            residues = self.residues
            pref_idx, suf_idx = get_prefix_and_suffix_index(residues, enzyme)[:2]
            seq = residues[pref_idx:suf_idx + len(self.suffix)]

            # TODO: maybe we should look only to the part seq. not with the vector
            return not has_rec_sites(seq, enzymes=('BpiI', 'BsaI'))
        else:
            return False
Example #4
0
    def clean_seq(self):
        seq = self.cleaned_data['seq']
        category = self.cleaned_data.get('category', None)
        if len(seq) < 20:
            raise ValidationError('Seq length must be at least 20')

        if len(seq) != 20 and category is not None:
            msg = 'CRISPR target seq length must be 20 nucleotides'
            raise ValidationError(msg)

        if not _seq_is_dna(seq):
            raise ValidationError('Seq must only contain ACTG')
        if has_rec_sites(seq):
            msg = 'This secuence can not be domesticated.'
            msg += 'It has internal restriction sites'
            raise ValidationError(msg)
        return seq