Mercurial > repos > nikos > bigwig_to_wig
changeset 13:c74a6c9cf92b draft
Deleted selected files
author | nikos |
---|---|
date | Fri, 01 Aug 2014 08:05:50 -0400 |
parents | ae0e7fbe70bd |
children | 41e2861b6ab7 |
files | bigwig_to_wig/bigwig_to_wig.sh bigwig_to_wig/bigwig_to_wig.xml bigwig_to_wig/test-data/1.bigwig bigwig_to_wig/tool_dependencies.xml |
diffstat | 4 files changed, 0 insertions(+), 154 deletions(-) [+] |
line wrap: on
line diff
--- a/bigwig_to_wig/bigwig_to_wig.sh Fri Aug 01 08:05:34 2014 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -#!/bin/bash -#$Id: bigwig2wig 23 2014-01-28 12:09:22Z jens $ - -#SCRIPT CONVERTS BIGWIG FILE TO FIXED-STEP WIGGLE FORMAT FILE -#RESOLUTION IS CONTROLLED THROUGH THE BIN SIZE - -#default bin_size -bin_size=500 -mylab="wiggle file" - -#parse input -while getopts hf:b:l: myarg -do case "$myarg" in - h) echo "Usage: bigwig_correlation -f <bigwig_file> -b <bin_size>" - echo "Ex: bigwig_correlation -f <MYFILE.bw> -b 600" - exit ;; - f) bigwig_file="$OPTARG" ;; #required - l) mylab="$OPTARG" ;; #optional - b) bin_size="$OPTARG" ;; #optional - [?]) echo "Usage: bigwig_correlation -f <MYFILE.bw> -b <bin_size>" - exit 1 ;; - esac -done - -################################################### -###VALIDATE INPUT -################################################### - -#make tmp-filename to hold chromosome info -org_assembly_file=`mktemp -u` -bigWigInfo -chroms $bigwig_file | perl -ne "/^\tchr/ && print" | perl -pe "s/ +/\t/g" | cut -f2,4 > $org_assembly_file - -#check bin_size & define step_size -bin_size_mod=`expr $bin_size % 2` #determine modulus -if [ $bin_size_mod -ne 0 ]; then - echo "Chosen bin_size must be an even positive number, added +1 to bin_size" - bin_size=$(($bin_size + 1)) -fi - -if [ $bin_size -lt 100 ]; then - echo "ERROR: Chosen bin_size must be a positive number >=100" - exit 1 -fi -#set stetp size equal to bin size i.e. non-overlapping intervals -step_size=$bin_size - -################################################### -###EXTRACT DENSITIES FROM NORMALIZED BIGWIG FILES -################################################### - - -#make track definition line -echo "track type=wiggle_0 name=$mylab description=\"fixedStep format\"" - -#for each chromsome -cat $org_assembly_file | while read line; do - - cur_chr=`echo $line | cut --delimiter=" " -f1` - cur_length=`echo $line | cut --delimiter=" " -f2` - - n_bins=`echo "scale=0; (${cur_length}-${step_size})/${bin_size}" | bc` - - start=1 - stop=`echo "$n_bins * $bin_size" | bc` - - #write header line for each chromosome - echo "fixedStep chrom=$cur_chr start=$start step=$step_size span=$step_size" - - #get densities along chr in n_bins with chosen bin_size and step_size (giving overlap in bins) - nice bigWigSummary $bigwig_file $cur_chr $start $stop $n_bins | perl -pe 's/\t/\n/g' | perl -pe "s/n\/a/0/" - #gives warning if no data in/for current chromosome - -done - -#rm tmp -rm $org_assembly_file -
--- a/bigwig_to_wig/bigwig_to_wig.xml Fri Aug 01 08:05:34 2014 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -<tool id="bigwig_to_wig" name="BigWig to Wig" version="1.0.0"> - <description>converter</description> - <command>bigwig_to_wig.sh -f $input -b $bin_size -l $mylab > $output </command> - <requirements> - <requirement type="package">bigWigSummary</requirement> - <requirement type="package">bigWigInfo</requirement> - </requirements> - <inputs> - <param format="bigwig" name="input" type="data" label="BigWig file to convert" /> - <param name="bin_size" size="4" type="integer" value="500" label="Bin size" help="Must be an even integer > 100." /> - <param name="mylab" type="text" value="wiggle_file" label="Output file prefix" help="" /> - </inputs> - <outputs> - <data format="wig" name="output" label="${mylab}_density_bin${bin_size}.wig" /> - </outputs> - <tests> - <test> - <param name="input" value="1.bigwig" /> - <param name="bin_size" value="500" /> - <output name="output" file="1.wig" /> - <test> - </tests> - <help> - -This tool converts a **BigWig** file to fixed step **Wiggle** format. -Resolution is controlled through the bin size (the higher the size, the lower the resolution). - -The script this tool is based on is written by Jens Vilstrup Johansen and uses bigWigInfo_ and bigWigSummary_. - -.. _bigWigInfo: https://github.com/adamlabadorf/ucsc_tools/blob/master/executables/bigWigInfo -.. _bigWigSummary: https://github.com/adamlabadorf/ucsc_tools/blob/master/executables/bigWigSummary - -</help> -</tool>
--- a/bigwig_to_wig/tool_dependencies.xml Fri Aug 01 08:05:34 2014 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<tool_dependency> - <package name="bigWigSummary"> - <install version="1.0"> - <actions_group> - <actions os="linux" architecture="x86_64"> - <action type="download_binary"><url_template>http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/bigWigSummary</url_template></action> - <action type="move_directory_files"> - <source_directory>.</source_directory> - <destination_directory>$INSTALL_DIR</destination_directory> - </action> - </actions> - - - <action type="set_environment"> - <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR</environment_variable> - </action> - </actions_group> - </install> - <readme> - </readme> - </package> - <package name="bigWigInfo"> - <install version="1.0"> - <actions_group> - <actions os="linux" architecture="x86_64"> - <action type="download_binary"><url_template>http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/bigWigInfo</url_template></action> - <action type="move_directory_files"> - <source_directory>.</source_directory> - <destination_directory>$INSTALL_DIR</destination_directory> - </action> - </actions> - - - <action type="set_environment"> - <environment_variable name="PATH" action="prepend_to">$INSTALL_DIR</environment_variable> - </action> - </actions_group> - </install> - <readme> - </readme> - </package> -</tool_dependency>