File: cgShore.pl

package info (click to toggle)
snpeff 5.2.f%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 701,384 kB
  • sloc: java: 62,547; perl: 2,279; sh: 1,185; python: 744; xml: 507; makefile: 50
file content (39 lines) | stat: -rwxr-xr-x 1,217 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl

#-------------------------------------------------------------------------------
#
# Add shore / shelf to CpG islands:
#
#	i) Shore : 2KB up/downstream of the islands (North-shore / South-shore)
#	ii) Shelf : 2KB up/downstream of the shore:
#		ii.a) North-shelf upstream of North_Shore
#		ii.b) South-shelf downstream of South-shore
#
#
#														Pablo Cingolani 2013
#-------------------------------------------------------------------------------

$SHORE_SIZE = 2000;
$SHELF_SIZE = 2000;

while( $l = <STDIN> ) {
	chomp $l;
	($chr, $start, $end) = split /\s+/, $l;

	if( $start >= 0 ) {

		($shelfStart,$shelfEnd) = ($start - $SHORE_SIZE - $SHELF_SIZE, $start - $SHORE_SIZE);
		print "$chr\t$shelfStart\t$shelfEnd\tCpG_N_SHELF\n" if( $shelfStart >= 0);

		($shoreStart,$shoreEnd) = ($start - $SHORE_SIZE, $start);
		print "$chr\t$shoreStart\t$shoreEnd\tCpG_N_SHORE\n" if( $shoreStart >= 0);

		print "$chr\t$start\t$end\tCpG_ISLAND\n";

		($shoreStart,$shoreEnd) = ($end, $end + $SHORE_SIZE);
		print "$chr\t$shoreStart\t$shoreEnd\tCpG_S_SHORE\n";

		($shelfStart,$shelfEnd) = ($end + $SHORE_SIZE, $end + $SHORE_SIZE + $SHELF_SIZE);
		print "$chr\t$shelfStart\t$shelfEnd\tCpG_S_SHELF\n";
	}
}