Mercurial > repos > fubar > jbrowse2dev
comparison jbrowse2/maf2bed.pl @ 0:cd5d63cd0eb5 draft
Uploaded
author | fubar |
---|---|
date | Wed, 03 Jan 2024 01:36:39 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:cd5d63cd0eb5 |
---|---|
1 #!/usr/bin/env perl | |
2 use warnings; | |
3 use strict; | |
4 | |
5 $, = ' '; | |
6 $\ = "\n"; | |
7 $, = "\t"; | |
8 | |
9 my $id = 0; | |
10 my $buffer = ''; | |
11 my $start = 0; | |
12 my $end = 0; | |
13 my $score = 0; | |
14 my $chrom = ''; | |
15 | |
16 while (<STDIN>) { | |
17 chomp; | |
18 next if /^$/; | |
19 my @line = split('\s+'); | |
20 if (/^s\s+$ARGV[0]/) { | |
21 $chrom = $line[1]; | |
22 $chrom =~ s/$ARGV[0]\.//; | |
23 $start = $line[2]; | |
24 $end = $line[2] + $line[3]; | |
25 s/^s //; | |
26 s/ +/:/g; | |
27 my $temp = $_; | |
28 $buffer = $buffer eq '' ? $temp : "$buffer,$temp"; | |
29 } | |
30 elsif (/^a/) { | |
31 $score = +(s/^a score=//); | |
32 if($id > 0) { | |
33 print $chrom, $start, $end, "$ARGV[0]_$id", $score, $buffer; | |
34 } | |
35 $id += 1; | |
36 $buffer = ''; | |
37 } | |
38 | |
39 elsif (/^s/) { | |
40 s/^s //; | |
41 s/ +/:/g; | |
42 my $temp = $_; | |
43 $buffer = $buffer eq '' ? $temp : "$buffer,$temp"; | |
44 } | |
45 } | |
46 print $chrom, $start, $end, "$ARGV[0]_$id", $score, $buffer; |