src/hg/instinct/hgPathways/hgPathways.h 1.4

1.4 2009/11/07 00:35:49 sbenz
Bunch of updates to make this work, and slightly change the UI
Index: src/hg/instinct/hgPathways/hgPathways.h
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/instinct/hgPathways/hgPathways.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -b -B -U 1000000 -r1.3 -r1.4
--- src/hg/instinct/hgPathways/hgPathways.h	18 May 2009 20:52:17 -0000	1.3
+++ src/hg/instinct/hgPathways/hgPathways.h	7 Nov 2009 00:35:49 -0000	1.4
@@ -1,268 +1,268 @@
 /* hgHeatmap.h - Include file used by hgHeatmap. 
  * hgHeatmap is a CGI script that produces a web page containing
  * a graphic with all chromosomes in genome */
 
 #ifndef HGHEATMAP2_H
 #define HGHEATMAP2_H
 
 #define VERSION "1.0"
 #define DEBUG_IMG 1           // Will always write new images. 
 #define MAX_NUM_RESPONSE 100  // maximum number of objects in JSON response
 #define MIN_HEATMAP_HEIGHT 100  // minimum height of a heatmap
 
 #include "cart.h"
 #include "genoLay.h"
 #include "hgHeatmapLib.h"
 #include "featuresLib.h"
 #include "filterFeatures.h"
 
 #define DEBUG 1
 
 /*** Prefixes for variables in cart we don't share with other apps. ***/
 #define hghPrefix "hgHeatmap_"
 #define hghDo hghPrefix "do"
 
 #define hghTableName hghPrefix "tableName"
 
-#define hghPathwayModuleID	2
+#define hghPathwayModuleID	3
 
 /*** Our various cart variables. ***/
 #define hghHeatmap hghPrefix "heatmap"
 #define hghDataSet hghPrefix "dataset"
 #define hghDisplayType hghPrefix "display"
 #define hghGhName hghPrefix "ghName"
 #define hghMaxGapToFill hghPrefix "maxGapToFill"
 #define hghImageWidth hghPrefix "imageWidth"
 #define hghDataConfigPrefix hghPrefix "data_" 
 
 /** Commands from Javascript client **/
 
 #define hgh2Prefix "hgh2_"
 
 /* Obtaining Heatmaps */
 #define hgh2Mode hgh2Prefix "mode"
 #define hgh2PathwayID hgh2Prefix "pathwayID"
 #define hgh2AnalysisID hgh2Prefix "analysisID"
 
 /* Some from the original API */
 #define hgh2Dataset hgh2Prefix "dataset"
 #define hgh2FeatureList hgh2Prefix "featureList"
 #define hgh2Width hgh2Prefix "width"
 #define hgh2SortGene hgh2Prefix "sortGene"
 #define hgh2SortDir hgh2Prefix "sortDir"
 #define hgh2FeatureSort hgh2Prefix "featureSort"
 #define hgh2FeatureSortDir hgh2Prefix "featureSortDir"
 
 /* Subgrouping */
 #define hgh2SubgroupNum hgh2Prefix "subgroupNum"
 #define hgh2Subgroup1Features hgh2Prefix "subgroup1Features"
 #define hgh2Subgroup1Mins hgh2Prefix "subgroup1Mins"
 #define hgh2Subgroup1Maxs hgh2Prefix "subgroup1Maxs"
 #define hgh2Subgroup2Features hgh2Prefix "subgroup2Features"
 #define hgh2Subgroup2Mins hgh2Prefix "subgroup2Mins"
 #define hgh2Subgroup2Maxs hgh2Prefix "subgroup2Maxs"
 
 #define hgh2Subgroup1CodedFeatures hgh2Prefix "subgroup1CodedFeatures"
 #define hgh2Subgroup1Codes hgh2Prefix "subgroup1Codes"
 #define hgh2Subgroup2CodedFeatures hgh2Prefix "subgroup2CodedFeatures"
 #define hgh2Subgroup2Codes hgh2Prefix "subgroup2Codes"
 
 
 /* Circle Map */
 #define hgh2Gene hgh2Prefix "gene"
 #define hgh2Summarize hgh2Prefix "summarize"
 #define hgh2SummaryDisplay hgh2Prefix "summaryDisplay"
 
 /*** Name prefixes to separate user from db graphs. */
 #define hghUserTag "user: "
 #define hghDbTag "db: "
 
 #define hghVis hghPrefix "vis"
 #define hghBetweenRowPad 3
 #define hghBetweenVPad 2
 #define SMALL_SPACING 1
 #define hgHeatmapDefaultPixWidth 700
 #define hgFeatureDefaultPixWidth 250
 #define hgDefaultScalePixWidth 60
 #define hgHeatmapDefaultCircleWidth 50
 #define hgDefaultGenomeScalePixHeight 20
 #define hgHeatmapDefaultLabelHeight 15
 
 #define hgHeatmapDefaultSummaryHeight 150
 #define hgSampleHeightDefault 1
 #define hghSubgroupDefaultPixWidth 10
 #define hghTrackContrlBar 10
 #define hghFeatureLabel 80
 #define hghGeneSetLabel 120
 #define hghGeneLabelHeight 50
 #define hghGeneLabelMinSize 7   /* max number of genes to display gene labels*/
 #define hgh2SubgroupDefaultNum 2
 #define hghBed5Height 40
 #define hghProbCutoff 1.3       /* Equivalent of p<0.05 in -log10(p) */
 
 /* ---- Global variables declared in hgHeatmap.c */
 extern struct cart *cart;	/* This holds cgi and other variables between clicks. */
 
 struct hmPixel {
     struct hmPixel *next;
     int x;
     int y;
     int w;
     int h;
     
     double val;
     int count;
     Color color;
 
     struct slDouble *valList;
     double sum;
     double avg;
     double median;  // median
     double lowQ;    // low quantile
     double highQ;   // high quantile
     double lowW;    // low whisker
     double highW;   // high whisker
 
     double val2;    // TODO: A temporary hack
     int count2;
 };
 
 struct hmElement {
     struct hmElement *next;
 
     char *name;
     int pixelStart;
     int pixelEnd;
 
     unsigned long baseStart;  // only for chrom
     unsigned long baseEnd;    // only for chrom
 
     char *shortLabel;         // only for feature
     char *longLabel;          // only for feature
 
     char *probeName;           // only for geneset hmElement
     struct bed *bed;           // only for geneset hmElement
 };
 
 struct heatmapLay {
     struct heatmapLay *next;
 
     char *name;
     int width;
     int height;
 
     int genesetLabelHeight;
     int sampleHeight;
     double basesPerPixel;
 
     int pixelStart;
     int pixelEnd;
     
     MgFont *font;
     int fontHeight;
 
     /* For scales */
     int maxValPos;
     double maxVal;
     int minValPos;
     double minVal;
 
     struct hmElement *elements;
 
     struct rgbColor *lowColor;
     struct rgbColor *zeroColor;
     struct rgbColor *highColor;
 };
 
 /* next two structs are used to group datasets for display */
 struct dataset {
     struct dataset *next; 
 
     char *name;
     char *shortLabel;
     char *longLabel;
     char *url;
     int expCount;
 };
 
 struct datasetGroup {
     struct datasetGroup *next; 
 
     char *name;
     struct dataset *datasets;
 };
    
 /*** Functions imported from other modules. ***/
 
 void printMainHelp();
 /* Put up main page help info. */
 
 char *cartSettingsString(char *prefix, char *functionName);
 
 void trashDirMD5File(struct tempName *tn, char *dirName, char *suffix, char *strToHash);
 
 char *retrieveSettings(struct cart *cart, char *key);
 /* Retrieves settings according to unique key... if key is NULL, then session according to 
  * user id is returned.  If no session exists, NULL is returned. */
 
 int saveUserSettings(struct cart *cart, char *vars);  
 /* Saves settings in vars to mysql database, one entry in db per user-id.
  * -1 is returned if problem occurred. */
 
 struct slName *getGenesMatchingList(char *searchGenes); 
 
 struct slName *getGenesMatching(char *searchGene); 
 
 struct slName *getGenesNotMatching(char *searchGenes);
 
 struct slName *getGenesetsMatching(struct cart *cart, char *searchGenes, char *searchGenesets);
 
 char *getDescriptionOfGeneset(char *geneset);
  
 char *storeUserGeneset(struct cart *cart, char *name, char *geneList);
 
 struct geneSet *getAllPathways(struct cart *cart, char *db, char *pathwayNames);
 
 struct slName *getGenesInGeneset(struct cart *cart, char *geneset);
 
 char *annotationGif(struct heatmapLay *hl, char *table);
 
 void vgMakeColorGradient(struct vGfx *vg,
 			 struct rgbColor *start, struct rgbColor *end,
 			 int steps, Color *colorIxs);
 
 boolean singleChromImage(struct heatmapLay *hl); 
 
 char *md5HashString(char *str);
 
 char *toolTipByProbe(struct genoHeatmap *gh, char *sampleId, char *probeId);
 
 char *toolTipByFeature(struct genoHeatmap *gh, char *sampleId, char *feature);
 
 char *toolTipByChromPos(struct genoHeatmap *gh, char *sampleId,
 			char *chrom, int chromStart, int chromStop); 
 
 char *toolTipGeneTrackByChromPos(char *db, char *tableName, char *chromName,
 				 int chromStart, int chromStop, int maxNumGenes);  
 
 void verticalTextRight(struct vGfx *vg, int x, int y,
 		       int width, int height, int colorIx, MgFont *font, char *string);
 
 void drawLayoutLines(struct vGfx *vg, struct heatmapLay *hlList, int width);
 
 
 void heatmapLaySetDefaultColor(struct heatmapLay *hl, char *platform);
 
 /* Moving all circle map to own file, to prepare for making it separate CGI */
 void modeGetCircleMap();
 
 void setupFeatureVisibility(struct genoHeatmap *gh);
 
 void setupSort(struct genoHeatmap *gh); 
 
 char *getId(struct sqlConnection *conn, char *table, char *key, char *sample, char *value);
 /* get patient ID from sample (or experiment) Id */ 
 
 void setSubgroups(struct genoHeatmap *gh);
 
 #endif /* HGHEATMAP2_H */