Kept seeing "Illegal stran" when using SAM/BAM to count matrix

Hi @Xiaoqiang_Ma

As additional advice to that provided by @gallardoalba, it appears that your reference GTF contains header lines. Header lines are out of specification for strict GTF format (even though many data providers include them). When present, those lines can cause odd errors with many tools – and usually not mapping tools (if incorporated) – but instead with downstream tools. It is strongly recommended to remove any GTF headers to avoid technical errors (whether a tool is run in Galaxy, or not).

Please try removing the header lines, rerun, and see if that resolves the error as a first-pass solution. If it doesn’t, then do investigate the GTF content closer. The genome appears to have just one sequence/chromosome with the name “Chromosome”. If that is not a match for the sequence/chromosome label in your BAM datasets, due to the genome mapped against having a different sequence/chromosome label, that can also cause conflicts but can be addressed.

“How to” is covered here:

This is also covered in much prior Q&A:

Many things could be going wrong content-wise, but those are the top issues that tend to produce errors like yours. My guess is that you are hitting the “GTF formatting” issue first, then could possibly hit a “chromosome mismatch problem”. Verify/fix both as needed – full details are in the FAQs above.

Note: The GTF is also a hybrid format (GFF3 transformed into a GTF), but that will probably not be a problem with this particular tool.

Thanks!

1 Like