Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Create, manipulate, and convert bedGraph files for genome browser visualization. Covers bedGraph format, conversion to/from bigWig, normalization, and signal processing. Use when handling coverage and signal tracks from ChIP-seq, ATAC-seq, or RNA-seq.
.claude/skills/bio-bedgraph-handling/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 80% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 213% | 0% |
| case-14 | ✗→✓ | ▲ Improved | 316% | 0% |
| case-01 | ✓→✓ | = Same ✓ | 276% | 0% |
| case-03 | ✓→✓ | = Same ✓ | 126% | 0% |
<!--
#
#
-->
bedGraph is a text format for displaying continuous-valued data on genome browsers. Common for coverage, signal intensity, and scores.
track type=bedGraph name="Sample" description="Coverage"
chr1 0 100 1.5
chr1 100 200 2.3
chr1 200 300 0.8Four columns: chrom, start, end, value (0-based, half-open)
bashbedtools genomecov -ibam sample.bam -bg > sample.bedgraph bedtools genomecov -ibam sample.bam -bg -split > sample.bedgraph bedtools genomecov -ibam sample.bam -bg -scale 1.5 > sample.scaled.bedgraph
bashbedtools genomecov -ibam sample.bam -bg -strand + > sample.plus.bedgraph bedtools genomecov -ibam sample.bam -bg -strand - > sample.minus.bedgraph
bashbedtools genomecov -ibam sample.bam -bg -5 > sample.5prime.bedgraph
bashtotal_reads=$(samtools view -c -F 260 sample.bam) scale=$(echo "scale=10; 1000000 / $total_reads" | bc) bedtools genomecov -ibam sample.bam -bg -scale $scale > sample.cpm.bedgraph
bedGraph must be sorted for conversion to bigWig.
bashsort -k1,1 -k2,2n sample.bedgraph > sample.sorted.bedgraph LC_ALL=C sort -k1,1 -k2,2n sample.bedgraph > sample.sorted.bedgraph
bashbedGraphToBigWig sample.sorted.bedgraph chrom.sizes sample.bw fetchChromSizes hg38 > hg38.chrom.sizes bedGraphToBigWig sample.sorted.bedgraph hg38.chrom.sizes sample.bw
bashsamtools faidx reference.fa cut -f1,2 reference.fa.fai > chrom.sizes fetchChromSizes hg38 > hg38.chrom.sizes mysql --user=genome --host=genome-mysql.soe.ucsc.edu -A -e \ "select chrom, size from hg38.chromInfo" > hg38.chrom.sizes
bashbedClip sample.bedgraph chrom.sizes sample.clipped.bedgraph bedGraphToBigWig sample.clipped.bedgraph chrom.sizes sample.bw
bashbigWigToBedGraph sample.bw sample.bedgraph bigWigToBedGraph sample.bw sample.chr1.bedgraph -chrom=chr1 bigWigToBedGraph sample.bw sample.region.bedgraph -chrom=chr1 -start=1000 -end=2000
bashbedtools unionbedg -i sample1.bedgraph sample2.bedgraph sample3.bedgraph \ -header -names sample1 sample2 sample3 > merged.bedgraph
bashbedtools unionbedg -i sample1.bedgraph sample2.bedgraph sample3.bedgraph | \ awk '{sum=0; for(i=4;i<=NF;i++) sum+=$i; print $1,$2,$3,sum/(NF-3)}' OFS='\t' \ > average.bedgraph
bashbedtools map -a regions.bed -b sample.bedgraph -c 4 -o mean > region_means.bed bedtools map -a regions.bed -b sample.bedgraph -c 4 -o sum > region_sums.bed bedtools map -a regions.bed -b sample.bedgraph -c 4 -o max > region_max.bed
bashbedtools unionbedg -i treatment.bedgraph input.bedgraph | \ awk '{diff=$4-$5; if(diff<0) diff=0; print $1,$2,$3,diff}' OFS='\t' \ > subtracted.bedgraph
bashawk '{print $1,$2,$3,log($4+1)/log(2)}' OFS='\t' sample.bedgraph > sample.log2.bedgraph
bashbedtools slop -i sample.bedgraph -g chrom.sizes -b 50 | \ bedtools merge -i - -c 4 -o mean > smoothed.bedgraph
pythonimport pyBigWig bw = pyBigWig.open('output.bedgraph', 'w') bw.addHeader([('chr1', 248956422), ('chr2', 242193529)]) chroms = ['chr1', 'chr1', 'chr1'] starts = [0, 100, 200] ends = [100, 200, 300] values = [1.5, 2.3, 0.8] bw.addEntries(chroms, starts, ends=ends, values=values) bw.close()
pythonimport pyBigWig bw = pyBigWig.open('sample.bw') for chrom, size in bw.chroms().items(): intervals = bw.intervals(chrom) if intervals: for start, end, value in intervals: print(f'{chrom}\t{start}\t{end}\t{value}') bw.close()
pythonimport pyBigWig bw = pyBigWig.open('sample.bw') intervals = bw.intervals('chr1', 1000000, 2000000) with open('region.bedgraph', 'w') as f: for start, end, value in intervals: f.write(f'chr1\t{start}\t{end}\t{value}\n') bw.close()
bashbamCoverage -b sample.bam -o sample.bw --normalizeUsing RPKM bamCoverage -b sample.bam -o sample.bw --normalizeUsing CPM bamCoverage -b sample.bam -o sample.bw --normalizeUsing BPM bamCoverage -b sample.bam -o sample.bedgraph --outFileFormat bedgraph --normalizeUsing CPM
bashbamCompare -b1 treatment.bam -b2 input.bam -o log2ratio.bw --scaleFactorsMethod readCount bamCompare -b1 treatment.bam -b2 input.bam -o subtracted.bw --ratio subtract
bashbigwigCompare -b1 treatment.bw -b2 input.bw -o ratio.bw --ratio log2 bigwigCompare -b1 sample1.bw -b2 sample2.bw -o diff.bw --ratio subtract
bashawk '$4 >= 1.0' sample.bedgraph > high_signal.bedgraph awk '$4 > 0' sample.bedgraph > nonzero.bedgraph
bashbedtools intersect -a sample.bedgraph -b regions.bed > subset.bedgraph
bashgrep -v "^chrM" sample.bedgraph | grep -v "_random" > filtered.bedgraph awk '$1 ~ /^chr[0-9XY]+$/' sample.bedgraph > standard_chroms.bedgraph
bashbedtools makewindows -g chrom.sizes -w 1000 > bins.bed bedtools map -a bins.bed -b sample.bedgraph -c 4 -o mean > binned.bedgraph
bashbedtools map -a genes.bed -b sample.bedgraph -c 4 -o mean > gene_signal.bed
bashbedtools merge -i sample.bedgraph -c 4 -o collapse | \ awk 'index($4,",") > 0' | head
bashsort -c -k1,1 -k2,2n sample.bedgraph && echo "Sorted" || echo "Not sorted"
bashawk 'NR==1 {min=$4; max=$4} {if($4<min) min=$4; if($4>max) max=$4} END {print "Min:", min, "Max:", max}' sample.bedgraph
bash#!/bin/bash BAM=$1 NAME=$(basename $BAM .bam) CHROM_SIZES=$2 total_reads=$(samtools view -c -F 260 $BAM) scale=$(echo "scale=10; 1000000 / $total_reads" | bc) bedtools genomecov -ibam $BAM -bg -scale $scale > ${NAME}.bedgraph sort -k1,1 -k2,2n ${NAME}.bedgraph > ${NAME}.sorted.bedgraph bedClip ${NAME}.sorted.bedgraph $CHROM_SIZES ${NAME}.clipped.bedgraph bedGraphToBigWig ${NAME}.clipped.bedgraph $CHROM_SIZES ${NAME}.bw rm ${NAME}.bedgraph ${NAME}.sorted.bedgraph ${NAME}.clipped.bedgraph echo "Created ${NAME}.bw (CPM normalized)"
bashecho 'track type=bedGraph name="Sample" description="CPM normalized" visibility=full color=0,0,255 altColor=255,0,0 autoScale=on graphType=bar' > track.bedgraph cat sample.bedgraph >> track.bedgraph
<!-- AUTHOR_SIGNATURE: 9a7f3c2e-MD-BABU-MIA-2026-MSSM-SECURE -->
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | pass→pass | 4,658 | 3,034 | -35% | 1 | 1 | 0% | 868 | 3,260 | +276% | 0 | 0 | — |
case-02 | fail→pass | 9,934 | 3,861 | -61% | 1 | 1 | 0% | 1,906 | 3,423 | +80% | 0 | 0 | — |
case-03 | pass→pass | 9,029 | 5,197 | -42% | 1 | 1 | 0% | 1,660 | 3,754 | +126% | 0 | 0 | — |
case-04 | pass→pass | 8,797 | 3,611 | -59% | 1 | 1 | 0% | 1,697 | 3,395 | +100% | 0 | 0 | — |
case-05 | pass→pass | 3,887 | 2,036 | -48% | 1 | 1 | 0% | 657 | 3,050 | +364% | 0 | 0 | — |
case-06 | pass→pass | 4,896 | 3,215 | -34% | 1 | 1 | 0% | 988 | 3,286 | +233% | 0 | 0 | — |
case-07 | pass→pass | 6,811 | 3,511 | -48% | 1 | 1 | 0% | 1,315 | 3,412 | +159% | 0 | 0 | — |
case-08 | pass→pass | 8,533 | 5,997 | -30% | 1 | 1 | 0% | 1,638 | 3,927 | +140% | 0 | 0 | — |
case-09 | pass→pass | 7,518 | 3,163 | -58% | 1 | 1 | 0% | 1,439 | 3,264 | +127% | 0 | 0 | — |
case-10 | pass→pass | 11,019 | 5,290 | -52% | 1 | 1 | 0% | 1,852 | 3,740 | +102% | 0 | 0 | — |
case-11 | pass→pass | 8,210 | 5,108 | -38% | 1 | 1 | 0% | 1,560 | 3,637 | +133% | 0 | 0 | — |
case-12 | pass→pass | 7,288 | 3,917 | -46% | 1 | 1 | 0% | 1,313 | 3,320 | +153% | 0 | 0 | — |
case-13 | fail→pass | 5,381 | 3,762 | -30% | 1 | 1 | 0% | 1,071 | 3,348 | +213% | 0 | 0 | — |
case-14 | fail→pass | 3,736 | 2,504 | -33% | 1 | 1 | 0% | 760 | 3,164 | +316% | 0 | 0 | — |
case-15 | pass→pass | 3,715 | 2,827 | -24% | 1 | 1 | 0% | 687 | 3,186 | +364% | 0 | 0 | — |
case-16 | pass→pass | 9,339 | 6,531 | -30% | 1 | 1 | 0% | 1,849 | 3,988 | +116% | 0 | 0 | — |
case-17 | pass→pass | 14,302 | 6,258 | -56% | 1 | 1 | 0% | 2,801 | 3,909 | +40% | 0 | 0 | — |
case-18 | fail→fail | 11,659 | 12,909 | +11% | 1 | 1 | 0% | 2,196 | 5,108 | +133% | 0 | 0 | — |
case-19 | pass→pass | 8,674 | 5,641 | -35% | 1 | 1 | 0% | 1,679 | 3,700 | +120% | 0 | 0 | — |
case-20 | pass→pass | 4,876 | 3,841 | -21% | 1 | 1 | 0% | 908 | 3,341 | +268% | 0 | 0 | — |
case-21 | pass→pass | 11,562 | 13,260 | +15% | 1 | 1 | 0% | 2,420 | 4,738 | +96% | 0 | 0 | — |
case-22 | pass→pass | 14,441 | 11,160 | -23% | 1 | 1 | 0% | 2,899 | 4,929 | +70% | 0 | 0 | — |
case-23 | pass→pass | 10,315 | 5,936 | -42% | 1 | 1 | 0% | 2,130 | 3,883 | +82% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +13 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
| Model | Method | Date | Lift |
|---|---|---|---|
| gemini-3.6-flash | verified | 7/26/2026 | +18% |
Other measured skills in the registry, with their headline benchmark lift.