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

add zMapFeatureCreateID() and zMapFeatureSetCoords() functions for handling...

add zMapFeatureCreateID() and zMapFeatureSetCoords() functions for handling feature datalist ids and coordinates.
parent 9285f37c
No related branches found
No related tags found
No related merge requests found
......@@ -25,9 +25,9 @@
* Description: Data structures describing a genetic feature.
*
* HISTORY:
* Last edited: Nov 4 10:30 2004 (rnc)
* Last edited: Nov 19 13:45 2004 (edgrif)
* Created: Fri Jun 11 08:37:19 2004 (edgrif)
* CVS info: $Id: zmapFeature.h,v 1.17 2004-11-08 10:19:52 rnc Exp $
* CVS info: $Id: zmapFeature.h,v 1.18 2004-11-19 14:32:41 edgrif Exp $
*-------------------------------------------------------------------
*/
#ifndef ZMAP_FEATURE_H
......@@ -245,6 +245,10 @@ typedef struct ZMapFeatureContextStruct_
ZMapFeature zmapFeatureCreate(void) ;
char *zMapFeatureCreateID(ZMapFeatureType feature_type, char *feature_name,
int start, int end, int query_start, int query_end) ;
gboolean zMapFeatureSetCoords(ZMapStrand strand, int *start, int *end,
int *query_start, int *query_end) ;
gboolean zmapFeatureAugmentData(ZMapFeature feature, char *name,
char *sequence, char *source, ZMapFeatureType feature_type,
int start, int end, double score, ZMapStrand strand,
......@@ -449,4 +453,5 @@ typedef void (*Calc_cb) (void *seqRegion,
char *zmapLookUpEnum (int id, int enumType);
void zmapFeatureDump(ZMapFeatureContext feature_context, char *file, int format);
#endif /* ZMAP_FEATURE_H */
......@@ -26,9 +26,13 @@
* 1
* Exported functions: See zmapFeature.h
* HISTORY:
<<<<<<< zmapFeature.c
* Last edited: Nov 19 11:46 2004 (edgrif)
=======
* Last edited: Nov 15 10:35 2004 (rnc)
>>>>>>> 1.6
* Created: Tue Nov 2 2004 (rnc)
* CVS info: $Id: zmapFeature.c,v 1.6 2004-11-15 10:37:32 rnc Exp $
* CVS info: $Id: zmapFeature.c,v 1.7 2004-11-19 14:32:14 edgrif Exp $
*-------------------------------------------------------------------
*/
......@@ -71,6 +75,56 @@ char *zmapLookUpEnum(int id, int enumType)
return NULL;
}
char *zMapFeatureCreateID(ZMapFeatureType feature_type, char *feature_name,
int start, int end, int query_start, int query_end)
{
char *feature_id = NULL ;
if (feature_type == ZMAPFEATURE_HOMOL)
feature_id = g_strdup_printf("%s.%d-%d-%d-%d", feature_name, start, end, query_start, query_end) ;
else
feature_id = g_strdup_printf("%s.%d-%d", feature_name, start, end) ;
return feature_id ;
}
/* In zmap we hold coords in the forward orientation always and get strand from the strand
* member of the feature struct. This function looks at the supplied strand and sets the
* coords accordingly. */
/* ACTUALLY I REALISE I'M NOT QUITE SURE WHAT I WANT THIS FUNCTION TO DO.... */
gboolean zMapFeatureSetCoords(ZMapStrand strand, int *start, int *end, int *query_start, int *query_end)
{
gboolean result = FALSE ;
if (strand == ZMAPSTRAND_UP)
{
if ((start && end) && start > end)
{
int tmp ;
tmp = *start ;
*start = *end ;
*end = tmp ;
if (query_start && query_end)
{
tmp = *query_start ;
*query_start = *query_end ;
*query_end = tmp ;
}
result = TRUE ;
}
}
else
result = TRUE ;
return result ;
}
void zmapFeatureDump(ZMapFeatureContext feature_context, char *file, int format)
{
......
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