gravatar for predeus

1 hour ago by

Hinxton, UK

Do you use TSSpredator standalone? I would suggest installing ANNOgesic, it makes it easier to do the whole analysis and adds quite a lot more functionality.

To answer your question, wiggle is just a format of coverage. You can make it from the alignment BAM file. There's a frustrating lack of consistency in .wig definition though (e.g. if you will make a .bigWig and convert it to wig, it won't work for ANNOgesic, even though it's totally fine for visualisation).

Also, ANNOgesic requires a strand-specific wig file. Here's a small script I wrote for making wig files that work with it nicely. You'll need to save this as some file, e.g. make_proper_wig.pl, and make it executable. You also need to have samtools (v1+) installed.

#!/usr/bin/env perl 

use strict; 
use warnings; 

if ($#ARGV < 1) { 
  print "Usage: ./make_proper_wig.pl <bam> <strand>n";
  print "Requires samtools v1+; strand can be + or -n"; 
  exit 1
}

my $bam = shift @ARGV;
my $strand = shift @ARGV; 

if ($strand ne "+" && $strand ne "-") { 
  die "ERROR: Strand can be + or - only!n"; 
} 

if ($strand eq "+") { 
  system "samtools view -b -F 16 $bam | samtools depth -d 0 - > $bam.$$.out"; 
} else {
  system "samtools view -b -f 16 $bam | samtools depth -d 0 - > $bam.$$.out";
}

open COV,"<","$bam.$$.out" or die "$!"; 

my $tag = $bam; 
$tag =~ s/.bam//g; 

printf "track type=wiggle_0 name=%sn",$tag;
my $lastC = ""; 

while (<COV>) { 
  my ($c, $start, $depth) = split;
  print "variableStep chrom=$c span=1n" if ($c ne $lastC);
  $lastC = $c; 
  if ($strand eq "+") {
    print "$startt$depthn"; 
  } else { 
    print "$startt-$depthn";
  } 
} 

system "rm $bam.$$.out";
close COV;

link

modified 1 hour ago

written
1 hour ago
by

predeus1.5k



Source link