### samtools samples: List read groups and samples Source: https://www.htslib.org/doc/samtools.html Lists the read groups and samples present in the input BAM file. ```bash samtools samples input.bam ``` -------------------------------- ### samtools import: Convert FASTQ to BAM Source: https://www.htslib.org/doc/samtools.html Converts a FASTQ file to BAM format and writes to standard output. ```bash samtools import input.fastq > output.bam ``` -------------------------------- ### samtools phase: Phase BAM file Source: https://www.htslib.org/doc/samtools.html Phases the input BAM file. ```bash samtools phase input.bam ``` -------------------------------- ### samtools dict: Create sequence dictionary Source: https://www.htslib.org/doc/samtools.html Creates a sequence dictionary file for the reference FASTA. The -a option specifies the assembly name and -s the species. ```bash samtools dict -a GRCh38 -s "Homo sapiens" ref.fasta ``` -------------------------------- ### samtools fastq: Convert BAM to FASTQ Source: https://www.htslib.org/doc/samtools.html Converts the input BAM file to FASTQ format and writes to standard output. ```bash samtools fastq input.bam > output.fastq ``` -------------------------------- ### samtools head: Print BAM header Source: https://www.htslib.org/doc/samtools.html Prints the header of the input BAM file. ```bash samtools head in.bam ``` -------------------------------- ### samtools fqidx: Index FASTQ file Source: https://www.htslib.org/doc/samtools.html Indexes a FASTQ file for random access. ```bash samtools fqidx ref.fastq ``` -------------------------------- ### samtools index: Index BAM file Source: https://www.htslib.org/doc/samtools.html Creates an index for the sorted BAM file. ```bash samtools index aln.sorted.bam ``` -------------------------------- ### samtools faidx: Index FASTA file Source: https://www.htslib.org/doc/samtools.html Indexes the reference FASTA file for fast random access. ```bash samtools faidx ref.fasta ``` -------------------------------- ### samtools coverage: Report coverage statistics Source: https://www.htslib.org/doc/samtools.html Reports coverage statistics for the sorted BAM file. ```bash samtools coverage aln.sorted.bam ``` -------------------------------- ### samtools tview: Interactive alignment viewer Source: https://www.htslib.org/doc/samtools.html Displays an interactive text-based alignment viewer using the sorted BAM file and reference FASTA. ```bash samtools tview aln.sorted.bam ref.fasta ``` -------------------------------- ### Convert BAM to CRAM with samtools view Source: https://www.htslib.org/doc/samtools.html Shows two samtools view commands for converting BAM to CRAM. The first uses explicit CRAM version and options (decode_md=0, embed_ref, seqs_per_slice=2000), while the second uses the 'small' preset. Both write CRAM output files. ```bash samtools view --input-fmt-option decode_md=0 --output-fmt cram,version=3.0 --output-fmt-option embed_ref --output-fmt-option seqs_per_slice=2000 -o foo.cram foo.bam samtools view -O cram,small -o bar.cram bar.bam ``` -------------------------------- ### samtools depth: Report per-base depth Source: https://www.htslib.org/doc/samtools.html Reports per-base depth of coverage from the sorted BAM file. ```bash samtools depth aln.sorted.bam ``` -------------------------------- ### samtools quickcheck: Validate BAM/CRAM files Source: https://www.htslib.org/doc/samtools.html Quickly checks that the input files are valid BAM or CRAM files. ```bash samtools quickcheck in1.bam in2.cram ``` -------------------------------- ### samtools fasta: Convert BAM to FASTA Source: https://www.htslib.org/doc/samtools.html Converts the input BAM file to FASTA format and writes to standard output. ```bash samtools fasta input.bam > output.fasta ``` -------------------------------- ### Convert SAM to BAM with BAI index Source: https://www.htslib.org/doc/samtools.html Converts a SAM file to compressed BAM using BAI indexing. The --write-index option with the filename##idx##indexname notation specifies the index file name and format. ```bash samtools view --write-index in.sam -o out.bam##idx##out.bam.bai ``` -------------------------------- ### Import SAM to BAM with @SQ header Source: https://www.htslib.org/doc/samtools.html Converts a SAM file to BAM when the header contains @SQ lines. The -b option outputs BAM format. ```bash samtools view -b aln.sam > aln.bam ``` -------------------------------- ### samtools split: Split BAM by read groups Source: https://www.htslib.org/doc/samtools.html Splits the input BAM file into separate files based on read groups. ```bash samtools split merged.bam ``` -------------------------------- ### Import SAM to BAM without @SQ header Source: https://www.htslib.org/doc/samtools.html Converts SAM to BAM when @SQ lines are absent. First generates the .fai index with faidx, then uses -t to specify the index file. ```bash samtools faidx ref.fa samtools view -bt ref.fa.fai aln.sam > aln.bam ``` -------------------------------- ### samtools stats: Report BAM statistics Source: https://www.htslib.org/doc/samtools.html Reports detailed statistics for the sorted BAM file. ```bash samtools stats aln.sorted.bam ``` -------------------------------- ### Convert BAM to CRAM with local reference Source: https://www.htslib.org/doc/samtools.html Converts a BAM file to CRAM using a local reference sequence specified with -T. ```bash samtools view -C -T ref.fa aln.bam > aln.cram ``` -------------------------------- ### samtools mpileup: Generate pileup for a region Source: https://www.htslib.org/doc/samtools.html Generates pileup for the specified region using the reference FASTA. The -f option specifies the reference and -r the region. ```bash samtools mpileup -f ref.fasta -r chr3:1,000-2,000 in1.bam in2.bam ``` -------------------------------- ### samtools flagstat: Report flag statistics Source: https://www.htslib.org/doc/samtools.html Reports statistics on the flags in the sorted BAM file. ```bash samtools flagstat aln.sorted.bam ``` -------------------------------- ### samtools ampliconstats: Compute amplicon statistics Source: https://www.htslib.org/doc/samtools.html Computes amplicon statistics from the given BAM file using the primer intervals in primers.bed. ```bash samtools ampliconstats primers.bed in.bam ``` -------------------------------- ### Convert BAM to compressed SAM with CSI index Source: https://www.htslib.org/doc/samtools.html Converts a BAM file to compressed SAM with CSI indexing. The -h flag includes the header, -O sam,level=6 requests compressed SAM output, and --write-index creates an index automatically. ```bash samtools view -h -O sam,level=6 --write-index in.bam -o out.sam.gz ``` -------------------------------- ### samtools reheader: Replace BAM header Source: https://www.htslib.org/doc/samtools.html Replaces the header of the input BAM file with the header from in.header.sam and writes the result to standard output. ```bash samtools reheader in.header.sam in.bam > out.bam ``` -------------------------------- ### samtools idxstats: Report per-reference statistics Source: https://www.htslib.org/doc/samtools.html Reports statistics per reference sequence from the index of the sorted BAM file. ```bash samtools idxstats aln.sorted.bam ``` -------------------------------- ### samtools merge: Merge BAM files Source: https://www.htslib.org/doc/samtools.html Merges multiple BAM files into a single output BAM file. ```bash samtools merge out.bam in1.bam in2.bam in3.bam ``` -------------------------------- ### samtools targetcut: Cut BAM at target regions Source: https://www.htslib.org/doc/samtools.html Cuts the input BAM file at target regions. ```bash samtools targetcut input.bam ``` -------------------------------- ### samtools checksum: Compute BAM checksum Source: https://www.htslib.org/doc/samtools.html Computes a checksum for the input BAM file. ```bash samtools checksum in.bam ``` -------------------------------- ### samtools addreplacerg: Add or replace read groups Source: https://www.htslib.org/doc/samtools.html Adds or replaces read group tags in the input BAM file and writes the result to output.bam. The -r option specifies read group fields such as ID, LB, and SM. ```bash samtools addreplacerg -r 'ID:fish' -r 'LB:1334' -r 'SM:alpha' -o output.bam input.bam ``` -------------------------------- ### samtools cat: Concatenate BAM files Source: https://www.htslib.org/doc/samtools.html Concatenates multiple BAM files into a single output BAM file. The input files must be in the same sort order. ```bash samtools cat out.bam in1.bam in2.bam in3.bam ``` -------------------------------- ### samtools consensus: Generate consensus sequence Source: https://www.htslib.org/doc/samtools.html Generates a consensus sequence from the input BAM file and writes it to the specified FASTA file. ```bash samtools consensus -o out.fasta in.bam ``` -------------------------------- ### samtools flags: Convert flag names to numeric value Source: https://www.htslib.org/doc/samtools.html Converts a comma-separated list of flag names to their numeric value. ```bash samtools flags PAIRED,UNMAP,MUNMAP ``` -------------------------------- ### samtools fixmate: Fix mate information Source: https://www.htslib.org/doc/samtools.html Fixes mate information in a name-sorted SAM file and writes the result to a BAM file. ```bash samtools fixmate in.namesorted.sam out.bam ``` -------------------------------- ### samtools sort: Sort BAM file Source: https://www.htslib.org/doc/samtools.html Sorts the input BAM file by coordinate and writes the result to the specified output file. The -T option specifies a temporary file prefix. ```bash samtools sort -T /tmp/aln.sorted -o aln.sorted.bam aln.bam ``` -------------------------------- ### samtools view: Convert SAM to BAM Source: https://www.htslib.org/doc/samtools.html Converts a SAM file to BAM format. The -b option specifies BAM output, -t specifies a reference list file, and -o specifies the output file. ```bash samtools view -bt ref_list.txt -o aln.bam aln.sam.gz ``` -------------------------------- ### samtools collate: Collate reads by name Source: https://www.htslib.org/doc/samtools.html Collates reads by name and writes the result to the specified output file. The -o option specifies the output BAM file. ```bash samtools collate -o aln.name_collated.bam aln.sorted.bam ``` -------------------------------- ### samtools cram-size: Estimate CRAM file size Source: https://www.htslib.org/doc/samtools.html Estimates the size of a CRAM file. The -v option enables verbose output and -o specifies the output size file. ```bash samtools cram-size -v -o out.size in.cram ``` -------------------------------- ### samtools ampliconclip: Clip reads to amplicon intervals Source: https://www.htslib.org/doc/samtools.html Clips reads to the amplicon intervals defined in the BED file. The -b option specifies the BED file containing the amplicon regions. ```bash samtools ampliconclip -b bed.file input.bam ``` -------------------------------- ### samtools reference: Extract reference from CRAM Source: https://www.htslib.org/doc/samtools.html Extracts the reference sequence from a CRAM file and writes it to the specified FASTA file. ```bash samtools reference -o ref.fa in.cram ``` -------------------------------- ### samtools calmd: Calculate MD tags Source: https://www.htslib.org/doc/samtools.html Calculates and adds MD tags to the sorted BAM file using the reference FASTA file. ```bash samtools calmd in.sorted.bam ref.fasta ``` -------------------------------- ### samtools markdup: Mark duplicate reads Source: https://www.htslib.org/doc/samtools.html Marks duplicate reads in the input BAM file and writes the result to the output BAM file. ```bash samtools markdup in.algnsorted.bam out.bam ``` -------------------------------- ### samtools reset: Reset alignment information Source: https://www.htslib.org/doc/samtools.html Resets the alignment information in the input BAM file and writes the result to the specified output file. ```bash samtools reset -o /tmp/reset.bam processed.bam ``` -------------------------------- ### samtools bedcov: Report per-interval coverage Source: https://www.htslib.org/doc/samtools.html Reports the depth of coverage per genomic interval from the sorted BAM file. ```bash samtools bedcov aln.sorted.bam ``` -------------------------------- ### samtools depad: Remove padding from BAM Source: https://www.htslib.org/doc/samtools.html Removes padding from the input BAM file. ```bash samtools depad input.bam ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.