In f1
below I am trying to split $1
based on each line and create a bed file. If the line is a snp then the :
is spilt and the text is $1
the last digit is $2
-1 and $3
and the letter to the left of the >
is $4
and the letter to the right is $5
. (lines 1 and 2)
If the line has dup
then the :
is spilt and the text is $1
the last digit is $2
and $3
and the $4
is -
and the letter to the right is $5
. (line 4)
If the line has del
with nothing else then the :
is spilt and the text is $1
the last digit is $2
and $3
and the letter to the left of the >
is $4
and $5
is -
. (line 5)
I am not sure how to format for line 3 (the complex indel)... maybe split $1
on the :
and the text is $1
the last digit is $2
and $3
and the letters to the left of the >
is $4
and the letters to the right is $5
. Thank you :)
f1
chr7:140453145A>T
chr7:140453136A>T
chr7:140453135_140453136delCAinsTT
chr20:31022287dupA
chr19:13054614delG
desired
chr7 140453144 140453145 A T
chr7 140453135 140453136 A T
chr7 140453135 140453136 TT CA
chr20 31022287 31022287 - A
chr19 13054614 13054614 G -
awk
awk 'BEGIN{OFS="\t"} {sub(/[^0-9]+$/, "", $1)}' f1
awk 'BEGIN { FS = "[ -]"; OFS="\t" } NF==3 { print $1, $2 - 1, $2, $3 } NF==4 { print $1, $2, $3, $4 }' f1
python
is fine I just don't know it as well.... only the basics but I am interested to see what it would look like as I can learn from it. Thank you :). $\endgroup$