returns the first occurence of strSeq in self. Takes polymorphisms into account
499558
def findByBiSearch(self, strSeq) :
		""""""
		arr = self.encode(strSeq)
		return self._dichFind(arr[0], self, 0, lst = None)
1352772
def get_string(self):
    
    ostr = ''
    ostr += 'BaseError for ['+self._type+'] base: '+self.get_base()+"\n"
    if self._observable.get_error_probability() > 0:
      ostr += '  Homopolymer set:'+"\n"
      ostr += '    '+str(self.get_homopolymer())+"\n"
      ostr += '  Observable:'+"\n"
      ostr += '    type is: '+str(self.get_observable_type())+"\n"
      ostr += '    P(error): '+str(self._observable.get_error_probability())+"\n"
      ostr += '    Elength:  '+str(self._observable.get_attributable_length())+"\n"
    before = self._unobservable.get_before_type()
    after = self._unobservable.get_after_type()
    if before or after:
      ostr += '  Unobservable '
      if self._type == 'query': ostr += 'deletion:'+"\n"
      else: ostr += 'insertion:'+"\n"
      ostr += '    P(error): '+str(self._unobservable.get_error_probability())+"\n"
      ostr += '    Elength:  '+str(self._unobservable.get_attributable_length())+"\n"
      if before:
        ostr += '    before: '+"\n"
        ostr += '      P(error): '+str(self._unobservable.get_before_probability())+"\n"
        ostr += '      '+str(before)+"\n"
      if after:
        ostr += '    after:'+"\n"
        ostr += '      P(error): '+str(self._unobservable.get_after_probability())+"\n"
        ostr += '      '+str(after)+"\n"
    return ostr
777826
def getFirstUrn(self, reference=None):
        
        if reference is not None:
            if ":" in reference:
                urn = reference
            else:
                urn = "{}:{}".format(
                    str(URN(str(self.urn)).upTo(URN.NO_PASSAGE)),
                    str(reference)
                )
        else:
            urn = str(self.urn)
        _first = _SharedMethod.firstUrn(
            self.retriever.getFirstUrn(
                urn
            )
        )
        return _first
1185211
public static String lcFirst(String str) {
	if (str == null) return null;
	else if (str.length() <= 1) return str.toLowerCase();
	else {
	    return str.substring(0, 1).toLowerCase() + str.substring(1);
	}
    }
51498
def firstVariant():
        
        def fget(self):
            if self.variants:
                return self.variants[0]
            else:
                variant = Variant()
                return variant

        return locals()
964285
def first(self):
        """"""
        self.open()
        seq = SeqIO.parse(self.handle, self.format).next()
        self.close()
        return seq
1293030
def first_of(obj, *attrs):
    
    for attr in attrs:
        r = resolve(obj, attr)
        if r:
            return r
953461
public static int findFirstNotOf(String container, String chars, int begin){
		//find the first occurrence of characters not in the charSeq	from begin forward	
		for (int i = begin; i < container.length() && i >=0; ++i) 
		   if (!chars.contains("" + container.charAt(i)))
				return i;
		return -1;
    }
218625
private int findFirst(CharSequence input, int beginIndex, int rewindIndex) {
        int first = -1;
        boolean atomBoundary = true;
        for (int i = beginIndex; i >= rewindIndex; i--) {
            char c = input.charAt(i);
            if (localAtomAllowed(c)) {
                first = i;
                atomBoundary = false;
            } else if (c == '.') {
                if (atomBoundary) {
                    break;
                }
                atomBoundary = true;
            } else {
                break;
            }
        }
        return first;
    }
551961
function getSimiliarString(base, relation) {
	var length = Math.round(base.length * relation),
		r = '',
		i, str
	do {
		str = getRandomString(base.length - length)
	} while (str && str[0] === base[length])
	for (i = 0; i < length; i++) {
		r += base[i] // substr(...) seems to be optimized
	}
	return r + str
}
665460
public T getFirst() {
        Optional<Rsp<T>> retval=values().stream().filter(rsp -> rsp.getValue() != null).findFirst();
        return retval.isPresent()? retval.get().getValue() : null;
    }
1351486
def first(self, default=None, as_dict=False, as_ordereddict=False):
        """"""

        # Try to get a record, or return/raise default.
        try:
            record = self[0]
        except IndexError:
            if isexception(default):
                raise default
            return default

        # Cast and return.
        if as_dict:
            return record.as_dict()
        elif as_ordereddict:
            return record.as_dict(ordered=True)
        else:
            return record
1302920
def __getSequenceVariants(self, x1, polyStart, polyStop, listSequence) :
		""""""
		if polyStart < len(self.polymorphisms) and polyStart < polyStop: 
			sequence = copy.copy(listSequence)
			ret = []
			
			pk = self.polymorphisms[polyStart]
			posInSequence = pk[0]-x1
			if posInSequence < len(listSequence) : 
				for allele in pk[1] :
					sequence[posInSequence] = allele
					ret.extend(self.__getSequenceVariants(x1, polyStart+1, polyStop, sequence))
			
			return ret
		else :
			return [''.join(listSequence)]
1371184
def _guess_sequence_type_from_string(self, seq):
        ''''''
        # Define expected residues for each sequence type
        aa_chars = ['P','V','L','I','M','F','Y','W','H','K','R','Q','N','E','D','S','X','*']
        aas = set(itertools.chain(aa_chars, [lower(a) for a in aa_chars]))
        na_chars = ['A', 'T', 'G', 'C', 'N', 'U']
        nas = set(itertools.chain(na_chars, [lower(a) for a in na_chars]))

        num_nucleotide = 0
        num_protein = 0
        count = 0
        for residue in seq:
            if residue in nas:
                num_nucleotide += 1
            elif residue in aas:
                num_protein += 1
            else:
                raise Exception('Encountered unexpected character when attempting to guess sequence type: %s' % (residue))
            count += 1
            if count >300: break
        if float(num_protein) / (num_protein+num_nucleotide) > 0.1:
            return self.PROTEIN_SEQUENCE_TYPE
        else:
            return self.NUCLEOTIDE_SEQUENCE_TYPE
506304
@Override
    public int first() {
        fCachedBreakPositions = null;
        fDictionaryCharCount = 0;
        fPositionInCache = 0;
        fLastRuleStatusIndex  = 0;
        fLastStatusIndexValid = true;
        if (fText == null) {
            return BreakIterator.DONE;
        }
        fText.first();
        return fText.getIndex();
    }
1201315
def encode(self, sequence):
		""""""
		
		polymorphisms = []
		defaultSequence = '' 
		binSequence = array.array(self.forma.typecode)
		b = 0
		i = 0
		trueI = 0 #not inc in case if poly
		poly = set()
		while i < len(sequence)-1:
			b = b | self.forma[self.charToBin[sequence[i]]]
			if sequence[i+1] == '/' :
				poly.add(sequence[i])
				i += 2
			else :
				binSequence.append(b)
				if len(poly) > 0 :
					poly.add(sequence[i])
					polymorphisms.append((trueI, poly))
					poly = set()
				
				bb = 0
				while b % 2 != 0 :
					b = b/2
					
				defaultSequence += sequence[i]
				b = 0
				i += 1
				trueI += 1
		
		if i < len(sequence) :
			b = b | self.forma[self.charToBin[sequence[i]]]
			binSequence.append(b)
			if len(poly) > 0 :
				if sequence[i] not in poly :
					poly.add(sequence[i])
				polymorphisms.append((trueI, poly))
			defaultSequence += sequence[i]
		
		return (binSequence, defaultSequence, polymorphisms)
491283
def fastq(self):
        '''
        
        '''
        if self.qual is None:
            self._fastq = None
        else:
            if self._fastq is None:
                self._fastq = '@{}\n{}\n+\n{}'.format(self.id, self.sequence, self.qual)
        return self._fastq