Hi, I'd like to use samtools reheader to convert bam files from UCSC ('chr' prefix) to ENSEMBL (no 'chr' prefix) chromosome names.
The current documentation at http://www.htslib.org/doc/samtools-reheader.html gets me most of the way there with the example: - Remove “Chr” prefix samtools reheader -c 'perl -pe "s/^(@SQ.*)(\tSN:)Chr/\$1\$2/"' in.bam To complete the chromosome notation conversion, I also need to rename the mitochondrial chromosome from UCSC to ENSEMBL notation (M to MT). It would be ideal to do this in the same command as removing the 'chr' prefix. However, I'm not familiar enough with perl expressions to integrate a change in the above example, and whether the above example would need a pipe to the second MT expression, a second -c 'perl -pe' flag, or some combination of both. Given the existing examples in the samtools documentation, my guess is this kind of chromosome notation conversion is the most common use for Samtools reheader, so it may also be beneficial to include the solution for this MT conversion in the documentation. Thank you in advance! Marsha
_______________________________________________ Samtools-help mailing list Samtools-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/samtools-help