diff --git a/blxGff3Parser.c b/blxGff3Parser.c index b7645e7064237149da5c0de4b6e4eb22cacf26b9..16ea2e705c08242b6860f6c8d501b55159301475 100644 --- a/blxGff3Parser.c +++ b/blxGff3Parser.c @@ -292,7 +292,9 @@ static void createBlixemObject(BlxGffData *gffData, if (tmpError) { /* style errors are not critical */ - reportAndClearIfError(&tmpError, G_LOG_LEVEL_WARNING); + //reportAndClearIfError(&tmpError, G_LOG_LEVEL_WARNING); + g_error_free(tmpError); + tmpError = NULL; } /* populate the gaps array */ diff --git a/blxwindow.c b/blxwindow.c index fbda7c0f2f4dbdc9ea02b48149bd8ad8a88a6d40..658d6b2e496d53d3b98960b98bddb886eaa63da7 100755 --- a/blxwindow.c +++ b/blxwindow.c @@ -5234,43 +5234,33 @@ static void calcReadingFrame(MSP *msp, const BlxViewContext *bc) * used to pass the reading frame in exblx files seemed to occasionally pass an incorrect reading frame. */ if (!mspIsIntron(msp)) { - if (msp->phase != UNSET_INT || msp->qFrame == UNSET_INT) - { - if (msp->phase == UNSET_INT) - { - g_warning("Phase is not specified for MSP '%s' (q=%d-%d; s=%d-%d) - assuming phase 0.\n", mspGetSName(msp), msp->qRange.min, msp->qRange.max, msp->sRange.min, msp->sRange.max); - msp->phase = 0; - } - - /* Get the first coord of the first complete codon. This is the start coord (5' end) of the match - * plus the phase (if non-zero), which initially gets stored in the qFrame field in the MSP... */ - const int coord = mspGetQStart(msp) + msp->phase; + /* Get the first coord of the first complete codon. This is the start coord (5' end) of the match + * plus (or minus) the phase (if non-zero), which initially gets stored in the qFrame field in the MSP... */ + const int direction = (msp->qStrand == BLXSTRAND_FORWARD ? 1 : -1); + const int coord = mspGetQStart(msp) + (direction * msp->phase); - /* Find the reading frame that this coord belongs in. This is the same as the base number within - * reading frame 1. */ - int frame = UNSET_INT; - const gboolean invertCoords = (mspGetRefStrand(msp) == BLXSTRAND_REVERSE); + /* Find the reading frame that this coord belongs in. This is the same as the base number within + * reading frame 1. */ + int frame = UNSET_INT; + const gboolean invertCoords = (mspGetRefStrand(msp) == BLXSTRAND_REVERSE); - convertDnaIdxToDisplayIdx(coord, bc->seqType, 1, bc->numFrames, invertCoords, &bc->refSeqRange, &frame); - - if (frame != UNSET_INT) - { - if (msp->qFrame != UNSET_INT && msp->qFrame != frame && bc->seqType == BLXSEQ_PEPTIDE) - { - g_warning("Calculated reading frame '%d' differs from parsed reading frame '%d'; using calculated frame (%s).\n", frame, msp->qFrame, mspGetSName(msp)); - } - - msp->qFrame = frame; - } + convertDnaIdxToDisplayIdx(coord, bc->seqType, 1, bc->numFrames, invertCoords, &bc->refSeqRange, &frame); + + if (frame != UNSET_INT) + { + msp->qFrame = frame; } if (msp->qFrame == UNSET_INT) { - g_warning("Reading frame is not set for MSP '%s' (q=%d-%d; s=%d-%d) - setting to 1.\n", mspGetSName(msp), msp->qRange.min, msp->qRange.max, msp->sRange.min, msp->sRange.max); + g_warning("Reading frame could not be calculated for MSP '%s' (q=%d-%d; s=%d-%d) - setting to 1.\n", mspGetSName(msp), msp->qRange.min, msp->qRange.max, msp->sRange.min, msp->sRange.max); msp->qFrame = 1; } - - /* Messy, for backwards compatibility... set the frame number in the qframe string */ + } + + /* Messy, for backwards compatibility... set the frame number in the qframe string */ + if (msp->qFrame != UNSET_INT) + { char *frameStr = convertIntToString(msp->qFrame); msp->qframe[2] = frameStr[0]; g_free(frameStr); @@ -5278,6 +5268,7 @@ static void calcReadingFrame(MSP *msp, const BlxViewContext *bc) } + /* Calculate the ID and q frame for the given MSP and store * them in the MSP struct. Returns the calculated ID (or UNSET_INT if this msp * is not a blast match). */ diff --git a/utilities.c b/utilities.c index 9e6acaedda03937b79a9aee1769e4c7141b99b00..cc6914644c75f83a2b7ae2b28b2ff304c53117c0 100644 --- a/utilities.c +++ b/utilities.c @@ -1700,46 +1700,50 @@ static BlxSequence* blxSequenceFindByName(const char *name, GList *allSeqs) BlxSequence* blxSequenceGetVariantParent(const BlxSequence *variant, GList *allSeqs) { BlxSequence *result = NULL; - + const char *variantName = blxSequenceGetFullName(variant); - char *parentName = g_strdup(variantName); - char *insertPoint = strchr(parentName, '-'); - if (insertPoint) + if (variantName) { - /* Replace '-' by terminating char, in case there's nothing else to copy in. */ - *insertPoint = '\0'; - - /* The insert point is where we'll copy into. Create another pointer that we'll increment - * until we find a '.' and then we'll copy from that point. */ - char *copyPoint = insertPoint; - ++copyPoint; - - gboolean foundRestartPoint = FALSE; /* set to true when we find where to start copying from again */ - - while (copyPoint && *copyPoint != '\0') + char *parentName = g_strdup(variantName); + char *insertPoint = strchr(parentName, '-'); + + if (insertPoint) { - if (foundRestartPoint) - { - *insertPoint = *copyPoint; - ++insertPoint; - } - else if (*copyPoint == '.') - { - foundRestartPoint = TRUE; - *insertPoint = *copyPoint; - ++insertPoint; - } + /* Replace '-' by terminating char, in case there's nothing else to copy in. */ + *insertPoint = '\0'; + /* The insert point is where we'll copy into. Create another pointer that we'll increment + * until we find a '.' and then we'll copy from that point. */ + char *copyPoint = insertPoint; ++copyPoint; + + gboolean foundRestartPoint = FALSE; /* set to true when we find where to start copying from again */ + + while (copyPoint && *copyPoint != '\0') + { + if (foundRestartPoint) + { + *insertPoint = *copyPoint; + ++insertPoint; + } + else if (*copyPoint == '.') + { + foundRestartPoint = TRUE; + *insertPoint = *copyPoint; + ++insertPoint; + } + + ++copyPoint; + } + + *insertPoint = '\0'; + + result = blxSequenceFindByName(parentName, allSeqs); + g_free(parentName); } - - *insertPoint = '\0'; - - result = blxSequenceFindByName(parentName, allSeqs); - g_free(parentName); } - + return result; }