modkit icon indicating copy to clipboard operation
modkit copied to clipboard

bed file resulting from pileup and igv

Open mocherry opened this issue 1 year ago • 3 comments

Dear all,

can I use the bed-file resulting from the modkit pileup command directly in IGV or do i have to modify it somewhow?

Thanks and best, Matthias

mocherry avatar Apr 05 '24 16:04 mocherry

Hello @mocherry,

You can use it directly, but it may not be very helpful - to be honest. The bedGraph format is more suitable to visualization. You can use the --bedgraph flag in modkit or transform the bedMethyl using bash.

I prefer to transform the bedMethyl into a bedGraph and keep the bedMethyl around since it has more information. Here's some bash that will transform a bedMethyl with m and h calls into a bedgraph.

for strand in "+" "-"
do
  for mod in "h" "m"
  do
    case $strand in 
      "+")
        out_file=${mod}_positive.bedgraph
        ;;
      "-")
        out_file=${mod}_negative.bedgraph
        ;;
      *)
        echo "> not a strand"
        exit 1
        ;;
    esac
    awk -v strand=${strand} -v mod=${mod} 'BEGIN{OFS="\t"} (($4==mod) && ($6==strand)) {print $1,$2,$3,$11/100,$5}' ${bedmethyl} > ${out_file}
  done
done

ArtRand avatar Apr 05 '24 17:04 ArtRand

Hi Arthur, thanks for the advice.not being this familiar with what you suggest, (bash?), I will try and maybe contact you again for advice.Please bear with me. Best,Matthias Von meinem/meiner Galaxy gesendet -------- Ursprüngliche Nachricht --------Von: Arthur Rand @.> Datum: 05.04.24 19:44 (GMT+01:00) An: nanoporetech/modkit @.> Cc: mocherry @.>, Mention @.> Betreff: [EXTERN] Re: [nanoporetech/modkit] bed file resulting from pileup and igv (Issue #153) Hello @mocherry, You can use it directly, but it may not be very helpful - to be honest. However you may find that bedGraph format is more suitable to visualization. You can use the --bedgraph flag in modkit or transform the bedMethyl using bash. I prefer to transform the bedMethyl into a bedGraph and keep the bedMethyl around since it has more information. Here's some bash that will transform a bedMethyl with m and h calls into a bedgraph. for strand in "+" "-" do for mod in "h" "m" do case $strand in "+") out_file=${mod}_positive.bedgraph ;; "-") out_file=${mod}_negative.bedgraph ;; *) echo "> not a strand" exit 1 ;; esac awk -v strand=${strand} -v mod=${mod} 'BEGIN{OFS="\t"} (($4==mod) && ($6==strand)) {print $1,$2,$3,$11/100,$5}' ${bedmethyl} > ${out_file} done done

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

mocherry avatar Apr 05 '24 18:04 mocherry

Hello @mocherry,

Sorry for not explaining. bash is just a commonly used shell language. If you don't have an environment like this, that's not a problem. You can run modkit pileup with the --bedgraph flag (the output must point to a directory) and get a bedgraph output.

ArtRand avatar Apr 11 '24 14:04 ArtRand