1 /******************************************************************************
2 
3  #    #    ##       #    #    #           ####
4  ##  ##   #  #      #    ##   #          #    #
5  # ## #  #    #     #    # #  #          #
6  #    #  ######     #    #  # #   ###    #
7  #    #  #    #     #    #   ##   ###    #    #
8  #    #  #    #     #    #    #   ###     ####
9 
10 ******************************************************************************/
11 /* This file is part of MAPMAKER 3.0b, Copyright 1987-1992, Whitehead Institute
12    for Biomedical Research. All rights reserved. See READ.ME for license. */
13 
14 #define INC_LIB
15 #define INC_SHELL
16 #include "mapm.h"
17 
18 void setup_commands();
19 
20 void make_help_entries();    /* move these to lib */
21 extern char help_filename[];
22 
main(argc,argv)23 main(argc,argv)
24 int argc;
25 char *argv[];
26 {
27     char *version, help_filename[PATH_LENGTH+1];
28     FILE *fp;
29 
30     custom_lib_init();
31     get_cmd_line_args(&argc,argv); /* side-effects file_arg vars */
32     tty_hello();
33     seedrand(RANDOM);
34 
35     strcpy(help_filename,"mapmaker");
36     shell_init("MAPMAKER/EXP","3.0b","1987-1992",help_filename);
37     banner();
38 
39     photo_banner_hook= mapm_data_info;
40     quit_save_hook= mapm_save_on_exit;
41 
42     data_init();
43     npt_cmds_init();
44     state_init();
45     map_init();
46     sequence_init();
47 
48     setup_commands();
49     make_help_entries();
50     reset_state();
51 
52 #ifdef HAVE_CEPH
53     prep_init();
54 #endif
55 
56     if (!nullstr(file_arg[PHOTO_FILE_ARG])) run {
57 	nl();
58 	if ((append_it &&  !photo_to_file(file_arg[PHOTO_FILE_ARG],APPEND)) ||
59 	    (!append_it && !photo_to_file(file_arg[PHOTO_FILE_ARG],WRITE)))
60 	  send(CANTOPEN);
61 	sf(ps,"photo is on: file is '%s'\n",photo_file); pr();
62     } on_error { print("error opening photo file\n"); }
63 
64     if (!nullstr(file_arg[LOAD_FILE_ARG])) run {
65 	nl();
66 	fp=open_file(file_arg[LOAD_FILE_ARG],READ);
67 	try_to_load(fp,file_arg[LOAD_FILE_ARG],FALSE,prep_it); /*verbose*/
68     } on_error { print("error opening load or prep file\n"); }
69 
70     if (!nullstr(file_arg[RUN_FILE_ARG])) run {
71 	redirect_input(file_arg[RUN_FILE_ARG],TRUE); /*verbose*/
72     } on_error { print("error opening run file\n"); }
73 
74     command_loop();
75     /* screen_end(); */
76     exit_main();
77 }
78 
79 
mapm_save_on_exit(do_it_now)80 bool mapm_save_on_exit(do_it_now)
81 bool do_it_now;
82 {
83     if (!do_it_now) return(auto_save && data_loaded());
84     if (auto_save && data_loaded()) do_save_data(raw.filename,FALSE);
85     return(TRUE); /* => OK to exit now */
86 }
87 
88 
89 #define NO_DATA_ERR \
90 "No data have been loaded.\nUse the 'load data' command first."
91 #define IS_DATA_ERR \
92 "%sYou must use the '%s' command before loading data."
93 #define IS_DATA_ERR1 \
94 "Data have already been loaded.\n"
95 #define WRONG_DATA_ERR \
96 "Data of the wrong type are loaded.\nThe '%s' command only works with %s data."
97 
98 #define NO_SEQ_ERR \
99 "The current sequence is empty.\nUse the 'sequence' command first."
100 #define SHORT_SEQ_ERR \
101 "%sThe '%s' command requires a sequence containing at least %d loci."
102 #define SHORT_SEQ_ERR1 \
103 "The current sequence is too short.\n"
104 
105 #define SEQ_PERM_ERR \
106 "The current sequence specifies only one order.\n\
107 The '%s' command requires a sequence which specifies more than one order\n\
108 of loci. %s"
109 #define SEQ_PERM_WARN \
110 "warning: The current sequence specifies more than one order.\n\
111 The '%s' command ignores alternative orders.\n%s"
112 #define SEQ_FIX_WARN \
113 "warning: The current sequence specifies fixed distances.\n\
114 The '%s' command ignores order and distance information.\n%s"
115 #define SEQ_EXP_EMPTY "After expanding names, the current sequence is empty."
116 #define SEQ_HELP      "Type 'help sequence' for details."
117 
mapm_ready(data_type,min_seq_loci,permable_seq,seq_loci)118 void mapm_ready(data_type,min_seq_loci,permable_seq,seq_loci)
119 int data_type;     /* CEPH, F2, NO_DATA, ANY_DATA, or MAYBE_DATA */
120 int min_seq_loci;  /* 0 indicates no seq is needed */
121 bool permable_seq; /* TRUE, FALSE or MAYBE, ignored if min_seq_loci==0 */
122 int *seq_loci;
123 {
124     int loci;
125 
126     if (data_type==NO_DATA && data_loaded())
127 	{ sf(ps,IS_DATA_ERR,IS_DATA_ERR1,com); error(ps); }
128     if (data_type!=MAYBE_DATA && !data_loaded()) error(NO_DATA_ERR);
129     /* CHECK THESE! */
130     if ((data_type==CEPH_DATA && raw.data_type!=CEPH) ||
131 	(data_type==F2_DATA   && raw.data_type!=F2)) {
132 	sf(ps,WRONG_DATA_ERR,com,
133 	   data_type==CEPH ? "CEPH-type data" : "F2-type data");
134 	error(ps);
135     }
136 
137     seq=NULL; loci=0;
138     run check_current_seq(&loci);
139       except_when(BADSEQ) {
140 	  if (min_seq_loci!=0) { /* n>0 or MAYBE_SEQ (-1) means need seq */
141 	      print_badseq(); abort_command();
142 	  }
143       }
144     if (seq_loci!=NULL) *seq_loci=loci;
145 
146     if (min_seq_loci==0) {
147 	seq=NULL;
148 	if (seq_loci!=NULL) send(CRASH);
149 	return;
150     }
151 
152     if (min_seq_loci>0) { /* test min num loci in seq */
153 	if (loci==0) {
154 	    if (!nullstr(seq_string) && !xstreq(seq_string,"none"))
155 	      error(SEQ_EXP_EMPTY);
156 	    else error(NO_SEQ_ERR);
157 	}
158 	if (loci<min_seq_loci) {
159 	    sf(ps,SHORT_SEQ_ERR,SHORT_SEQ_ERR1,com,min_seq_loci);
160 	    error(ps);
161 	}
162     }
163 
164     /* test permability and crunchiness */
165     if (seq!=NULL) get_list_of_all_loci(seq,seq_locus,&loci,MAX_SEQ_LOCI);
166     switch (permable_seq) {
167       case PERM_SEQ:   /* ordered seq - need to use for_all_orders() */
168 	if (seq!=NULL) {
169 	    if (!permutable(seq))
170 	      { sf(ps,SEQ_PERM_ERR,com,SEQ_HELP); error(ps); }
171 	    crunch_locus_list(seq_locus,&loci,ORDER_ERRORS,TRUE,TRUE);
172 	}
173 	break;
174       case MAYBE_PERM: /* ordered seq - for_all_orders() or get_one_order() */
175 	/* no permability test, but we need a crunch test */
176 	if (seq!=NULL)
177 	  crunch_locus_list(seq_locus,&loci,ORDER_ERRORS,TRUE,TRUE);
178 	break;
179       case ONE_ORDER:  /* ordered seq - get_one_order() */
180 	if (seq!=NULL) {
181 	    if (permutable(seq))
182 	      { sf(ps,SEQ_PERM_WARN,com,SEQ_HELP); pr(); nl(); nl(); }
183 	    crunch_locus_list(seq_locus,&loci,ORDER_ERRORS,TRUE,TRUE);
184 	}
185 	break;
186       case LIST_SEQ:   /* not ordered - alloc_ or get_list_of_all_loci() */
187 	if (seq!=NULL) {
188 	    if (permutable(seq))
189 	      { sf(ps,SEQ_PERM_WARN,com,SEQ_HELP); pr(); nl(); nl(); }
190 	    if (has_fixed_dists(seq))
191 	      { sf(ps,SEQ_FIX_WARN,com,SEQ_HELP); pr(); nl(); nl(); }
192 	    crunch_locus_list(seq_locus,&loci,CRUNCH_WARNINGS,TRUE,TRUE);
193 	}
194 	break;
195       case UNCRUNCHED_LIST: /* not ordered, for assign and haplo commands */
196 	if (seq!=NULL) {
197 	    if (permutable(seq))
198 	      { sf(ps,SEQ_PERM_WARN,com,SEQ_HELP); pr(); nl(); nl(); }
199 	    if (has_fixed_dists(seq))
200 	      { sf(ps,SEQ_FIX_WARN,com,SEQ_HELP); pr(); nl(); nl(); }
201 	}
202 	break;
203       default: send(CRASH);
204     }
205 }
206 
207 
208 #define WARN_CHROMOSOME \
209   "%s: %s markers not assigned to current chromosome"
210 #define WARN_DUPLICATES \
211   "%s: marker(s) listed %smultiple times... %s"
212 #define WARN_CONVERT \
213   "%s: haplotype group(s) %s%sindicated by first locus"
214 #define WARN_HAPLO_DUPS \
215   "%s: haplotype group(s) listed %smultiple times... %s"
216 
crunch_locus_list(locus,num_loci,verbose,check_assignments,in_sequence)217 bool crunch_locus_list(locus,num_loci,verbose,check_assignments,in_sequence)
218 int *locus, *num_loci;
219 bool verbose; /* ORDER_ERRORS, or CRUNCH_WARNINGS, or FALSE (silent) */
220 bool check_assignments;
221 bool in_sequence; /* adjusts output: TRUE, FALSE, or MAYBE */
222 {
223     int i, n;
224     bool haplos_converted, haplo_dups, other_dups, wrong_chrom;
225     bool abort_on_error;
226     /* we use the seq_locus and use_locus globals from sequence.c */
227 
228     haplos_converted= haplo_dups= other_dups= wrong_chrom= FALSE;
229     abort_on_error= (verbose==ORDER_ERRORS);
230 
231     for (i=0; i<raw.num_markers; i++) use_locus[i]=FALSE;
232     for (i=0; i<*num_loci; i++) seq_locus[i]=locus[i];
233 
234     if (use_haplotypes)
235       for (i=0; i<*num_loci; i++)
236 	if (seq_locus[i]!=NO_LOCUS && haplotyped(seq_locus[i])) {
237 	    if (haplo_first[seq_locus[i]]==seq_locus[i]) continue;
238 	    if (!use_locus[haplo_first[seq_locus[i]]]) {
239 		seq_locus[i]=haplo_first[seq_locus[i]];
240 		use_locus[seq_locus[i]]=TRUE; /* now using the haplo_first */
241 		haplos_converted= TRUE;
242 	    } else {
243 		seq_locus[i]=NO_LOCUS; haplo_dups=TRUE;
244 	    }
245 	}
246 
247     for (i=0; i<*num_loci; i++) {
248 	if (!use_locus[seq_locus[i]]) use_locus[seq_locus[i]]=TRUE;
249 	else { seq_locus[i]=NO_LOCUS; other_dups=TRUE; }
250     }
251 
252     for (i=0, n=0; i<*num_loci; i++)
253       if (seq_locus[i]!=NO_LOCUS) locus[n++]=seq_locus[i];
254     *num_loci=n;
255 
256     if (current_chrom!=NO_CHROM && check_assignments)
257       for (i=0, n=0; i<*num_loci; i++)
258 	if (assigned(seq_locus[i]) && !assigned_to(seq_locus[i],current_chrom))
259 	  wrong_chrom=TRUE;
260 
261     if (verbose) { /* TRUE or MAYBE */
262 	if (wrong_chrom) {
263 	    sf(ps,WARN_CHROMOSOME,"error",
264 	       (in_sequence ? "sequence contains":"can't use"));
265 	    pr(); nl();
266 	}
267 	if (haplos_converted) {
268 	    sf(ps,WARN_CONVERT,"warning",(in_sequence ? "in sequence ":""),
269 	       (in_sequence==MAYBE ? "will be ":""));
270 	    pr(); nl();
271 	}
272 	if (haplo_dups) {
273 	    sf(ps,WARN_HAPLO_DUPS,(abort_on_error ? "error":"warning"),
274 	       (in_sequence ? "in sequence ":""),
275 	       (in_sequence==MAYBE ? "":"extras deleted"));
276 	    pr(); nl();
277 	}
278 	if (other_dups) {
279 	    sf(ps,WARN_DUPLICATES,(abort_on_error ? "error":"warning"),
280 	       (in_sequence ? "in sequence ":""),
281 	       (in_sequence==MAYBE ? "":"extras deleted"));
282 	    pr(); nl();
283 	}
284 	if ((abort_on_error && (haplos_converted || haplo_dups)) ||
285 	    wrong_chrom) abort_command();
286     }
287     return (other_dups || haplos_converted || haplo_dups);
288 }
289 
290 
291 #define CHROM_NOT_EXISTS "there is no chromosome named '%s'"
292 #define CHROM_NOT_SET    "no chromosome is selected"
293 #define CHROM_NOT_ANY    "you must select a chromosome ('any' is not allowed)"
294 
get_chrom_arg(allow_no_chrom)295 int get_chrom_arg(allow_no_chrom)
296 bool allow_no_chrom;
297 {
298     char name[TOKLEN+1];
299     int chrom;
300 
301     get_arg(stoken,"",name);
302     if (nullstr(name)) {
303 	if (current_chrom==NO_CHROM) {
304 	    if (!allow_no_chrom) error(CHROM_NOT_SET);
305 	    else chrom=NO_CHROM;
306 	} else chrom=current_chrom;
307     } else if (streq(name,"any") || streq(name,"all")) {
308 	if (!allow_no_chrom) error(CHROM_NOT_ANY);
309 	else chrom=NO_CHROM;
310     } else if (!isa_chrom(name,&chrom)) {
311 	sf(ps,CHROM_NOT_EXISTS,name); error(ps);
312     }
313     return(chrom);
314 }
315 
316 
input_dist(dist)317 bool input_dist(dist)
318 real *dist;
319 {
320     if (*dist<0.0) return(FALSE);
321     else if (*dist<=0.5) return(TRUE);
322     else if (*dist>=999.0) return(FALSE);
323 
324     *dist= ((*mapfunction->dist_to_rec)(*dist/100.0));
325     return(TRUE);
326 }
327 
328 
329 
330 /********** We don't use these anymore, do we? ************/
331 
get_markers(prompt,command_str,marker_list,num_markers)332 bool get_markers(prompt,command_str,marker_list,num_markers)
333 char *prompt,*command_str;
334 int **marker_list, *num_markers;
335 {
336     int i;
337     char token[TOKLEN+1], *str, *save_str, *errmsg;
338 
339     *marker_list= NULL;
340 
341     run {
342 	if (!nullstr(command_str)) str=save_str=command_str;
343             else { getln(prompt); str=save_str=ln; }
344 	*num_markers= count_tokens(str);
345 	array(*marker_list, *num_markers, int);
346 
347 	for(i=0; i<*num_markers; i++) {
348 	    if (!stoken(&str,sREQUIRED,token) ||
349 		!is_a_locus(token,&(*marker_list)[i],&errmsg)) {
350 		  print("error in marker list '"); print(command_str);
351 		  print("'\n");
352 		  space(22+imaxf(len(save_str)-len(str)-1,0)); print("^\n");
353 		  print(errmsg); nl(); abort_command();
354 	    }
355 	}
356 	if (!nullstr(str)) send(CRASH);
357 
358     } when_aborting { unarray(*marker_list,int); relay; }
359 
360     return(TRUE);
361 }
362 
363 
364 #define GETI_BAD_NUM \
365 "bad interval number (must be an integer from %d to %d)\n"
366 
get_intervals(prompt,command_str,selected_interval,marker,num_markers,edges_ok)367 bool get_intervals(prompt,command_str,selected_interval,
368 		   marker,num_markers,edges_ok)
369 char *prompt, *command_str;
370 bool **selected_interval;
371 int *marker, num_markers;
372 bool edges_ok;
373 {
374     int interval, to_interval, i, first, last;
375     char token[TOKLEN+1], *str, *save_str, c;
376 
377     run {
378 	if (edges_ok) { first=0; last=num_markers; }
379 	    else { first=1; last=num_markers-1; }
380 	if (!nullstr(command_str)) str=save_str=command_str;
381             else {
382 		print(  "loci:          ");
383 		for (i=0; i<num_markers; i++)
384 		    { print(loc2str(marker[i])); print("    "); }
385 		print("\nintervals: ");
386 		if (!edges_ok) { print(loc2str(-1)); print("    "); }
387 		for (i=first; i<=last; i++) {
388 		    sf(ps,"(%d)%s",i,i<10 ? " ":""); pr();
389 		    print(loc2str(-1));
390 		}
391 		nl(); print(prompt); getln("[all] "); str=save_str=ln;
392 	}
393 	array(*selected_interval, num_markers+1, int);
394 	for (i=0; i<num_markers+1; i++) (*selected_interval)[i]=FALSE;
395 
396 	if (nullstr(str) || xstreq(str,"all")) {
397 	    for (i=first; i<=last; i++) (*selected_interval)[i]=TRUE;
398 	} else while (!nullstr(str)) {
399 	    if (!itoken(&str,iREQUIRED,&interval) ||
400 		!irange(&interval,first,last)) {
401 		    print("error in interval list '"); print(ps); print("'\n");
402 		    space(19+imaxf(len(save_str)-len(str)-1,0)); print("^\n");
403 		    sf(ps,GETI_BAD_NUM,first,last);
404 		    pr(); abort_command();
405 	    }
406 	    to_interval= interval;
407 	    if (parse_char(&str,"-",SKIPWHITE,&c)) {
408 		if (!itoken(&str,iREQUIRED,&to_interval) ||
409 		    !irange(&to_interval,interval,last)) {
410 		        print("error in interval list '"); print(ps);
411 			print("'\n");
412 			space(19+imaxf(len(save_str)-len(str)-1,0));
413 			print("^\n");
414 			sf(ps,"bad interval number: valid range is %d to %d\n",
415 			   interval,last); pr(); abort_command();
416 
417 		    }
418 	    }
419 	    for (i=interval; i<=to_interval; i++) (*selected_interval)[i]=TRUE;
420 	}
421     } when_aborting { unarray(*selected_interval,int); relay; }
422     return(TRUE);
423 }
424 
425 
get_reals(prompt,real_list,command_str,num_reals)426 bool get_reals(prompt,real_list,command_str,num_reals)
427 char *prompt, *command_str;
428 real *real_list;
429 int *num_reals;
430 {
431     int i, *temp_ints;
432 
433     if(nullstr(command_str)) {
434         getln(prompt); crunch(ln);
435 	*num_reals = count_tokens(ln);
436         for(i = 0; i < *num_reals; i++) {
437 	    if(!(rtoken(&ln,rREQUIRED,&real_list[i])))
438 	        return(FALSE);
439 	}
440     }
441     else { /* real list is in command_str */
442         crunch(command_str);
443         *num_reals = count_tokens(command_str);
444         for(i = 0; i < *num_reals; i++) {
445             if(!(rtoken(&command_str,rREQUIRED,&real_list[i])))
446 		    return(FALSE);
447 	}
448     }
449     return(TRUE);
450 }
451 
452 
453 #ifdef OBSOLETE_CODE
454 char *print_using();
455 
456 /* The screen header:
457          1         2         3         4         5         6         7
458 1234567890123456789012345678901234567890123456789012345678901234567890123456789
459 -------------------------------------------------------------------------------
460 MAPMAKER 3.0b     units: kossambi CM             photo: 123456789012.out
461 using %-24s photo: %s"
462 sequence #123: blah blah blah
463 -------------------------------------------------------------------------------
464 */
465 
466 #define LINE0 "MAPMAKER V3.0b   map function %-17s  data: %-22s"
467 #define LINE1 "units: %-9s using: %-24s photo: %-22s"
468 #define LINE2 "sequence #%d: %-64s"
469 
mapm_top(line,lines,cols)470 void mapm_top(line,lines,cols)
471 char **line;
472 int lines,cols;
473 {
474     char file[PATH_LENGTH+1];
475 
476     if(!data_loaded()) { sf(line[0],LINE0,mapfunction->name,"<none>"); }
477     else { nstrcpy(file,raw.filename,cols-55);
478 	   sf(line[0],LINE0,mapfunction->name,file); }
479 
480     if(!log_open) { strcpy(file,"<off>"); }
481     else { nstrcpy(file,photo_file,cols-36); }
482 
483     sf(line[1],LINE1,(units == RECFRACS)?"rec-fracs":"cM",print_using(),file);
484 
485     sf(line[2],LINE2,context[active_context]->seq_history_num,seq_string);
486 }
487 #endif
488 
489 
setup_commands()490 void setup_commands()
491 {
492     two_pt_touched = FALSE;
493     three_pt_touched = FALSE;
494 
495     /*  command-name	             Abbrev	function	   	type
496 	1234567890123456789012345    123	12345678901234...  	123
497 	------------------------- sp ---  tab   --------------	  tab   ---
498     mc("dietrichs unreadable gels", "dug",	blow_dead_bears,	CMD);*/
499 
500     /* npt commands */
501     mc("map",                        "m",    	make_map,		CMD);
502     mc("draw map",                   "",        draw_map,               CMD);
503     mc("compare",                    "c",	compare,         	CMD);
504     mc("try",                        "",	try,             	CMD);
505     mc("genotypes",                  "",    	genotypes,		CMD);
506     mc("ripple",                     "",	ripple,          	CMD);
507     mc("order",                      "",	order_maker,     	CMD);
508     mc("build",                      "",	greedy,			CMD);
509 
510     /* state.c */
511     mc("print names",                "",	set_print_names, 	OPT);
512     mc("tolerance",                  "",	set_tolerance,		PAR);
513     mc("units",                      "",	set_units,       	PAR);
514     mc("centimorgan function",       "",	set_cm_func,         	PAR);
515     mc("auto save data",             "",	set_autosave,    	OPT);
516     mc("more mode",                  "",	set_more_mode,		OPT);
517 
518     mc("default linkage criteria",   "",	set_default_linkage,	PAR);
519     mc("use three point",            "",	set_use_3pt,      	OPT);
520     mc("triple linkage criteria",    "",	set_3pt_linkage, 	PAR);
521     mc("triple exclusion criteria",  "",	set_3pt_threshold,	PAR);
522     mc("triple error detection",     "",	set_3pt_errors,		OPT);
523     mc("multipoint criteria",        "",	set_npt_threshold,	PAR);
524     mc("informativeness criteria",   "",	set_inf_threshold,	PAR);
525     mc("print maps",                 "",	set_print_all_maps,	OPT);
526 
527     mc("error detection",            "",	set_use_error_rate,    	OPT);
528     mc("error probability",          "",	set_error_rate,        	CMD);
529     mc("error thresholds",           "",	set_error_lod_thresh,  	PAR);
530 
531     /* sequence commands now in sys_cmds.c */
532     mc("sequence",                   "s",	sequence,        	CMD);
533     mc("expand sequence",            "x",	expand_sequence,	CMD);
534     mc("delete",                     "d",	new_delete,    	        CMD);
535     mc("insert",                     "i",	new_insert,    	        CMD);
536     mc("append",                     "a",	new_append,    	        CMD);
537     mc("history",                    "h",	show_seq_history,	CMD);
538 /*  mc("let",                        "l",	let,			CMD);*/
539     mc("let",                        "l",	let_expanding,		CMD);
540     mc("names",                      "n",	names,           	CMD);
541     mc("forget named sequence",      "",	forget,          	CMD);
542     mc("edit sequence",              "e", 	edit_sequence, 		CMD);
543     mc("translate",                  "t",	translate,       	CMD);
544 
545     /* general commands in sys_cmds.c */
546     mc("prepare data",               "pd",	new_prepare,         	CMD);
547     mc("load data",                  "ld",	new_load_data,   	CMD);
548     mc("save data",                  "",	new_save_data,   	CMD);
549     mc("age",                        "",	set_age,         	CMD);
550     mc("class",                      "",        set_class,              CMD);
551     mc("make class",                 "",        make_classes,           CMD);
552     mc("list loci",                  "ll",	list_loci,       	CMD);
553 
554     /* shell commands in shell.h */
555     mc("quit",                       "q",	quit,            	CMD);
556     mc("photo",                      "",	do_photo,        	CMD);
557     mc("help",                       "?",	help,            	CMD);
558     mc("about mapmaker",             "",	about,            	CMD);
559     mc("system",                     "",	system_command,  	CMD);
560     mc("previous commands",          "p",	show_cmd_history,	CMD);
561     mc("review output",              "",	review_output,   	CMD);
562     mc("change directory",           "cd",	cd_command,      	CMD);
563     mc("run",                        "",	run_from_file,   	CMD);
564     mc("time",                       "",	show_time,       	CMD);
565     mc("remark",                     "",	comment,         	CMD);
566     mc("comment",                    "",	comment,         	CMD);
567     mc("wizard mode",                "",	set_wizard,      	CMD);
568 
569     /* 2pt commands in cmds_2.c */
570     mc("two point",                  "",	two_point,       	CMD);
571     mc("big lods",                   "",	biglods,         	CMD);
572     mc("lod table",                  "",	lodtable,        	CMD);
573     mc("near",                       "",	near_locus,            	CMD);
574     mc("pairwise",                   "",	pairwise,        	CMD);
575     mc("group",                      "",	group,           	CMD);
576     mc("suggest subset",             "",	suggest_subset,		CMD);
577     mc("join haplotypes",             "",	haplotype,       	CMD);
578     mc("list haplotypes",            "lh",	list_haplotypes, 	CMD);
579     mc("restore haplotypes",         "",	unhaplotype,       	CMD);
580 
581     /* 3pt commands in cmds_2.c */
582     mc("three point",                "",	three_point,		CMD);
583     mc("forget three point",         "",	forget_three_point,   	CMD);
584 
585     /* auto commands in auto.c */
586     mc("links",                       "",	near_chrom,            	CMD);
587     mc("make chromosome",            "",	make_chromosome, 	CMD);
588     mc("anchor",                     "",	set_anchors,		CMD);
589     mc("assign",                     "",	assign,          	CMD);
590     mc("unassign",                   "",	unassign,        	CMD);
591     mc("attach",                     "",	attach,          	CMD);
592     mc("framework",                  "",	set_framework,   	CMD);
593     mc("place",                      "",	place,           	CMD);
594     mc("together",                   "",	place_together,  	CMD);
595     mc("list chromosomes",           "lc",	list_chroms,     	CMD);
596     mc("list assignments",           "la",	list_assignments,     	CMD);
597     mc("list status",                "ls",	list_mapping,    	CMD);
598     mc("draw chromosome",            "",        draw_chromosome,	CMD);
599     mc("draw all chromosomes",       "",        draw_all_chromosomes,	CMD);
600 
601     /* special commands */
602     mc("import data",                "",	import,        		CMD);
603     mc("export data",                "",	export,			CMD);
604 
605 /*  mc("fake maps",                  "",	set_fake_maps,		WIZ);*/
606 
607 
608 #ifdef PUNT_THESE_FOR_NOW
609     /* wizard, obsolete, and undeleted CEPH commands */
610     mc("likely",              likely,          	CMD);
611     mc("revise data",         revisedat,       	CMD);
612     mc("new load",            new_load_data,   	CMD);
613     mc("new save",            new_save_data,   	CMD);
614     mc("use hmm",                   set_use_hmm,                	CMD);
615 
616     mc("note",                       "",	make_note,       	CMD);
617     mc("sex specific",              set_sex_specific,           CMD);
618     mc("segregation distortion",    set_segregation_distortion, CMD);
619     mc("print maps",                set_print_maps,             CMD);
620     mc("inner tolerance",           set_inner_tolerance,        CMD);
621     mc("startrecombs",              set_startrecombs,           CMD);
622     mc("inner loop",                set_inner_loop,             CMD);
623     mc("print problem size",        set_print_problem_size,     CMD);
624     mc("max problem size",          set_max_problem_size,       CMD);
625     mc("time stamping",             set_time_stamping,          CMD);
626     mc("print dots",                set_print_dots,             CMD);
627     mc("seg dist",            seg_dist,        CMD);
628 #endif
629 }
630