Skip to content
Snippets Groups Projects
Commit 0efbb5d4 authored by gb10's avatar gb10
Browse files

Fixed a few bugs with gff input

parent 190b69a5
No related branches found
No related tags found
No related merge requests found
......@@ -130,7 +130,8 @@ GSList* blxCreateSupportedGffTypeList()
addGffType(&supportedTypes, "intron", "SO:0000188", BLXMSP_INTRON);
addGffType(&supportedTypes, "SNP", "SO:0000694", BLXMSP_SNP);
addGffType(&supportedTypes, "polyA_sequence", "SO:0000610", BLXMSP_POLYA_TAIL);
addGffType(&supportedTypes, "polyA_signal_sequence", "SO:0000551", BLXMSP_POLYA_SIG_SEQ);
addGffType(&supportedTypes, "polyA_site", "SO:0000553", BLXMSP_POLYA_SITE);
return supportedTypes;
}
......@@ -429,7 +430,7 @@ static void parseGffColumns(GString *line_string,
/* This error should get set if there is a fatal error reading this line. */
GError *tmpError = NULL;
validateNumTokens(tokens, 9, 9, &tmpError);
validateNumTokens(tokens, 8, 9, &tmpError);
if (!tmpError)
{
......@@ -458,13 +459,26 @@ static void parseGffColumns(GString *line_string,
if (!tmpError)
{
if (stringsEqual(tokens[7], ".", TRUE))
gffData->phase = UNSET_INT;
{
gffData->phase = 0;
if (gffData->mspType == BLXMSP_CDS)
{
g_warning("[line %d] CDS type does not have phase specified.\n", lineNum);
}
}
else
gffData->phase = convertStringToInt(tokens[7]);
{
gffData->phase = convertStringToInt(tokens[7]);
}
/* Parse the optional attributes */
char *attributes = tokens[8];
parseAttributes(attributes, seqList, opts, lineNum, gffData, &tmpError);
if (attributes)
{
parseAttributes(attributes, seqList, opts, lineNum, gffData, &tmpError);
}
}
if (tmpError)
......
......@@ -88,7 +88,7 @@
01-10-05 Added getsseqsPfetch to fetch all missing sseqs in one go via socket connection to pfetch [RD]
* Created: Thu Feb 20 10:27:39 1993 (esr)
* CVS info: $Id: blxview.c,v 1.66 2010-09-21 12:50:43 gb10 Exp $
* CVS info: $Id: blxview.c,v 1.67 2010-09-27 10:19:59 gb10 Exp $
*-------------------------------------------------------------------
*/
......@@ -978,6 +978,15 @@ static void createMissingExonCdsUtr(MSP **exon, MSP **cds, MSP **utr,
ptrToUpdate = utr;
}
}
else if (*exon)
{
/* We just have an exon. Assume it is all utr. */
newStart = (*exon)->qRange.min;
newEnd = (*exon)->qRange.max;
newPhase = 0;
newType = BLXMSP_UTR;
ptrToUpdate = utr;
}
if (newType != BLXMSP_INVALID)
{
......@@ -1051,7 +1060,7 @@ static void constructTranscriptData(BlxSequence *blxSeq, MSP **lastMsp, MSP **ms
if (prevExon && curExon && !mspIsIntron(msp) && !mspIsIntron(prevMsp))
{
createNewMsp(lastMsp, mspList, seqList, BLXMSP_INTRON, NULL, UNSET_INT, UNSET_INT, blxSeq->idTag,
NULL, prevExon->qRange.max, curExon->qRange.min, blxSeq->strand, UNSET_INT, blxSeq->fullName,
NULL, prevExon->qRange.max + 1, curExon->qRange.min, blxSeq->strand, UNSET_INT, blxSeq->fullName,
UNSET_INT, UNSET_INT, blxSeq->strand, NULL, opts, &tmpError);
reportAndClearIfError(&tmpError, G_LOG_LEVEL_CRITICAL);
......@@ -1394,20 +1403,6 @@ MSP* createNewMsp(MSP **lastMsp,
intrangeSetValues(&msp->qRange, qStart, qEnd);
intrangeSetValues(&msp->sRange, sStart, sEnd);
/* Check that a phase wasn't passed in for anything that's not an exon. (Technically it
* should be anything that's not a CDS, but we copy the CDS phase to exons/UTRs so we
* can calculate which reading frame to display them in.) */
if (!mspIsExon(msp) && msp->phase != UNSET_INT)
{
g_warning("Warning: MSP '%s' (%d-%d) has phase '%d' specified but only CDS types should have phase (MSP type=%d).\n", msp->sname, msp->qRange.min, msp->qRange.max, msp->phase, msp->type);
}
/* Alignments don't have a phase, so set it to 0 so that it gets ignored in our reading-frame calculation. */
if (mspIsBlastMatch(msp) && msp->phase == UNSET_INT)
{
msp->phase = 0;
}
/* For exons and introns, the s strand is not applicable. We always want the exon
* to be in the same direction as the ref sequence, so set the match seq strand to be
* the same as the ref seq strand */
......@@ -1760,7 +1755,20 @@ BlxStyle* getBlxStyle(const char *styleName, GSList *styles, GError **error)
if (!result)
{
g_set_error(error, BLX_ERROR, 1, "Requested style '%s' does not exist.\n", styleName);
/* Only report the same missing style once */
static GSList *seenStyles = NULL;
GSList *item = seenStyles;
gboolean seen = FALSE;
for ( ; item && !seen; item = item->next)
{
seen = stringsEqual((char*)(item->data), styleName, FALSE);
}
if (!seen)
{
seenStyles = g_slist_append(seenStyles, g_strdup(styleName));
g_set_error(error, BLX_ERROR, 1, "Requested style '%s' does not exist.\n", styleName);
}
}
}
......
......@@ -27,7 +27,7 @@
* Last edited: Aug 21 13:57 2009 (edgrif)
* * Aug 26 16:57 1999 (fw): added this header
* Created: Thu Aug 26 16:57:17 1999 (fw)
* CVS info: $Id: blxview.h,v 1.33 2010-08-27 12:25:14 gb10 Exp $
* CVS info: $Id: blxview.h,v 1.34 2010-09-27 10:19:59 gb10 Exp $
*-------------------------------------------------------------------
*/
#ifndef DEF_BLXVIEW_H
......@@ -141,7 +141,8 @@ typedef enum
BLXMSP_INTRON, /* Intron */
BLXMSP_EXON, /* Exon (should appear AFTER CDS and UTR for sorting, as required by constructTranscriptData) */
BLXMSP_TRANSCRIPT, /* Transcript */
BLXMSP_POLYA_TAIL, /* polyA tail */
BLXMSP_POLYA_SIG_SEQ, /* polyA signal sequence */
BLXMSP_POLYA_SITE, /* polyA site */
BLXMSP_SNP, /* Single Nucleotide Polymorphism */
......
......@@ -565,7 +565,7 @@ gboolean mspIsSnp(const MSP const *msp)
gboolean mspIsPolyATail(const MSP const *msp)
{
return (msp && msp->type == BLXMSP_POLYA_TAIL);
return (msp && msp->type == BLXMSP_POLYA_SIG_SEQ);
}
gboolean mspIsBlastMatch(const MSP const *msp)
......
......@@ -67,7 +67,7 @@
#define BLX_LIGHTER_RED "#ff5353"
#define BLX_LIGHT_RED "#ff7373"
#define BLX_DARK_RED "#800000"
#define BLX_VERY_DARK_RED "#A00000"
#define BLX_VERY_DARK_RED "#400000"
#define BLX_ORANGE "#ffa500"
#define BLX_LIGHT_ORANGE "#FFCF55"
#define BLX_DUSK_ORANGE "#D7BA94"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment