Returns is seq is sequence and not string.
16162
def _is_proper_sequence(seq):
    """"""
    return (isinstance(seq, collections.abc.Sequence) and
            not isinstance(seq, str))
14192
def is_listish(obj):
    """"""
    if isinstance(obj, (list, tuple, set)):
        return True
    return is_sequence(obj)
9428
def compare_seqs(seqs):
    
    A, B, ignore_gaps = seqs
    a, b = A[1], B[1] # actual sequences
    if len(a) != len(b):
        print('# reads are not the same length', file=sys.stderr)
        exit()
    if ignore_gaps is True:
        pident = calc_pident_ignore_gaps(a, b)
    else:
        pident = calc_pident(a, b)
    return A[0], B[0], pident
1230907
private static DNASequence getDNASequence(String str) {
		try {
			DNASequence s = new DNASequence(str);
			return s;
		} catch (CompoundNotFoundException e) {

			logger.error("Unexpected error when creating DNASequence ",e);
		}
		return null;
	}
530935
def is_sequence(obj):
    
    try:
        from collections import Sequence
    except ImportError:
        from operator import isSequenceType
        return isSequenceType(obj)
    else:
        return isinstance(obj, Sequence)
393673
def validate_sequence(sequence: str, sequence_is_as_nucleotide=True):
    

    tmp_seq = tempfile.NamedTemporaryFile(mode="wb+", delete=False)

    if len(str(sequence).strip()) == 0:
        raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_ERROR_MSG)

    if str(sequence).strip()[0] != ">":
        tmp_seq.write(">seq1\n".encode())

    tmp_seq.write(sequence.encode())
    tmp_seq.close()

    records = SeqIO.index(tmp_seq.name, "fasta")
    record_count = len(records)

    if record_count == 0:
        raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_ERROR_MSG)

    if record_count > blast_settings.BLAST_MAX_NUMBER_SEQ_IN_INPUT:
        raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_MAX_SEQ_NUMB_ERROR_MSG)

    # read query sequence from temporary file
    first_sequence_list_in_file = SeqIO.parse(tmp_seq.name, "fasta")

    for sequence in first_sequence_list_in_file:

        if len(sequence.seq) <= 10:
            raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_TOO_SHORT_ERROR_MSG)

        if sequence_is_as_nucleotide:
            check_allowed_letters(str(sequence.seq), ALLOWED_NUCL)
        else:
            check_allowed_letters(str(sequence.seq), ALLOWED_AMINOACIDS)

    return tmp_seq
1347852
public static String validate (ActionSequence seq)
    {
        if (StringUtil.isBlank(seq.name)) {
            return "Missing 'name' definition.";
        }
        if (seq.framesPerSecond == 0) {
            return "Missing 'framesPerSecond' definition.";
        }
        if (seq.orients == null) {
            return "Missing 'orients' definition.";
        }
        return null;
    }
960594
public static boolean containsIgnoreCase(CharSequence sequence, CharSequence subSequence) {
    // Calling length() is the null pointer check (so do it before we can exit early).
    int length = sequence.length();
    if (sequence == subSequence) {
      return true;
    }
    // if subSequence is longer than sequence, it is impossible for sequence to contain subSequence
    if (subSequence.length() > length) {
      return false;
    }
    return indexOfIgnoreCase(sequence, subSequence) > -1;
  }
1006917
def is_sequential(self):
        
        seq_ids = tuple(int(residue["Seq_ID"]) for residue in self)
        return seq_ids == tuple(range(int(seq_ids[0]), int(seq_ids[-1])+1))
710152
def _is_sequence(typ):
    
    # PEP_560 deprecates issubclass for
    # List types, for the time being
    # we'll support a specific escape hatch.
    if PEP_560:  # pragma: no cover
        return isinstance(typ, _GenericAlias) and typ.__origin__ is list
    else:  # pragma: no cover
        return issubclass(typ, Sequence)
1195673
def get_seq(self,obj,default=None):
        """"""
        if is_sequence(obj):
            return obj
        if is_number(obj): return [obj]
        if obj is None and default is not None:
            log.warning('using default value (%s)'%(default))
            return self.get_seq(default)
        raise ValueError('expected sequence|number but got %s'%(type(obj)))
428132
protected static int findSequence(byte[] sequence, byte[] buffer) {
        int pos = -1;
        for (int i = 0; i < buffer.length - sequence.length + 1; i++) {
            if (buffer[i] == sequence[0] && testRemaining(sequence, buffer, i)) {
                pos = i;
                break;
            }
        }
        return pos;
    }
76189
def check_seq_exists(self, seq, amount_ntermwildcards):
        
        cursor = self.get_cursor()
        if amount_ntermwildcards > 0:
            seq = seq[::-1]
            sqlseq = '{}{}'.format(seq, '%')
            # FIXME non-parametrized string binding because if ? binding is
            # used the INDEX is not used when looking up, apparently because
            # the query cant be optimized when using LIKE and binding.
            sql = ('select seqs from known_searchspace where seqs LIKE '
                   '"{}"'.format(sqlseq))
            for match in cursor.execute(sql):
                if match[0][:-amount_ntermwildcards] in seq:
                    return True
            return False
        else:
            sql = ('select exists(select seqs from known_searchspace '
                   'where seqs=? limit 1)')
            return cursor.execute(sql, (seq, )).fetchone()[0] == 1
877668
public static boolean containsWhitespace(final CharSequence seq) {
        if (isEmpty(seq)) {
            return false;
        }
        final int strLen = seq.length();
        for (int i = 0; i < strLen; i++) {
            if (CharUtils.isWhitespace(seq.charAt(i))) {
                return true;
            }
        }
        return false;
    }
688879
def _extract_seq(extractor, seq):
    """"""
    subtype = Any
    if seq.__args__ and seq.__args__[0] is not Any:
        subtype = seq.__args__[0]
    return _array_type(extractor.extract(subtype))
973762
public static String deepCleanSequence(String sequence) {
	sequence = SequenceUtil.cleanSequence(sequence);
	sequence = SequenceUtil.DIGIT.matcher(sequence).replaceAll("");
	sequence = SequenceUtil.NONWORD.matcher(sequence).replaceAll("");
	final Pattern othernonSeqChars = Pattern.compile("[_-]+");
	sequence = othernonSeqChars.matcher(sequence).replaceAll("");
	return sequence;
	}
1061797
def sequence_type(self):
        ''''''
        if self.known_sequence_type is not None:
            return self.known_sequence_type
        else:
            # If its Gzipped and fastq make a small sample of the sequence to be
            # read
            cmd='%s | head -n 2' % (self.command_line())
            first_seq = subprocess.check_output(
                                                cmd,
                                                shell=True,
                                                preexec_fn=lambda:signal(SIGPIPE, SIG_DFL)
                                                )
            _, seq = tuple(first_seq.strip().split('\n'))
            self.type = self._guess_sequence_type_from_string(seq)
            logging.debug("Detected sequence type as %s" % self.type)
            return self.type