gaospecial / ggVennDiagram

A 'ggplot2' implement of Venn Diagram.
https://gaospecial.github.io/ggVennDiagram/
GNU General Public License v3.0
282 stars 38 forks source link

empty "" was generated during Venn() #51

Closed crebli closed 1 year ago

crebli commented 1 year ago

Hi, When we input data with csv file, an empty cell "" was found in the column with less items as below shown in $Mono.M7.prog and $Mono.F7.prog.

df<-read.csv("D:\covid19\sm6.sm7.sf7.intersecton.csv") venn <- Venn(df[1:3]) venn An object of class "Venn" Slot "sets": $Mono.M6.prog [1] "S100A9" "S100A8" "ID1" "CLU" "HIST1H1E" "ID2" "FBP1" "TXNIP" "EGR1"
[10] "TSC22D1" "NRIP1" "BCL11A" "IRF7" "PPARG" "PELI1" "GTF2B" "NCOA7" "HSPA8"
[19] "MITF" "PIM1" "YBX3" "BHLHE40" "SP140" "DNAJB1" "DDIT3" "FOS" "AIM2"
[28] "HESX1" "BASP1" "TDP2" "ENG" "NR4A2" "HSPA1B" "ELL2" "SQSTM1" "NFKBIA"
[37] "FOSB" "CIR1" "VEGFA" "NR1H3" "KLF2" "TXN" "HSPA1A" "EGR2" "ATF3"
[46] "DAB2" "ATF5" "NLRP3" "LITAF" "CEBPB" "PLSCR1" "CREM" "HES4" "NFKBIZ"
[55] "RGCC" "IRF1" "STAT1" "MAFB" "JUN" "SGK1"

$Mono.M7.prog [1] "NFKBIA" "MAFB" "JUND" "SGK1" "NFKBIZ" "NLRP3" "ATF3" "BHLHE40" "PELI1" "NCOA7"
[11] "YBX3" "BCL11A" "DDIT3" "HSPA1B" "CREG1" "JUN" "S100A9" "FOS" "S100A8" ""

$Mono.F7.prog [1] "TXN" "CLU" "DAB2" "S100A8" "HSPA8" "PCBD1" "CITED2" "FBP1" "CREG1"
[10] "CALR" "CEBPB" "LITAF" "RGCC" "HIST1H1C" "GTF2B" "TCF4" "SGK1" "S100A9"
[19] "PLSCR1" "AIM2" "NRIP1" "BCL11A" "YBX3" "BHLHE40" "NR4A2" "PIM1" "ID2"
[28] "STAT1" "TCF7L2" "JUND" "JUN" "IRF7" "NLRP3" "PELI1" "KLF2" "IRF1"
[37] "FOSB" "TXNIP" "NFKBIZ" "NFKBIA" "FOS" ""

Therefore, a code should be added to remove the empty "".

crebli commented 1 year ago

image

crebli commented 1 year ago

Therefore, $Mono.M7.prog and $Mono.F7.prog both have one more item.

gaospecial commented 1 year ago

Could you check whether the data frame df[1:3] has a "" item?

crebli commented 1 year ago

Dear Chun-Hui, there's no any "" in the csv file.

At 2023-05-18 19:53:34, "Chun-Hui Gao" @.***> wrote:

Could you check whether the data frame df[1:3] has a "" item?

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

gaospecial commented 1 year ago

@crebli could you give me a reproducible example?

crebli commented 1 year ago

sm6.sm7.sf7.intersecton.xlsx

crebli commented 1 year ago

The attached xlsx file is the example I used.

gaospecial commented 1 year ago
> df<-read.csv("sm6.sm7.sf7.intersecton.csv")

> df$mono.M6.prog
 [1] "S100A9"   "S100A8"   "ID1"      "CLU"      "HIST1H1E" "ID2"      "FBP1"     "TXNIP"    "EGR1"    
[10] "TSC22D1"  "NRIP1"    "BCL11A"   "IRF7"     "PPARG"    "PELI1"    "GTF2B"    "NCOA7"    "HSPA8"   
[19] "MITF"     "PIM1"     "YBX3"     "BHLHE40"  "SP140"    "DNAJB1"   "DDIT3"    "FOS"      "AIM2"    
[28] "HESX1"    "BASP1"    "TDP2"     "ENG"      "NR4A2"    "HSPA1B"   "ELL2"     "SQSTM1"   "NFKBIA"  
[37] "FOSB"     "CIR1"     "VEGFA"    "NR1H3"    "KLF2"     "TXN"      "HSPA1A"   "EGR2"     "ATF3"    
[46] "DAB2"     "ATF5"     "NLRP3"    "LITAF"    "CEBPB"    "PLSCR1"   "CREM"     "HES4"     "NFKBIZ"  
[55] "RGCC"     "IRF1"     "STAT1"    "MAFB"     "JUN"      "SGK1"    

> df$mono.M7.prog
 [1] "NFKBIA"  "MAFB"    "JUND"    "SGK1"    "NFKBIZ"  "NLRP3"   "ATF3"    "BHLHE40" "PELI1"   "NCOA7"  
[11] "YBX3"    "BCL11A"  "DDIT3"   "HSPA1B"  "CREG1"   "JUN"     "S100A9"  "FOS"     "S100A8"  ""       
[21] ""        ""        ""        ""        ""        ""        ""        ""        ""        ""       
[31] ""        ""        ""        ""        ""        ""        ""        ""        ""        ""       
[41] ""        ""        ""        ""        ""        ""        ""        ""        ""        ""       
[51] ""        ""        ""        ""        ""        ""        ""        ""        ""        ""       

> df$mono.F7.prog

 [1] "TXN"      "CLU"      "DAB2"     "S100A8"   "HSPA8"    "PCBD1"    "CITED2"   "FBP1"     "CREG1"   
[10] "CALR"     "CEBPB"    "LITAF"    "RGCC"     "HIST1H1C" "GTF2B"    "TCF4"     "SGK1"     "S100A9"  
[19] "PLSCR1"   "AIM2"     "NRIP1"    "BCL11A"   "YBX3"     "BHLHE40"  "NR4A2"    "PIM1"     "ID2"     
[28] "STAT1"    "TCF7L2"   "JUND"     "JUN"      "IRF7"     "NLRP3"    "PELI1"    "KLF2"     "IRF1"    
[37] "FOSB"     "TXNIP"    "NFKBIZ"   "NFKBIA"   "FOS"      ""         ""         ""         ""        
[46] ""         ""         ""         ""         ""         ""         ""         ""         ""        
[55] ""         ""         ""         ""         ""         ""     

read.csv() read many empty values, and this is the reason.

To fix this, try

> df2 = lapply(df, function(x) x[!x==""])
> df2
$mono.M6.prog
 [1] "S100A9"   "S100A8"   "ID1"      "CLU"      "HIST1H1E" "ID2"      "FBP1"     "TXNIP"    "EGR1"    
[10] "TSC22D1"  "NRIP1"    "BCL11A"   "IRF7"     "PPARG"    "PELI1"    "GTF2B"    "NCOA7"    "HSPA8"   
[19] "MITF"     "PIM1"     "YBX3"     "BHLHE40"  "SP140"    "DNAJB1"   "DDIT3"    "FOS"      "AIM2"    
[28] "HESX1"    "BASP1"    "TDP2"     "ENG"      "NR4A2"    "HSPA1B"   "ELL2"     "SQSTM1"   "NFKBIA"  
[37] "FOSB"     "CIR1"     "VEGFA"    "NR1H3"    "KLF2"     "TXN"      "HSPA1A"   "EGR2"     "ATF3"    
[46] "DAB2"     "ATF5"     "NLRP3"    "LITAF"    "CEBPB"    "PLSCR1"   "CREM"     "HES4"     "NFKBIZ"  
[55] "RGCC"     "IRF1"     "STAT1"    "MAFB"     "JUN"      "SGK1"    

$mono.M7.prog
 [1] "NFKBIA"  "MAFB"    "JUND"    "SGK1"    "NFKBIZ"  "NLRP3"   "ATF3"    "BHLHE40" "PELI1"   "NCOA7"  
[11] "YBX3"    "BCL11A"  "DDIT3"   "HSPA1B"  "CREG1"   "JUN"     "S100A9"  "FOS"     "S100A8" 

$mono.F7.prog
 [1] "TXN"      "CLU"      "DAB2"     "S100A8"   "HSPA8"    "PCBD1"    "CITED2"   "FBP1"     "CREG1"   
[10] "CALR"     "CEBPB"    "LITAF"    "RGCC"     "HIST1H1C" "GTF2B"    "TCF4"     "SGK1"     "S100A9"  
[19] "PLSCR1"   "AIM2"     "NRIP1"    "BCL11A"   "YBX3"     "BHLHE40"  "NR4A2"    "PIM1"     "ID2"     
[28] "STAT1"    "TCF7L2"   "JUND"     "JUN"      "IRF7"     "NLRP3"    "PELI1"    "KLF2"     "IRF1"    
[37] "FOSB"     "TXNIP"    "NFKBIZ"   "NFKBIA"   "FOS" 
crebli commented 1 year ago

Thank you!