Skip to content
Snippets Groups Projects
Commit b75d7dbd authored by edgrif's avatar edgrif
Browse files

redo earlier changes overwritten by robs checkin.

parent 03da6eea
No related branches found
No related tags found
No related merge requests found
......@@ -27,9 +27,9 @@
*
* Exported functions: See zmapView_P.h
* HISTORY:
* Last edited: Nov 22 10:12 2004 (edgrif)
* Last edited: Nov 22 18:17 2004 (edgrif)
* Created: Fri Jul 16 13:05:58 2004 (edgrif)
* CVS info: $Id: zmapFeature.c,v 1.9 2004-11-22 17:47:09 edgrif Exp $
* CVS info: $Id: zmapFeature.c,v 1.10 2004-11-22 22:46:21 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -37,7 +37,11 @@
#include <glib.h>
#include <ZMap/zmapUtils.h>
#include <ZMap/zmapFeature.h>
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
#include <zmapView_P.h>
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
/*! @defgroup zmapfeatures zMapFeatures: feature handling for ZMap
......@@ -95,12 +99,13 @@ static void printFeature(GQuark key_id, gpointer data, gpointer user_data) ;
* @param void None.
* @return ZMapFeature A pointer to the new ZMapFeature.
* */
ZMapFeature zmapFeatureCreate(void)
ZMapFeature zmapFeatureCreateEmpty(void)
{
ZMapFeature feature ;
feature = g_new0(ZMapFeatureStruct, 1) ;
feature->id = ZMAPFEATUREID_NULL ;
feature->feature_id = ZMAPFEATURE_NULLQUARK ;
feature->db_id = ZMAPFEATUREID_NULL ;
feature->type = ZMAPFEATURE_INVALID ;
return feature ;
......@@ -114,7 +119,7 @@ ZMapFeature zmapFeatureCreate(void)
* NOTE that really we need this to be a polymorphic function so that the arguments
* are different for different features.
* */
gboolean zmapFeatureAugmentData(ZMapFeature feature, char *name,
gboolean zmapFeatureAugmentData(ZMapFeature feature, char *feature_name_id, char *name,
char *sequence, char *source, ZMapFeatureType feature_type,
int start, int end, double score, ZMapStrand strand,
ZMapPhase phase,
......@@ -124,11 +129,10 @@ gboolean zmapFeatureAugmentData(ZMapFeature feature, char *name,
zMapAssert(feature) ;
/* Note we have hacked this up for now...in the end we should have a unique id for each feature
* but for now we will look at the type to determine if a feature is empty or not..... */
/* If its an empty feature then initialise... */
if (feature->type == ZMAPFEATURE_INVALID)
if (feature->feature_id == ZMAPFEATURE_NULLQUARK)
{
feature->feature_id = g_quark_from_string(feature_name_id) ;
feature->name = g_strdup(name) ;
feature->type = feature_type ;
feature->x1 = start ;
......@@ -458,7 +462,11 @@ static void doNewFeatureSets(GQuark key_id, gpointer data, gpointer user_data)
* work as part of a foreach loop....which is where this routine is called from... */
unused = g_datalist_id_remove_no_notify(&(new_feature_sets), key_id) ;
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
printf("stop here\n") ;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
}
else
{
......
......@@ -26,9 +26,9 @@
* 1
* Exported functions: See zmapFeature.h
* HISTORY:
* Last edited: Nov 22 14:46 2004 (edgrif)
* Last edited: Nov 22 21:39 2004 (edgrif)
* Created: Tue Nov 2 2004 (rnc)
* CVS info: $Id: zmapFeatureUtils.c,v 1.1 2004-11-22 14:48:22 edgrif Exp $
* CVS info: $Id: zmapFeatureUtils.c,v 1.2 2004-11-22 22:46:21 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -43,32 +43,33 @@ static gboolean printLine(GIOChannel *channel, gchar *line);
char *zmapLookUpEnum(int id, int enumType)
char *zmapFeatureLookUpEnum(int id, int enumType)
{
/* These arrays must correspond 1:1 with the enums declared in zmapFeature.h */
static char *types[8] = {"BASIC", "HOMOL", "EXON", "INTRON", "TRANSCRIPT",
"VARIATION", "BOUNDARY", "SEQUENCE"} ;
static char *strands[3] = {"ZMAPSTRAND_NONE", "ZMAPSTRAND_DOWN", "ZMAPSTRAND_UP" };
static char *phases[4] = {"ZMAPPHASE_NONE", "ZMAPPHASE_0", "ZMAPPHASE_1", "ZMAPPHASE_2" };
char *enum_str = NULL ;
zMapAssert(enumType == TYPE_ENUM || enumType == STRAND_ENUM || enumType == PHASE_ENUM) ;
switch (enumType)
{
case TYPE_ENUM:
return types[id];
enum_str = types[id];
break;
case STRAND_ENUM:
return strands[id];
enum_str = strands[id];
break;
case PHASE_ENUM:
return phases[id];
enum_str = phases[id];
break;
}
default:
break;
}
return NULL;
return enum_str ;
}
char *zMapFeatureCreateID(ZMapFeatureType feature_type, char *feature_name,
......@@ -228,12 +229,12 @@ static void featureDump_TD(GQuark key_id, gpointer data, gpointer user_data)
if (feature)
{
line = g_string_sized_new(150);
type = zmapLookUpEnum(feature->type, TYPE_ENUM);
strand = zmapLookUpEnum(feature->strand, STRAND_ENUM);
phase = zmapLookUpEnum(feature->phase, PHASE_ENUM);
type = zmapFeatureLookUpEnum(feature->type, TYPE_ENUM);
strand = zmapFeatureLookUpEnum(feature->strand, STRAND_ENUM);
phase = zmapFeatureLookUpEnum(feature->phase, PHASE_ENUM);
g_string_printf(line, "%d\t%s\t%s\t%d\t%d\t%d\t%s\t%s\t%s\t%f",
feature->id,
feature->db_id,
feature->name,
type,
feature->x1,
......
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