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

change styles to be a dataset not a list.

parent e37c97a8
No related branches found
No related tags found
No related merge requests found
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Feb 19 13:22 2007 (rds)
* Last edited: Feb 26 08:50 2007 (edgrif)
* Created: Thu Feb 1 00:12:49 2007 (rds)
* CVS info: $Id: zmapControlRemoteXML.c,v 1.7 2007-02-20 12:53:44 rds Exp $
* CVS info: $Id: zmapControlRemoteXML.c,v 1.8 2007-03-01 09:22:26 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -37,7 +37,7 @@
#include <ZMap/zmapGLibUtils.h>
static gboolean setupStyles(ZMapFeatureSet set, ZMapFeature feature,
GList *styles, GQuark style_id);
GData *styles, GQuark style_id) ;
/* xml event callbacks ... */
/* starts */
static gboolean xml_zmap_start_cb(gpointer user_data, ZMapXMLElement zmap_element,
......@@ -127,7 +127,7 @@ ZMapXMLParser zmapControlRemoteXMLInitialise(void *data)
/* INTERNALS */
static gboolean setupStyles(ZMapFeatureSet set, ZMapFeature feature,
GList *styles, GQuark style_id)
GData *styles, GQuark style_id)
{
ZMapFeatureTypeStyle style, set_style;
gboolean got_style = TRUE;
......
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Feb 1 08:57 2007 (rds)
* Last edited: Feb 19 10:32 2007 (edgrif)
* Created: Thu Feb 1 00:29:43 2007 (rds)
* CVS info: $Id: zmapControlRemote_P.h,v 1.1 2007-02-06 11:00:15 rds Exp $
* CVS info: $Id: zmapControlRemote_P.h,v 1.2 2007-03-01 09:22:26 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -103,7 +103,7 @@ typedef struct {
controlClientObj client;
GList *styles; /* These should be ZMapFeatureTypeStyle */
GData *styles; /* These should be ZMapFeatureTypeStyle */
GList *locations; /* This is just a list of ZMapSpan Structs */
ViewConnectDataStruct new_view;
......
......@@ -27,9 +27,9 @@
*
* Exported functions: See XXXXXXXXXXXXX.h
* HISTORY:
* Last edited: Jan 11 16:02 2006 (rds)
* Last edited: Feb 19 13:56 2007 (edgrif)
* Created: Wed Jan 11 11:30:39 2006 (rds)
* CVS info: $Id: gffparser.c,v 1.2 2006-11-08 09:24:15 edgrif Exp $
* CVS info: $Id: gffparser.c,v 1.3 2007-03-01 09:20:51 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -197,7 +197,7 @@ static gboolean readFeatures(parserFile data)
return result;
}
static int parseFile(char *filename, GList *styles)
static int parseFile(char *filename, GData *styles)
{
parserFileStruct data = {NULL};
......@@ -218,7 +218,7 @@ static int parseFile(char *filename, GList *styles)
int main(int argc, char *argv[])
{
int main_rc ;
GList *styles = NULL;
GData *styles = NULL;
styles = zMapFeatureTypeGetFromFile("ZMapTypes");
main_rc = parseFile("huge.gff", styles);
......
......@@ -26,9 +26,9 @@
*
* Exported functions: See ZMap/zmapGFF.h
* HISTORY:
* Last edited: Feb 6 17:55 2007 (rds)
* Last edited: Feb 26 11:20 2007 (edgrif)
* Created: Mon Nov 14 13:21:14 2005 (edgrif)
* CVS info: $Id: zmapGFF2Dumper.c,v 1.7 2007-02-06 17:55:58 rds Exp $
* CVS info: $Id: zmapGFF2Dumper.c,v 1.8 2007-03-01 09:20:51 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -280,7 +280,7 @@ static gboolean dumpFeature(GIOChannel *file, gpointer user_data,
GIOStatus status ;
gsize bytes_written ;
GString *buffer = (GString *)user_data ;
const char *gff_source = NULL, *gff_feature = NULL ;
const char *gff_source, *gff_feature ;
/* Don't dump some features...this will go when dna is not longer a feature... */
......@@ -289,10 +289,8 @@ static gboolean dumpFeature(GIOChannel *file, gpointer user_data,
/* Set up GFF output specials from style. */
if (style->gff_source)
gff_source = g_quark_to_string(style->gff_source) ;
if (style->gff_feature)
gff_feature = g_quark_to_string(style->gff_feature) ;
gff_source = zMapStyleGetGFFSource(style) ;
gff_feature = zMapStyleGetGFFFeature(style) ;
/* Fields are: <seqname> <source> <feature> <start> <end> <score> <strand> <frame> */
......
......@@ -26,9 +26,9 @@
*
* Exported functions: See ZMap/zmapGFF.h
* HISTORY:
* Last edited: Jan 5 10:05 2007 (rds)
* Last edited: Mar 1 09:20 2007 (edgrif)
* Created: Fri May 28 14:25:12 2004 (edgrif)
* CVS info: $Id: zmapGFF2parser.c,v 1.69 2007-01-05 22:26:23 rds Exp $
* CVS info: $Id: zmapGFF2parser.c,v 1.70 2007-03-01 09:20:51 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -82,23 +82,12 @@ static void destroyFeatureArray(gpointer data) ;
static void printSource(GQuark key_id, gpointer data, gpointer user_data) ;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
static gboolean loadGaps(char *currentPos, GArray *gaps);
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
static int sortGapsByTarget(gconstpointer a, gconstpointer b);
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
static void initSources(GData **datalist, GList *sources);
#ifdef ED_G_NEVER_INCLUDE_THIS_CODE
static void stylePrintCB(gpointer data, gpointer user_data) ;
#endif /* ED_G_NEVER_INCLUDE_THIS_CODE */
static void mungeFeatureType(char *source, ZMapFeatureType *type_inout);
static gboolean getNameFromNote(char *attributes, char **name) ;
......@@ -112,7 +101,7 @@ static gboolean getNameFromNote(char *attributes, char **name) ;
* _not_ create any features. This means the parser can be tested/used on huge datasets
* without having to have huge amounts of memory to hold the feature structs.
* You can only set parse_only when you create the parser, it cannot be set later. */
ZMapGFFParser zMapGFFCreateParser(GList *sources, gboolean parse_only)
ZMapGFFParser zMapGFFCreateParser(GData *sources, gboolean parse_only)
{
ZMapGFFParser parser ;
GQuark locus_id ;
......@@ -144,14 +133,11 @@ ZMapGFFParser zMapGFFCreateParser(GList *sources, gboolean parse_only)
parser->done_sequence_region = FALSE ;
parser->sequence_name = NULL ;
parser->features_start = parser->features_end = 0 ;
initSources(&(parser->sources), sources);
parser->sources = sources ;
/* Check for Locus as one of the sources as this needs to be constructed as we go along. */
locus_id = zMapStyleCreateID(ZMAP_FIXED_STYLE_LOCUS_NAME) ;
if (!(parser->locus_set_style = zMapFindStyle(g_datalist_id_get_data(&(parser->sources),
locus_id),
locus_id)))
if (!(parser->locus_set_style = zMapFindStyle(parser->sources, locus_id)))
{
zMapLogWarning("Locus set will not be created, "
"could not find style \"%s\" for feature set \"%s\".",
......@@ -547,9 +533,6 @@ void zMapGFFDestroyParser(ZMapGFFParser parser)
if (!parser->parse_only && parser->feature_sets)
g_datalist_clear(&(parser->feature_sets)) ;
if(parser->sources)
g_datalist_clear(&(parser->sources));
g_free(parser) ;
return ;
......@@ -972,9 +955,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find,
/* If a feature set style or a feature style is missing then we can't carry on.
* NOTE the feature sets style has the same name as the feature set. */
if (!(feature_set_style = zMapFindStyle(g_datalist_id_get_data(&(parser->sources),
feature_set_style_id),
feature_set_style_id)))
if (!(feature_set_style = zMapFindStyle(parser->sources, feature_set_style_id)))
{
*err_text = g_strdup_printf("feature ignored, could not find style \"%s\" for feature set \"%s\".",
feature_set_name, feature_set_name) ;
......@@ -983,9 +964,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find,
return result ;
}
if (!(feature_style = zMapFindStyle(g_datalist_id_get_data(&(parser->sources),
feature_style_id),
feature_style_id)))
if (!(feature_style = zMapFindStyle(parser->sources, feature_style_id)))
{
*err_text = g_strdup_printf("feature ignored, could not find its style \"%s\".",
g_quark_to_string(feature_style_id)) ;
......@@ -1142,7 +1121,7 @@ static gboolean makeNewFeature(ZMapGFFParser parser, NameFindType name_find,
else if (feature_type == ZMAPFEATURE_ALIGNMENT)
{
/* I am not sure if we ever have target_strand, target_phase from GFF output.... */
if(feature_style->opts.parse_gaps &&
if(zMapStyleIsParseGaps(feature_style) &&
((gaps_onwards = strstr(attributes, "\tGaps ")) != NULL))
{
gaps = g_array_new(FALSE, FALSE, sizeof(ZMapAlignBlockStruct));
......@@ -1431,32 +1410,6 @@ static gboolean getFeatureName(NameFindType name_find, char *sequence, char *att
return has_name ;
}
/* This should speed things up a little as the look up will be quicker.
* We store the actual list item at the moment. This is deliberate so
* we can use the zMapFindStyle function with the list that we get
* from our g_dataset_id_get lookup...
*/
static void initSources(GData **datalist, GList *sources)
{
GList *list = NULL;
list = g_list_first(sources);
g_datalist_init(datalist);
while(list)
{
g_datalist_id_set_data_full(datalist,
((ZMapFeatureTypeStyle)list->data)->unique_id,
list,
NULL); /* MUST NOT Destroy when g_dataset_clear called */
list = list->next;
}
return ;
}
/* Format of column group attribute section is:
*
......
......@@ -30,9 +30,9 @@
*
* Exported functions: See ZMap/zmapServerPrototype.h
* HISTORY:
* Last edited: Feb 6 18:15 2007 (rds)
* Last edited: Feb 19 14:05 2007 (edgrif)
* Created: Fri Sep 10 18:29:18 2004 (edgrif)
* CVS info: $Id: fileServer.c,v 1.25 2007-02-06 18:15:47 rds Exp $
* CVS info: $Id: fileServer.c,v 1.26 2007-03-01 09:23:34 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -72,7 +72,7 @@ static gboolean createConnection(void **server_out,
char *version_str, int timeout) ;
static ZMapServerResponseType openConnection(void *server) ;
static ZMapServerResponseType getStyles(void *server, GList **styles_out) ;
static ZMapServerResponseType getStyles(void *server, GData **styles_out) ;
static ZMapServerResponseType getFeatureSets(void *server, GList **feature_sets_out) ;
static ZMapServerResponseType setContext(void *server, ZMapFeatureContext feature_context) ;
static ZMapFeatureContext copyContext(void *server_conn) ;
......@@ -213,7 +213,7 @@ static ZMapServerResponseType openConnection(void *server_in)
* something has gone wrong.
*
* */
static ZMapServerResponseType getStyles(void *server_in, GList **styles_out)
static ZMapServerResponseType getStyles(void *server_in, GData **styles_out)
{
ZMapServerResponseType result = ZMAP_SERVERRESPONSE_REQFAIL ;
FileServer server = (FileServer)server_in ;
......
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