Skip to content
Snippets Groups Projects
Commit 9f99eb72 authored by gb10's avatar gb10
Browse files

Added basic type for polyA tails

parent 3bc45dc5
No related branches found
No related tags found
No related merge requests found
......@@ -264,6 +264,11 @@ static gboolean isSnp(char *text)
return (stringsEqual(text, "SNP", FALSE) || stringsEqual(text, "SO:0000694", FALSE));
}
static gboolean isPolyATail(char *text)
{
return (stringsEqual(text, "polyA_sequence", FALSE) || stringsEqual(text, "SO:0000610", FALSE));
}
/* Get the MSP type from a string continaing a valid GFF3 type name */
......@@ -299,6 +304,10 @@ static void parseMspType(char *token, MSP *msp, GError **error)
{
msp->type = BLXMSP_SNP;
}
else if (isPolyATail(token))
{
msp->type = BLXMSP_POLYA_TAIL;
}
else
{
g_set_error(error, BLX_GFF3_ERROR, BLX_GFF3_ERROR_INVALID_TYPE, "Unexpected MSP type '%s' in input file.", token);
......
......@@ -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.51 2010-07-13 14:20:42 gb10 Exp $
* CVS info: $Id: blxview.c,v 1.52 2010-07-15 09:24:05 gb10 Exp $
*-------------------------------------------------------------------
*/
......@@ -616,8 +616,8 @@ BlxSequence* addBlxSequence(MSP *msp, BlxStrand strand, GList **seqList, char *s
blxSeq->strand = strand;
/* Set the sequence data (if relevant and if passed) */
blxSeq->sequenceReqd = mspIsBlastMatch(msp) || mspIsSnp(msp);
/* Set whether the sequence data is required by any of this sequence's MSPs */
blxSeq->sequenceReqd |= mspIsBlastMatch(msp) || mspIsPolyATail(msp) || mspIsSnp(msp);
}
g_free(name);
......
......@@ -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.26 2010-07-12 09:42:21 gb10 Exp $
* CVS info: $Id: blxview.h,v 1.27 2010-07-15 09:24:05 gb10 Exp $
*-------------------------------------------------------------------
*/
#ifndef DEF_BLXVIEW_H
......@@ -124,6 +124,7 @@ typedef enum
BLXMSP_EXON_UTR, /* Exon (untranslated region i.e. non-coding section) */
BLXMSP_EXON_UNK, /* Exon (unknown type) */
BLXMSP_INTRON, /* Intron */
BLXMSP_POLYA_TAIL, /* polyA tail */
BLXMSP_SNP, /* Single Nucleotide Polymorphism */
......@@ -173,6 +174,7 @@ typedef enum
BLXCOLOR_UNALIGNED_SEQ, /* color in which to show additional sequence in the match that is not part of the alignment */
BLXCOLOR_CANONICAL, /* background highlight color for canonical intron bases */
BLXCOLOR_NON_CANONICAL, /* background highlight color for non-canonical intron bases */
BLXCOLOR_POLYA_TAIL, /* background color for polyA tails in the detail view */
BLXCOL_NUM_COLORS
} BlxColorId;
......
......@@ -3936,6 +3936,7 @@ static void createBlxColors(BlxViewContext *bc, GtkWidget *widget)
createBlxColor(bc, BLXCOLOR_UNALIGNED_SEQ, "Unaligned sequence", "Addition sequence in the match that is not part of the alignment", defaultBgColorStr, BLX_WHITE, NULL, NULL);
createBlxColor(bc, BLXCOLOR_CANONICAL, "Canonical intron bases", "The two bases at the start/end of the intron for the selected MSP are colored this color if they are canonical", BLX_GREEN, BLX_GREY, NULL, NULL);
createBlxColor(bc, BLXCOLOR_NON_CANONICAL, "Non-canonical intron bases", "The two bases at the start/end of the intron for the selected MSP are colored this color if they are not canonical", BLX_RED, BLX_GREY, NULL, NULL);
createBlxColor(bc, BLXCOLOR_POLYA_TAIL, "polyA tail", "polyA tail", BLX_RED, BLX_GREY, NULL, NULL);
g_free(defaultBgColorStr);
}
......@@ -4309,6 +4310,10 @@ void blxWindowSelectionChanged(GtkWidget *blxWindow)
{
GtkWidget *detailView = blxWindowGetDetailView(blxWindow);
/* Re-filter the detail-view trees, because selecting an MSP can cause other MSPs to
* become visible (i.e. polyA tails). */
callFuncOnAllDetailViewTrees(detailView, refilterTree, NULL);
/* Redraw */
updateFeedbackBox(detailView);
blxWindowRedrawAll(blxWindow);
......
......@@ -3782,8 +3782,8 @@ void detailViewAddMspData(GtkWidget *detailView, MSP *mspList)
for ( ; msp; msp = msp->next)
{
/* Only add matches and exons to trees */
if (mspIsBlastMatch(msp) || mspIsExon(msp))
/* Only add matches/exons/polyA-tails to trees */
if (mspIsBlastMatch(msp) || mspIsExon(msp) || mspIsPolyATail(msp))
{
/* Find the tree that this MSP should belong to based on its reading frame and strand */
BlxStrand strand = mspGetRefStrand(msp);
......
......@@ -691,12 +691,12 @@ void resortTree(GtkWidget *tree, gpointer data)
static void mspGetVisibleRange(const MSP const *msp,
const BlxViewContext *bc,
const gboolean showUnalignedSeq,
const gboolean limitUnalignedBases,
const int numUnalignedBases,
IntRange *qRange_out,
IntRange *sRange_out)
const BlxViewContext *bc,
const gboolean showUnalignedSeq,
const gboolean limitUnalignedBases,
const int numUnalignedBases,
IntRange *qRange_out,
IntRange *sRange_out)
{
if (showUnalignedSeq && mspIsBlastMatch(msp))
{
......@@ -779,6 +779,39 @@ static void mspGetVisibleRange(const MSP const *msp,
}
/* Utility that returns true if the given MSP is currently shown in the tree with the given
* strand/frame */
static gboolean isMspVisible(const MSP const *msp,
GtkWidget *blxWindow,
const BlxViewContext *bc,
const BlxStrand strand,
const int frame,
const IntRange const *displayRange,
const int numUnalignedBases)
{
/* We only display blast matches or exons (or polyA tails, if the MSP's sequence is
* selected) */
gboolean result = mspIsBlastMatch(msp) || mspIsExon(msp) ||
(mspIsPolyATail(msp) && blxWindowIsSeqSelected(blxWindow, msp->sSequence));
/* Check that it is in this tree's frame and strand */
result &= (mspGetRefStrand(msp) == strand);
result &= (mspGetRefFrame(msp, bc->seqType) == frame);
/* Check it's in the current display range */
if (result)
{
IntRange qRange;
const gboolean showUnalignedSeq = blxContextGetFlag(bc, BLXFLAG_SHOW_UNALIGNED_SEQ);
const gboolean limitUnalignedBases = blxContextGetFlag(bc, BLXFLAG_LIMIT_UNALIGNED_BASES);
mspGetVisibleRange(msp, bc, showUnalignedSeq, limitUnalignedBases, numUnalignedBases, &qRange, NULL);
result &= (qRange.min <= displayRange->max && qRange.max >= displayRange->min);
}
return result;
}
/* Filter function. Returns true if the given row in the given tree model should be visible. */
......@@ -815,20 +848,10 @@ static gboolean isTreeRowVisible(GtkTreeModel *model, GtkTreeIter *iter, gpointe
{
const MSP* msp = (const MSP*)(mspListItem->data);
if ((mspIsBlastMatch(msp) || mspIsExon(msp)) &&
mspGetRefStrand(msp) == strand && mspGetRefFrame(msp, bc->seqType) == frame)
if (isMspVisible(msp, blxWindow, bc, strand, frame, displayRange, dvProperties->numUnalignedBases))
{
IntRange qRange;
const gboolean showUnalignedSeq = blxContextGetFlag(bc, BLXFLAG_SHOW_UNALIGNED_SEQ);
const gboolean limitUnalignedBases = blxContextGetFlag(bc, BLXFLAG_LIMIT_UNALIGNED_BASES);
mspGetVisibleRange(msp, bc, showUnalignedSeq, limitUnalignedBases, dvProperties->numUnalignedBases, &qRange, NULL);
if (qRange.min <= displayRange->max && qRange.max >= displayRange->min)
{
bDisplay = TRUE;
break;
}
bDisplay = TRUE;
break;
}
}
}
......
......@@ -55,6 +55,8 @@ typedef struct _RenderData
GdkColor *unalignedSeqColorSelected;
GdkColor *exonBoundaryColorStart;
GdkColor *exonBoundaryColorEnd;
GdkColor *polyAColor;
GdkColor *polyAColorSelected;
int exonBoundaryWidth;
GdkLineStyle exonBoundaryStyleStart;
GdkLineStyle exonBoundaryStyleEnd;
......@@ -574,6 +576,16 @@ static void drawBase(MSP *msp,
sBase = SEQUENCE_CHAR_GAP;
baseBgColor = selected ? data->mismatchColorSelected : data->mismatchColor;
}
else if (mspIsPolyATail(msp))
{
/* Special treatment for bases inside a polyA tail: only show polyA tails if the sequence
* is selected. */
if (data->seqSelected)
{
baseBgColor = selected ? data->polyAColorSelected : data->polyAColor;
sBase = getMatchSeqBase(msp->sSequence, *sIdx, data->bc->seqType);
}
}
else
{
/* There is a base in the match sequence. See if it matches the ref sequence */
......@@ -978,6 +990,8 @@ static void drawMsps(SequenceCellRenderer *renderer,
getGdkColor(BLXCOLOR_UNALIGNED_SEQ, bc->defaultColors, TRUE, bc->usePrintColors),
getGdkColor(BLXCOLOR_EXON_START, bc->defaultColors, FALSE, bc->usePrintColors),
getGdkColor(BLXCOLOR_EXON_END, bc->defaultColors, FALSE, bc->usePrintColors),
getGdkColor(BLXCOLOR_POLYA_TAIL, bc->defaultColors, FALSE, bc->usePrintColors),
getGdkColor(BLXCOLOR_POLYA_TAIL, bc->defaultColors, TRUE, bc->usePrintColors),
detailViewProperties->exonBoundaryLineWidth,
detailViewProperties->exonBoundaryLineStyleStart,
detailViewProperties->exonBoundaryLineStyleEnd,
......@@ -1002,7 +1016,7 @@ static void drawMsps(SequenceCellRenderer *renderer,
{
drawExon(renderer, msp, tree, &data);
}
else if (mspIsBlastMatch(msp))
else if (mspIsBlastMatch(msp) || mspIsPolyATail(msp))
{
drawDnaSequence(renderer, msp, tree, &data);
}
......
......@@ -509,6 +509,11 @@ gboolean mspIsSnp(const MSP const *msp)
return (msp && msp->type == BLXMSP_SNP);
}
gboolean mspIsPolyATail(const MSP const *msp)
{
return (msp && msp->type == BLXMSP_POLYA_TAIL);
}
gboolean mspIsBlastMatch(const MSP const *msp)
{
return (msp && msp->type == BLXMSP_MATCH);
......@@ -524,21 +529,21 @@ gboolean mspHasSName(const MSP const *msp)
* and exons have coords on the subject sequence. (to do: is this optional for exons?) */
gboolean mspHasSCoords(const MSP const *msp)
{
return mspIsExon(msp) || mspIsBlastMatch(msp);
return mspIsExon(msp) || mspIsBlastMatch(msp) || mspIsPolyATail(msp);
}
/* Whether the MSP requires subject sequence strand to be set. Only matches
* require strand on the subject sequence, although exons may have them set. */
gboolean mspHasSStrand(const MSP const *msp)
{
return mspIsBlastMatch(msp);
return mspIsBlastMatch(msp) || mspIsPolyATail(msp);
}
/* Whether the MSP requires the actual sequence data for the subject sequence. Only
* matches require the sequence data. */
gboolean mspHasSSeq(const MSP const *msp)
{
return mspIsBlastMatch(msp);
return mspIsBlastMatch(msp) || mspIsPolyATail(msp);
}
......@@ -781,7 +786,7 @@ int gapCoord(const MSP *msp,
{
int result = UNSET_INT;
if (mspIsBlastMatch(msp) || mspIsExon(msp))
if (mspIsBlastMatch(msp) || mspIsExon(msp) || mspIsPolyATail(msp))
{
const gboolean qForward = (mspGetRefStrand(msp) == BLXSTRAND_FORWARD);
const gboolean sForward = (mspGetMatchStrand(msp) == BLXSTRAND_FORWARD);
......@@ -1260,6 +1265,7 @@ BlxSequence* createEmptyBlxSequence(char *fullName)
seq->mspList = NULL;
seq->sequence = NULL;
seq->sequenceReqd = FALSE;
return seq;
}
......
......@@ -137,6 +137,7 @@ void adjustColorBrightness(GdkColor *origColor, const double factor, GdkC
gboolean mspIsExon(const MSP const *msp);
gboolean mspIsIntron(const MSP const *msp);
gboolean mspIsSnp(const MSP const *msp);
gboolean mspIsPolyATail(const MSP const *msp);
gboolean mspIsBlastMatch(const MSP const *msp);
gboolean mspHasSName(const MSP const *msp);
......
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