Skip to content

Instantly share code, notes, and snippets.

@millerh1
Created August 27, 2021 22:21
Show Gist options
  • Save millerh1/316ab4e45056829a609c6f64611466df to your computer and use it in GitHub Desktop.
Save millerh1/316ab4e45056829a609c6f64611466df to your computer and use it in GitHub Desktop.
Shuffle Bam File
#!/bin/bash
bamToBed -i $BAM_ORIG -bed12 -cigar | shuffleBed -i - -g $CHROM_SIZES | bedToBam -bed12 -g $CHROM_SIZES | samtools sort > $BAM_SHUFFLED
@millerh1
Copy link
Author

This is a simple one-liner for taking a bam file and shuffling it.

Requires bedtools and samtools installed. Also requires a chrom.sizes file provided for the relevant genome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment