Skip to content

Instantly share code, notes, and snippets.

@radaniba
Created November 29, 2012 17:19
Show Gist options
  • Save radaniba/4170518 to your computer and use it in GitHub Desktop.
Save radaniba/4170518 to your computer and use it in GitHub Desktop.
Get everything working, extract line by line in BED file, run hgWiggle and calculate conserved bases and conserved regions and output into bed file
#!/usr/bin/perl -w
my $numb = 1;
open(RefGenes, "< ../RefGenes.bed");
while(<RefGenes>)
{
print("$numb\r");
# Good practice to store $_ value because
# subsequent operations may change it.
my($line) = $_;
# Good practice to always strip the trailing
# newline from the line.
chomp($line);
# Convert the line to upper case.
#$line =~ tr/[a-z]/[A-Z]/;
# Print the line to the screen and add a newline
my @data = split(/\t/, $line);
getCoverage($data[0],$data[1],$data[2]);
$numb++;
}
close (RefGenes);
sub getCoverage {
($chr, $start, $end) = @_;
#/nfshomes/aniba/bin/x86_64/hgWiggle -chr=chr12 -position=chr12:51987539-51987559 -rawDataOut phastCons44way > tmp
@score = `/nfshomes/aniba/bin/x86_64/hgWiggle -chr=$chr -position=$chr:$start-$end -rawDataOut phastCons44way > tmp`;
#print "RawData/bigWigSummary $bwfile $chr $start $end $step 2>&1";
system(@score);
#print(@RCMD);
@RCMD = `R CMD BATCH --no-save --no-restore '--args $chr $start $end' coveragecount.R`;
system(@RCMD);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment