{"id":9553,"date":"2025-04-15T16:58:45","date_gmt":"2025-04-15T15:58:45","guid":{"rendered":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/?page_id=9553"},"modified":"2025-08-01T16:21:27","modified_gmt":"2025-08-01T15:21:27","slug":"samtools","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/applications\/samtools\/","title":{"rendered":"SAMTools"},"content":{"rendered":"<h2>Overview<\/h2>\n<p><a href=\"https:\/\/www.htslib.org\/\">SAMTools<\/a> provides various utilities for manipulating alignments in the SAM format, including sorting, merging, indexing and generating alignments in a per-position format.<br \/>\nSAM (Sequence Alignment\/Map) format is a generic format for storing large nucleotide sequence alignments. <\/p>\n<h2>Restrictions on use<\/h2>\n<p>There are no restrictions on accessing this software on the CSF. It is provided under the <a href=\"https:\/\/github.com\/samtools\/samtools\/blob\/develop\/LICENSE\">MIT\/Expat<\/a> license, and all usage of the application must adhere to that license.<\/p>\n<h2>Set up procedure<\/h2>\n<p>We now recommend loading modulefiles within your jobscript so that you have a full record of how the job was run. See the example jobscript below for how to do this. Alternatively, you may load modulefiles on the login node and let the job <abbr title=\"add '#$ -V' to your jobscript\">inherit these settings<\/abbr>.<\/p>\n<p>Load one of the following modulefiles:<\/p>\n<pre>\r\n# These versions are available on the CSF3 (Slurm) system\r\nmodule load apps\/gcc\/samtools\/1.22.1\r\nmodule load apps\/gcc\/samtools\/1.21\r\nmodule load apps\/gcc\/samtools\/1.13\r\nmodule load apps\/gcc\/samtools\/1.11\r\nmodule load apps\/gcc\/samtools\/1.9\r\n\r\n# These versions are available on the CSF (SGE) system (new versions will not be installed)\r\nmodule load apps\/gcc\/samtools\/1.13\r\nmodule load apps\/gcc\/samtools\/1.11\r\nmodule load apps\/gcc\/samtools\/1.9\r\n<\/pre>\n<h2>Running the application<\/h2>\n<p>Please do not run SAMTools on the login node. Jobs should be submitted to the compute nodes via batch.<\/p>\n<h3>Serial batch job submission<\/h3>\n<p>Create a batch submission script (which will load the modulefile in the jobscript), for example:<\/p>\n<pre class=\"sge\">\r\n#!\/bin\/bash --login\r\n#$ -cwd             # Job will run from the current directory\r\n                    # NO -V line - we load modulefiles in the jobscript\r\n\r\nmodule load apps\/gcc\/samtools\/1.13\r\n\r\nsamtools <em>command<\/em> <em>[options]<\/em>\r\n<\/pre>\n<p>Submit the jobscript using: <\/p>\n<pre>qsub <em>scriptname<\/em><\/pre>\n<p>where <em>scriptname<\/em> is the name of your jobscript.<\/p>\n<pre class=\"slurm\">\r\n#!\/bin\/bash --login\r\n#SBATCH -p serial     # 1-core job\r\n#SBATCH -t 4-0        # 4-day max wallclock\r\n\r\n# Start with a clean environment in Slurm\r\nmodule purge\r\nmodule load apps\/gcc\/samtools\/1.21\r\n\r\nsamtools <em>command<\/em> <em>[options]<\/em>\r\n<\/pre>\n<p>Submit the jobscript using: <\/p>\n<pre>sbatch <em>scriptname<\/em><\/pre>\n<p>where <em>scriptname<\/em> is the name of your jobscript.<\/p>\n<h3>Parallel batch job submission<\/h3>\n<p>Not all of the SAMTools tools can use mutliple cores. You should check the options on each tool, by running the <code>help<\/code> command on the login node:<\/p>\n<pre>\r\nsamtools help\r\nsamtools help <em>merge<\/em>     # Or one of the other tools\r\n<\/pre>\n<p>The <em>merge<\/em> tool can use multiple cores, so we use that as an example:<\/p>\n<pre class=\"sge\">\r\n#!\/bin\/bash --login\r\n#$ -cwd\r\n#$ -pe smp.pe 8             # Run in parallel with 8 threads (max is 32 in smp.pe)\r\n\r\nmodule load apps\/gcc\/samtools\/1.13\r\n\r\n# Use --threads $NSLOTS to tell samtools to use the number of threads requested above\r\nsamtools merge --threads $NSLOTS <em>args...<\/em>\r\n<\/pre>\n<p>Submit the jobscript using <code>qsub <em>jobscript<\/em><\/code><\/p>\n<pre class=\"slurm\">\r\n#!\/bin\/bash --login\r\n#SBATCH -p multicore     # AMD 168-core nodes\r\n#SBATCH -n 8             # Run in parallel with 8 threads (max is 168 in multicore)\r\n#SBATCH -t 2-0           # 2-day wallclock (7-0 is max permitted)\r\n\r\n# Start with a clean environment in Slurm\r\nmodule purge\r\nmodule load apps\/gcc\/samtools\/1.21\r\n\r\n# Use --threads $SLURM_NTASKS to tell samtools to use the number of threads requested above\r\nsamtools merge --threads $SLURM_NTASKS <em>args...<\/em>\r\n<\/pre>\n<p>Submit the jobscript using <code>sbatch <em>jobscript<\/em><\/code><\/p>\n<h2>Further info<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.htslib.org\/\">SAMTools website (part of HTSLib)<\/a><\/li>\n<\/ul>\n<h2>Updates<\/h2>\n<p>None.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview SAMTools provides various utilities for manipulating alignments in the SAM format, including sorting, merging, indexing and generating alignments in a per-position format. SAM (Sequence Alignment\/Map) format is a generic format for storing large nucleotide sequence alignments. Restrictions on use There are no restrictions on accessing this software on the CSF. It is provided under the MIT\/Expat license, and all usage of the application must adhere to that license. Set up procedure We now recommend.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/software\/applications\/samtools\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":86,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-9553","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/comments?post=9553"}],"version-history":[{"count":4,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9553\/revisions"}],"predecessor-version":[{"id":10765,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/9553\/revisions\/10765"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/pages\/86"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/csf3\/wp-json\/wp\/v2\/media?parent=9553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}