Skip to content

Instantly share code, notes, and snippets.

@kepbod
Last active August 29, 2015 14:08
Show Gist options
  • Save kepbod/7e21576bf2391decbb98 to your computer and use it in GitHub Desktop.
Save kepbod/7e21576bf2391decbb98 to your computer and use it in GitHub Desktop.
Convert ref format to BED format
perl -alne '@starts = split /,/,$F[9]; @ends = split /,/,$F[10]; @sizes = map {$ends[$_] - $starts[$_]} 0..($F[8]-1); @offsets = map {$_ - $F[4]} @starts; $" = ","; print "$F[2]\t$F[4]\t$F[5]\t$F[0]/$F[1]\t0\t$F[3]\t$F[6]\t$F[7]\t0,0,0\t$F[8]\t@sizes\t@offsets"' ref.txt > ref.bed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment