diff --git a/blxFetch.c b/blxFetch.c index 3c158b3c885dc8638f1f9b0e19f1665428ae2131..9333e37ca438521fa494bedf7cf02b8c34c1abe3 100644 --- a/blxFetch.c +++ b/blxFetch.c @@ -38,7 +38,7 @@ * HISTORY: * Last edited: Aug 21 17:34 2009 (edgrif) * Created: Tue Jun 17 16:20:26 2008 (edgrif) - * CVS info: $Id: blxFetch.c,v 1.37 2010-09-03 11:15:38 gb10 Exp $ + * CVS info: $Id: blxFetch.c,v 1.38 2010-09-21 12:50:42 gb10 Exp $ *------------------------------------------------------------------- */ @@ -574,7 +574,7 @@ static void pfetchEntry(char *seqName, GtkWidget *blxWindow, const gboolean disp * return anything with the -F option, so if it fails we need to re-try without -F so * that at least we can display the fasta sequence. */ GString *command = g_string_sized_new(100); - g_string_append_printf(command, "pfetch --client=acedb_%s_%s -F '%s' &", g_get_host_name(), g_get_user_name(), seqName); + g_string_append_printf(command, "pfetch --client=%s_%s_%s -F '%s' &", g_get_prgname(), g_get_host_name(), g_get_user_name(), seqName); GString *resultText = getExternalCommandOutput(command->str); @@ -583,7 +583,7 @@ static void pfetchEntry(char *seqName, GtkWidget *blxWindow, const gboolean disp g_string_truncate(command, 0); g_string_truncate(resultText, 0); - g_string_append_printf(command, "pfetch --client=acedb_%s_%s -C '%s' &", g_get_host_name(), g_get_user_name(), seqName); + g_string_append_printf(command, "pfetch --client=%s_%s_%s -C '%s' &", g_get_prgname(), g_get_host_name(), g_get_user_name(), seqName); resultText = getExternalCommandOutput(command->str); } diff --git a/blxdotter.c b/blxdotter.c index 97497f6db57008387caf3e6bd993b8cfddb75326..0e514378124a2333bd245f776417ad4dd172b3c4 100644 --- a/blxdotter.c +++ b/blxdotter.c @@ -20,17 +20,19 @@ typedef struct _DotterDialogData { - GtkWidget *blxWindow; + GtkWidget *blxWindow; /* pointer to the main blixem window */ - GtkWidget *autoButton; - GtkWidget *manualButton; + GtkWidget *autoButton; /* the radio button on the dialog for automatic dotter parameters */ + GtkWidget *manualButton; /* the radio button on the dialog for manual dotter parameters */ - GtkWidget *startEntry; - GtkWidget *endEntry; - GtkWidget *zoomEntry; + GtkWidget *startEntry; /* the text entry box on the dialog for the start coord */ + GtkWidget *endEntry; /* the text entry box on the dialog for the end coord */ + GtkWidget *zoomEntry; /* the text entry box on the dialog for the zoom value */ - gboolean callOnSelf; - gboolean hspsOnly; + gboolean callOnSelf; /* whether to call dotter on the query seq versus itself */ + gboolean hspsOnly; /* whether to call dotter on HSPs only */ + + char *dotterSSeq; /* the match sequence to call dotter on */ } DotterDialogData; @@ -44,7 +46,8 @@ typedef enum { BLX_DOTTER_ERROR_NOT_FOUND, /* failed to find the sequence */ BLX_DOTTER_ERROR_NO_REF_SEQ, /* failed to find the query sequence segment */ BLX_DOTTER_ERROR_INTERNAL_SEQ, /* using internally-stored sequence (because fetch failed) */ - BLX_DOTTER_ERROR_NO_MATCHES /* there are no matches on the requested sequence */ + BLX_DOTTER_ERROR_NO_MATCHES, /* there are no matches on the requested sequence */ + BLX_DOTTER_ERROR_NO_SEQ_DATA /* the match sequence has no sequence data (e.g. if could not pfetch it) */ } BlxDotterError; @@ -54,7 +57,6 @@ static gboolean smartDotterRange(GtkWidget *blxWindow, const char *dotterS static gboolean smartDotterRangeSelf(GtkWidget *blxWindow, int *dotter_start_out, int *dotter_end_out, GError **error); static char* fetchSeqRaw(const char *seqname, const char *fetchMode); static char* fetchSequence(const char *seqname, char *fetch_prog); -static char* getDotterSSeq(GtkWidget *blxWindow, GError **error); static gboolean callDotterSelf(GtkWidget *blxWindow, GError **error); @@ -223,7 +225,7 @@ static void onSelfButtonToggled(GtkWidget *button, gpointer data) int autoStart = UNSET_INT, autoEnd = UNSET_INT; const gboolean autoDotter = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dialogData->autoButton)); - getDotterRange(dialogData->blxWindow, getDotterSSeq(dialogData->blxWindow, NULL), dialogData->callOnSelf, autoDotter, &autoStart, &autoEnd, NULL, NULL); + getDotterRange(dialogData->blxWindow, dialogData->dotterSSeq, dialogData->callOnSelf, autoDotter, &autoStart, &autoEnd, NULL, NULL); if (autoStart == UNSET_INT) autoStart = bc->displayRev ? bc->refSeqRange.max : bc->refSeqRange.min; @@ -274,7 +276,7 @@ static void onResponseDotterDialog(GtkDialog *dialog, gint responseId, gpointer } else { - destroy = callDotter(dialogData->blxWindow, dialogData->hspsOnly, &error); + destroy = callDotter(dialogData->blxWindow, dialogData->hspsOnly, dialogData->dotterSSeq, &error); } } else @@ -325,7 +327,7 @@ static void onRadioButtonToggled(GtkWidget *button, gpointer data) { /* Recalculate auto start/end in case user has selected a different sequence */ int autoStart = UNSET_INT, autoEnd = UNSET_INT; - getDotterRange(dialogData->blxWindow, getDotterSSeq(dialogData->blxWindow, NULL), dialogData->callOnSelf, TRUE, &autoStart, &autoEnd, NULL, NULL); + getDotterRange(dialogData->blxWindow, dialogData->dotterSSeq, dialogData->callOnSelf, TRUE, &autoStart, &autoEnd, NULL, NULL); if (autoStart == UNSET_INT) autoStart = bc->displayRev ? bc->refSeqRange.max : bc->refSeqRange.min; @@ -530,6 +532,7 @@ void showDotterDialog(GtkWidget *blxWindow, const gboolean bringToFront) dialogData->zoomEntry = zoomEntry; dialogData->callOnSelf = FALSE; dialogData->hspsOnly = FALSE; + dialogData->dotterSSeq = getDotterSSeq(blxWindow, NULL); /* There is an issue if the user selects a different sequence while the dotter dialog * is still open: the auto range does not update automatically for the new sequence. To @@ -648,8 +651,8 @@ static gboolean getDotterRange(GtkWidget *blxWindow, * This function assumes that if multiple MSPs are selected, that they are all for * the same match sequence. Returns null if no MSPs are selected, with details of the error * in 'error'. If the sequence was found but there were warnings, it returns non-null with - * the warnings in 'error'. */ -static char* getDotterSSeq(GtkWidget *blxWindow, GError **error) + * the warnings in 'error'. The return value should be free'd with g_free */ +char* getDotterSSeq(GtkWidget *blxWindow, GError **error) { g_return_val_if_fail(!error || *error == NULL, FALSE); /* if error is passed, its contents must be NULL */ @@ -956,8 +959,8 @@ static char *fetchSequence(const char *seqname, char *fetch_prog) { /* --client gives logging information to pfetch server, * -q Sequence only output (one line) */ - fetchstr = hprintf(0, "%s --client=acedb_%s_%s -q '%s' &", - fetch_prog, getSystemName(), getLogin(TRUE), seqname) ; + fetchstr = hprintf(0, "%s --client=%s_%s_%s -q '%s' &", + fetch_prog, g_get_prgname(), getSystemName(), getLogin(TRUE), seqname) ; } else { @@ -1028,7 +1031,7 @@ static char *fetchSequence(const char *seqname, char *fetch_prog) /* Call dotter. Returns true if dotter was called; false if we quit trying. */ -gboolean callDotter(GtkWidget *blxWindow, const gboolean hspsOnly, GError **error) +gboolean callDotter(GtkWidget *blxWindow, const gboolean hspsOnly, char *dotterSSeqIn, GError **error) { g_return_val_if_fail(!error || *error == NULL, FALSE); /* if error is passed, its contents must be NULL */ BlxViewContext *bc = blxWindowGetContext(blxWindow); @@ -1056,18 +1059,22 @@ gboolean callDotter(GtkWidget *blxWindow, const gboolean hspsOnly, GError **erro return FALSE; } - /* Get the match sequence. */ - GError *tmpError = NULL; - char *dotterSSeq = getDotterSSeq(blxWindow, &tmpError); - - if (!dotterSSeq) + /* Make a copy of the match sequence, because dotter takes ownership of this. */ + char *dotterSSeq = NULL; + if (dotterSSeqIn) { - g_propagate_error(error, tmpError); + dotterSSeq = g_strdup(dotterSSeqIn); + } + else + { + g_set_error(error, BLX_DOTTER_ERROR, BLX_DOTTER_ERROR_NO_SEQ_DATA, "No sequence data for this sequence.\n"); return FALSE; } /* Get the coords */ int dotterStart = UNSET_INT, dotterEnd = UNSET_INT, dotterZoom = 0; + GError *tmpError = NULL; + if (!getDotterRange(blxWindow, dotterSSeq, FALSE, bc->autoDotter, &dotterStart, &dotterEnd, &dotterZoom, &tmpError)) { g_propagate_error(error, tmpError); diff --git a/blxdotter.h b/blxdotter.h index 6359e104410a581d704d2c0483e95361e7411509..9e2d81cd3bc53fe96a631fc0862b9a665b49a5bf 100644 --- a/blxdotter.h +++ b/blxdotter.h @@ -19,7 +19,8 @@ void showDotterDialog(GtkWidget *blxWindow, const gboolean bringToFront); -gboolean callDotter(GtkWidget *blxWindow, const gboolean hspsOnly, GError **error); +gboolean callDotter(GtkWidget *blxWindow, const gboolean hspsOnly, char *dotterSSeq, GError **error); +char* getDotterSSeq(GtkWidget *blxWindow, GError **error); #endif /* _blx_dotter_h_included_ */ diff --git a/blxview.c b/blxview.c index 5b49c09c09bda854afa141c1ba03ef4af262a87e..28ac5f5a1f1610648ff120d3cb05f82b771da353 100644 --- a/blxview.c +++ b/blxview.c @@ -88,7 +88,7 @@ 01-10-05 Added getsseqsPfetch to fetch all missing sseqs in one go via socket connection to pfetch [RD] * Created: Thu Feb 20 10:27:39 1993 (esr) - * CVS info: $Id: blxview.c,v 1.65 2010-09-03 11:15:38 gb10 Exp $ + * CVS info: $Id: blxview.c,v 1.66 2010-09-21 12:50:43 gb10 Exp $ *------------------------------------------------------------------- */ @@ -767,7 +767,13 @@ static void blviewCreate(char *opts, blxWindowSelectSeq(blixemWindow, options->mspList->sSequence); GError *error = NULL; - callDotter(blixemWindow, FALSE, &error); + char *dotterSSeq = getDotterSSeq(blixemWindow, &error); + + if (!error) + { + callDotter(blixemWindow, FALSE, dotterSSeq, &error); + } + reportAndClearIfError(&error, G_LOG_LEVEL_CRITICAL); } diff --git a/blxwindow.c b/blxwindow.c index c47f15536fcaab7e26e80e0926b7d5cf15b24ee0..7016bb984a20bcb282b937f9ac81e76c30d58e66 100755 --- a/blxwindow.c +++ b/blxwindow.c @@ -5376,7 +5376,7 @@ GtkWidget* createBlxWindow(CommandLineOptions *options, /* Realise the widgets */ - printf("Starting Blixem\n"); + g_debug("Running %s\n", g_get_prgname()); gtk_widget_show_all(window); /* If the options don't say to show the reverse strand grid, hide it now. (This must be done diff --git a/detailview.c b/detailview.c index edc6ce74634d0b2ed41aedfdb457be7415604f73..cb9b7d4849265ed0d979e7cd7aed21ad0b4853ed 100755 --- a/detailview.c +++ b/detailview.c @@ -181,7 +181,7 @@ static const char* findFixedWidthFontFamily(GtkWidget *widget, GList *pref_famil if (match_family) { result = pango_font_family_get_name(match_family); - printf("Using fixed-width font '%s'\n", result); + g_debug("Using fixed-width font '%s'\n", result); } else {