Mercurial > repos > artbio > bigwig_to_wig
comparison bigwig_to_wig.sh @ 1:ac8ea1ca115d draft default tip
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/main/tools/bigwig_to_wig commit 85bdb086a4aa403465844a0b10399440b31b65a7
author | artbio |
---|---|
date | Fri, 06 Oct 2023 00:19:35 +0000 |
parents | ee2fbee916f7 |
children |
comparison
equal
deleted
inserted
replaced
0:ee2fbee916f7 | 1:ac8ea1ca115d |
---|---|
52 #make track definition line | 52 #make track definition line |
53 echo "track type=wiggle_0 name=$mylab description=\"fixedStep format\"" | 53 echo "track type=wiggle_0 name=$mylab description=\"fixedStep format\"" |
54 | 54 |
55 #for each chromsome | 55 #for each chromsome |
56 while read line; do | 56 while read line; do |
57 | 57 |
58 cur_chr=$(echo $line | cut --delimiter=" " -f1) | 58 cur_chr=$(echo $line | cut -d " " -f1) |
59 cur_length=$(echo $line | cut --delimiter=" " -f2) | 59 cur_length=$(echo $line | cut -d " " -f2) |
60 | 60 |
61 n_bins=$(echo "scale=0; (${cur_length}-${step_size})/${bin_size}" | bc) | 61 n_bins=$(echo "scale=0; (${cur_length}-${step_size})/${bin_size}" | bc) |
62 | 62 |
63 start=1 | 63 start=1 |
64 stop=$(echo "$n_bins * $bin_size" | bc) | 64 stop=$(echo "$n_bins * $bin_size" | bc) |
65 | 65 |
66 #write header line for each chromosome | 66 #write header line for each chromosome |
67 echo "fixedStep chrom=$cur_chr start=$start step=$step_size span=$step_size" | 67 echo "fixedStep chrom=$cur_chr start=$start step=$step_size span=$step_size" |
68 | 68 |
69 #get densities along chr in n_bins with chosen bin_size and step_size (giving overlap in bins) | 69 #get densities along chr in n_bins with chosen bin_size and step_size (giving overlap in bins) |
70 nice bigWigSummary $bigwig_file $cur_chr $start $stop $n_bins | perl -pe 's/\t/\n/g' | perl -pe "s/n\/a/0/" | 70 nice bigWigSummary $bigwig_file $cur_chr $start $stop $n_bins | perl -pe 's/\t/\n/g' | perl -pe "s/n\/a/0/" |
71 #gives warning if no data in/for current chromosome | 71 #gives warning if no data in/for current chromosome |
72 | 72 |
73 done < $org_assembly_file | 73 done < $org_assembly_file |
74 | 74 |
75 #rm tmp | 75 #rm tmp |
76 rm $org_assembly_file | 76 rm $org_assembly_file |
77 | 77 |