comparison carpet-src-1/tools/CARPET/gff2bed_v2.pl @ 0:cdd489d98766

Migrated tool version 1.0.0 from old tool shed archive to new tool shed repository
author matces
date Tue, 07 Jun 2011 16:50:41 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cdd489d98766
1 #! /usr/bin/perl
2
3 # Copyright 2009 Matteo Cesaroni, Lucilla Luzi
4 #
5 # This program is free software; ; you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or (at your
8 # option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14
15
16 $fname=$ARGV[0]; #legge il nome del file che gli passi dopo il comando
17 $col3=$ARGV[1];
18
19 qx {sort -k 1,1 -k 4,4n $fname >$fname.sortato};
20
21 open(FILE, "< $fname.sortato") or die "Cannot find file $fname\n";
22
23 @array=<FILE>;
24
25 print "track type=wiggle_0 name=\"$col3\" description=\"raw_data ratio\" visibility=full autoscale=off maxHeightPixels=100:50:20 color=200,100,0 altColor=0,100,200 \n";
26
27 for ($i=0;$i<$#array;$i++){
28 @array_new= split("\t",$array[$i]);
29 @array_new2=split("\t",$array[$i+1]);
30 $dist=$array_new[4]-$array_new2[3];
31 if (($array_new[4]>=$array_new2[3])&&("$array_new[0]"eq"$array_new2[0]")){
32 $fine=$array_new2[3]-1;
33 }
34 else {
35 $fine=$array_new[4];
36
37 }
38 print "$array_new[0]\t$array_new[3]\t$fine\t$array_new[5]\n";
39
40 }
41 @array_fine=split("\t", $array[$#array]);
42 print "$array_fine[0]\t$array_fine[3]\t$array_fine[4]\t$array_fine[5]\n";
43
44 close FILE;