annotate carpet-src-1/tools/CARPET/gff2bed_v2.pl @ 1:78770028dcf1 default tip

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