Using previous DE analyses, look for what is in common
I want to look for common parasite genes in the set of up/down comparisons between metacylic and amastigote 4 hour samples.
tt <- sm(loadme(filename="xrefs.rda.xz"))
lmajor_hsapiens <- read.csv(file="csv/lmajor_metac_vs_amast4.csv")
lmajor_mmusculus <- read.csv(file="csv/lmajor_metac_vs_amast4_mmusculus.csv")
lmajor_hsapiens_sig <- get_sig_genes(table=lmajor_hsapiens, p=0.05, fc=0.6)
## Assuming the fold changes are on the log scale and so taking >< 0
## After (adj)p filter, the up genes table has 1732 genes.
## After (adj)p filter, the down genes table has 1492 genes.
## Assuming the fold changes are on the log scale and so taking -1.0 * fc
## After fold change filter, the up genes table has 556 genes.
## After fold change filter, the down genes table has 736 genes.
lmajor_mmusculus_sig <- get_sig_genes(table=lmajor_mmusculus, p=0.05, fc=0.6)
## Assuming the fold changes are on the log scale and so taking >< 0
## After (adj)p filter, the up genes table has 1460 genes.
## After (adj)p filter, the down genes table has 1502 genes.
## Assuming the fold changes are on the log scale and so taking -1.0 * fc
## After fold change filter, the up genes table has 517 genes.
## After fold change filter, the down genes table has 787 genes.
lm_hs_up <- lmajor_hsapiens_sig[["up_genes"]][, c("X", "logFC")]
lm_mm_up <- lmajor_mmusculus_sig[["up_genes"]][, c("X", "logFC")]
lm_hs_down <- lmajor_hsapiens_sig[["down_genes"]][, c("X", "logFC")]
lm_mm_down <- lmajor_mmusculus_sig[["down_genes"]][, c("X", "logFC")]
hsmm_up <- merge(lm_hs_up, lm_mm_up, by="X", all=TRUE)
hsmm_down <- merge(lm_hs_down, lm_mm_down, by="X", all=TRUE)
tt <- sm(require.auto("hs229/Vennerable"))
library(Vennerable)
up_ones <- c("hs" = sum(!is.na(hsmm_up[[2]]) & is.na(hsmm_up[[3]])),
"mm" = sum(is.na(hsmm_up[[2]]) & !is.na(hsmm_up[[3]])))
up_twos <- c("hs&mm" = sum(!is.na(hsmm_up[[2]]) & !is.na(hsmm_up[[3]])))
up_twos_table <- hsmm_up[ !is.na(hsmm_up[[2]]) & !is.na(hsmm_up[[3]]), ]
hs_mm_up_venn <- plot_fun_venn(ones=up_ones, twos=up_twos)

up_twos_table$X <- gsub(pattern="\\-[0-9]", replace="", x=up_twos_table$X)
down_ones <- c("hs" = sum(!is.na(hsmm_down[[2]]) & is.na(hsmm_down[[3]])),
"mm" = sum(is.na(hsmm_down[[2]]) & !is.na(hsmm_down[[3]])))
down_twos <- c("hs&mm" = sum(!is.na(hsmm_down[[2]]) & !is.na(hsmm_down[[3]])))
down_twos_table <- hsmm_down[ !is.na(hsmm_down[[2]]) & !is.na(hsmm_down[[3]]), ]
hs_mm_down_venn <- plot_fun_venn(ones=down_ones, twos=down_twos)

down_twos_table$X <- gsub(pattern="\\-[0-9]", replace="", x=down_twos_table$X)
## Get the big table from the previous cross referencing
big_table <- tri_sci_sig_fas_sec
big_shared_hs_mm_up <- merge(up_twos_table, big_table, by.x="X", by.y="ID", all.x=TRUE)
big_shared_hs_mm_down <- merge(down_twos_table, big_table, by.x="X", by.y="ID", all.x=TRUE)
write.csv(file="csv/big_shared_hs_mm_up.csv", x=big_shared_hs_mm_up)
up_lmonly_idx <- is.na(big_shared_hs_mm_up$tritryp_brucei_homologs) & is.na(big_shared_hs_mm_up$tritryp_cruzi_homologs)
up_lmonly <- big_shared_hs_mm_up[up_lmonly_idx, ]
write.csv(file="csv/big_shared_hsmm_up_lmonly.csv", x=up_lmonly)
up_lmtc_idx <- is.na(big_shared_hs_mm_up$tritryp_brucei_homologs) & !is.na(big_shared_hs_mm_up$tritryp_cruzi_homologs)
up_lmtc <- big_shared_hs_mm_up[up_lmtc_idx, ]
write.csv(file="csv/big_shared_hsmm_up_lmtc.csv", x=up_lmtc)
up_lmtb_idx <- !is.na(big_shared_hs_mm_up$tritryp_brucei_homologs) & is.na(big_shared_hs_mm_up$tritryp_cruzi_homologs)
up_lmtb <- big_shared_hs_mm_up[up_lmtb_idx, ]
write.csv(file="csv/big_shared_hsmm_up_lmtb.csv", x=up_lmtb)
up_lmtbtc_idx <- !is.na(big_shared_hs_mm_up$tritryp_brucei_homologs) & !is.na(big_shared_hs_mm_up$tritryp_cruzi_homologs)
up_lmtbtc <- big_shared_hs_mm_up[up_lmtbtc_idx, ]
write.csv(file="csv/big_shared_hsmm_up_lmtbtc.csv", x=up_lmtbtc)
write.csv(file="csv/big_shared_hs_mm_down.csv", x=big_shared_hs_mm_down)
down_lmonly_idx <- is.na(big_shared_hs_mm_down$tritryp_brucei_homologs) & is.na(big_shared_hs_mm_down$tritryp_cruzi_homologs)
down_lmonly <- big_shared_hs_mm_down[down_lmonly_idx, ]
write.csv(file="csv/big_shared_hsmm_down_lmonly.csv", x=down_lmonly)
down_lmtc_idx <- is.na(big_shared_hs_mm_down$tritryp_brucei_homologs) & !is.na(big_shared_hs_mm_down$tritryp_cruzi_homologs)
down_lmtc <- big_shared_hs_mm_down[down_lmtc_idx, ]
write.csv(file="csv/big_shared_hsmm_down_lmtc.csv", x=down_lmtc)
down_lmtb_idx <- !is.na(big_shared_hs_mm_down$tritryp_brucei_homologs) & is.na(big_shared_hs_mm_down$tritryp_cruzi_homologs)
down_lmtb <- big_shared_hs_mm_down[down_lmtb_idx, ]
write.csv(file="csv/big_shared_hsmm_down_lmtb.csv", x=down_lmtb)
down_lmtbtc_idx <- !is.na(big_shared_hs_mm_down$tritryp_brucei_homologs) & !is.na(big_shared_hs_mm_down$tritryp_cruzi_homologs)
down_lmtbtc <- big_shared_hs_mm_down[down_lmtbtc_idx, ]
write.csv(file="csv/big_shared_hsmm_down_lmtbtc.csv", x=down_lmtbtc)
LS0tCnRpdGxlOiAiUk5Bc2VxIG9mIEwubWFqb3IvYW1hem9uZW5zaXM6ICBMb29rIGZvciBjb21tb24gbW91c2UvaHVtYW4gdXAvZG93biBnZW5lcy4iCmF1dGhvcjogImF0YiBhYmVsZXdAZ21haWwuY29tIgpkYXRlOiAiYHIgU3lzLkRhdGUoKWAiCm91dHB1dDoKIGh0bWxfZG9jdW1lbnQ6CiAgY29kZV9kb3dubG9hZDogd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