Example #1
0
void handle_a_sequence (FILE* output, StringBuffer& current_name, StringBuffer& current_sequence, unsigned long from, unsigned long to, double coverage, ambig_mode ambig_mode, bool is_protein) {
    long covered = 0;
    const unsigned char *s = (const unsigned char *)current_sequence.getString();
    for (unsigned long c = from; c <= to; c++) {
        double rc = resolution_count (s[c], false);
        if (rc == 1.) {
          covered ++;
        } else if (rc > 0.) {
          switch (ambig_mode) {
            case nfold: 
              if (rc > (is_protein? 0.05 : 0.25)) {
                covered ++;
              }
              break;
            case threefold:
              if (rc > 1./3.) {
                covered ++;
              }
              break;
            case any:
            case gaponly:
              break;
          }
        }
    }
    if (covered/ (to-from+1.0) >= coverage) {
      dump_sequence_fasta (0, output, 0, NULL,  is_protein, from, to);
    }
}   
Example #2
0
wstring_ptr qm::AbstractSSLSocketCallback::getSSLErrorMessage() const
{
	if (nErrors_ == ERROR_NONE)
		return 0;
	
	StringBuffer<WSTRING> buf;
	
	if (nErrors_ & ERROR_VERIFICATIONFAILED) {
		buf.append(loadString(getResourceHandle(), IDS_ERROR_VERIFICATIONFAILED).get());
		buf.append(L'\n');
		if (wstrVerifyError_.get()) {
			buf.append(L' ');
			buf.append(wstrVerifyError_.get());
			buf.append(L'\n');
		}
	}
	
	if (nErrors_ & ERROR_HOSTNAMENOTMATCH) {
		buf.append(loadString(getResourceHandle(), IDS_ERROR_HOSTNAMENOTMATCH).get());
		buf.append(L'\n');
	}
	
	if (pCertificate_.get()) {
		buf.append(L' ');
		buf.append(loadString(getResourceHandle(), IDS_SUBJECT).get());
		buf.append(L": ");
		buf.append(pCertificate_->getSubject()->getText().get());
		buf.append(L'\n');
		buf.append(L' ');
		buf.append(loadString(getResourceHandle(), IDS_ISSUER).get());
		buf.append(L": ");
		buf.append(pCertificate_->getIssuer()->getText().get());
		buf.append(L'\n');
	}
	
	return buf.getString();
}