#!/usr/bin/perl
$len=$ARGV[0];
while(<STDIN>){
    chomp;
    if($_=~/\s+(.*)\s+position=\s+(\d+)C\s+score=\s+([\d,.]+)\s+ln\(p-value\)=\s+([-,d,.]+)/){
	$seq=$1;
	$start=$2;
	$end=$start+$len;
	$score=$3;
	$strand="-";
#	print $1."\t".$2."\t".$3."\t".$4."\n";
    }
    if($_=~/\s+(.*)\s+position=\s+(\d+)\s+score=\s+([\d,.]+)\s+ln\(p-value\)=\s+([-,d,.]+)/){
	$strand="+";
	$start=$2;
        $end=$start+$len;
        $score=$3;
    }
    if($seq){
#$print $1."\t".$2."\t".$3."\t".$4."\t".$strand."\n";
print $seq."\t".$start."\t".$end."\t.\t".$score."\t".$strand."\n";
}
}
