cat ctms_bigwigs.tsv | head -5 | perl -ne 'chomp; ($rid,$bw,$g)=split(/\t/,$_); @f=split(/\s+/,$g); $i=0; for $f (@f) { @e=split(//,$f); if(scalar(@e) == 3 && ord($e[0]) == 226 && ord($e[1]) == 128 && ord($e[2]) == 148) { $f[$i]="-"; } $i++; } print "$rid\t$bw\t".join(" ",@f)."\n";' > ctms_bigwigs.tsv.fixed ls *.bw | perl -ne 'BEGIN { open(IN,"<./ctms_bigwigs.tsv.fixed"); while($line=) { chomp($line); $line =~s/\r$//; ($rid,$bw,$g)=split(/\t/,$line); $h{$bw}=$g; } close(IN); } chomp; $f=$_; $g=$h{$f}; $i2++; $d=3-length($i2); $i=("0"x$d).$i2; print "\ttrack Track$i\n\tparent CTMS off\n\tbigDataUrl $f\n\tshortLabel $i $g\n\tlongLabel $i $g\n\ttype bigWig\n\n";' >> ./trackDb.txt