From eaa53c31cf02e3fbfb8e6c70adf82be70ab9cca1 Mon Sep 17 00:00:00 2001
From: rds <rds>
Date: Fri, 24 Oct 2008 14:01:12 +0000
Subject: [PATCH] Addition of code to return fasta sequence of isoforms. This
 is achieved by dropping the -F flag when there's a '-' in the sequence name.

---
 src/libpfetch/libpfetch.c   | 27 ++++++++++++++++++++++++---
 src/libpfetch/libpfetch_I.h |  6 ++++--
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/src/libpfetch/libpfetch.c b/src/libpfetch/libpfetch.c
index 7789b709a..1d1f8bea6 100755
--- a/src/libpfetch/libpfetch.c
+++ b/src/libpfetch/libpfetch.c
@@ -27,9 +27,9 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Oct 23 13:29 2008 (rds)
+ * Last edited: Oct 24 14:26 2008 (rds)
  * Created: Fri Apr  4 14:21:42 2008 (rds)
- * CVS info:   $Id: libpfetch.c,v 1.5 2008-10-23 12:31:41 rds Exp $
+ * CVS info:   $Id: libpfetch.c,v 1.6 2008-10-24 14:01:12 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -201,6 +201,12 @@ static void pfetch_handle_class_init(PFetchHandleClass pfetch_class)
 						       "Search EMBL and UniProtKB archive, including current data",
 						       FALSE, PFETCH_PARAM_STATIC_RW));
 
+  g_object_class_install_property(gobject_class,
+				  PFETCH_UNIPROT_ISOFORM_SEQ, 
+				  g_param_spec_boolean("isoform-seq", "isoform-seq", 
+						       "Return the fasta entry for an isofrom as the -F entries don't exist.",
+						       FALSE, PFETCH_PARAM_STATIC_RW));
+
   g_object_class_install_property(gobject_class,
 				  PFETCH_DEBUG, 
 				  g_param_spec_boolean("debug", "debug", 
@@ -304,6 +310,9 @@ static void pfetch_handle_set_property(GObject *gobject, guint param_id, const G
 
       pfetch_handle->location = g_value_dup_string(value);
 
+      break;
+    case PFETCH_UNIPROT_ISOFORM_SEQ:
+      pfetch_handle->opts.isoform_seq = g_value_get_boolean(value);
       break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, param_id, pspec);
@@ -335,6 +344,9 @@ static void pfetch_handle_get_property(GObject *gobject, guint param_id, GValue
     case PFETCH_LOCATION:
       g_value_set_string(value, pfetch_handle->location);
       break;
+    case PFETCH_UNIPROT_ISOFORM_SEQ:
+      g_value_set_boolean(value, pfetch_handle->opts.isoform_seq);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, param_id, pspec);
       break;
@@ -364,9 +376,18 @@ static void pfetch_handle_finalize (GObject *object)
 static void pfetch_get_argv(PFetchHandle handle, char *seq, char **argv)
 {
   int current = 0;
+  gboolean add_F = FALSE;
   argv[current++] = handle->location;
 
-  if(handle->opts.full)
+  add_F = handle->opts.full;
+
+  if(handle->opts.isoform_seq)
+    {
+      if(g_strstr_len(seq, -1, "-"))
+	add_F = FALSE;
+    }
+
+  if(add_F)
     argv[current++] = "-F";
 
   if(seq != NULL)
diff --git a/src/libpfetch/libpfetch_I.h b/src/libpfetch/libpfetch_I.h
index 3d1874fa6..77dd82156 100755
--- a/src/libpfetch/libpfetch_I.h
+++ b/src/libpfetch/libpfetch_I.h
@@ -27,9 +27,9 @@
  *
  * Exported functions: See XXXXXXXXXXXXX.h
  * HISTORY:
- * Last edited: Jun  5 09:41 2008 (rds)
+ * Last edited: Oct 24 14:22 2008 (rds)
  * Created: Fri Apr  4 14:20:41 2008 (rds)
- * CVS info:   $Id: libpfetch_I.h,v 1.1 2008-06-05 09:49:50 rds Exp $
+ * CVS info:   $Id: libpfetch_I.h,v 1.2 2008-10-24 14:01:12 rds Exp $
  *-------------------------------------------------------------------
  */
 
@@ -56,6 +56,7 @@ enum
     PFETCH_DEBUG,
     PFETCH_LOCATION,
     PFETCH_PORT,
+    PFETCH_UNIPROT_ISOFORM_SEQ,
     /* http specific stuff */
     PFETCH_COOKIE_JAR,
     PFETCH_URL,			/* same as location */
@@ -159,6 +160,7 @@ typedef struct _pfetchHandleStruct
     unsigned int full    : 1;
     unsigned int archive : 1;
     unsigned int debug   : 1;
+    unsigned int isoform_seq : 1;
   }opts;
 
 } pfetchHandleStruct;
-- 
GitLab