Other Command / Print Sam Header And Reads
Print Sam Header And Reads
Prints the header and specific read segments from a SAM file based on provided parameters.
<other_command> | samtools view -h - chromosome:start-end <other_command> | samtools view -h - chromosome:start-end #!/bin/bash
# Print Sam Header And Reads
{{other_command}} | samtools view {{[-h|--with-header]}} - chromosome:start-end When To Use
To examine the header information and alignments of specific genomic regions in a SAM file.
Pro Tip
Filter the output using pipe commands to process reads efficiently for quality checks or filtering.
Anatomy of Output
Understanding the result
@HD VN:1.0 SO:unsorted Header Info SAM header line with version and sorting order.
chr1 1001 0 60 42 5S40M Read Info A single read alignment with chromosome position and quality.
# 2 sequences read. Summary Indicating the number of sequences retrieved.
Troubleshooting
Common pitfalls
Error: Unknown chromosome 'unknown_chr'.
Solution: Ensure the chromosome name exists in the reference genome.
Error: Invalid range specified: start >= end.
Solution: Check start and end positions, ensuring start is less than end.
Error: Input SAM file not found.
Solution: Verify the path of the specified SAM file.
Command Breakdown
What each part is doing
-
<other_command> - Base Command
- The executable that performs this operation. Here it runs Other Command before the shell applies any redirect operators.
-
<other_command> - other command
- The value supplied for other command.
-
-h - h| with header
- The value supplied for h| with header.
-
-h - Command Option
- Tool-specific option used by this command invocation.
-
- - Command Option
- Tool-specific option used by this command invocation.
Alternative Approaches
Comparable commands in other tools
Alternative data processing tools for the same job.
gdown --fuzzy <url> Picotool / Convert Elf Bin To Uf2 picotool uf2 convert <path/to/elf_or_bin> <path/to/output> Aws / List Glue Jobs aws glue list-jobs Aws / List Triggers aws glue list-triggers Aws / Create Dev Endpoint aws glue create-dev-endpoint --endpoint-name <name> --role-arn <role_arn_used_by_endpoint>