Last active
August 2, 2019 02:44
-
-
Save suimye/0b53009b7af9bcb3dc45 to your computer and use it in GitHub Desktop.
行数、列数が不均一なデータをRで読み込む ref: https://qiita.com/suimye/items/af3686990abc139c04eb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rl <- readLines(con="./c3.all.v5.0.symbols.gmt.txt") #readlineによる行データの読み込み | |
gs_list <- list() #list準備 | |
for(i in 1:length(rl)){ | |
dl <- unlist(strsplit(rl[i], "\t")) #strsplitでdelimitorとして\tで分割 | |
gs_list[[dl[1]]] <- dl[3:length(rl)] #dl[1]とdl[2]には、motif名、urlなどの情報があるので除いておく | |
} | |
#1番のリストから遺伝子名を取り出す。 | |
na.omit(unlist(gs_list[[1]])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
==========================出力======================================= | |
[1] "MEF2C" "ATP1B1" "RORA" "CITED2" "APP" "MAP3K4" | |
[7] "ATP2B4" "GRIN2B" "PHTF1" "TLK1" "PHOX2B" "MYH2" | |
[13] "SKP2" "ZHX3" "TGIF1" "LUC7L3" "PPARGC1A" "TSC22D4" | |
[19] "SPAG9" "MAPK3" "PDGFRB" "EFNA5" "RAB10" "NEK6" | |
[25] "LOC148872" "EPHB2" "TBC1D8B" "DMD" "EGFLAM" "DYNC1I2" | |
[31] "MAML3" "TRAM1" "CDC42EP3" "OLFM1" "CDC42EP5" "KLF12" | |
[37] "RSPO2" "KLF14" "NTRK3" "EPHA7" "SEMA6C" "SFRP2" | |
==========================出力======================================= | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment