void CBlastAncillaryData::do_copy(const CBlastAncillaryData& other) { if (this != &other) { m_UngappedKarlinBlk = m_GappedKarlinBlk = NULL; m_SearchSpace = other.m_SearchSpace; if (other.m_UngappedKarlinBlk) { m_UngappedKarlinBlk = Blast_KarlinBlkNew(); Blast_KarlinBlkCopy(m_UngappedKarlinBlk, other.m_UngappedKarlinBlk); } if (other.m_GappedKarlinBlk) { m_GappedKarlinBlk = Blast_KarlinBlkNew(); Blast_KarlinBlkCopy(m_GappedKarlinBlk, other.m_GappedKarlinBlk); } if (other.m_PsiUngappedKarlinBlk) { m_PsiUngappedKarlinBlk = Blast_KarlinBlkNew(); Blast_KarlinBlkCopy(m_PsiUngappedKarlinBlk, other.m_PsiUngappedKarlinBlk); } if (other.m_PsiGappedKarlinBlk) { m_PsiGappedKarlinBlk = Blast_KarlinBlkNew(); Blast_KarlinBlkCopy(m_PsiGappedKarlinBlk, other.m_PsiGappedKarlinBlk); } if (other.m_GumbelBlk) { s_InitializeGumbelBlk(other.m_GumbelBlk, &m_GumbelBlk); } } }
static void s_InitializeKarlinBlk(Blast_KarlinBlk* src, Blast_KarlinBlk** dest) { _ASSERT(dest); if (src && src->Lambda >= 0) { *dest = Blast_KarlinBlkNew(); Blast_KarlinBlkCopy(*dest, src); } }
/** * Read a checkpoint file and set the necessary structures in a * BlastScoreBlk: the psi_matrix, kbp_psi[0], and kbp_gap_psi[0]. * * @param sbp a BlastScoreBlk to receive a PSSM [in/out] * @param query query sequence data * @param psi_matrix_file checkpoint file to read * @pcore_msg a pointer to receive error and warning messages */ static int s_SetupScoreBlkPssmFromChkpt(BlastScoreBlk * sbp, BLAST_SequenceBlk * query, Blast_PsiCheckpointLoc * psi_checkpoint, Blast_Message* *pcore_msg) { int status = 0; /* An intermediate representation of the PSSM data that is used in PSIBlast routines */ PSIMatrix * pssm = NULL; /* The actual PSSM that is saved in the BlastScoreBlk */ SPsiBlastScoreMatrix * psi_matrix = NULL; size_t i, j; psi_matrix = SPsiBlastScoreMatrixNew(query->length); if (!psi_matrix) { ErrPostEx(SEV_FATAL, 1, 0, "Out-of-memory: cannot allocate a PSSM of length %d.\n", query->length); status = -1; goto error_return; } status = Blast_PosReadCheckpoint(psi_matrix->freq_ratios, query->length, query->sequence, psi_checkpoint, pcore_msg); if (status != 0) { goto error_return; } Blast_KarlinBlkCopy(psi_matrix->kbp, sbp->kbp_gap_std[0]); status = PSICreatePssmFromFrequencyRatios(query->sequence, query->length, sbp, psi_matrix->freq_ratios, kPSSM_NoImpalaScaling, &pssm); if (0 != status) { goto error_return; } for (i = 0; i < psi_matrix->pssm->ncols; i++) { for (j = 0; j < psi_matrix->pssm->nrows; j++) { psi_matrix->pssm->data[i][j] = pssm->pssm[i][j]; } } PSIMatrixFree(pssm); sbp->psi_matrix = psi_matrix; return 0; error_return: if (psi_matrix) SPsiBlastScoreMatrixFree(psi_matrix); return status; }