That is certainly odd behavior for this simple sed command. I have no idea
why it would work on one line and not another. Unless the file has unusual
ideas
about how it does line breaks. See if your file has unusual characters in it:
head yourFile.bed | cat -A
The 'cat -A' will show any non-printable characters. Does the 'head' command
output 10 lines from the file ?
I'm guessing your original bam file has chromosome numbers instead of the chr17
strings
used at UCSC. In that case, you will need to insert the chr prefix to the
numbers
in your bed file. To use this bed file at UCSC, you want the string "chr" and
*not* the string "Chr" that you are using in your examples here.
--Hiram
DeQuincy Prescott (UCL) wrote:
> Thanks for this,
>
> I am using Terminal Version 2.2.2 (303) on Mac OSX Version 10.7.3
>
> I tried the command that you sent: sed -e 's/^/chr/' inputFile.bed >
> outputFile.bed and it did the first line but not the rest.
>
> chr17 397142 397152 1
> 17 397152 397171 2
> 17 397171 397183 3
> 17 397183 397192 4
> 17 397192 397202 3
>
> I get a similar result when I do:
> awk '{print "chr"$1,$2,$3,$4}' inputFile.bed > outputFile.bed
> awk '/^/{print "chr"$1,$2,$3,$4}' inputFile.bed > outputFile.bed
> sed -i .bak 's/^/Chr/'inputFile.bed > outputFile.bed
> sed -i '''s/^/Chr/' inputFile.bed > outputFile.bed
> sed 's/^/^Chr/' inputFile.bed > outputFile.bed
>
> and others…
>
> How do I get it to do the other lines
>
> genomeCoverageBed is part of the BedTools and it creates either a histogram,
> BEDGRAPH, or a "per base" report of genome coverage. as you can see from here
> http://code.google.com/p/bedtools/
>
> The source files was a Bam file and corresponding .bai file.
>
> Can UCSC generate a Coverage histogram is that possible?
>
> Thank you.
>
> -----------------------------------------------------
> DeQuincy Prescott
> Sen Res Tech to Professor Bhattacharya
> -----------------------------------
> about our group
> http://tinyurl.com/3264vn
> ------------------------------------
> Mobile: +44 (0) 7590 695 435
> Office: +44 (0) 207 608 6951
> -----------------------------------------------------
>
> On 27 Feb 2012, at 17:49, Hiram Clawson wrote:
>
>> Good Morning:
>>
>> Can you please clarify what the program 'genomeCoverageBed' is and what it
>> is working on ?
>> Did the source files you used with 'genomeCoverageBed' have the 'chr' prefix
>> on the chromosome numbers ?
>>
>> You can simply change a file such as this with this sed command
>> to place "chr" at the beginning of each line:
>>
>> sed -e 's/^/chr/' inputFile.bed > outputFile.bed
>>
>> You should be using chr instead of Chr if you are loading these tracks
>> into the UCSC genome browser.
>>
>> --Hiram
>>
>> DeQuincy Prescott (UCL) wrote:
>>> I managed to insert the header line however the genomeCoverageBed program
>>> made each line without the "Chr" start
>>> i.e.
>>> 17 422997 422999 26
>>> 17 422999 423001 27
>>> 17 423001 423003 29
>>> 17 423003 423010 28
>>> 17 423010 423012 29
>>> 17 423012 423013 32
>>> 17 423013 423014 34
>>> instead of Chr17 422997 422999 26
>>> Chr17 422999 423001 27
>>> Chr17 423001 423003 29
>>> Chr17 423003 423010 28
>>> Chr17 423010 423012 29
>>> Chr17 423012 423013 32
>>> Chr17 423013 423014 34
>>> Is there a way to get "Chr" inserted at the beginning of each line or is
>>> there a way to get UCSC to read the file without it?
>>> Thanks
>>> -----------------------------------------------------
>>> DeQuincy Prescott
>>> Sen Res Tech to Professor Bhattacharya
>
>
_______________________________________________
Genome maillist - [email protected]
https://lists.soe.ucsc.edu/mailman/listinfo/genome