5
$\begingroup$

SAM and BAM are effectively plain-text and binary representations of the same alignment format. I'd argue these terms should be synonyms.

UPDATE: It doesn't look like we've reached a consensus, but I still think this is the best course of action. See Konrad's post below. I agree the [sam] tag should refer to the SAM specification, which includes everything that is shared between SAM and BAM, as well as issues that are SAM- or BAM-specific.

$\endgroup$
  • $\begingroup$ I opened a new meta question suggesting a third, master tag (sam-or-bam) as a compromise. $\endgroup$ – terdon Jun 7 '17 at 16:39
6
$\begingroup$

I'm really hesitant about this. There are a number of very BAM specific questions, mostly pertaining to how things are actually encoded (e.g., chromosome names) and how the implications of that play out in different situations (e.g., merging multiple files or replacing headers). If we do make these synonyms, then we should include CRAM in that as well.

I should also add that SAM and BAM have some different constraints. For example, SAM allows any length query (read) name, whereas BAM does not (it has a 252 character max if you want versions that are byte-aligned in memory). SAM allows arbitrary length CIGAR strings, BAM does not. These all have important different implications in downstream applications.

Edit: Note that if it's just me that opposes this then it should really be done regardless!

$\endgroup$
  • 2
    $\begingroup$ Interesting piece of trivia. This really should be on the main (instead of meta) site. $\endgroup$ – burger Jun 6 '17 at 20:00
  • 1
    $\begingroup$ Give it a couple months and most of these questions will get raised organically :) $\endgroup$ – Devon Ryan Jun 6 '17 at 20:04
4
$\begingroup$

I would argue the opposite for exactly the same reason. SAM is a simple text file, BAM is not. While the two are obviously related, I really don't think a question about sam files should be tagged as nor a question about bam tagged as .

To take a very simple example, consider a question like "How can I extract all reads mapped to chr1 from a sam file" and the same one for a bam. The answer for the sam could be as simple as awk '$3=="chr1". It could be done with no specialist bioinformatics tools and just using standard *nix text processing utilities.

Granted, the same could be done for a bam file if we first pass it through samtools view, but isn't that like saying that a PDF file is the same as a text file because I can pass it through pdf2txt or similar utilities?

Finally, I would argue that these are two of the main formats used in NGS analyses and each have their place and are used by different downstream programs and in different ways. I don't see any benefit in merging these two tags and we might be losing some "resolution".

Perhaps we can revisit the question further on down the line when we've seen how the tags are being used?

$\endgroup$
  • $\begingroup$ I don't think that the comparison with pdf2txt holds well. bam to sam conversion is much "cleaner" than pdf to txt. That said, I have no opinion about whether sam and bam should be distinct tags or not. $\endgroup$ – bli Jun 8 '17 at 9:48
3
$\begingroup$

I agree, regardless of the misgivings voiced in other answers; and I suggest having a tag (with being a synonym).

In addition to what Daniel said, nobody stores SAM files.

At least nobody should: there is (with the exception of Devon’s trivia) no reason to do so. So while two distinct data formats exist, they refer to the same technology. As a consequence, any question being asked about either SAM or BAM will fall in either of the following categories:

  1. Creation or conversion between SAM and BAM (and thus deserving of both tags).
  2. Querying a BAM file, which is solvable using tools for BAM and SAM (either by working on the BAM file directly, or by using samtools view in combination with text transformation tools).

    Using the tag for such questions would be potentially confusing if that tag referred to a specific file format. But if the tag refers to “Sequence Alignment/Map Format Specification”, which is the official name, then that definitely covers BAM as well.

$\endgroup$
  • $\begingroup$ Hmm, your point about conversion makes sense, yes. Still, it feels strange to have one tag for what is really two different formats, despite their obvious link. Then again, I haven't been working with these formats for all that long, I suppose anyone who's an expert in one would be an expert in the other by default. Maybe we should just create a sam-or-bam tag and circumvent the issue? $\endgroup$ – terdon Jun 7 '17 at 14:06
3
$\begingroup$

On one hand, SAM and BAM are really not synonyms. Mixing them will make it harder to distinguish sam-specific or bam-specific questions. On the other hand, we often mix them in practice. I do the same. I am ok with one of the two solutions:

  1. Take "sam" as the master tag and "bam" as a synonym of "sam". At present, we are taking "bam" as the master tag (see the synonym page). This should be reversed.

  2. Keep them separate.

I object to creating a "sam-or-bam" tag.

$\endgroup$
  • $\begingroup$ What arguments would you give in favour of havig "sam" as the master tag rather than bam? I tend to agree because I often see the bam format as just a compressed version of sam format, the latter being what I conceptually grasp better, with its lines and fields. Some people may have question more related to compressing and indexing aspects, but my intuition is that more often questions will relate to the fields, flags, tags and so on. $\endgroup$ – bli Jun 8 '17 at 10:42
  • 1
    $\begingroup$ @bli sam is the primary format. bam, cram, biohdf and many other binary formats are just alternative representations of sam. Naturally, "sam" should be the master. $\endgroup$ – user172818 Jun 8 '17 at 11:56
2
$\begingroup$

I agree with this. I expect that anything that is specific to BAM / CRAM would be likely to be more specifically a computer programming question (and probably better placed on the issues pages of github), rather than a general bioinformatics question.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .