EddyRivasLab / easel

Sequence analysis library used by Eddy/Rivas lab code
Other
46 stars 26 forks source link

Dumping functions #34

Closed horta closed 5 years ago

horta commented 5 years ago

Easel library has a couple of functions for debugging purposes. In particular, those are for dumping information:

./esl_random.h:extern int esl_randomness_Dump(FILE *fp, ESL_RANDOMNESS *r);
./esl_keyhash.h:extern void         esl_keyhash_Dump(FILE *fp, const ESL_KEYHASH *kh);
./esl_json.h:extern int   esl_json_Dump(FILE *fp, ESL_JSON *pi);
./esl_rand64.h:extern int         esl_rand64_Dump(FILE *fp, ESL_RAND64 *rng);
./esl_workqueue.h:extern int esl_workqueue_Dump(ESL_WORK_QUEUE *queue);
./esl_hyperexp.h:extern int           esl_hyperexp_Dump(FILE *fp, ESL_HYPEREXP *hxp);
./esl_dmatrix.h:extern int          esl_dmatrix_Dump(FILE *ofp, const ESL_DMATRIX *A, 
./esl_dmatrix.h:extern int              esl_permutation_Dump(FILE *ofp, const ESL_PERMUTATION *P, 
./esl_mixdchlet.h:extern int            esl_mixdchlet_Dump(FILE *fp, const ESL_MIXDCHLET *dchl);
./esl_sq.h:extern int           esl_sq_DumpBlock(FILE *fp, const ESL_SQ_BLOCK *sqBlock);
./esl_getopts.h:extern void         esl_getopts_Dump(FILE *ofp, ESL_GETOPTS *g);
./esl_matrixops.h:extern int      esl_mat_DDump(double **A, int M, int N);
./esl_matrixops.h:extern int      esl_mat_FDump( float **A, int M, int N);
./esl_matrixops.h:extern int      esl_mat_IDump(   int **A, int M, int N);
./esl_gencode.h:extern int   esl_gencode_DumpAltCodeTable(FILE *ofp);
./esl_vectorops.h:extern int    esl_vec_DDump(FILE *ofp, const double  *v, int n, const char *label);
./esl_vectorops.h:extern int    esl_vec_FDump(FILE *ofp, const float   *v, int n, const char *label);
./esl_vectorops.h:extern int    esl_vec_IDump(FILE *ofp, const int     *v, int n, const char *label);
./esl_vectorops.h:extern int    esl_vec_LDump(FILE *ofp, const int64_t *v, int n, const char *label);
./esl_huffman.h:extern int  esl_huffman_Dump(FILE *fp, ESL_HUFFMAN *hc);
./esl_minimizer.h:extern int          esl_min_dat_Dump(FILE *fp, ESL_MIN_DAT *dat);

I find those functions very handy to understand the software, and I've found myself writting new ones to help me further understand it. For example, esl_sq_Dump().

My question is: would you be interested in the implementation of some of those functions?

My understanding is that those functions are externally visible, which might be wise to keep the number of them minimal...

cryptogenomicon commented 5 years ago

Yes, that would be useful. If you give us a pull request, it would be ideal if a PR brings in one function at a time, to make it easy for us to review.

I'm not particularly worried about how many functions we make externally visible, particularly since we we use prefixes (esl_, etc.) to help protect against namespace clashes.

My notes on what I expect from a *_Dump() function, from codestyle.md: