This is a test version of Biostars. For the public version, visit https://www.biostars.org.
how to format a large txt file to bed

Dear all,
I am trying to format CpG methylation calls from R package "methyKit" to simple bed format. Since it is a large file, i can not do it in Excel. I also tried Seqmonk, but it does not allow me to export the data in the format I want. Linux awk/seq might be a good option, but i am new to them as well. Basically, I need to trim "chr" column, add "stop" column, convert "F" to "+" /"R" to "-", and freqC with 2 decimal places.
Best,

"From"        
chrBase chr base    strand  coverage  freqC   freqT
chr1.339    chr1    339 F   7      0.00   100.00
chr1.183    chr1    183 R   4      0.00   100.00
chr1.192    chr1    192 R   6      0.00   100.00
chr1.340    chr1    340 R   5      40.00  60.00
chr1.10007  chr1    10007   F   13     53.85  46.15
chr1.10317  chr1    10317   F   8      0.00   100.00
chr1.10346  chr1    10346   F   9      88.89  11.11
chr1.10349  chr1    10349   F   9      88.89  11.11

"To"
   chr     start         stop      freqc  Coverage strand
    1   67678   67679   0   3   -
    1   67701   67702   0   3   -
    1   67724   67725   0   3   -
    1   67746   67747   0   3   -
    1   67768   67769   0.333333    3   -
    1   159446  159447  0   3   +
    1   162652  162653  0   3   +
    1   167767  167768  0.666667    3   +
    1   167789  167790  0.666667    3   +
    1   167797  167798  0   3   +
methylation dna bed

0 answers

No answers yet.

Log in to answer this question.