Good Morning Carlos:

Maybe your samtools pileup command is giving a different
output than this script expects.  I just tried this here:

samtools pileup test.bam | perl -pe '
($c, $start, undef, $depth) = split;
if ($c ne $lastC || $start != $lastStart+1) {
     print "fixedStep chrom=$c start=$start step=1 span=1\n";
}
$_ = "$depth\n";
($lastC, $lastStart) = ($c, $start);'

and it works just fine.  The output of the samtools pileup looks like:

chr10   65700   N       1       ^!T     I
chr10   65701   N       1       A       I
chr10   65702   N       1       T       I
chr10   65703   N       1       C       I
chr10   65704   N       1       A       I
chr10   65705   N       1       A       I
chr10   65706   N       1       G       I
chr10   65707   N       1       A       I
chr10   65708   N       1       C       I
chr10   65709   N       1       C       I

My samtools says its version is:

 > Program: samtools (Tools for alignments in the SAM format)
 > Version: 0.1.12a (r862)

--Hiram

> On Thu, Feb 24, 2011 at 1:05 PM, Carlos Javier Borroto
>> On Thu, Feb 24, 2011 at 12:21 PM, Hiram Clawson  wrote:
>>> Good Morning Carlos:
>>>
>>> Here is an alternative procedure to create a coverage graph
>>> for a bam file:
>>>
>>> https://lists.soe.ucsc.edu/pipermail/genome/2010-December/024318.html
>>>
>> I tried this, but is failing on Ubuntu Lucid:
>> samtools pileup mybam.sorted.bam         | perl -pe '($c, $start,
>> undef, $depth) = split; \
>> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â if ($c ne $lastC || $start != $lastStart+1) { \
>> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â  Â print "fixedStep chrom=chr$c start=$start 
>> step=1
>> span=1\n"; \
>> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â } \
>> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â $_ = "$depth\n"; \
>> Â  Â  Â  Â  Â  Â  Â  Â  Â  Â ($lastC, $lastStart) = ($c, $start);'
>> syntax error at -e line 2, near "if"
>> syntax error at -e line 6, near ";}"
>>
>> My perl skills aren't that good, I even tried to move it to a file and
>> I got rid of the syntax error, but the script only prints the first
>> line. This is the file I created.
>> pileupToWiggle.pl:
>>
>> #!/usr/bin/perl
>>
>> ($c, $start, undef, $depth) = split;
>> if ($c ne $lastC || $start != $lastStart+1) {
>> Â print "fixedStep chrom=chr$c start=$start step=1 span=1\n";
>> }
>> $_ = "$depth\n";
>> ($lastC, $lastStart) = ($c, $start);
>>
>> And I tried to use it like this:
>> $ samtools pileup mybam.sorted.bam | pileupToWiggle.pl
>> fixedStep chrom=chr start= step=1 span=1
>>
>> Would be nice to get it to work, any further help?
>>
>>> For assistance with BEDTools, please consult the bedTools project:
>>> http://code.google.com/p/bedtools/
>>>
>> I thought the problem could had been in the way I was declaring my
>> track, that there was an option to get it to display the data in the
>> way I wanted, but you are right, I should have gone to BEBTools
>> project website.
>>
>>> Can you intersect your graph with 'NOT gap' in the table browser
>>> to display the graph in areas that are not gap ?
>>>
>> This I did not understand, I'm very new to the Genome Browser.
>>
>>> --Hiram
>> Thanks for your comments,
>> --
>> Carlos Javier Borroto
>> Baltimore, MD
_______________________________________________
Genome maillist  -  [email protected]
https://lists.soe.ucsc.edu/mailman/listinfo/genome

Reply via email to