How to use operating system commands

Listed below are instructions for carrying out simple tasks using operating system commands which may be needed for the exercises in genetic linkage analysis.

Running a DOS window under Windows

Some programs used in the exercises do not run directly from Windows, but should be run only from the MSDOS prompt within a DOS window. These include table, easigraf and all the linkage analysis programs. In order to obtain a DOS window, first see if one is already running. Do this by looking at the taskbar (Windows 95+) or by pressing control-Esc to see a Task List of currently running programs (Windows 3.*). If a program is already running within the DOS window then you will probably want to exit from that program before running the new one. If you do want to run another program in addition to the the program already running then you can run an additional DOS window, as described below.

If no DOS window is running, or if you wish to run an additional DOS window as well as one which is already running, then begin by displaying the folder or group containing the icons for the programs needed for the exercises. Under Windows 95+ you can do this by choosing the folder from the task bar (if it is not open then instead open it from Explorer.) Under Windows 3.* obtain the Task List by pressing control-Esc and then double-click on Program Manager. When you view the folder or group for the exercises you should see that there is an MS-DOS icon. If this icon is present, then double-click on this to run a DOS window. (If there is no special MS-DOS icon available, then contact the person responsible for setting up these exercises.) If when the DOS prompt appears it takes up the full screen (rather than just appearing as a window) then press Alt-Enter to toggle to displaying it as a window. This makes it easier and faster to switch to other programs

Toggling the DOS window to full-screen

The DOS window can either be displayed as a window taking up part of the screen or as the full screen. You can toggle between these two states by pressing Alt-Enter. You should always have the DOS window as full screen before running MSDOS programs which use graphics such as easigraf. Otherwise it is better to have it as a window because it makes it easier to switch between it and other programs. Once you have finished displaying graphics toggle back to a window by pressing Alt-Enter again.

How to run a program

Before you run a program you should check that you are using the correct working directory, and you should check that any data files which will required by the program are available in the directory by performing a directory listing.

For example, to run table on the file d1m1.res, at the operating system prompt enter:

table d1m1.res

You should see that the file d1m1.tab has been created. To check this you can perform a directory listing. If there has been a problem, begin by checking you are using the directory which should contain d1m1.res (if not change to the correct directory) and then perform a directory listing to make sure that d1m1.res exists and to check that it is not zero length. Finally, if you cannot see why table is not working correctly on d1m1.res, use a text editor to examine d1m1.res to make sure that it appears to contain the information which it is supposed to. Another thing make sure that you are using the correct file names, in particular that you have not confused a digit 1 with a lower case L.

All the command files created by lcp and quiklink to run linkage analyses run from the operating system prompt. For example to run the d1m1 command file, at the DOS prompt enter:

d1m1.bat

or at the Unix prompt enter:

sh d1m1.sh

The files d1m1.out and d1m1.res should be created. You can check that they exist by performing a directory listing, and you can check their contents by viewing them with a text editor. If they do not run correctly, then begin by checking you are using the correct directory (if not change to it) and then perform a directory listing to make sure that command file itself exists, as well as the pedigree and locus data file which it uses, and to check that they appear to be about the correct size. If you still cannot see why the command file is not working, examine it and the pedigree and locus data files it uses with a text editor. If you find an error in them then use lcp or dolink to set them up again correctly.

Running a program from the MSDOS prompt

If you are running the exercises under Windows then to obtain an MSDOS prompt you need to run the MS-DOS prompt window. Then to run a program under MSDOS you simply enter the program name at the MSDOS prompt. Program files have extension .com or .exe, but you do not need to include this extension when you type the name. For the program to run, it must either be in the current working directory or it must be on the PATH. If you get the message Bad command or file name then either you have misspelt the name or else the program file exists but is neither in the current directory nor on the PATH. Check that you are in the correct directory for the exercise (by entering cd). (The exercises should have been set up so that all the necessary programs are available on the PATH, so if the program does not run you should contact the person responsible for setting up the exercises on your system.)

Running a program under Windows

Some programs used in the exercises do not run directly from Windows, but should be run only from the MSDOS prompt within a DOS window. These include table, easigraf and all the linkage analysis programs. The Windows programs consist of pedraw, qdb, a text editor, and an HTML browser. There are a number of ways to run a program under Windows. The first thing to do is to make sure that the program is not running already. To do this look at the task bar (Windows 95+) or press control-Esc (Windows 3.*) and you will see a list of programs currently running. If you see the one you want then just double-click on it. Some programs, including pedraw and qdb, will not let you run more than one copy at a time. Even if a program will let you run more than one copy at once, you probably should not be running two copies because you are likely to get confused and may corrupt some of the files used. If the program is not already running then choose the folder or group containing the programs for the exercises, find the icon of the program which you wish to use, and then double-click on it. (The exercises should have been set up so that all the necessary Windows programs have icons displayed in one folder (Windows 95+) or a Program Manager group (Windows 3.*), so if you do not see the icon you want you should contact the person responsible for setting up the exercises on your system.)

How to find out the current working directory

The current directory is the default directory for programs to find data files and to write their output files to. It is set by the change directory command.

How to check the current working directory under MSDOS

Most systems will be set up so that the current working directory appears in the command line prompt (because of a $P$G command in autoexec.bat). However a general way to check the current working directory under MSDOS is to enter:

cd

The directory name will then be displayed.

How to check the current working directory under Unix

To check the current working directory under Unix is to enter:

pwd

The directory name will then be displayed.

The working directory for a program run from Windows

Programs which are run directly from Windows, rather than from the MSDOS prompt in a DOS window, can have their default working directory set in different ways. If the program is run from Program Manager then the Working Directory can be viewed by (in Program Manager) highlighting the program icon and selecting File, Properties.

How to change the current working directory

The current working directory is changed using the change directory command.

How to change directory under MSDOS

The command to change the current working directory is chdir, which can be abbreviated to cd, and which is followed by the name of the directory you wish to change to. To change to the parent directory (the one which the current directory is a subdirectory of) enter:

cd ..

To change to a subdirectory of the current directory, for example one called subdir, enter:

cd subdir

You can see which directories are subdirectories of the current one by listing the current directory with the dir /p command, and you can tell which is the current directory by using the cd command with no arguments.

How to change directory under Unix

The command to change the current working directory is chdir, which can usually be abbreviated to cd, and which is followed by the name of the directory you wish to change to. To change to the parent directory (the one which the current directory is a subdirectory of) enter:

chdir ..

To change to a subdirectory of the current directory, for example one called subdir, enter:

chdir subdir

You can see which directories are subdirectories of the current one by listing the current directory with the ls -l | more command, and you can tell which is the current directory by using the pwd command with no arguments.

How to obtain a directory listing

A directory listing is a display of the names of the files in a particular directory, by default the current working directory.

Obtaining a directory listing under MSDOS

To list the files in the current directory enter:

dir

If there are too many files then they will scroll off the screen. You can fit more in if you list them widthwise by entering:

dir /w

However in a widthwise listing the file lengths and time of modification are not displayed, so you may instead perform a paged listing, in which just one screen's worth at a time of filenames are listed, by entering:

dir /p

Obtaining a directory listing under Unix

To list the files in the current directory enter:

ls -l

If there are too many files then they will scroll off the screen. You can fit more in if you list them widthwise by entering:

ls

However in a widthwise listing the file lengths and time of modification are not displayed, so you may instead perform a paged listing, in which just one screen's worth at a time of filenames are listed, by entering:

ls -l | more

Obtaining a directory listing under Windows

To list the contents of a directory under Windows you can either run a DOS window and then enter the dir command or you can run Explorer (Windows 95+) or File manager (Windows 3.*) and navigate to the directory you are interested in. If you use Explorer/File manager then make sure that all file details, including date and size, are displayed. This can help you recognise if, for example, a file of zero length has been created by mistake.

How to copy a file

Copying files allows different copies of the same file to exist in different directories with the same name, or with different names in the same directory (or both). For these exercises, file copying is generally used to copy the data to a file with a different name.

Copying a file under MSDOS

To make a copy of a file called oldname in a file called newname enter:

copy oldname newname

If there are any problems and you have not made a typing error you should check that you are in the correct directory by entering cd, and you should check that the original file exists by entering dir oldname.

Copying a file under Unix

To make a copy of a file called oldname in a file called newname enter:

cp oldname newname

If there are any problems and you have not made a typing error you should check that you are in the correct directory by entering pwd, and you should check that the original file exists by entering ls oldname.

How to edit or view a file

Exactly how this is done will depend on the editor you are using. However there are a few things which will always apply. First, you should see if the editor program is already running, or else run a new copy of it. It will be important to make sure that you do not have the editor running with the file already loaded which you wish to edit, because then if you run a new copy of the editor you might end up modifying two different copies of the same file simultaneously. When you have the editor running, you should load the file which you wish to view or edit. If the editor was already running and if you made changes to the previous file but did not save them to disk then when you try to load a new file you may be asked if you wish to save the changed file before loading the new one. When you have the new file loaded, view or modify it as necessary. If you have to make changes then make sure you save the file to disk before attempting to use it with another program. If you make changes by mistake, then the safest thing to do may be to quit from the editor and specify that you do not want to save the changes. When you have finished viewing the file, or changing and saving it, you may either leave the editor running so that you'll be able to use it with another file, or else quit from the editor which will mean that the next time you need it you will have to run a new copy.

Summary of emacs commands

Here is a brief list of the commands needed when using the emacs program to edit files for the exercises. (At HGMP, emacs will run from any shell.)

Exercises in genetic linkage analysis

All material copyright (C) Dave Curtis 1996-2000

dcurtis@hgmp.mrc.ac.uk