[ -----------------------------------------------------------------------------
  --  SAMS (splits analysis methods) can read sequence data in the nexus file
  --  format. Commands can be passed to SAMS in a so called sams-block in a
  --  nexus file. Off course, all commands that occur in the sams-blocks in the
  --  examples below can also be passed to SAMS by typing them from the command
  --  line.
  ----------------------------------------------------------------------------]
#nexus

[ --------------------------------------------------------------------------- ]
[ -- Example:   Reading a data file. Exluding character positions or taxa  -- ]
[ --            form the analysis. Analysing base frequencies.             -- ]
[ --            Exporting the data set to different file formats.          -- ]
[ --------------------------------------------------------------------------- ]


[ -- The sams-block containing SAMS commands. -- ]
begin SAMS;

log start                      [ We log to the default log file: "sams.log"   ]
    replace;                   [ by always replacing the last log file        ]

exe Remerie_MPE_2004.nex;      [ We read the sequence data, assumptions, etc. ]
    			       [ from a nexus file                            ]

prbasefrequencies;             [ We compute the base frequencies and print    ]
			       [ them to the screen.                          ]

prbasefrequencies              [ Compute the base frequencies and print them  ]
    file=basefrequencies.txt;  [ to the specified file. If it exists  we are  ]
			       [ asked whether or not to replace the existing ]
			       [ file. ]


prsequence                     [ Print (export) the sequences                 ]
    file=Remerie_MPE_2004.fas  [ to the specified file by always              ]
    replace                    [ replacing an existing file with the same name]
    format=fasta;              [ using the fasta format.                      ]


delete  long_branches;	       [ Exclude three sequences with long branches   ]
			       [ from analysis  (see assumptions-block in     ]
			       [ Remerie_MPE_2004.nex.)                       ]

exclude 5-10 15;	       [ Exclude positions 5-10 and 15                ]
	     		       [ (chosen arbitrarily) from analyis.           ]

prbasefrequencies              [ Compute the base frequencies of reduced data ]
     file=basefrequencies-reduced-data-set.txt;
			       [ set and print them to the specified file.    ]
			       [ If it exists we are asked whether or not to  ]
			       [ replace the existing file. ]


[ Exporte the reduced data set to different file formats:  ]

  prsequence format=fasta   file=Remerie_MPE_2004-reduced.fas replace;
  prsequence format=phylip  file=Remerie_MPE_2004-reduced.phy replace;
  prsequence format=nexus   file=Remerie_MPE_2004-reduced.nex replace;


[ Continue working with the complete data set:]

  undelete all;
  include  all;

[ ... ]

[ Uncomment the following line if you automatically want to quit. ]
[ quit; ]

end;
