如何用DNA字母替换数字基因型代码? 我有一个修改后的vcf文件,如下所示:
Option Explicit
Sub LookUpExcel()
Dim objExcel As New Excel.Application
Dim exWb As Excel.Workbook
Dim ExcelFileName As String
Dim ColumnA As String
Dim ColumnB As String
Dim oMsg As MailItem
ExcelFileName = "C:\Users\vfdme\Desktop\test.xlsx"
Set exWb = objExcel.Workbooks.Open(ExcelFileName)
ColumnA = InputBox("Please Column A value.")
'[VLOOKUP / Search function?]
MsgBox (ColumnB)
ExitRoutine:
Set oMsg = Nothing
Set exWb = Nothing
Set objExcel = Nothing
End Sub
我想用引用字母替换0/0,用替换字母替换1/1,并删除其后的所有字符串。 它应该看起来像这样:
POS REF ALT A2.bam C10.bam
448 T C 0/0:0,255,255 0/0:0,255,255
2402 C T 1/1:209,23,0 xxx:255,0,255
n...
试图用sed来做,但是没用 不知道如何解决
答案 0 :(得分:1)
请您尝试:
awk '{
if (NR > 1) {
for (i=4; i<=5; i++) {
split($i, a, ":")
$i = a[1]
if ($i == "0/0") $i = $2
if ($i == "1/1") $i = $3
}
}
print
}' file.txt
输出:
POS REF ALT A2.bam C10.bam
448 T C T T
2402 C T T xxx
n...
for
循环处理第4列和第5列(A2.bam
和C10.bam
)。REF
)。ALT
)。希望这会有所帮助。