Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zmap
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
zmap
Commits
50e967e6
Commit
50e967e6
authored
19 years ago
by
edgrif
Browse files
Options
Downloads
Patches
Plain Diff
add functions to validate feature poitners, add features to sets, remove features.
parent
b0cc4273
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/include/ZMap/zmapFeature.h
+23
-7
23 additions, 7 deletions
src/include/ZMap/zmapFeature.h
src/zmapFeature/zmapFeature.c
+132
-11
132 additions, 11 deletions
src/zmapFeature/zmapFeature.c
with
155 additions
and
18 deletions
src/include/ZMap/zmapFeature.h
+
23
−
7
View file @
50e967e6
/* File: zmapFeature.h
* Author: Ed Griffiths (edgrif@sanger.ac.uk)
* Copyright (c) Sanger Institute, 2004
...
...
@@ -26,9 +25,9 @@
* Description: Data structures describing a sequence feature.
*
* HISTORY:
* Last edited: Jan
5 16:36
2006 (edgrif)
* Last edited: Jan
13 14:52
2006 (edgrif)
* Created: Fri Jun 11 08:37:19 2004 (edgrif)
* CVS info: $Id: zmapFeature.h,v 1.5
4
2006-01-
06 16:19
:3
1
edgrif Exp $
* CVS info: $Id: zmapFeature.h,v 1.5
5
2006-01-
13 18:46
:3
2
edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_FEATURE_H
...
...
@@ -424,10 +423,13 @@ typedef struct ZMapFeatureTypeStyleStruct_
char
*
description
;
/* Description of what this style
represents. */
/* I'm not sure this will work...how will we know ?? if there no features then we can't get
* the style...but lets leave this as a place holder.... */
/* I don't want a general show/hide flag here because we should get that dynamically from the
* state of the column canvas item. */
gboolean
hide_initially
;
/* Is the column hidden initially ? */
gboolean
show_when_empty
;
/* If TRUE, features column is
displayed even if there are no features. */
GdkColor
foreground
;
/* Overlaid on background. */
GdkColor
background
;
/* Fill colour. */
GdkColor
outline
;
/* Surround/line colour. */
...
...
@@ -518,6 +520,13 @@ ZMapFeature zMapFeatureFindFeatureInSet(ZMapFeatureSet feature_set, GQuark featu
GData
*
zMapFeatureFindSetInContext
(
ZMapFeatureContext
feature_context
,
GQuark
set_id
)
;
gboolean
zMapFeatureIsValid
(
ZMapFeatureAny
any_feature
)
;
gboolean
zMapFeatureTypeIsValid
(
ZMapFeatureStuctType
group_type
)
;
ZMapFeatureAny
zMapFeatureGetParentGroup
(
ZMapFeatureAny
any_feature
,
ZMapFeatureStuctType
group_type
)
;
ZMapFeatureContext
zMapFeatureContextCreate
(
char
*
sequence
,
int
start
,
int
end
,
GList
*
styles
,
GList
*
feature_set_names
)
;
gboolean
zMapFeatureContextMerge
(
ZMapFeatureContext
*
current_context_inout
,
...
...
@@ -570,14 +579,21 @@ ZMapFeatureTypeStyle zMapFeatureGetStyle(ZMapFeature feature) ;
ZMapFeatureSet
zMapFeatureGetSet
(
ZMapFeature
feature
)
;
void
zmapFeatureDestroy
(
ZMapFeature
feature
)
;
ZMapFeatureSet
zMapFeatureSetCreate
(
char
*
source
,
GData
*
features
)
;
ZMapFeatureSet
zMapFeatureSetIDCreate
(
GQuark
original_id
,
GQuark
unique_id
,
GData
*
features
)
;
void
zMapFeatureSetAddFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
;
gboolean
zMapFeatureSetAddFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
;
gboolean
zMapFeatureSetRemoveFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
;
char
*
zMapFeatureSetGetName
(
ZMapFeatureSet
feature_set
)
;
gboolean
zMapFeatureSetFindFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
;
void
zMapFeatureSetDestroy
(
ZMapFeatureSet
feature_set
,
gboolean
free_data
)
;
ZMapFeatureAny
zMapFeatureGetGroup
(
ZMapFeatureAny
any_feature
,
ZMapFeatureStuctType
group_type
)
;
/* Style functions. */
GList
*
zMapStylesGetNames
(
GList
*
styles
)
;
ZMapFeatureTypeStyle
zMapFeatureTypeCreate
(
char
*
name
,
char
*
outline
,
char
*
foreground
,
char
*
background
,
...
...
This diff is collapsed.
Click to expand it.
src/zmapFeature/zmapFeature.c
+
132
−
11
View file @
50e967e6
...
...
@@ -27,9 +27,9 @@
*
* Exported functions: See zmapView_P.h
* HISTORY:
* Last edited:
Nov 22 11
:4
1
200
5
(edgrif)
* Last edited:
Jan 13 18
:4
5
200
6
(edgrif)
* Created: Fri Jul 16 13:05:58 2004 (edgrif)
* CVS info: $Id: zmapFeature.c,v 1.
29
200
5-11-24 15:53:29
edgrif Exp $
* CVS info: $Id: zmapFeature.c,v 1.
30
200
6-01-13 18:46:31
edgrif Exp $
*-------------------------------------------------------------------
*/
...
...
@@ -104,6 +104,80 @@ static void removeNotFreeFeatureSet(GQuark key_id, gpointer data, gpointer user_
/*!
* Function to do some validity checking on a ZMapFeatureAny struct. Always more you
* could do but this is better than nothing.
*
* Returns TRUE if the struct is OK, FALSE otherwise.
*
* @param any_feature The feature to validate.
* @return gboolean TRUE if feature is valid, FALSE otherwise.
* */
gboolean
zMapFeatureIsValid
(
ZMapFeatureAny
any_feature
)
{
gboolean
result
=
FALSE
;
if
(
any_feature
&&
zMapFeatureTypeIsValid
(
any_feature
->
struct_type
)
&&
any_feature
->
unique_id
!=
ZMAPFEATURE_NULLQUARK
&&
any_feature
->
original_id
!=
ZMAPFEATURE_NULLQUARK
)
result
=
TRUE
;
return
result
;
}
gboolean
zMapFeatureTypeIsValid
(
ZMapFeatureStuctType
group_type
)
{
gboolean
result
=
FALSE
;
if
(
group_type
>=
ZMAPFEATURE_STRUCT_CONTEXT
&&
group_type
<=
ZMAPFEATURE_STRUCT_FEATURE
)
result
=
TRUE
;
return
result
;
}
/*!
* Function to return the _parent_ group of group_type of the feature any_feature.
* This is a generalised function to stop all the poking about through the context
* hierachy that is otherwise required. Note you can only go _UP_ the tree with
* this function because going down is a one-to-many mapping.
*
* Returns the feature group or NULL if there is no parent group or there is some problem
* with the arguments like asking for a group at or below the level of any_feature.
*
* @param any_feature The feature for which you wish to find the parent group.
* @param group_type The type/level of the parent group you want to find.
* @return ZMapFeatureAny The parent group or NULL.
* */
ZMapFeatureAny
zMapFeatureGetParentGroup
(
ZMapFeatureAny
any_feature
,
ZMapFeatureStuctType
group_type
)
{
ZMapFeatureAny
result
=
NULL
;
zMapAssert
(
zMapFeatureIsValid
(
any_feature
)
&&
group_type
>=
ZMAPFEATURE_STRUCT_CONTEXT
&&
group_type
<=
ZMAPFEATURE_STRUCT_FEATURE
)
;
if
(
any_feature
->
struct_type
>
group_type
)
{
ZMapFeatureAny
group
=
any_feature
;
while
(
group
->
struct_type
>
group_type
)
{
group
=
group
->
parent
;
}
result
=
group
;
}
return
result
;
}
/*!
* Returns TRUE if feature context has DNA, FALSE otherwise.
...
...
@@ -156,6 +230,11 @@ ZMapFeature zmapFeatureCreateEmpty(void)
/*!
* Adds the standard data fields to an empty feature.
* */
...
...
@@ -307,8 +386,6 @@ gboolean zMapFeatureAddAlignmentData(ZMapFeature feature,
}
/*!
* Destroys a feature, freeing up all of its resources.
*
...
...
@@ -378,21 +455,65 @@ ZMapFeatureSet zMapFeatureSetIDCreate(GQuark original_id, GQuark unique_id, GDat
}
/* Features must not be null to be added we need at least the feature id and probably should.
* check for more. */
void
zMapFeatureSetAddFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
/* Feature must not be null to be added we need at least the feature id and probably should.
* check for more.
*
* Returns FALSE if feature is already in set.
* */
gboolean
zMapFeatureSetAddFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
{
gboolean
result
=
FALSE
;
zMapAssert
(
feature_set
&&
feature
&&
feature
->
unique_id
!=
ZMAPFEATURE_NULLQUARK
)
;
feature
->
parent
=
(
ZMapFeatureAny
)
feature_set
;
if
(
!
zMapFeatureSetFindFeature
(
feature_set
,
feature
))
{
feature
->
parent
=
(
ZMapFeatureAny
)
feature_set
;
g_datalist_id_set_data_full
(
&
(
feature_set
->
features
),
feature
->
unique_id
,
feature
,
destroyFeature
)
;
g_datalist_id_set_data_full
(
&
(
feature_set
->
features
),
feature
->
unique_id
,
feature
,
destroyFeature
)
;
return
;
result
=
TRUE
;
}
return
result
;
}
/* Returns TRUE if the feature could be found in the feature_set, FALSE otherwise. */
gboolean
zMapFeatureSetFindFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
{
gboolean
result
=
FALSE
;
zMapAssert
(
feature_set
&&
feature
)
;
if
(
g_datalist_id_get_data
(
&
(
feature_set
->
features
),
feature
->
unique_id
))
result
=
TRUE
;
return
result
;
}
/* Feature must exist in set to be removed.
*
* Returns FALSE if feature is not in set.
* */
gboolean
zMapFeatureSetRemoveFeature
(
ZMapFeatureSet
feature_set
,
ZMapFeature
feature
)
{
gboolean
result
=
FALSE
;
zMapAssert
(
feature_set
&&
feature
&&
feature
->
unique_id
!=
ZMAPFEATURE_NULLQUARK
)
;
if
(
zMapFeatureSetFindFeature
(
feature_set
,
feature
))
{
g_datalist_id_remove_data
(
&
(
feature_set
->
features
),
feature
->
unique_id
)
;
result
=
TRUE
;
}
return
result
;
}
void
zMapFeatureSetDestroy
(
ZMapFeatureSet
feature_set
,
gboolean
free_data
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment