Hello everyone!
I am getting started with chip-seq analysis so this is probably a very basic question. In the following command:
samtools view -Shu s1.sam > s1.bam
What does -Shu do/mean?
Thanks a lot!
PS: I couldn't find any reference or explanation anywhere.
2 answers
$ samtools view
Usage: samtools view [options] <in.bam>|<in.sam>|<in.cram> [region ...]
Options:
(...)
-u uncompressed BAM output (implies -b)
-h include header in SAM output
-S ignored (input format is auto-detected)
(...)
I couldn't find any reference or explanation anywhere....
Did you look at the samtools manual?
-u Output uncompressed BAM. This option saves time spent on compression/decompression and is thus preferred when the output is piped to another samtools command.
-h Include the header in the output.
-S Ignored for compatibility with previous samtools versions. Previously this option was required if input was in SAM format, but now the correct format is automatically detected by examining the first few characters of input.
Log in to answer this question.
There's a lot of times where a specific setting/command is not easy to google, or you may not have access to a search engine at that time. In case you're often in that situation, my tip would be to try these steps in order:
1)
man yourcommand # Opens up the manual/man pages if installed or if they exists2)
yourcommand --help # See if there's a help menu for the tool3)
yourcommand -h # Same as above. Can also try --h, -help4)
yourcommand # Run the command without any arguments, often the fallback is to show the help menu.In this case,
man samtoolsopens up the man pages for samtools (with a section forview), orsamtools viewwithout arguments prints out the help menu. If all these fail, look at the tool's official website or its github repository, if they have one.Tools that follow unix philosophy of parameters can have their parameters clustered. For example,
samtools -Shuis the same assamtools -S -h -u. This applies to almost all unix commands that don't take an argument after the parameter name. If the parameter takes an argument, it must not be combined with another such parameter and must ideally be placed at the end of the cluster.For example,
tar -c -z -v -f file.tar.gz -T files.listcan also be written astar -czvf file.tar.gz -T files.list, but not astar -czvfT file.tar.gz files.listThat's what I was missing, didn't know that. Thanks a lot!