sample_sheet <- glue::glue("sample_sheets/tmrc2_samples_202203.xlsx")
This is mostly just a run of this worksheet to reacquaint myself with it.
This document is intended to provide a general overview of the TMRC2 samples which have thus far been sequenced. In some cases, this includes only those samples starting in 2019; in other instances I am including our previous (2015-2016) samples.
In all cases the processing performed was:
The analyses in this document use the matrices of counts/gene from #3 and variants/position from #4 in order to provide some images and metrics describing the samples we have sequenced so far.
Everything which follows depends on the Existing TriTrypDB annotations revision 46, circa 2019. The following block loads a database of these annotations and turns it into a matrix where the rows are genes and columns are all the annotation types provided by TriTrypDB.
The same database was used to create a matrix of orthologous genes between L.panamensis and all of the other species in the TriTrypDB.
tt <- sm(library(EuPathDB))
orgdb <- "org.Lpanamensis.MHOMCOL81L13.v46.eg.db"
tt <- sm(library(orgdb, character.only=TRUE))
pan_db <- org.Lpanamensis.MHOMCOL81L13.v46.eg.db
all_fields <- columns(pan_db)
all_lp_annot <- sm(load_orgdb_annotations(
pan_db,
keytype = "gid",
fields = c("annot_gene_entrez_id", "annot_gene_name",
"annot_strand", "annot_chromosome", "annot_cds_length",
"annot_gene_product")))$genes
lp_go <- sm(load_orgdb_go(pan_db))
lp_lengths <- all_lp_annot[, c("gid", "annot_cds_length")]
colnames(lp_lengths) <- c("ID", "length")
all_lp_annot[["annot_gene_product"]] <- tolower(all_lp_annot[["annot_gene_product"]])
orthos <- sm(EuPathDB::extract_eupath_orthologs(db = pan_db))
hisat_annot <- all_lp_annot
meta <- sm(EuPathDB::download_eupath_metadata(webservice="tritrypdb"))
lp_entry <- EuPathDB::get_eupath_entry(species="Leishmania panamensis", metadata=meta)
## Found the following hits: Leishmania panamensis MHOM/COL/81/L13, Leishmania panamensis strain MHOM/PA/94/PSC-1, choosing the first.
## Using: Leishmania panamensis MHOM/COL/81/L13.
colnames(lp_entry)
## [1] "AnnotationVersion" "AnnotationSource" "BiocVersion"
## [4] "DataProvider" "Genome" "GenomeSource"
## [7] "GenomeVersion" "NumArrayGene" "NumChipChipGene"
## [10] "NumChromosome" "NumCodingGene" "NumCommunity"
## [13] "NumContig" "NumEC" "NumEST"
## [16] "NumGene" "NumGO" "NumOrtholog"
## [19] "NumOtherGene" "NumPopSet" "NumProteomics"
## [22] "NumPseudogene" "NumRNASeq" "NumRTPCR"
## [25] "NumSNP" "NumTFBS" "Organellar"
## [28] "ReferenceStrain" "MegaBP" "PrimaryKey"
## [31] "ProjectID" "RecordClassName" "SourceID"
## [34] "SourceVersion" "TaxonomyID" "TaxonomyName"
## [37] "URLGenome" "URLGFF" "URLProtein"
## [40] "Coordinate_1_based" "Maintainer" "SourceUrl"
## [43] "Tags" "BsgenomePkg" "GrangesPkg"
## [46] "OrganismdbiPkg" "OrgdbPkg" "TxdbPkg"
## [49] "Taxon" "Genus" "Species"
## [52] "Strain" "BsgenomeFile" "GrangesFile"
## [55] "OrganismdbiFile" "OrgdbFile" "TxdbFile"
## [58] "GenusSpecies" "TaxonUnmodified" "TaxonCanonical"
## [61] "TaxonXref"
testing_panamensis <- "BSGenome.Leishmania.panamensis.MHOMCOL81L13.v53"
## testing_panamensis <- EuPathDB::make_eupath_bsgenome(entry=lp_entry, eu_version="v46")
library(as.character(testing_panamensis), character.only=TRUE)
## Loading required package: BSgenome
## Loading required package: Biostrings
## Loading required package: XVector
##
## Attaching package: 'Biostrings'
## The following object is masked from 'package:base':
##
## strsplit
## Loading required package: rtracklayer
genome <- get0(as.character(testing_panamensis))
Resequence samples: TMRC20002, TMRC20006, TMRC20004 (maybe TMRC20008 and TMRC20029)
The process of sample estimation takes two primary inputs:
An expressionset is a data structure used in R to examine RNASeq data. It is comprised of annotations, metadata, and expression data. In the case of our processing pipeline, the location of the expression data is provided by the filenames in the metadata.
The first lines of the following block create the Expressionset. All of the following lines perform various normalizations and generate plots from it.
The following samples are much lower coverage:
20210610: I made some manual changes to the sample sheet which I downloaded, filling in some zymodeme with ‘unknown’
sanitize_columns <- c("passagenumber", "clinicalresponse", "clinicalcategorical",
"zymodemecategorical", "zymodemecategorical")
lp_expt <- create_expt(sample_sheet,
gene_info = hisat_annot,
annotation = orgdb,
id_column = "hpglidentifier",
file_column = "lpanamensisv36hisatfile") %>%
set_expt_conditions(fact = "zymodemecategorical") %>%
subset_expt(nonzero = 8550) %>%
subset_expt(coverage = 5000000) %>%
semantic_expt_filter(semantic = c("amastin", "gp63", "leishmanolysin"),
semantic_column = "annot_gene_product") %>%
sanitize_expt_metadata(columns = sanitize_columns) %>%
set_expt_factors(columns = sanitize_columns, class = "factor")
## Reading the sample metadata.
## Dropped 11 rows from the sample metadata because they were blank.
## Did not find the condition column in the sample sheet.
## Filling it in as undefined.
## Did not find the batch column in the sample sheet.
## Filling it in as undefined.
## The sample definitions comprises: 110 rows(samples) and 64 columns(metadata fields).
## Warning in create_expt(sample_sheet, gene_info = hisat_annot, annotation =
## orgdb, : Some samples were removed when cross referencing the samples against
## the count data.
## Matched 8778 annotations and counts.
## Bringing together the count matrix and gene information.
## Some annotations were lost in merging, setting them to 'undefined'.
## Saving the expressionset to 'expt.rda'.
## The final expressionset has 8778 rows and 104 columns.
## The samples (and read coverage) removed when filtering 8550 non-zero genes are:
## TMRC20002 TMRC20006
## 11681227 6670348
## subset_expt(): There were 104, now there are 102 samples.
## The samples removed (and read coverage) when filtering samples with less than 5e+06 reads are:
## TMRC20004 TMRC20029
## 564812 1658096
## subset_expt(): There were 102, now there are 100 samples.
## semantic_expt_filter(): Removed 68 genes.
libsizes <- plot_libsize(lp_expt)
dev <- pp(file = "images/lp_expt_libsizes.png", width = 14, height = 9)
libsizes$plot
closed <- dev.off()
libsizes$plot
## I think samples 7,10 should be removed at minimum, probably also 9,11
nonzero <- plot_nonzero(lp_expt)
dev <- pp(file = "images/lp_nonzero.png", width=9, height=9)
nonzero$plot
## Warning: ggrepel: 80 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
closed <- dev.off()
lp_box <- plot_boxplot(lp_expt)
## 8022 entries are 0. We are on a log scale, adding 1 to the data.
dev <- pp(file = "images/lp_expt_boxplot.png", width = 12, height = 9)
lp_box
closed <- dev.off()
lp_box
filter_plot <- plot_libsize_prepost(lp_expt)
filter_plot$lowgene_plot
## Warning: Using alpha for a discrete variable is not advised.
filter_plot$count_plot
table(pData(lp_expt)[["zymodemecategorical"]])
##
## notapplicable unknown z10 z20 z21
## 2 4 1 1 7
## z22 z23 z24 z30
## 43 39 2 1
table(pData(lp_expt)[["clinicalresponse"]])
##
## cure failure
## 38 37
## laboratory line laboratory line miltefosine resistant
## 1 1
## nd reference strain
## 19 4
Najib’s favorite plots are of course the PCA/TNSE. These are nice to look at in order to get a sense of the relationships between samples. They also provide a good opportunity to see what happens when one applies different normalizations, surrogate analyses, filters, etc. In addition, one may set different experimental factors as the primary ‘condition’ (usually the color of plots) and surrogate ‘batches’.
Column ‘Q’ in the sample sheet, make a categorical version of it with these parameters:
starting <- as.numeric(pData(lp_expt)[["susceptibilityinfectionreduction32ugmlsbvhistoricaldata"]])
## Warning: NAs introduced by coercion
sus_categorical <- starting
na_idx <- is.na(starting)
sus_categorical[na_idx] <- "unknown"
resist_idx <- starting <= 0.35
sus_categorical[resist_idx] <- "resistant"
indeterminant_idx <- starting >= 0.36 & starting <= 0.48
sus_categorical[indeterminant_idx] <- "ambiguous"
susceptible_idx <- starting >= 0.49
sus_categorical[susceptible_idx] <- "sensitive"
pData(lp_expt)[["sus_category"]] <- sus_categorical
table(sus_categorical)
## sus_categorical
## ambiguous resistant sensitive unknown
## 5 12 32 51
clinical_colors <- list(
"z1.0" = "#333333",
"z2.0" = "#555555",
"z3.0" = "#777777",
"z2.1" = "#874400",
"z2.2" = "#0000cc",
"z2.3" = "#cc0000",
"z2.4" = "#df7000",
"unknown" = "#cbcbcb",
"null" = "#000000")
clinical_samples <- lp_expt %>%
set_expt_batches(fact = sus_categorical) %>%
set_expt_colors(clinical_colors)
table(pData(clinical_samples)[["condition"]])
##
## null unknown z1.0 z2.0 z2.1 z2.2 z2.3 z2.4 z3.0
## 2 4 1 1 7 43 39 2 1
clinical_norm <- normalize_expt(clinical_samples, norm = "quant", transform = "log2",
convert = "cpm", filter = TRUE)
## Removing 135 low-count genes (8575 remaining).
## transform_counts: Found 2 values equal to 0, adding 1 to the matrix.
zymo_pca <- plot_pca(clinical_norm, plot_title = "PCA of parasite expression values",
plot_labels = FALSE)
ggplt(zymo_pca$plot)
## [1] "ggplot.html"
dev <- pp(file = "images/zymo_pca_sus_shape.png")
zymo_pca$plot
closed <- dev.off()
zymo_pca$plot
only_two_types <- subset_expt(clinical_samples, subset = "condition=='z2.3'|condition=='z2.2'")
## subset_expt(): There were 100, now there are 82 samples.
only_two_norm <- sm(normalize_expt(only_two_types, norm = "quant", transform = "log2",
convert = "cpm", batch = FALSE, filter = TRUE))
onlytwo_pca <- plot_pca(only_two_norm, plot_title = "PCA of z2.2 and z2.3 parasite expression values",
plot_labels = FALSE)
dev <- pp(file = "images/zymo_z2.2_z2.3_pca_sus_shape.pdf")
onlytwo_pca$plot
closed <- dev.off()
onlytwo_pca$plot
zymo_3dpca <- plot_3d_pca(zymo_pca)
zymo_3dpca$plot
clinical_n <- sm(normalize_expt(clinical_samples, transform = "log2",
convert = "cpm", batch = FALSE, filter = TRUE))
zymo_tsne <- plot_tsne(clinical_n, plot_title = "TSNE of parasite expression values")
zymo_tsne$plot
## Warning: ggrepel: 78 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
clinical_nb <- normalize_expt(clinical_samples, convert = "cpm", transform = "log2",
filter = TRUE, batch = "svaseq")
## Removing 135 low-count genes (8575 remaining).
## Setting 702 low elements to zero.
## transform_counts: Found 702 values equal to 0, adding 1 to the matrix.
clinical_nb_pca <- plot_pca(clinical_nb, plot_title = "PCA of parasite expression values",
plot_labels = FALSE)
dev <- pp(file = "images/clinical_nb_pca_sus_shape.png")
clinical_nb_pca$plot
closed <- dev.off()
clinical_nb_pca$plot
clinical_nb_tsne <- plot_tsne(clinical_nb, plot_title = "TSNE of parasite expression values")
clinical_nb_tsne$plot
## Warning: ggrepel: 84 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
corheat <- plot_corheat(clinical_norm, plot_title = "Correlation heatmap of parasite
expression values
")
corheat$plot
plot_sm(clinical_norm)$plot
## Performing correlation.
cf_colors <- list(
"cure" = "#006f00",
"fail" = "#9dffa0",
"unknown" = "#cbcbcb",
"notapplicable" = "#000000")
cf_expt <- set_expt_conditions(lp_expt, fact = "clinicalcategorical") %>%
set_expt_batches(fact = sus_categorical) %>%
set_expt_colors(cf_colors)
## Warning in set_expt_colors(., cf_colors): Colors for the following categories
## are not being used: notapplicable.
table(pData(cf_expt)[["condition"]])
##
## cure fail unknown
## 38 37 25
cf_norm <- normalize_expt(cf_expt, convert = "cpm", transform = "log2",
norm = "quant", filter = TRUE)
## Removing 135 low-count genes (8575 remaining).
## transform_counts: Found 2 values equal to 0, adding 1 to the matrix.
start_cf <- plot_pca(cf_norm, plot_title = "PCA of parasite expression values",
plot_labels = FALSE)
dev <- pp(file = "images/cf_sus_shape.png")
start_cf$plot
closed <- dev.off()
start_cf$plot
cf_nb <- normalize_expt(cf_expt, convert = "cpm", transform = "log2",
norm = "quant", filter = TRUE, batch = "svaseq")
## Warning in normalize_expt(cf_expt, convert = "cpm", transform = "log2", :
## Quantile normalization and sva do not always play well together.
## Removing 135 low-count genes (8575 remaining).
## Setting 230 low elements to zero.
## transform_counts: Found 230 values equal to 0, adding 1 to the matrix.
cf_nb_pca <- plot_pca(cf_nb, plot_title = "PCA of parasite expression values",
plot_labels = FALSE)
dev <- pp(file = "images/cf_sus_share_nb.png")
cf_nb_pca$plot
closed <- dev.off()
cf_nb_pca$plot
cf_norm <- normalize_expt(cf_expt, transform = "log2", convert = "cpm",
filter = TRUE, norm = "quant")
## Removing 135 low-count genes (8575 remaining).
## transform_counts: Found 2 values equal to 0, adding 1 to the matrix.
test <- pca_information(cf_norm,
expt_factors = c("clinicalcategorical", "zymodemecategorical",
"pathogenstrain", "passagenumber"),
num_components = 6, plot_pcas = TRUE)
test$anova_p
## PC1 PC2 PC3 PC4 PC5 PC6
## clinicalcategorical 3.412e-01 0.451405 0.9566 7.640e-03 0.237474 3.565e-01
## zymodemecategorical 1.159e-05 0.006049 0.7837 3.332e-02 0.004994 4.047e-01
## pathogenstrain 5.311e-01 0.872529 0.6709 4.969e-05 0.021346 2.287e-01
## passagenumber 9.481e-01 0.173679 0.4688 3.298e-02 0.856872 7.004e-06
test$cor_heatmap
sus_colors <- list(
"resistant" = "#8563a7",
"sensitive" = "#8d0000",
"ambiguous" = "#cbcbcb",
"unknown" = "#000000")
sus_expt <- set_expt_conditions(lp_expt, fact = "sus_category") %>%
set_expt_batches(fact = "zymodemecategorical") %>%
set_expt_colors(colors = sus_colors) %>%
subset_expt(subset = "batch!='z24'") %>%
subset_expt(subset = "batch!='z21'")
## subset_expt(): There were 100, now there are 98 samples.
## subset_expt(): There were 98, now there are 91 samples.
sus_norm <- normalize_expt(sus_expt, transform = "log2", convert = "cpm",
norm = "quant", filter = TRUE)
## Removing 136 low-count genes (8574 remaining).
## transform_counts: Found 2 values equal to 0, adding 1 to the matrix.
sus_pca <- plot_pca(sus_norm, plot_title = "PCA of parasite expression values",
plot_labels = FALSE)
dev <- pp(file = "images/sus_norm_pca.png")
sus_pca[["plot"]]
closed <- dev.off()
sus_pca[["plot"]]
sus_nb <- normalize_expt(sus_expt, transform = "log2", convert = "cpm",
batch = "svaseq", filter = TRUE)
## Removing 136 low-count genes (8574 remaining).
## Setting 319 low elements to zero.
## transform_counts: Found 319 values equal to 0, adding 1 to the matrix.
sus_nb_pca <- plot_pca(sus_nb, plot_title = "PCA of parasite expression values",
plot_labels = FALSE)
dev <- pp(file = "images/sus_nb_pca.png")
sus_nb_pca[["plot"]]
closed <- dev.off()
sus_nb_pca[["plot"]]
The following sections perform a series of analyses which seek to elucidate differences between the zymodemes 2.2 and 2.3 either through differential expression or variant profiles.
TODO: Do this with and without sva and compare the results.
zy_expt <- subset_expt(lp_expt, subset = "condition=='z2.2'|condition=='z2.3'")
## subset_expt(): There were 100, now there are 82 samples.
zy_norm <- normalize_expt(zy_expt, filter = TRUE, convert = "cpm", norm = "quant")
## Removing 153 low-count genes (8557 remaining).
zy_de_nobatch <- all_pairwise(zy_expt, filter = TRUE, model_batch = FALSE)
## Finished running DE analyses, collecting outputs.
## Comparing analyses.
zy_table_nobatch <- combine_de_tables(
zy_de_nobatch, excel = glue::glue("excel/zy_tables_nobatch-v{ver}.xlsx"),
gmt = glue::glue("gmt/zymodeme_nobatch-v{ver}.gmt"))
## Deleting the file excel/zy_tables_nobatch-v202203.xlsx before writing the tables.
zy_sig_nobatch <- extract_significant_genes(
zy_table_nobatch,
excel = glue::glue("excel/zy_sig_nobatch-v{ver}.xlsx"))
## Deleting the file excel/zy_sig_nobatch-v202203.xlsx before writing the tables.
zy_de_sva <- all_pairwise(zy_expt, filter = TRUE, model_batch = "svaseq")
## Removing 0 low-count genes (8557 remaining).
## Setting 379 low elements to zero.
## transform_counts: Found 379 values equal to 0, adding 1 to the matrix.
## Finished running DE analyses, collecting outputs.
## Comparing analyses.
zy_table_sva <- combine_de_tables(
zy_de_sva, excel = glue::glue("excel/zy_tables_sva-v{ver}.xlsx"),
gmt = glue::glue("gmt/zymodeme_sva-v{ver}.gmt"))
## Deleting the file excel/zy_tables_sva-v202203.xlsx before writing the tables.
zy_sig_sva <- extract_significant_genes(
zy_table_sva,
excel = glue::glue("excel/zy_sig_sva-v{ver}.xlsx"))
## Deleting the file excel/zy_sig_sva-v202203.xlsx before writing the tables.
dev <- pp(file = "images/zymo_ma.png")
zy_table_sva[["plots"]][["z23_vs_z22"]][["deseq_ma_plots"]][["plot"]]
closed <- dev.off()
zy_table_sva[["plots"]][["z23_vs_z22"]][["deseq_ma_plots"]][["plot"]]
In contrast, we can search for genes which are differentially expressed with respect to cure/failure status.
cf_de <- all_pairwise(cf_expt, filter = TRUE, model_batch = "svaseq")
## Removing 0 low-count genes (8575 remaining).
## Setting 342 low elements to zero.
## transform_counts: Found 342 values equal to 0, adding 1 to the matrix.
## Finished running DE analyses, collecting outputs.
## Comparing analyses.
cf_table <- combine_de_tables(cf_de, excel = glue::glue("excel/cf_tables-v{ver}.xlsx"))
## Deleting the file excel/cf_tables-v202203.xlsx before writing the tables.
cf_sig <- extract_significant_genes(cf_table, excel = glue::glue("excel/cf_sig-v{ver}.xlsx"))
## Deleting the file excel/cf_sig-v202203.xlsx before writing the tables.
dev <- pp(file = "images/cf_ma.png")
cf_table[["plots"]][["fail_vs_cure"]][["deseq_ma_plots"]][["plot"]]
closed <- dev.off()
cf_table[["plots"]][["fail_vs_cure"]][["deseq_ma_plots"]][["plot"]]
Finally, we can use our category of susceptibility and look for genes which change from sensitive to resistant. Keep in mind, though, that for the moment we have a lot of ambiguous and unknown strains.
sus_de_sva <- all_pairwise(sus_expt, filter = TRUE, model_batch = "svaseq")
## Removing 0 low-count genes (8574 remaining).
## Setting 319 low elements to zero.
## transform_counts: Found 319 values equal to 0, adding 1 to the matrix.
## Finished running DE analyses, collecting outputs.
## Comparing analyses.
sus_table_sva <- combine_de_tables(sus_de_sva, excel = glue::glue("excel/sus_tables_sva-v{ver}.xlsx"))
## Deleting the file excel/sus_tables_sva-v202203.xlsx before writing the tables.
sus_sig_sva <- extract_significant_genes(sus_table_sva, excel = glue::glue("excel/sus_sig_sva-v{ver}.xlsx"))
## Deleting the file excel/sus_sig_sva-v202203.xlsx before writing the tables.
sus_de_nobatch <- all_pairwise(sus_expt, filter = TRUE, model_batch = FALSE)
## Finished running DE analyses, collecting outputs.
## Comparing analyses.
sus_table_nobatch <- combine_de_tables(sus_de_nobatch, excel = glue::glue("excel/sus_tables_nobatch-v{ver}.xlsx"))
## Deleting the file excel/sus_tables_nobatch-v202203.xlsx before writing the tables.
sus_sig_nobatch <- extract_significant_genes(sus_table_nobatch, excel = glue::glue("excel/sus_sig_nobatch-v{ver}.xlsx"))
## Deleting the file excel/sus_sig_nobatch-v202203.xlsx before writing the tables.
knitr::kable(head(sus_sig_sva$deseq$ups$sensitive_vs_resistant, n = 20))
gid | annotgeneproduct | annotgenetype | chromosome | start | end | strand | annotgeneentrezid | annotgenename | annotstrand | annotchromosome | annotcdslength | length | deseq_logfc | deseq_adjp | edger_logfc | edger_adjp | limma_logfc | limma_adjp | basic_nummed | basic_denmed | basic_numvar | basic_denvar | basic_logfc | basic_t | basic_p | basic_adjp | deseq_basemean | deseq_lfcse | deseq_stat | deseq_p | ebseq_fc | ebseq_logfc | ebseq_c1mean | ebseq_c2mean | ebseq_mean | ebseq_var | ebseq_postfc | ebseq_ppee | ebseq_ppde | ebseq_adjp | edger_logcpm | edger_lr | edger_p | limma_ave | limma_t | limma_b | limma_p | limma_adjp_ihw | deseq_adjp_ihw | edger_adjp_ihw | ebseq_adjp_ihw | basic_adjp_ihw | lfc_meta | lfc_var | lfc_varbymed | p_meta | p_var | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LPAL13_000017600 | LPAL13_000017600 | hypothetical protein, conserved | protein coding | LPAL13_SCAF000146 | 359 | 586 | + | forward | Not Assigned | 228.0 | 227 | 6.547 | 0 | 6.529 | 0e+00 | 6.128 | 0.0310 | 4.2400 | -1.2170 | 5.0723 | 2.5415 | 5.457 | 8.906 | 0.0000 | 0.0000 | 519.70 | 0.7000 | 9.353 | 0 | 76.859 | 6.264 | 12.7294 | 979.13 | 709.44 | 4.389e+05 | 61.504 | 0e+00 | 1.0000 | 0e+00 | 4.4180 | 48.32 | 0 | 2.2140 | 2.782 | -2.3820 | 0.0066 | 3.096e-02 | 1.875e-17 | 3.072e-09 | 9.877e-01 | 1.163e-07 | 6.914 | 3.355e+00 | 4.852e-01 | 2.201e-03 | 1.454e-05 | ||
LPAL13_000053200 | LPAL13_000053200 | hypothetical protein | protein coding | LPAL13_SCAF000804 | 5037 | 5249 | - | reverse | Not Assigned | 213.0 | 212 | 8.731 | 0 | 9.955 | 0e+00 | 5.774 | 0.0178 | 0.9899 | -4.2030 | 8.5553 | 0.1296 | 5.193 | 9.698 | 0.0000 | 0.0000 | 67.36 | 1.1270 | 7.744 | 0 | 13050.655 | 13.672 | 0.0000 | 130.50 | 94.08 | 8.140e+03 | 37.001 | 1e+00 | 0.0000 | 1e+00 | 1.5320 | 43.07 | 0 | -0.9734 | 3.055 | -2.1450 | 0.0030 | 1.779e-02 | 8.850e-12 | 2.053e-08 | 0.000e+00 | 1.076e-08 | 8.372 | 2.811e-01 | 3.358e-02 | 9.907e-04 | 2.944e-06 | ||
LPAL13_300029400 | LPAL13_300029400 | hypothetical protein, conserved | protein coding | LpaL13_30 | 853953 | 854150 | - | reverse | 30 | 198.0 | 197 | 6.277 | 0 | 6.183 | 0e+00 | 4.801 | 0.0019 | 1.5890 | -2.6050 | 1.8478 | 1.8507 | 4.194 | 9.069 | 0.0000 | 0.0000 | 75.01 | 0.7892 | 7.954 | 0 | 62.349 | 5.962 | 2.0413 | 127.89 | 92.77 | 9.658e+03 | 23.324 | 0e+00 | 0.0000 | 0e+00 | 1.6430 | 40.92 | 0 | -0.1934 | 3.987 | 0.1668 | 0.0001 | 1.930e-03 | 2.256e-12 | 4.812e-08 | 0.000e+00 | 1.106e-06 | 5.765 | 3.125e-01 | 5.420e-02 | 4.570e-05 | 6.265e-09 | ||
LPAL13_200050100 | LPAL13_200050100 | hypothetical protein | protein coding | LpaL13_20.1 | 1627529 | 1627717 | + | forward | 20.1 | 189.0 | 188 | 5.368 | 0 | 5.317 | 0e+00 | 4.517 | 0.0018 | 2.2500 | -1.9170 | 1.7009 | 2.3837 | 4.168 | 8.277 | 0.0000 | 0.0000 | 95.95 | 0.6436 | 8.341 | 0 | 24.141 | 4.593 | 8.0134 | 193.68 | 141.87 | 2.250e+04 | 17.216 | 0e+00 | 1.0000 | 0e+00 | 2.0230 | 44.48 | 0 | 0.4662 | 4.017 | 0.4812 | 0.0001 | 1.775e-03 | 1.226e-13 | 1.380e-08 | 9.462e-01 | 8.648e-06 | 5.074 | 4.967e-01 | 9.788e-02 | 4.113e-05 | 5.076e-09 | ||
LPAL13_350011800 | LPAL13_350011800 | hypothetical protein, conserved | protein coding | LpaL13_35 | 171009 | 171242 | + | forward | 35 | 234.0 | 233 | 5.123 | 0 | 5.098 | 0e+00 | 4.387 | 0.0061 | 2.6570 | -1.2270 | 2.8101 | 1.1071 | 3.885 | 9.083 | 0.0000 | 0.0000 | 149.50 | 0.6430 | 7.967 | 0 | 31.867 | 4.994 | 9.1908 | 293.19 | 213.94 | 5.991e+04 | 23.747 | 0e+00 | 1.0000 | 0e+00 | 2.6270 | 40.29 | 0 | 0.8868 | 3.525 | -0.6383 | 0.0007 | 6.089e-03 | 2.039e-12 | 6.334e-08 | 9.839e-01 | 3.867e-08 | 4.911 | 5.696e-01 | 1.160e-01 | 2.244e-04 | 1.511e-07 | ||
LPAL13_000014000 | LPAL13_000014000 | hypothetical protein | protein coding | LPAL13_SCAF000119 | 655 | 942 | + | forward | Not Assigned | 288.0 | 287 | 4.062 | 0 | 4.051 | 0e+00 | 3.815 | 0.0065 | 2.3230 | -1.1330 | 1.7770 | 1.8434 | 3.456 | 7.525 | 0.0000 | 0.0000 | 105.30 | 0.5694 | 7.134 | 0 | 16.711 | 4.063 | 11.6917 | 195.53 | 144.23 | 1.334e+04 | 13.065 | 0e+00 | 1.0000 | 0e+00 | 2.1540 | 35.52 | 0 | 0.8292 | 3.497 | -0.7034 | 0.0007 | 6.535e-03 | 6.166e-10 | 3.971e-07 | 9.877e-01 | 1.239e-05 | 4.193 | 6.941e-01 | 1.655e-01 | 2.457e-04 | 1.811e-07 | ||
LPAL13_000035500 | LPAL13_000035500 | hypothetical protein, conserved | protein coding | LPAL13_SCAF000492 | 7045 | 7410 | + | forward | Not Assigned | 366.0 | 365 | 4.413 | 0 | 4.405 | 0e+00 | 3.938 | 0.0199 | 4.1930 | 0.7673 | 4.0955 | 0.5624 | 3.426 | 8.098 | 0.0000 | 0.0000 | 422.60 | 0.5579 | 7.910 | 0 | 18.069 | 4.175 | 49.2030 | 889.21 | 654.79 | 3.850e+05 | 17.450 | 0e+00 | 1.0000 | 0e+00 | 4.1270 | 41.20 | 0 | 2.7430 | 2.995 | -1.9030 | 0.0036 | 1.995e-02 | 2.853e-12 | 4.751e-08 | 9.877e-01 | 6.885e-08 | 4.507 | 7.460e-01 | 1.655e-01 | 1.186e-03 | 4.220e-06 | ||
LPAL13_220019500 | LPAL13_220019500 | hypothetical protein | protein coding | LpaL13_22 | 578260 | 578538 | + | forward | 22 | 279.0 | 278 | 3.718 | 0 | 3.714 | 0e+00 | 3.291 | 0.0179 | 3.3820 | 0.2987 | 2.5264 | 0.8041 | 3.084 | 8.002 | 0.0000 | 0.0000 | 261.80 | 0.5013 | 7.416 | 0 | 13.780 | 3.784 | 31.6002 | 435.57 | 322.83 | 7.699e+04 | 12.711 | 0e+00 | 1.0000 | 0e+00 | 3.4410 | 38.94 | 0 | 2.3750 | 3.052 | -1.7380 | 0.0030 | 1.789e-02 | 8.091e-11 | 1.063e-07 | 9.877e-01 | 1.937e-07 | 3.803 | 4.787e-01 | 1.259e-01 | 9.987e-04 | 2.992e-06 | ||
LPAL13_000040700 | LPAL13_000040700 | hypothetical protein, conserved | protein coding | LPAL13_SCAF000598 | 54 | 1067 | + | forward | Not Assigned | 1014.0 | 1013 | 6.480 | 0 | 6.870 | 0e+00 | 3.317 | 0.0300 | -0.9737 | -4.0110 | 5.9817 | 0.5233 | 3.038 | 6.245 | 0.0000 | 0.0000 | 18.06 | 0.9817 | 6.600 | 0 | 222.255 | 7.796 | 0.1376 | 32.79 | 23.68 | 8.650e+02 | 9.563 | 0e+00 | 0.0000 | 0e+00 | -0.1662 | 31.45 | 0 | -2.1520 | 2.798 | -2.6350 | 0.0063 | 2.998e-02 | 1.239e-08 | 1.674e-06 | 0.000e+00 | 6.797e-06 | 5.577 | 6.409e-01 | 1.149e-01 | 2.102e-03 | 1.326e-05 | ||
LPAL13_040019400 | LPAL13_040019400 | hypothetical protein | protein coding | LpaL13_04 | 440768 | 441127 | - | reverse | 4 | 360.0 | 359 | 5.430 | 0 | 5.214 | 0e+00 | 3.374 | 0.0051 | -0.5295 | -3.3990 | 1.9225 | 1.0580 | 2.869 | 7.404 | 0.0000 | 0.0000 | 21.87 | 0.8319 | 6.528 | 0 | 42.408 | 5.406 | 0.8143 | 34.95 | 25.42 | 1.781e+03 | 8.602 | 0e+00 | 0.0000 | 0e+00 | -0.0039 | 31.59 | 0 | -1.8600 | 3.598 | -1.0640 | 0.0005 | 5.066e-03 | 1.768e-08 | 1.525e-06 | 0.000e+00 | 2.947e-06 | 4.736 | 1.342e-02 | 2.834e-03 | 1.755e-04 | 9.240e-08 | ||
LPAL13_080009800 | LPAL13_080009800 | tuzin, putative | protein coding | LpaL13_08 | 184254 | 185207 | + | forward | 8 | 954.0 | 953 | 3.180 | 0 | 3.173 | 0e+00 | 3.034 | 0.0002 | 7.1410 | 4.2800 | 1.6073 | 0.4533 | 2.861 | 9.558 | 0.0000 | 0.0000 | 2813.00 | 0.4560 | 6.974 | 0 | 8.758 | 3.131 | 623.6144 | 5462.00 | 4111.75 | 1.567e+07 | 8.975 | 0e+00 | 1.0000 | 0e+00 | 6.8490 | 36.92 | 0 | 5.9470 | 4.756 | 3.3470 | 0.0000 | 2.262e-04 | 1.394e-09 | 2.968e-07 | 1.000e+00 | 4.813e-09 | 3.291 | 2.770e-01 | 8.418e-02 | 2.533e-06 | 1.924e-11 | ||
LPAL13_170012200 | LPAL13_170012200 | hypothetical protein | protein coding | LpaL13_17 | 289959 | 290222 | - | reverse | 17 | 264.0 | 263 | 3.639 | 0 | 3.632 | 0e+00 | 3.209 | 0.0047 | 3.1250 | 0.3654 | 3.6675 | 0.2477 | 2.759 | 7.402 | 0.0000 | 0.0000 | 201.30 | 0.5657 | 6.434 | 0 | 13.492 | 3.754 | 31.6019 | 426.49 | 316.29 | 9.550e+04 | 12.528 | 0e+00 | 1.0000 | 0e+00 | 3.0710 | 29.59 | 0 | 1.6540 | 3.631 | -0.1810 | 0.0005 | 4.688e-03 | 3.019e-08 | 3.157e-06 | 9.877e-01 | 5.432e-07 | 3.697 | 4.184e-01 | 1.132e-01 | 1.573e-04 | 7.422e-08 | ||
LPAL13_000011700 | LPAL13_000011700 | hypothetical protein | protein coding | LPAL13_SCAF000076 | 101 | 364 | - | reverse | Not Assigned | 264.0 | 263 | 6.172 | 0 | 7.411 | 0e+00 | 3.208 | 0.0103 | -1.4660 | -4.2030 | 6.0405 | 0.1296 | 2.738 | 6.037 | 0.0000 | 0.0000 | 12.04 | 1.2090 | 5.105 | 0 | 2517.131 | 11.298 | 0.0000 | 25.16 | 18.14 | 5.252e+02 | 7.745 | 1e+00 | 0.0000 | 1e+00 | -0.6559 | 25.26 | 0 | -2.8610 | 3.299 | -1.7560 | 0.0014 | 1.033e-02 | 1.271e-05 | 1.956e-05 | 0.000e+00 | 2.712e-05 | 5.348 | 1.400e+00 | 2.619e-01 | 4.669e-04 | 6.529e-07 | ||
LPAL13_170014500 | LPAL13_170014500 | hypothetical protein, conserved | protein coding | LpaL13_17 | 361708 | 362040 | + | forward | 17 | 333.0 | 332 | 5.301 | 0 | 5.138 | 5e-04 | 3.262 | 0.0082 | -0.6603 | -3.3280 | 6.1076 | 1.4218 | 2.668 | 4.750 | 0.0000 | 0.0004 | 19.30 | 1.0890 | 4.868 | 0 | 44.410 | 5.473 | 0.9966 | 44.69 | 32.50 | 1.669e+03 | 10.387 | 0e+00 | 0.0000 | 0e+00 | -0.2263 | 17.46 | 0 | -2.4060 | 3.400 | -1.4310 | 0.0010 | 8.225e-03 | 3.589e-05 | 4.608e-04 | 0.000e+00 | 4.433e-04 | 4.539 | 2.966e-03 | 6.535e-04 | 3.475e-04 | 3.314e-07 | ||
LPAL13_130006100 | LPAL13_130006100 | hypothetical protein | protein coding | LpaL13_13 | 26114 | 26335 | - | reverse | 13 | 222.0 | 221 | 3.071 | 0 | 3.067 | 0e+00 | 2.609 | 0.0028 | 3.4680 | 0.9263 | 0.9553 | 0.3111 | 2.541 | 10.670 | 0.0000 | 0.0000 | 222.00 | 0.3907 | 7.859 | 0 | 8.019 | 3.003 | 48.3185 | 387.52 | 292.86 | 5.261e+04 | 7.668 | 0e+00 | 1.0000 | 0e+00 | 3.2120 | 48.23 | 0 | 2.5630 | 3.845 | 0.4668 | 0.0002 | 2.764e-03 | 3.330e-12 | 3.072e-09 | 9.877e-01 | 9.132e-10 | 2.914 | 4.009e-03 | 1.376e-03 | 7.543e-05 | 1.707e-08 | ||
LPAL13_080010600 | LPAL13_080010600 | hypothetical protein, conserved | protein coding | LpaL13_08 | 195555 | 195749 | - | reverse | 8 | 195.0 | 194 | 6.047 | 0 | 7.280 | 0e+00 | 2.934 | 0.0085 | -1.7800 | -4.2030 | 4.6829 | 0.1296 | 2.423 | 6.023 | 0.0000 | 0.0000 | 10.18 | 1.1040 | 5.478 | 0 | 2040.429 | 10.995 | 0.0000 | 20.39 | 14.70 | 5.085e+02 | 6.497 | 1e+00 | 0.0000 | 1e+00 | -0.9281 | 27.21 | 0 | -3.0370 | 3.384 | -1.6290 | 0.0011 | 8.518e-03 | 2.895e-06 | 8.016e-06 | 0.000e+00 | 1.934e-05 | 5.079 | 1.849e+00 | 3.641e-01 | 3.547e-04 | 3.773e-07 | ||
LPAL13_190012600 | LPAL13_190012600 | hypothetical protein, conserved | protein coding | LpaL13_19 | 254293 | 254577 | - | reverse | 19 | 285.0 | 284 | 3.390 | 0 | 3.380 | 0e+00 | 2.779 | 0.0041 | 1.9840 | -0.4375 | 1.6084 | 0.3135 | 2.421 | 8.668 | 0.0000 | 0.0000 | 88.51 | 0.4592 | 7.383 | 0 | 9.447 | 3.240 | 16.3299 | 154.35 | 115.83 | 8.229e+03 | 7.973 | 0e+00 | 1.0000 | 0e+00 | 1.9080 | 40.19 | 0 | 1.0670 | 3.689 | -0.0955 | 0.0004 | 4.098e-03 | 8.848e-11 | 6.334e-08 | 9.839e-01 | 2.046e-08 | 3.222 | 2.466e-02 | 7.653e-03 | 1.290e-04 | 4.995e-08 | ||
LPAL13_240030500 | LPAL13_240030500 | hypothetical protein | protein coding | LpaL13_24 | 828719 | 828913 | + | forward | 24 | 195.0 | 194 | 2.269 | 0 | 2.263 | 1e-04 | 2.495 | 0.0171 | 3.2970 | 0.9109 | 1.1727 | 3.9478 | 2.386 | 3.939 | 0.0016 | 0.0094 | 209.20 | 0.4572 | 4.963 | 0 | 4.499 | 2.170 | 78.1961 | 351.82 | 275.46 | 3.701e+04 | 4.394 | 4e-04 | 0.9996 | 4e-04 | 3.1130 | 21.31 | 0 | 2.3430 | 3.072 | -1.7090 | 0.0028 | 1.713e-02 | 2.434e-05 | 9.179e-05 | 9.839e-01 | 9.385e-03 | 2.351 | 1.967e-01 | 8.365e-02 | 9.425e-04 | 2.652e-06 | ||
LPAL13_210015300 | LPAL13_210015300 | core histone h2a/h2b/h3/h4, putative | protein coding | LpaL13_21 | 324301 | 324699 | + | forward | 21 | 399.0 | 398 | 2.631 | 0 | 2.630 | 0e+00 | 2.495 | 0.0000 | 8.7400 | 6.3960 | 1.7349 | 0.5224 | 2.344 | 7.430 | 0.0000 | 0.0000 | 10480.00 | 0.4531 | 5.805 | 0 | 5.971 | 2.578 | 2793.2520 | 16679.76 | 12804.45 | 1.102e+08 | 6.107 | 6e-04 | 0.9994 | 6e-04 | 8.7460 | 32.65 | 0 | 7.9550 | 5.659 | 6.7950 | 0.0000 | 1.857e-05 | 5.080e-07 | 8.927e-07 | 1.000e+00 | 7.219e-07 | 2.578 | 6.120e-02 | 2.375e-02 | 6.718e-08 | 1.026e-14 | ||
LPAL13_000018000 | LPAL13_000018000 | hypothetical protein | protein coding | LPAL13_SCAF000166 | 2 | 412 | + | forward | Not Assigned | 411.0 | 410 | 2.722 | 0 | 2.720 | 0e+00 | 2.699 | 0.0005 | 6.7350 | 4.4450 | 1.8807 | 0.1285 | 2.291 | 8.574 | 0.0000 | 0.0000 | 2186.00 | 0.4386 | 6.206 | 0 | 6.058 | 2.599 | 662.2272 | 4012.04 | 3077.21 | 5.392e+06 | 6.156 | 0e+00 | 1.0000 | 0e+00 | 6.4850 | 31.02 | 0 | 5.6940 | 4.503 | 2.3910 | 0.0000 | 4.738e-04 | 9.868e-08 | 1.793e-06 | 1.000e+00 | 3.431e-08 | 2.799 | 2.065e-01 | 7.377e-02 | 6.769e-06 | 1.369e-10 |
knitr::kable(head(sus_sig_sva$deseq$downs$sensitive_vs_resistant, n = 20))
gid | annotgeneproduct | annotgenetype | chromosome | start | end | strand | annotgeneentrezid | annotgenename | annotstrand | annotchromosome | annotcdslength | length | deseq_logfc | deseq_adjp | edger_logfc | edger_adjp | limma_logfc | limma_adjp | basic_nummed | basic_denmed | basic_numvar | basic_denvar | basic_logfc | basic_t | basic_p | basic_adjp | deseq_basemean | deseq_lfcse | deseq_stat | deseq_p | ebseq_fc | ebseq_logfc | ebseq_c1mean | ebseq_c2mean | ebseq_mean | ebseq_var | ebseq_postfc | ebseq_ppee | ebseq_ppde | ebseq_adjp | edger_logcpm | edger_lr | edger_p | limma_ave | limma_t | limma_b | limma_p | limma_adjp_ihw | deseq_adjp_ihw | edger_adjp_ihw | ebseq_adjp_ihw | basic_adjp_ihw | lfc_meta | lfc_var | lfc_varbymed | p_meta | p_var | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LPAL13_000033300 | LPAL13_000033300 | hypothetical protein, conserved | protein coding | LPAL13_SCAF000463 | 551 | 811 | + | forward | Not Assigned | 261.0 | 260 | -4.051 | 0.0061 | -4.016 | 0.0043 | -7.322 | 0.0000 | -3.5060 | 3.4470 | 11.5862 | 0.0607 | -6.954 | -11.300 | 0.000 | 0.0000 | 121.800 | 1.2180 | -3.326 | 0.0009 | 0.1453 | -2.7829 | 327.09 | 47.516 | 125.536 | 2.384e+04 | 0.1538 | 0.0000 | 0.0000 | 0.0000 | 2.3120 | 12.050 | 0.0005 | -0.9159 | -7.608 | 13.830 | 0.0000 | 4.800e-08 | 6.163e-03 | 4.547e-03 | 0.000e+00 | 9.132e-10 | -5.130 | 0.000e+00 | 0.000e+00 | 4.663e-04 | 1.964e-07 | ||
LPAL13_000012000 | LPAL13_000012000 | hypothetical protein | protein coding | LPAL13_SCAF000080 | 710 | 1159 | - | reverse | Not Assigned | 450.0 | 449 | -2.336 | 0.0027 | -2.341 | 0.0008 | -4.464 | 0.0000 | 0.0134 | 3.9290 | 8.0366 | 0.1673 | -3.916 | -7.492 | 0.000 | 0.0000 | 192.500 | 0.6472 | -3.610 | 0.0003 | 0.2451 | -2.0288 | 472.57 | 115.799 | 215.362 | 5.531e+04 | 0.2569 | 0.0256 | 0.9744 | 0.0256 | 2.9810 | 15.950 | 0.0001 | 1.2880 | -5.889 | 7.857 | 0.0000 | 9.491e-06 | 2.776e-03 | 8.784e-04 | 9.642e-01 | 6.194e-07 | -2.949 | 1.112e-01 | -3.770e-02 | 1.238e-04 | 2.606e-08 | ||
LPAL13_310035500 | LPAL13_310035500 | hypothetical protein | protein coding | LpaL13_31 | 1198439 | 1198957 | - | reverse | 31 | 519.0 | 518 | -2.338 | 0.0144 | -2.275 | 0.0084 | -3.574 | 0.0000 | -4.2500 | -0.4918 | 3.5831 | 0.4599 | -3.759 | -9.581 | 0.000 | 0.0000 | 6.416 | 0.7801 | -2.998 | 0.0027 | 0.2685 | -1.8968 | 18.64 | 5.000 | 8.807 | 3.123e+02 | 0.3178 | 0.0000 | 0.0000 | 0.0000 | -1.8410 | 10.410 | 0.0013 | -3.0790 | -6.859 | 8.631 | 0.0000 | 6.246e-07 | 1.464e-02 | 8.343e-03 | 0.000e+00 | 2.135e-09 | -2.737 | 1.446e-03 | -5.285e-04 | 1.326e-03 | 1.855e-06 | ||
LPAL13_000038400 | LPAL13_000038400 | expression-site associated gene (esag3), putative | protein coding | LPAL13_SCAF000573 | 101 | 1360 | + | forward | Not Assigned | 1260.0 | 1259 | -2.765 | 0.0000 | -2.770 | 0.0000 | -3.929 | 0.0000 | 4.4930 | 8.2090 | 3.4271 | 0.0364 | -3.716 | -11.030 | 0.000 | 0.0000 | 3380.000 | 0.5381 | -5.138 | 0.0000 | 0.1798 | -2.4753 | 9214.88 | 1657.147 | 3766.282 | 1.711e+07 | 0.1852 | 0.0000 | 0.0000 | 0.0000 | 7.1120 | 32.140 | 0.0000 | 5.7960 | -5.888 | 7.804 | 0.0000 | 9.491e-06 | 1.189e-05 | 1.301e-06 | 0.000e+00 | 1.467e-09 | -3.225 | 3.470e-02 | -1.076e-02 | 1.202e-07 | 1.930e-14 | ||
LPAL13_000038500 | LPAL13_000038500 | hypothetical protein | protein coding | LPAL13_SCAF000575 | 39 | 251 | + | forward | Not Assigned | 213.0 | 212 | -2.121 | 0.0035 | -2.122 | 0.0029 | -3.738 | 0.0000 | -2.3030 | 1.3340 | 5.2036 | 0.6833 | -3.638 | -7.672 | 0.000 | 0.0000 | 26.610 | 0.6026 | -3.520 | 0.0004 | 0.2673 | -1.9035 | 78.06 | 20.858 | 36.822 | 2.446e+03 | 0.2929 | 0.0000 | 0.0000 | 0.0000 | 0.1404 | 12.980 | 0.0003 | -1.3510 | -6.185 | 7.971 | 0.0000 | 3.998e-06 | 3.577e-03 | 3.128e-03 | 0.000e+00 | 1.852e-07 | -2.640 | 5.880e-02 | -2.227e-02 | 2.486e-04 | 4.976e-08 | ||
LPAL13_000012100 | LPAL13_000012100 | hypothetical protein | protein coding | LPAL13_SCAF000080 | 1637 | 1894 | - | reverse | Not Assigned | 258.0 | 257 | -1.856 | 0.0220 | -1.857 | 0.0148 | -3.524 | 0.0001 | -2.3030 | 1.1290 | 6.1207 | 0.6501 | -3.431 | -6.841 | 0.000 | 0.0000 | 28.960 | 0.6589 | -2.817 | 0.0049 | 0.2846 | -1.8128 | 67.24 | 19.131 | 32.556 | 1.831e+03 | 0.3140 | 0.0044 | 0.9956 | 0.0044 | 0.2662 | 9.014 | 0.0027 | -1.2890 | -5.297 | 4.881 | 0.0000 | 5.231e-05 | 2.451e-02 | 1.576e-02 | 9.864e-01 | 1.721e-06 | -2.230 | 1.642e-01 | -7.365e-02 | 2.511e-03 | 5.907e-06 | ||
LPAL13_350063000 | LPAL13_350063000 | hypothetical protein | protein coding | LpaL13_35 | 1964328 | 1964543 | - | reverse | 35 | 216.0 | 215 | -2.559 | 0.0000 | -2.543 | 0.0000 | -3.538 | 0.0000 | -2.2250 | 1.1420 | 2.2723 | 0.2255 | -3.367 | -11.090 | 0.000 | 0.0000 | 19.820 | 0.4499 | -5.688 | 0.0000 | 0.1795 | -2.4782 | 56.77 | 10.179 | 23.180 | 6.353e+02 | 0.1953 | 0.0000 | 1.0000 | 0.0000 | -0.2880 | 35.320 | 0.0000 | -1.3500 | -7.436 | 12.440 | 0.0000 | 7.763e-08 | 1.032e-06 | 4.255e-07 | 9.837e-01 | 1.087e-10 | -2.909 | 3.081e-02 | -1.059e-02 | 5.244e-09 | 4.549e-17 | ||
LPAL13_310031300 | LPAL13_310031300 | hypothetical protein, conserved | protein coding | LpaL13_31 | 1084772 | 1085059 | - | reverse | 31 | 288.0 | 287 | -2.167 | 0.0014 | -2.154 | 0.0005 | -3.643 | 0.0000 | -1.1870 | 2.1410 | 4.7045 | 0.7839 | -3.328 | -7.142 | 0.000 | 0.0000 | 58.050 | 0.5669 | -3.824 | 0.0001 | 0.2604 | -1.9414 | 145.08 | 37.766 | 67.713 | 6.939e+03 | 0.2781 | 0.0017 | 0.9983 | 0.0017 | 1.2390 | 17.170 | 0.0000 | -0.1278 | -5.796 | 7.053 | 0.0000 | 1.234e-05 | 1.591e-03 | 5.510e-04 | 9.461e-01 | 7.219e-07 | -2.655 | 1.068e-02 | -4.023e-03 | 5.529e-05 | 4.648e-09 | ||
LPAL13_340039600 | LPAL13_340039600 | hypothetical protein | protein coding | LpaL13_34 | 1247554 | 1247757 | - | reverse | 34 | 204.0 | 203 | -2.051 | 0.0007 | -2.057 | 0.0002 | -3.258 | 0.0000 | 1.2010 | 4.2610 | 3.9576 | 0.1030 | -3.060 | -8.289 | 0.000 | 0.0000 | 217.400 | 0.5061 | -4.054 | 0.0001 | 0.2144 | -2.2213 | 583.13 | 125.041 | 252.879 | 5.809e+04 | 0.2195 | 0.0000 | 1.0000 | 0.0000 | 3.1390 | 19.420 | 0.0000 | 2.0330 | -5.351 | 5.772 | 0.0000 | 4.394e-05 | 7.642e-04 | 2.040e-04 | 9.837e-01 | 1.314e-07 | -2.392 | 8.856e-03 | -3.703e-03 | 2.053e-05 | 6.950e-10 | ||
LPAL13_310031000 | LPAL13_310031000 | hypothetical protein, conserved | protein coding | LpaL13_31 | 1075172 | 1075459 | - | reverse | 31 | 288.0 | 287 | -2.295 | 0.0000 | -2.280 | 0.0000 | -3.464 | 0.0000 | -1.9610 | 0.9507 | 3.4017 | 0.5352 | -2.912 | -7.413 | 0.000 | 0.0000 | 19.960 | 0.4292 | -5.346 | 0.0000 | 0.2853 | -1.8096 | 57.60 | 16.423 | 27.913 | 1.029e+03 | 0.3065 | 0.3131 | 0.6869 | 0.3131 | -0.1515 | 32.140 | 0.0000 | -1.3750 | -8.102 | 14.910 | 0.0000 | 2.353e-08 | 5.107e-06 | 1.361e-06 | 6.903e-01 | 3.619e-07 | -2.666 | 3.846e-03 | -1.442e-03 | 3.477e-08 | 2.336e-15 | ||
LPAL13_050005000 | LPAL13_050005000 | hypothetical protein | protein coding | LpaL13_05 | 3394 | 3612 | - | reverse | 5 | 219.0 | 218 | -1.866 | 0.0063 | -1.872 | 0.0028 | -2.904 | 0.0001 | -0.0969 | 2.6670 | 3.2891 | 0.1597 | -2.764 | -7.999 | 0.000 | 0.0000 | 85.410 | 0.5630 | -3.315 | 0.0009 | 0.2818 | -1.8274 | 188.15 | 53.009 | 90.723 | 7.118e+03 | 0.2904 | 0.0000 | 1.0000 | 0.0000 | 1.7980 | 13.070 | 0.0003 | 0.5391 | -5.289 | 5.442 | 0.0000 | 5.260e-05 | 6.475e-03 | 2.996e-03 | 9.837e-01 | 1.589e-07 | -2.191 | 1.613e-02 | -7.365e-03 | 4.060e-04 | 2.186e-07 | ||
LPAL13_310039200 | LPAL13_310039200 | hypothetical protein | protein coding | LpaL13_31 | 1301745 | 1301972 | - | reverse | 31 | 228.0 | 227 | -2.301 | 0.0000 | -2.306 | 0.0000 | -2.812 | 0.0000 | 1.3090 | 3.7370 | 1.5959 | 0.2098 | -2.428 | -9.247 | 0.000 | 0.0000 | 176.700 | 0.4034 | -5.705 | 0.0000 | 0.2858 | -1.8069 | 411.30 | 117.541 | 199.519 | 3.648e+04 | 0.2969 | 0.1929 | 0.8071 | 0.1929 | 2.8660 | 39.350 | 0.0000 | 2.0740 | -6.830 | 11.860 | 0.0000 | 6.265e-07 | 1.038e-06 | 9.147e-08 | 7.975e-01 | 4.626e-09 | -2.573 | 6.751e-02 | -2.624e-02 | 4.329e-09 | 3.987e-17 | ||
LPAL13_140019300 | LPAL13_140019300 | bt1 family, putative | protein coding | LpaL13_14 | 530784 | 531350 | + | forward | 14 | 567.0 | 566 | -2.510 | 0.0000 | -2.513 | 0.0000 | -2.614 | 0.0000 | 4.6760 | 7.0960 | 0.6202 | 1.0309 | -2.420 | -7.436 | 0.000 | 0.0000 | 1816.000 | 0.3720 | -6.748 | 0.0000 | 0.1845 | -2.4381 | 4939.72 | 911.476 | 2035.637 | 5.489e+06 | 0.1903 | 0.0000 | 1.0000 | 0.0000 | 6.2150 | 54.810 | 0.0000 | 5.4710 | -6.779 | 11.630 | 0.0000 | 7.374e-07 | 4.947e-09 | 2.095e-10 | 9.839e-01 | 3.561e-05 | -2.653 | 2.149e-01 | -8.103e-02 | 4.350e-10 | 5.483e-19 | ||
LPAL13_290026200 | LPAL13_290026200 | hypothetical protein | protein coding | LpaL13_29 | 864413 | 864616 | + | forward | 29 | 204.0 | 203 | -1.213 | 0.2383 | -1.208 | 0.2126 | -1.935 | 0.0251 | -2.6990 | -0.5708 | 6.4336 | 4.6401 | -2.128 | -2.761 | 0.011 | 0.0401 | 17.660 | 0.7810 | -1.553 | 0.1204 | 0.5295 | -0.9173 | 41.11 | 21.762 | 27.161 | 2.397e+03 | 0.5777 | 0.0298 | 0.9702 | 0.0298 | -0.5283 | 2.692 | 0.1009 | -2.6160 | -2.886 | -2.199 | 0.0049 | 2.508e-02 | 2.428e-01 | 2.274e-01 | 9.689e-01 | 2.852e-02 | -1.453 | 2.977e-02 | -2.048e-02 | 7.540e-02 | 3.823e-03 | ||
LPAL13_340039700 | LPAL13_340039700 | snare domain containing protein, putative | protein coding | LpaL13_34 | 1248192 | 1248947 | - | reverse | 34 | 756.0 | 755 | -1.719 | 0.0000 | -1.725 | 0.0000 | -2.070 | 0.0000 | 4.6020 | 6.7060 | 0.7166 | 0.0945 | -2.104 | -11.950 | 0.000 | 0.0000 | 1294.000 | 0.3254 | -5.284 | 0.0000 | 0.2740 | -1.8679 | 3160.85 | 866.003 | 1506.426 | 1.487e+06 | 0.2781 | 0.0000 | 1.0000 | 0.0000 | 5.7220 | 34.070 | 0.0000 | 5.2630 | -6.365 | 9.800 | 0.0000 | 2.306e-06 | 5.995e-06 | 6.924e-07 | 9.457e-01 | 3.673e-11 | -1.837 | 5.236e-03 | -2.851e-03 | 4.673e-08 | 4.775e-15 | ||
LPAL13_050016500 | LPAL13_050016500 | unspecified product | snoRNA encoding | LpaL13_05 | undefined | undefined | + | forward | 5 | 0.0 | undefined | -1.016 | 0.1700 | -1.019 | 0.1707 | -2.380 | 0.0010 | -1.4980 | 0.6056 | 3.5984 | 1.0071 | -2.103 | -4.703 | 0.000 | 0.0005 | 25.390 | 0.5724 | -1.775 | 0.0759 | 0.6736 | -0.5700 | 46.03 | 31.000 | 35.194 | 3.534e+03 | 0.7127 | 0.6951 | 0.3049 | 0.6951 | 0.1057 | 3.190 | 0.0741 | -1.1770 | -4.210 | 1.357 | 0.0001 | 1.044e-03 | 1.925e-01 | 1.708e-01 | 3.502e-01 | 4.953e-04 | -1.401 | 2.983e-01 | -2.130e-01 | 5.002e-02 | 1.873e-03 | ||
LPAL13_350073400 | LPAL13_350073400 | hypothetical protein | protein coding | LpaL13_35 | 2342701 | 2342883 | + | forward | 35 | 183.0 | 182 | -1.554 | 0.0005 | -1.552 | 0.0007 | -2.039 | 0.0003 | -0.3040 | 1.7540 | 1.1191 | 0.8306 | -2.058 | -6.341 | 0.000 | 0.0001 | 43.080 | 0.3775 | -4.116 | 0.0000 | 0.2995 | -1.7395 | 115.91 | 34.704 | 57.366 | 6.357e+03 | 0.3249 | 0.0001 | 0.9999 | 0.0001 | 0.8098 | 16.630 | 0.0000 | 0.1382 | -4.713 | 3.261 | 0.0000 | 2.544e-04 | 6.145e-04 | 6.959e-04 | 9.877e-01 | 4.784e-05 | -1.712 | 4.240e-04 | -2.476e-04 | 3.099e-05 | 3.748e-10 | ||
LPAL13_140019100 | LPAL13_140019100 | bt1 family, putative | protein coding | LpaL13_14 | 525164 | 525514 | + | forward | 14 | 351.0 | 350 | -2.003 | 0.0000 | -2.005 | 0.0000 | -2.191 | 0.0000 | 3.9600 | 6.0150 | 0.4574 | 0.5082 | -2.055 | -8.601 | 0.000 | 0.0000 | 858.600 | 0.2946 | -6.800 | 0.0000 | 0.2486 | -2.0079 | 2079.27 | 516.963 | 952.955 | 7.515e+05 | 0.2529 | 0.0000 | 1.0000 | 0.0000 | 5.1340 | 56.280 | 0.0000 | 4.6820 | -7.777 | 16.160 | 0.0000 | 3.613e-08 | 4.149e-09 | 1.412e-10 | 9.462e-01 | 2.947e-06 | -2.142 | 5.201e-02 | -2.428e-02 | 7.718e-12 | 4.514e-23 | ||
LPAL13_170015400 | LPAL13_170015400 | hypothetical protein, conserved | protein coding | LpaL13_17 | 395975 | 396307 | + | forward | 17 | 333.0 | 332 | -1.856 | 0.0000 | -1.858 | 0.0000 | -2.241 | 0.0000 | 1.2050 | 3.2550 | 1.2016 | 0.1241 | -2.051 | -9.255 | 0.000 | 0.0000 | 140.300 | 0.3158 | -5.878 | 0.0000 | 0.3282 | -1.6075 | 285.57 | 93.708 | 147.249 | 1.387e+04 | 0.3329 | 0.0000 | 1.0000 | 0.0000 | 2.5240 | 37.910 | 0.0000 | 2.0000 | -6.406 | 10.020 | 0.0000 | 2.301e-06 | 4.439e-07 | 1.771e-07 | 9.505e-01 | 4.813e-09 | -2.008 | 5.444e-04 | -2.711e-04 | 3.957e-09 | 9.756e-18 | ||
LPAL13_350013200 | LPAL13_350013200 | hypothetical protein, conserved | protein coding | LpaL13_35 | 223837 | 224070 | + | forward | 35 | 234.0 | 233 | -1.172 | 0.0087 | -1.166 | 0.0108 | -1.919 | 0.0001 | -2.0980 | -0.2277 | 1.1372 | 0.7142 | -1.870 | -6.030 | 0.000 | 0.0001 | 10.050 | 0.3668 | -3.195 | 0.0014 | 0.3700 | -1.4343 | 26.02 | 9.623 | 14.199 | 2.850e+02 | 0.3934 | 0.6600 | 0.3400 | 0.6600 | -1.1170 | 9.796 | 0.0017 | -1.9060 | -4.911 | 3.190 | 0.0000 | 1.487e-04 | 8.718e-03 | 1.073e-02 | 3.895e-01 | 6.322e-05 | -1.389 | 3.277e-02 | -2.360e-02 | 1.050e-03 | 8.518e-07 |
sus_ma <- sus_table_sva[["plots"]][["sensitive_vs_resistant"]][["deseq_ma_plots"]][["plot"]]
dev <- pp(file = "images/sus_ma_sva.png")
sus_ma
closed <- dev.off()
sus_ma
## test <- ggplt(sus_ma)
Now let us look for ontology categories which are increased in the 2.3 samples followed by the 2.2 samples.
## Gene categories more represented in the 2.3 group.
zy_go_up <- simple_goseq(sig_genes = zy_sig_sva[["deseq"]][["ups"]][[1]],
go_db = lp_go, length_db = lp_lengths)
## Found 16 go_db genes and 54 length_db genes out of 54.
## Testing that go categories are defined.
## Removing undefined categories.
## Gathering synonyms.
## Gathering category definitions.
## Gene categories more represented in the 2.2 group.
zy_go_down <- simple_goseq(sig_genes = zy_sig_sva[["deseq"]][["downs"]][[1]],
go_db = lp_go, length_db = lp_lengths)
## Found 14 go_db genes and 69 length_db genes out of 69.
## Testing that go categories are defined.
## Removing undefined categories.
## Gathering synonyms.
## Gathering category definitions.
In the function ‘combined_de_tables()’ above, one of the tasks performed is to look at the agreement among DESeq2, limma, and edgeR. The following show a couple of these for the set of genes observed with a fold-change >= |2| and adjusted p-value <= 0.05.
zy_table_sva[["venns"]][[1]][["p_lfc1"]][["up_noweight"]]
zy_table_sva[["venns"]][[1]][["p_lfc1"]][["down_noweight"]]
zy_go_up$pvalue_plots$bpp_plot_over
zy_go_down$pvalue_plots$bpp_plot_over
Remind myself, the data structures are (zy|sus)_(de|table|sig).
zy_df <- zy_table_sva[["data"]][["z23_vs_z22"]]
sus_df <- sus_table_sva[["data"]][["sensitive_vs_resistant"]]
both_df <- merge(zy_df, sus_df, by = "row.names")
plot_df <- both_df[, c("deseq_logfc.x", "deseq_logfc.y")]
rownames(plot_df) <- both_df[["Row.names"]]
colnames(plot_df) <- c("z23_vs_z22", "sensitive_vs_resistant")
compare <- plot_linear_scatter(plot_df)
## Warning in plot_multihistogram(df): NAs introduced by coercion
dev <- pp(file = "images/compare_sus_zy.png")
compare$scatter
closed <- dev.off()
compare$scatter
compare$cor
##
## Pearson's product-moment correlation
##
## data: df[, 1] and df[, 2]
## t = -184, df = 8555, p-value <2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.8974 -0.8889
## sample estimates:
## cor
## -0.8932
Najib read me an email listing off the gene names associated with the zymodeme classification. I took those names and cross referenced them against the Leishmania panamensis gene annotations and found the following:
They are:
Given these 6 gene IDs (NH has two gene IDs associated with it), I can do some looking for specific differences among the various samples.
The following creates a colorspace (red to green) heatmap showing the observed expression of these genes in every sample.
my_genes <- c("LPAL13_120010900", "LPAL13_340013000", "LPAL13_000054100",
"LPAL13_140006100", "LPAL13_180018500", "LPAL13_320022300",
"other")
my_names <- c("ALAT", "ASAT", "G6PD", "NHv1", "NHv2", "MPI", "other")
zymo_expt <- exclude_genes_expt(zy_norm, ids = my_genes, method = "keep")
## Before removal, there were 8557 genes, now there are 6.
## There are 82 samples which kept less than 90 percent counts.
## TMRC20001 TMRC20065 TMRC20005 TMRC20066 TMRC20039 TMRC20037 TMRC20038 TMRC20067
## 0.13106 0.12479 0.13215 0.10580 0.12996 0.11000 0.11284 0.11633
## TMRC20068 TMRC20041 TMRC20015 TMRC20009 TMRC20010 TMRC20016 TMRC20011 TMRC20012
## 0.11542 0.11799 0.11468 0.11350 0.10977 0.10591 0.11017 0.12058
## TMRC20013 TMRC20017 TMRC20014 TMRC20018 TMRC20019 TMRC20070 TMRC20020 TMRC20021
## 0.12051 0.10631 0.10890 0.11456 0.12238 0.11248 0.11007 0.10617
## TMRC20022 TMRC20024 TMRC20036 TMRC20069 TMRC20033 TMRC20026 TMRC20031 TMRC20076
## 0.13062 0.11243 0.12016 0.11617 0.11258 0.13845 0.10014 0.12008
## TMRC20073 TMRC20055 TMRC20079 TMRC20071 TMRC20078 TMRC20094 TMRC20042 TMRC20058
## 0.12254 0.13478 0.12666 0.12325 0.13409 0.11733 0.13147 0.11798
## TMRC20072 TMRC20059 TMRC20048 TMRC20088 TMRC20060 TMRC20077 TMRC20074 TMRC20063
## 0.14327 0.11013 0.10303 0.12930 0.10841 0.12191 0.12067 0.11666
## TMRC20053 TMRC20052 TMRC20064 TMRC20075 TMRC20051 TMRC20050 TMRC20049 TMRC20062
## 0.11811 0.11035 0.11376 0.11102 0.12824 0.11529 0.13949 0.12848
## TMRC20110 TMRC20080 TMRC20043 TMRC20083 TMRC20054 TMRC20085 TMRC20046 TMRC20089
## 0.13862 0.11534 0.11355 0.12380 0.12766 0.12197 0.13684 0.11544
## TMRC20090 TMRC20044 TMRC20105 TMRC20109 TMRC20098 TMRC20096 TMRC20097 TMRC20101
## 0.11171 0.13383 0.12207 0.12673 0.11631 0.11659 0.11887 0.11890
## TMRC20092 TMRC20099 TMRC20100 TMRC20087 TMRC20104 TMRC20086 TMRC20107 TMRC20081
## 0.11560 0.12202 0.11059 0.12329 0.11720 0.10982 0.09643 0.10454
## TMRC20106 TMRC20095
## 0.09806 0.07967
zymo_heatmap <- plot_sample_heatmap(zymo_expt, row_label = my_names)
zymo_heatmap
In contrast, the following plots take the set of genes which are shared among all differential expression methods (|lfc| >= 1.0 and adjp <= 0.05) and use them to make categories of genes which are increased in 2.3 or 2.2.
shared_zymo <- intersect_significant(zy_table_sva)
## Deleting the file excel/intersect_significant.xlsx before writing the tables.
up_shared <- shared_zymo[["ups"]][[1]][["data"]][["all"]]
rownames(up_shared)
## [1] "LPAL13_000033300" "LPAL13_000012000" "LPAL13_000012100" "LPAL13_000038500"
## [5] "LPAL13_000038400" "LPAL13_310031300" "LPAL13_340039600" "LPAL13_050005000"
## [9] "LPAL13_310035500" "LPAL13_350063000" "LPAL13_310039200" "LPAL13_310031000"
## [13] "LPAL13_140019300" "LPAL13_340039700" "LPAL13_210015500" "LPAL13_180013900"
## [17] "LPAL13_290026200" "LPAL13_170015400" "LPAL13_250006300" "LPAL13_350073400"
## [21] "LPAL13_140019100" "LPAL13_350013200" "LPAL13_330024000" "LPAL13_230016400"
## [25] "LPAL13_190021800" "LPAL13_000025600" "LPAL13_050016500" "LPAL13_240009700"
## [29] "LPAL13_350012400" "LPAL13_320038700" "LPAL13_140019200" "LPAL13_210005000"
## [33] "LPAL13_270034100" "LPAL13_330021800" "LPAL13_250025700" "LPAL13_160014500"
## [37] "LPAL13_350073200" "LPAL13_230011200" "LPAL13_330021900" "LPAL13_000029000"
## [41] "LPAL13_000052700" "LPAL13_040007800" "LPAL13_160014100" "LPAL13_230011500"
## [45] "LPAL13_050009600" "LPAL13_350044000" "LPAL13_310032500" "LPAL13_230021300"
## [49] "LPAL13_310028500" "LPAL13_230011400" "LPAL13_000045100" "LPAL13_110015700"
## [53] "LPAL13_020006700" "LPAL13_230011300"
upshared_expt <- exclude_genes_expt(zy_norm, ids = rownames(up_shared), method = "keep")
## Before removal, there were 8557 genes, now there are 54.
## There are 82 samples which kept less than 90 percent counts.
## TMRC20001 TMRC20065 TMRC20005 TMRC20066 TMRC20039 TMRC20037 TMRC20038 TMRC20067
## 0.4022 0.4755 0.1522 0.4940 0.2219 0.5758 0.6687 0.3800
## TMRC20068 TMRC20041 TMRC20015 TMRC20009 TMRC20010 TMRC20016 TMRC20011 TMRC20012
## 0.4351 0.1991 0.5105 0.1854 0.4787 0.3959 0.1980 0.1569
## TMRC20013 TMRC20017 TMRC20014 TMRC20018 TMRC20019 TMRC20070 TMRC20020 TMRC20021
## 0.4504 0.2511 0.2042 0.4298 0.1761 0.4740 0.1812 0.4677
## TMRC20022 TMRC20024 TMRC20036 TMRC20069 TMRC20033 TMRC20026 TMRC20031 TMRC20076
## 0.1619 0.2123 0.2509 0.2256 0.2379 0.1455 0.1369 0.2264
## TMRC20073 TMRC20055 TMRC20079 TMRC20071 TMRC20078 TMRC20094 TMRC20042 TMRC20058
## 0.6241 0.2358 0.6004 0.6076 0.2670 0.5106 0.2142 0.8190
## TMRC20072 TMRC20059 TMRC20048 TMRC20088 TMRC20060 TMRC20077 TMRC20074 TMRC20063
## 0.2498 0.3678 0.4334 0.2370 0.1527 0.1542 0.2969 0.2037
## TMRC20053 TMRC20052 TMRC20064 TMRC20075 TMRC20051 TMRC20050 TMRC20049 TMRC20062
## 0.2452 0.5647 0.5705 0.3901 0.7473 0.2485 0.2185 0.7600
## TMRC20110 TMRC20080 TMRC20043 TMRC20083 TMRC20054 TMRC20085 TMRC20046 TMRC20089
## 0.2046 0.5946 0.5257 0.1767 0.6792 0.5156 0.1920 0.4461
## TMRC20090 TMRC20044 TMRC20105 TMRC20109 TMRC20098 TMRC20096 TMRC20097 TMRC20101
## 0.6512 0.2151 0.6212 0.1516 0.4455 0.1965 0.1640 0.1785
## TMRC20092 TMRC20099 TMRC20100 TMRC20087 TMRC20104 TMRC20086 TMRC20107 TMRC20081
## 0.1704 0.5580 0.5427 0.1727 0.6571 0.1335 0.3428 0.1390
## TMRC20106 TMRC20095
## 0.1648 0.3513
We can plot a quick heatmap to get a sense of the differences observed between the genes which are different between the two zymodemes.
high_23_heatmap <- plot_sample_heatmap(upshared_expt, row_label = rownames(up_shared))
high_23_heatmap
down_shared <- shared_zymo[["downs"]][[1]][["data"]][["all"]]
downshared_expt <- exclude_genes_expt(zy_norm, ids = rownames(down_shared), method = "keep")
## Before removal, there were 8557 genes, now there are 69.
## There are 82 samples which kept less than 90 percent counts.
## TMRC20001 TMRC20065 TMRC20005 TMRC20066 TMRC20039 TMRC20037 TMRC20038 TMRC20067
## 0.2261 0.1929 0.6787 0.2301 0.6685 0.2192 0.2085 0.2431
## TMRC20068 TMRC20041 TMRC20015 TMRC20009 TMRC20010 TMRC20016 TMRC20011 TMRC20012
## 0.2056 0.6963 0.1930 0.6481 0.1728 0.2123 0.5794 0.5614
## TMRC20013 TMRC20017 TMRC20014 TMRC20018 TMRC20019 TMRC20070 TMRC20020 TMRC20021
## 0.1713 0.6687 0.6606 0.1685 0.6627 0.1884 0.6924 0.1596
## TMRC20022 TMRC20024 TMRC20036 TMRC20069 TMRC20033 TMRC20026 TMRC20031 TMRC20076
## 0.6842 0.7270 0.6946 0.7052 0.7336 0.7036 0.6256 0.6185
## TMRC20073 TMRC20055 TMRC20079 TMRC20071 TMRC20078 TMRC20094 TMRC20042 TMRC20058
## 0.1958 0.7237 0.1925 0.1740 0.5447 0.1900 0.5565 0.2265
## TMRC20072 TMRC20059 TMRC20048 TMRC20088 TMRC20060 TMRC20077 TMRC20074 TMRC20063
## 0.5573 0.1440 0.1603 0.6268 0.7714 0.5807 0.6744 0.6443
## TMRC20053 TMRC20052 TMRC20064 TMRC20075 TMRC20051 TMRC20050 TMRC20049 TMRC20062
## 0.5808 0.1824 0.1988 0.1857 0.1962 0.6232 0.7064 0.1942
## TMRC20110 TMRC20080 TMRC20043 TMRC20083 TMRC20054 TMRC20085 TMRC20046 TMRC20089
## 0.5611 0.1575 0.1765 0.6377 0.2071 0.1641 0.6399 0.1561
## TMRC20090 TMRC20044 TMRC20105 TMRC20109 TMRC20098 TMRC20096 TMRC20097 TMRC20101
## 0.1757 0.6315 0.1857 0.6987 0.1985 0.7427 0.5672 0.6418
## TMRC20092 TMRC20099 TMRC20100 TMRC20087 TMRC20104 TMRC20086 TMRC20107 TMRC20081
## 0.5959 0.1843 0.1557 0.5600 0.2037 0.7286 0.1433 0.6779
## TMRC20106 TMRC20095
## 0.9969 0.2280
high_22_heatmap <- plot_sample_heatmap(downshared_expt, row_label = rownames(down_shared))
high_22_heatmap
Now I will combine our previous samples and our new samples in the hopes of finding variant positions which help elucidate currently unknown aspects of either group via their clustering to known samples from the other group. In other words, we do not know the zymodeme annotations for the old samples nor the strain identities (or the shortcut ‘chronic vs. self-healing’) for the new samples. I hope to make educated guesses given the variant profiles. There are some differences in how the previous and current data sets were analyzed (though I have since redone the old samples so it should be trivial to remove those differences now).
I added our 2016 data to a specific TMRC2 sample sheet, dated 20191203. Thus I will load the data here. That previous data was mapped using tophat, so I will also need to make some changes to the gene names to accomodate the two mappings.
old_expt <- create_expt("sample_sheets/tmrc2_samples_20191203.xlsx",
file_column = "tophat2file")
## Reading the sample metadata.
## Dropped 13 rows from the sample metadata because they were blank.
## The sample definitions comprises: 50 rows(samples) and 38 columns(metadata fields).
## Warning in create_expt("sample_sheets/tmrc2_samples_20191203.xlsx", file_column
## = "tophat2file"): Some samples were removed when cross referencing the samples
## against the count data.
## Matched 8841 annotations and counts.
## Bringing together the count matrix and gene information.
## Saving the expressionset to 'expt.rda'.
## The final expressionset has 8841 rows and 33 columns.
tt <- lp_expt[["expressionset"]]
rownames(tt) <- gsub(pattern = "^exon_", replacement = "", x = rownames(tt))
rownames(tt) <- gsub(pattern = "\\.E1$", replacement = "", x = rownames(tt))
lp_expt$expressionset <- tt
tt <- old_expt$expressionset
rownames(tt) <- gsub(pattern = "^exon_", replacement = "", x = rownames(tt))
rownames(tt) <- gsub(pattern = "\\.1$", replacement = "", x = rownames(tt))
old_expt$expressionset <- tt
rm(tt)
One other important caveat, we have a group of new samples which have not yet run through the variant search pipeline, so I need to remove them from consideration. Though it looks like they finished overnight…
## The next line drops the samples which are missing the SNP pipeline.
lp_snp <- subset_expt(lp_expt, subset="!is.na(pData(lp_expt)[['bcftable']])")
## subset_expt(): There were 100, now there are 67 samples.
new_snps <- sm(count_expt_snps(lp_snp, annot_column = "bcftable"))
old_snps <- sm(count_expt_snps(old_expt, annot_column = "bcftable", snp_column = 2))
nonzero_snps <- exprs(new_snps) != 0
colSums(nonzero_snps)
## tmrc20001 tmrc20065 tmrc20005 tmrc20007 tmrc20008 tmrc20027 tmrc20028 tmrc20032
## 31443 73441 1965 2133 2786 291022 290524 116072
## tmrc20040 tmrc20066 tmrc20039 tmrc20037 tmrc20038 tmrc20067 tmrc20068 tmrc20041
## 34648 69275 4048 79861 80805 75518 74157 34972
## tmrc20015 tmrc20009 tmrc20010 tmrc20016 tmrc20011 tmrc20012 tmrc20013 tmrc20017
## 95041 7410 87192 95605 5297 10 89292 6689
## tmrc20014 tmrc20018 tmrc20019 tmrc20070 tmrc20020 tmrc20021 tmrc20022 tmrc20025
## 6440 82235 3021 78538 3209 88148 2608 279253
## tmrc20024 tmrc20036 tmrc20069 tmrc20033 tmrc20026 tmrc20031 tmrc20073 tmrc20055
## 4981 32060 3304 4443 2851 3150 78772 2819
## tmrc20079 tmrc20071 tmrc20078 tmrc20042 tmrc20058 tmrc20072 tmrc20059 tmrc20048
## 78013 74977 3287 2490 78849 31425 77883 76892
## tmrc20057 tmrc20056 tmrc20060 tmrc20077 tmrc20063 tmrc20053 tmrc20052 tmrc20064
## 32003 2977 2770 3091 1592 2836 77467 75335
## tmrc20051 tmrc20050 tmrc20062 tmrc20080 tmrc20043 tmrc20054 tmrc20046 tmrc20047
## 75845 3399 75667 81666 77526 77155 31433 75963
## tmrc20044 tmrc20045 tmrc20061
## 3132 30107 96058
## My old_snps is using an older annotation incorrectly, so fix it here:
Biobase::annotation(old_snps$expressionset) = Biobase::annotation(new_snps$expressionset)
both_snps <- combine_expts(new_snps, old_snps)
both_norm <- normalize_expt(both_snps, transform = "log2", convert = "cpm", filter = TRUE)
## Removing 0 low-count genes (670128 remaining).
## transform_counts: Found 61643658 values equal to 0, adding 1 to the matrix.
## strains <- both_norm[["design"]][["strain"]]
both_strain <- set_expt_conditions(both_norm, fact = "strain")
The data structure ‘both_norm’ now contains our 2016 data along with the newer data collected since 2019.
The following plot shows the SNP profiles of all samples (old and new) where the colors at the top show either the 2.2 strains (orange), 2.3 strains (green), the previous samples (purple), or the various lab strains (pink etc).
old_new_variant_heatmap <- plot_disheat(both_norm)
dev <- pp(file = "images/raw_snp_disheat.png", height=12, width=12)
old_new_variant_heatmap$plot
closed <- dev.off()
old_new_variant_heatmap$plot
The function get_snp_sets() takes the provided metadata factor (in this case ‘condition’) and looks for variants which are exclusive to each element in it. In this case, this is looking for differences between 2.2 and 2.3, as well as the set shared among them.
snp_sets <- get_snp_sets(both_snps, factor = "condition")
## The factor z2.3 has 27 rows.
## The factor z2.2 has 28 rows.
## The factor unknown has 4 rows.
## The factor z1.0 has only 1 row.
## The factor z3.0 has only 1 row.
## The factor z2.0 has only 1 row.
## The factor z2.1 has 3 rows.
## The factor z2.4 has only 1 row.
## The factor null has only 1 row.
## The factor sh has 13 rows.
## The factor chr has 14 rows.
## The factor inf has 6 rows.
Biobase::annotation(old_expt$expressionset) = Biobase::annotation(lp_expt$expressionset)
both_expt <- combine_expts(lp_expt, old_expt)
snp_genes <- sm(snps_vs_genes(both_expt, snp_sets, expt_name_col = "chromosome"))
## I think we have some metrics here we can plot...
snp_subset <- sm(snp_subset_genes(
both_expt, both_snps,
genes = c("LPAL13_120010900", "LPAL13_340013000", "LPAL13_000054100",
"LPAL13_140006100", "LPAL13_180018500", "LPAL13_320022300")))
zymo_heat <- plot_sample_heatmap(snp_subset, row_label = rownames(exprs(snp_subset)))
zymo_heat
Didn’t I create a set of densities by chromosome? Oh I think they come in from get_snp_sets()
clinical_sets <- get_snp_sets(new_snps, factor = "clinicalresponse")
## The factor cure has 26 rows.
## The factor failure has 21 rows.
## The factor laboratory line has only 1 row.
## The factor laboratory line miltefosine resistant has only 1 row.
## The factor nd has 14 rows.
## The factor reference strain has 4 rows.
density_vec <- clinical_sets[["density"]]
chromosome_idx <- grep(pattern = "LpaL", x = names(density_vec))
density_df <- as.data.frame(density_vec[chromosome_idx])
density_df[["chr"]] <- rownames(density_df)
colnames(density_df) <- c("density_vec", "chr")
ggplot(density_df, aes_string(x = "chr", y = "density_vec")) +
ggplot2::geom_col() +
ggplot2::theme(axis.text = ggplot2::element_text(size = 10, colour = "black"),
axis.text.x = ggplot2::element_text(angle = 90, vjust = 0.5))
## clinical_written <- write_variants(new_snps)
clinical_genes <- sm(snps_vs_genes(lp_expt, clinical_sets, expt_name_col = "chromosome"))
snp_density <- merge(as.data.frame(clinical_genes[["summary_by_gene"]]),
as.data.frame(fData(lp_expt)),
by = "row.names")
snp_density <- snp_density[, c(1, 2, 4, 15)]
colnames(snp_density) <- c("name", "snps", "product", "length")
snp_density[["product"]] <- tolower(snp_density[["product"]])
snp_density[["length"]] <- as.numeric(snp_density[["length"]])
snp_density[["density"]] <- snp_density[["snps"]] / snp_density[["length"]]
snp_idx <- order(snp_density[["density"]], decreasing = TRUE)
snp_density <- snp_density[snp_idx, ]
removers <- c("amastin", "gp63", "leishmanolysin")
for (r in removers) {
drop_idx <- grepl(pattern = r, x = snp_density[["product"]])
snp_density <- snp_density[!drop_idx, ]
}
## Filter these for [A|a]mastin gp63 Leishmanolysin
clinical_snps <- snps_intersections(lp_expt, clinical_sets, chr_column = "chromosome")
fail_ref_snps <- as.data.frame(clinical_snps[["inters"]][["failure, reference strain"]])
cure_snps <- as.data.frame(clinical_snps[["inters"]][["cure"]])
head(fail_ref_snps)
## seqnames start end width strand
## chr_LpaL13-10_pos_327353_ref_T_alt_C LpaL13-10 327353 327354 2 +
## chr_LpaL13-13_pos_167047_ref_G_alt_C LpaL13-13 167047 167048 2 +
## chr_LpaL13-15_pos_42885_ref_A_alt_G LpaL13-15 42885 42886 2 +
## chr_LpaL13-20.1_pos_111781_ref_T_alt_C LpaL13-20.1 111781 111782 2 +
## chr_LpaL13-20.1_pos_85158_ref_C_alt_G LpaL13-20.1 85158 85159 2 +
## chr_LpaL13-20.2_pos_48545_ref_T_alt_C LpaL13-20.2 48545 48546 2 +
head(cure_snps)
## seqnames start end width strand
## chr_LpaL13-08_pos_184791_ref_T_alt_A LpaL13-08 184791 184792 2 +
## chr_LpaL13-20.1_pos_369935_ref_C_alt_T LpaL13-20.1 369935 369936 2 +
## chr_LpaL13-20.1_pos_370282_ref_C_alt_T LpaL13-20.1 370282 370283 2 +
## chr_LpaL13-20.1_pos_371356_ref_T_alt_C LpaL13-20.1 371356 371357 2 +
## chr_LpaL13-20.1_pos_380785_ref_A_alt_G LpaL13-20.1 380785 380786 2 +
## chr_LpaL13-20.1_pos_382801_ref_A_alt_C LpaL13-20.1 382801 382802 2 +
annot <- fData(lp_expt)
clinical_interest <- as.data.frame(clinical_snps[["gene_summaries"]][["cure"]])
clinical_interest <- merge(clinical_interest,
as.data.frame(clinical_snps[["gene_summaries"]][["failure, reference strain"]]),
by = "row.names")
rownames(clinical_interest) <- clinical_interest[["Row.names"]]
clinical_interest[["Row.names"]] <- NULL
colnames(clinical_interest) <- c("cure_snps","fail_snps")
annot <- merge(annot, clinical_interest, by = "row.names")
rownames(annot) <- annot[["Row.names"]]
annot[["Row.names"]] <- NULL
fData(lp_expt$expressionset) <- annot
The heatmap produced here should show the variants only for the zymodeme genes.
I am thinking that if we find clusters of locations which are variant, that might provide some PCR testing possibilities.
## Drop the 2.1, 2.4, unknown, and null
pruned_snps <- subset_expt(new_snps, subset="condition=='z2.2'|condition=='z2.3'")
## subset_expt(): There were 67, now there are 55 samples.
new_sets <- get_snp_sets(pruned_snps, factor = "zymodemecategorical")
## The factor z22 has 28 rows.
## The factor z23 has 27 rows.
summary(new_sets)
## Length Class Mode
## medians 3 data.frame list
## possibilities 2 -none- character
## intersections 3 -none- list
## chr_data 695 -none- list
## set_names 4 -none- list
## invert_names 4 -none- list
## density 695 -none- numeric
## 1000000: 2.2
## 0100000: 2.3
summary(new_sets[["intersections"]][["10"]])
## Length Class Mode
## 890 character character
summary(new_sets[["intersections"]][["01"]])
## Length Class Mode
## 76189 character character
Thus we see that there are 511 variants associated with 2.2 and 49,790 associated with 2.3.
The following function uses the positional data to look for sequential mismatches associated with zymodeme in the hopes that there will be some regions which would provide good potential targets for a PCR-based assay.
sequential_variants <- function(snp_sets, conditions = NULL, minimum = 3, maximum_separation = 3) {
if (is.null(conditions)) {
conditions <- 1
}
intersection_sets <- snp_sets[["intersections"]]
intersection_names <- snp_sets[["set_names"]]
chosen_intersection <- 1
if (is.numeric(conditions)) {
chosen_intersection <- conditions
} else {
intersection_idx <- intersection_names == conditions
chosen_intersection <- names(intersection_names)[intersection_idx]
}
possible_positions <- intersection_sets[[chosen_intersection]]
position_table <- data.frame(row.names = possible_positions)
pat <- "^chr_(.+)_pos_(.+)_ref_.*$"
position_table[["chr"]] <- gsub(pattern = pat, replacement = "\\1", x = rownames(position_table))
position_table[["pos"]] <- as.numeric(gsub(pattern = pat, replacement = "\\2", x = rownames(position_table)))
position_idx <- order(position_table[, "chr"], position_table[, "pos"])
position_table <- position_table[position_idx, ]
position_table[["dist"]] <- 0
last_chr <- ""
for (r in 1:nrow(position_table)) {
this_chr <- position_table[r, "chr"]
if (r == 1) {
position_table[r, "dist"] <- position_table[r, "pos"]
last_chr <- this_chr
next
}
if (this_chr == last_chr) {
position_table[r, "dist"] <- position_table[r, "pos"] - position_table[r - 1, "pos"]
} else {
position_table[r, "dist"] <- position_table[r, "pos"]
}
last_chr <- this_chr
}
## Working interactively here.
doubles <- position_table[["dist"]] == 1
doubles <- position_table[doubles, ]
write.csv(doubles, "doubles.csv")
one_away <- position_table[["dist"]] == 2
one_away <- position_table[one_away, ]
write.csv(one_away, "one_away.csv")
two_away <- position_table[["dist"]] == 3
two_away <- position_table[two_away, ]
write.csv(two_away, "two_away.csv")
combined <- rbind(doubles, one_away)
combined <- rbind(combined, two_away)
position_idx <- order(combined[, "chr"], combined[, "pos"])
combined <- combined[position_idx, ]
this_chr <- ""
for (r in 1:nrow(combined)) {
this_chr <- combined[r, "chr"]
if (r == 1) {
combined[r, "dist_pair"] <- combined[r, "pos"]
last_chr <- this_chr
next
}
if (this_chr == last_chr) {
combined[r, "dist_pair"] <- combined[r, "pos"] - combined[r - 1, "pos"]
} else {
combined[r, "dist_pair"] <- combined[r, "pos"]
}
last_chr <- this_chr
}
dist_pair_maximum <- 1000
dist_pair_minimum <- 200
dist_pair_idx <- combined[["dist_pair"]] <= dist_pair_maximum &
combined[["dist_pair"]] >= dist_pair_minimum
remaining <- combined[dist_pair_idx, ]
no_weak_idx <- grepl(pattern="ref_(G|C)", x=rownames(remaining))
remaining <- remaining[no_weak_idx, ]
print(head(table(position_table[["dist"]])))
sequentials <- position_table[["dist"]] <= maximum_separation
message("There are ", sum(sequentials), " candidate regions.")
## The following can tell me how many runs of each length occurred, that is not quite what I want.
## Now use run length encoding to find the set of sequential sequentials!
rle_result <- rle(sequentials)
rle_values <- rle_result[["values"]]
## The following line is equivalent to just leaving values alone:
## true_values <- rle_result[["values"]] == TRUE
rle_lengths <- rle_result[["lengths"]]
true_sequentials <- rle_lengths[rle_values]
rle_idx <- cumsum(rle_lengths)[which(rle_values)]
position_table[["last_sequential"]] <- 0
count <- 0
for (r in rle_idx) {
count <- count + 1
position_table[r, "last_sequential"] <- true_sequentials[count]
}
message("The maximum sequential set is: ", max(position_table[["last_sequential"]]), ".")
wanted_idx <- position_table[["last_sequential"]] >= minimum
wanted <- position_table[wanted_idx, c("chr", "pos")]
return(wanted)
}
zymo22_sequentials <- sequential_variants(new_sets, conditions = "z22", minimum=1, maximum_separation=2)
dim(zymo22_sequentials)
## 7 candidate regions for zymodeme 2.2 -- thus I am betting that the reference strain is a 2.2
zymo23_sequentials <- sequential_variants(new_sets, conditions = "z23",
minimum = 2, maximum_separation = 2)
dim(zymo23_sequentials)
## In contrast, there are lots (587) of interesting regions for 2.3!
The first 4 candidate regions from my set of remaining: * Chr Pos. Distance * LpaL13-15 238433 448 * LpaL13-18 142844 613 * LpaL13-29 830342 252 * LpaL13-33 1331507 843
Lets define a couple of terms: * Third: Each of the 4 above positions. * Second: Third - Distance * End: Third + PrimerLen * Start: Second - Primerlen
In each instance, these are the last positions, so we want to grab three things:
## * LpaL13-15 238433 448
first_candidate_chr <- genome[["LpaL13_15"]]
primer_length <- 22
amplicon_length <- 448
first_candidate_third <- 238433
first_candidate_second <- first_candidate_third - amplicon_length
first_candidate_start <- first_candidate_second - primer_length
first_candidate_end <- first_candidate_third + primer_length
first_candidate_region <- subseq(first_candidate_chr, first_candidate_start, first_candidate_end)
first_candidate_region
first_candidate_5p <- subseq(first_candidate_chr, first_candidate_start, first_candidate_second)
as.character(first_candidate_5p)
first_candidate_3p <- spgs::reverseComplement(subseq(first_candidate_chr, first_candidate_third, first_candidate_end))
first_candidate_3p
## * LpaL13-18 142844 613
second_candidate_chr <- genome[["LpaL13_18"]]
primer_length <- 22
amplicon_length <- 613
second_candidate_third <- 142844
second_candidate_second <- second_candidate_third - amplicon_length
second_candidate_start <- second_candidate_second - primer_length
second_candidate_end <- second_candidate_third + primer_length
second_candidate_region <- subseq(second_candidate_chr, second_candidate_start, second_candidate_end)
second_candidate_region
second_candidate_5p <- subseq(second_candidate_chr, second_candidate_start, second_candidate_second)
as.character(second_candidate_5p)
second_candidate_3p <- spgs::reverseComplement(subseq(second_candidate_chr, second_candidate_third, second_candidate_end))
second_candidate_3p
## * LpaL13-29 830342 252
third_candidate_chr <- genome[["LpaL13_29"]]
primer_length <- 22
amplicon_length <- 252
third_candidate_third <- 830342
third_candidate_second <- third_candidate_third - amplicon_length
third_candidate_start <- third_candidate_second - primer_length
third_candidate_end <- third_candidate_third + primer_length
third_candidate_region <- subseq(third_candidate_chr, third_candidate_start, third_candidate_end)
third_candidate_region
third_candidate_5p <- subseq(third_candidate_chr, third_candidate_start, third_candidate_second)
as.character(third_candidate_5p)
third_candidate_3p <- spgs::reverseComplement(subseq(third_candidate_chr, third_candidate_third, third_candidate_end))
third_candidate_3p
## You are a garbage polypyrimidine tract.
## Which is actually interesting if the mutations mess it up.
## * LpaL13-33 1331507 843
fourth_candidate_chr <- genome[["LpaL13_33"]]
primer_length <- 22
amplicon_length <- 843
fourth_candidate_third <- 1331507
fourth_candidate_second <- fourth_candidate_third - amplicon_length
fourth_candidate_start <- fourth_candidate_second - primer_length
fourth_candidate_end <- fourth_candidate_third + primer_length
fourth_candidate_region <- subseq(fourth_candidate_chr, fourth_candidate_start, fourth_candidate_end)
fourth_candidate_region
fourth_candidate_5p <- subseq(fourth_candidate_chr, fourth_candidate_start, fourth_candidate_second)
as.character(fourth_candidate_5p)
fourth_candidate_3p <- spgs::reverseComplement(subseq(fourth_candidate_chr, fourth_candidate_third, fourth_candidate_end))
fourth_candidate_3p
I made a fun little function which should find regions which have lots of variants associated with a given experimental factor.
pheno <- subset_expt(lp_expt, subset = "condition=='z2.2'|condition=='z2.3'")
## subset_expt(): There were 100, now there are 82 samples.
pheno <- subset_expt(pheno, subset = "!is.na(pData(pheno)[['bcftable']])")
## subset_expt(): There were 82, now there are 55 samples.
pheno_snps <- sm(count_expt_snps(pheno, annot_column = "bcftable"))
fun_stuff <- snp_density_primers(
pheno_snps,
bsgenome = "BSGenome.Leishmania.panamensis.MHOMCOL81L13.v53",
gff = "reference/TriTrypDB-53_LpanamensisMHOMCOL81L13.gff")
## Trying attempt: rtracklayer::import.gff3(gff, sequenceRegionsAsSeqinfo = TRUE)
## Had a successful gff import with rtracklayer::import.gff3(gff, sequenceRegionsAsSeqinfo = TRUE)
## Returning a df with 16 columns and 35190 rows.
drop_scaffolds <- grepl(x = rownames(fun_stuff$favorites), pattern = "SCAF")
favorite_primer_regions <- fun_stuff[["favorites"]][!drop_scaffolds, ]
favorite_primer_regions[["bin"]] <- rownames(favorite_primer_regions)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:Biostrings':
##
## collapse, intersect, setdiff, setequal, union
## The following object is masked from 'package:XVector':
##
## slice
## The following object is masked from 'package:AnnotationDbi':
##
## select
## The following object is masked from 'package:hpgltools':
##
## combine
## The following object is masked from 'package:testthat':
##
## matches
## The following objects are masked from 'package:GenomicRanges':
##
## intersect, setdiff, union
## The following object is masked from 'package:GenomeInfoDb':
##
## intersect
## The following objects are masked from 'package:IRanges':
##
## collapse, desc, intersect, setdiff, slice, union
## The following objects are masked from 'package:S4Vectors':
##
## first, intersect, rename, setdiff, setequal, union
## The following object is masked from 'package:matrixStats':
##
## count
## The following object is masked from 'package:Biobase':
##
## combine
## The following objects are masked from 'package:BiocGenerics':
##
## combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
favorite_primer_regions <- favorite_primer_regions %>%
relocate(bin)
Here is my note from our meeting:
Cross reference primers to DE genes of 2.2/2.3 and/or resistance/suscpetible, add a column to the primer spreadsheet with the DE genes (in retrospect I am guessing this actually means to put the logFC as a column.
One nice thing, I did a semantic removal on the lp_expt, so the set of logFC/pvalues should not have any of the offending types; thus I should be able to automagically get rid of them in the merge.
logfc <- zy_table_sva[["data"]][["z23_vs_z22"]]
logfc_columns <- logfc[, c("deseq_logfc", "deseq_adjp")]
colnames(logfc_columns) <- c("z23_logfc", "z23_adjp")
new_table <- merge(favorite_primer_regions, logfc_columns,
by.x = "closest_gene_before_id", by.y = "row.names")
sus <- sus_table_sva[["data"]][["sensitive_vs_resistant"]]
sus_columns <- sus[, c("deseq_logfc", "deseq_adjp")]
colnames(sus_columns) <- c("sus_logfc", "sus_adjp")
new_table <- merge(new_table, sus_columns,
by.x = "closest_gene_before_id", by.y = "row.names") %>%
relocate(bin)
written <- write_xlsx(data=new_table,
excel="excel/favorite_primers_xref_zy_sus.xlsx")
We can cross reference the variants against the zymodeme status and plot a heatmap of the results and hopefully see how they separate.
## pruned_snps <- subset_expt(new_snps, subset="condition=='z2.2'|condition=='z2.3'")
snp_genes <- sm(snps_vs_genes(lp_expt, new_sets, expt_name_col = "chromosome"))
##new_zymo_norm <- normalize_expt(pruned_snps, filter = TRUE, convert = "cpm", norm = "quant", transform = TRUE)
##new_zymo_norm <- set_expt_conditions(new_zymo_norm, fact = "zymodemecategorical")
clinical_colors_v2 <- list(
"z22" = "#0000cc",
"z23" = "#cc0000")
new_zymo_norm <- normalize_expt(pruned_snps, filter = TRUE, convert = "cpm", norm = "quant", transform = TRUE) %>%
set_expt_conditions(fact = "zymodemecategorical") %>%
set_expt_colors(clinical_colors_v2)
## Removing 0 low-count genes (568627 remaining).
## transform_counts: Found 28953155 values equal to 0, adding 1 to the matrix.
zymo_heat <- plot_disheat(new_zymo_norm)
dev <- pp(file = "images/onlyz22_z23_snp_heatmap.pdf", width=12, height=12)
zymo_heat[["plot"]]
closed <- dev.off()
zymo_heat[["plot"]]
Now let us try to make a heatmap which includes some of the annotation data.
des <- both_norm[["design"]]
undef_idx <- is.na(des[["strain"]])
des[undef_idx, "strain"] <- "unknown"
##hmcols <- colorRampPalette(c("yellow","black","darkblue"))(256)
correlations <- hpgl_cor(exprs(both_norm))
zymo_missing_idx <- is.na(des[["zymodemecategorical"]])
des[["zymodemecategorical"]] <- as.character(des[["zymodemecategorical"]])
des[["clinicalcategorical"]] <- as.character(des[["clinicalcategorical"]])
des[zymo_missing_idx, "zymodemecategorical"] <- "unknown"
mydendro <- list(
"clustfun" = hclust,
"lwd" = 2.0)
col_data <- as.data.frame(des[, c("zymodemecategorical", "clinicalcategorical")])
unknown_clinical <- is.na(col_data[["clinicalcategorical"]])
row_data <- as.data.frame(des[, c("strain")])
colnames(col_data) <- c("zymodeme", "outcome")
col_data[unknown_clinical, "outcome"] <- "undefined"
colnames(row_data) <- c("strain")
myannot <- list(
"Col" = list("data" = col_data),
"Row" = list("data" = row_data))
myclust <- list("cuth" = 1.0,
"col" = BrewerClusterCol)
mylabs <- list(
"Row" = list("nrow" = 4),
"Col" = list("nrow" = 4))
hmcols <- colorRampPalette(c("darkblue", "beige"))(240)
zymo_annot_heat <- annHeatmap2(
correlations,
dendrogram = mydendro,
annotation = myannot,
cluster = myclust,
labels = mylabs,
## The following controls if the picture is symmetric
scale = "none",
col = hmcols)
## Warning in breakColors(breaks, col): more colors than classes: ignoring 29 last
## colors
dev <- pp(file = "images/dendro_heatmap.png", height = 20, width = 20)
plot(zymo_annot_heat)
closed <- dev.off()
plot(zymo_annot_heat)
Print the larger heatmap so that all the labels appear. Keep in mind that as we get more samples, this image needs to continue getting bigger.
big heatmap
xref_prop <- table(pheno_snps[["conditions"]])
pheno_snps$conditions
## [1] "z2.3" "z2.3" "z2.2" "z2.3" "z2.2" "z2.3" "z2.3" "z2.3" "z2.3" "z2.2"
## [11] "z2.3" "z2.2" "z2.3" "z2.3" "z2.2" "z2.2" "z2.3" "z2.2" "z2.2" "z2.3"
## [21] "z2.2" "z2.3" "z2.2" "z2.3" "z2.2" "z2.2" "z2.2" "z2.2" "z2.2" "z2.2"
## [31] "z2.2" "z2.3" "z2.2" "z2.3" "z2.3" "z2.2" "z2.2" "z2.3" "z2.2" "z2.3"
## [41] "z2.3" "z2.2" "z2.2" "z2.2" "z2.2" "z2.3" "z2.3" "z2.3" "z2.2" "z2.3"
## [51] "z2.3" "z2.3" "z2.3" "z2.2" "z2.2"
idx_tbl <- exprs(pheno_snps) > 5
new_tbl <- data.frame(row.names = rownames(exprs(pheno_snps)))
for (n in names(xref_prop)) {
new_tbl[[n]] <- 0
idx_cols <- which(pheno_snps[["conditions"]] == n)
prop_col <- rowSums(idx_tbl[, idx_cols]) / xref_prop[n]
new_tbl[n] <- prop_col
}
keepers <- grepl(x = rownames(new_tbl), pattern = "LpaL13")
new_tbl <- new_tbl[keepers, ]
new_tbl[["strong22"]] <- 1.001 - new_tbl[["z2.2"]]
new_tbl[["strong23"]] <- 1.001 - new_tbl[["z2.3"]]
s22_na <- new_tbl[["strong22"]] > 1
new_tbl[s22_na, "strong22"] <- 1
s23_na <- new_tbl[["strong23"]] > 1
new_tbl[s23_na, "strong23"] <- 1
new_tbl[["SNP"]] <- rownames(new_tbl)
new_tbl[["Chromosome"]] <- gsub(x = new_tbl[["SNP"]], pattern = "chr_(.*)_pos_.*", replacement = "\\1")
new_tbl[["Position"]] <- gsub(x = new_tbl[["SNP"]], pattern = ".*_pos_(\\d+)_.*", replacement = "\\1")
new_tbl <- new_tbl[, c("SNP", "Chromosome", "Position", "strong22", "strong23")]
library(CMplot)
## Much appreciate for using CMplot.
## Full description, Bug report, Suggestion and the latest codes:
## https://github.com/YinLiLin/CMplot
simplify <- new_tbl
simplify[["strong22"]] <- NULL
CMplot(simplify, bin.size = 100000)
## SNP-Density Plotting.
## Circular-Manhattan Plotting strong23.
## Rectangular-Manhattan Plotting strong23.
## QQ Plotting strong23.
## Plots are stored in: /mnt/cbcb/fs01_abelew/cbcb-lab/nelsayed/scratch/atb/rnaseq/lpanamensis_tmrc_2019
CMplot(new_tbl, plot.type="m", multracks=TRUE, threshold = c(0.01, 0.05),
threshold.lwd=c(1,1), threshold.col=c("black","grey"),
amplify=TRUE, bin.size=10000,
chr.den.col=c("darkgreen", "yellow", "red"),
signal.col=c("red", "green", "blue"),
signal.cex=1, file="jpg", memo="", dpi=300, file.output=TRUE, verbose=TRUE)
## Multracks-Manhattan Plotting strong22.
## Multracks-Manhattan Plotting strong23.
## Multraits-Rectangular Plotting...(finished 73%)
Multraits-Rectangular Plotting...(finished 74%)
Multraits-Rectangular Plotting...(finished 75%)
Multraits-Rectangular Plotting...(finished 76%)
Multraits-Rectangular Plotting...(finished 77%)
Multraits-Rectangular Plotting...(finished 78%)
Multraits-Rectangular Plotting...(finished 79%)
Multraits-Rectangular Plotting...(finished 80%)
Multraits-Rectangular Plotting...(finished 81%)
Multraits-Rectangular Plotting...(finished 82%)
Multraits-Rectangular Plotting...(finished 83%)
Multraits-Rectangular Plotting...(finished 84%)
Multraits-Rectangular Plotting...(finished 85%)
Multraits-Rectangular Plotting...(finished 86%)
Multraits-Rectangular Plotting...(finished 87%)
Multraits-Rectangular Plotting...(finished 88%)
Multraits-Rectangular Plotting...(finished 89%)
Multraits-Rectangular Plotting...(finished 90%)
Multraits-Rectangular Plotting...(finished 91%)
Multraits-Rectangular Plotting...(finished 92%)
Multraits-Rectangular Plotting...(finished 93%)
Multraits-Rectangular Plotting...(finished 94%)
Multraits-Rectangular Plotting...(finished 95%)
Multraits-Rectangular Plotting...(finished 96%)
Multraits-Rectangular Plotting...(finished 97%)
Multraits-Rectangular Plotting...(finished 98%)
Multraits-Rectangular Plotting...(finished 99%)
Multraits-Rectangular Plotting...(finished 100%)
## Plots are stored in: /mnt/cbcb/fs01_abelew/cbcb-lab/nelsayed/scratch/atb/rnaseq/lpanamensis_tmrc_2019
This tool looks a little opaque, but provides sample data with things that make sense to me and should be pretty easy to recapitulate in our data.
## For this, let us use the 'new_snps' data structure.
## Caveat here: these need to be coerced to numbers.
my_covariates <- pData(new_snps)[, c("zymodemecategorical", "clinicalcategorical")]
for (col in colnames(my_covariates)) {
my_covariates[[col]] <- as.numeric(as.factor(my_covariates[[col]]))
}
my_covariates <- t(my_covariates)
my_geneloc <- fData(lp_expt)[, c("gid", "chromosome", "start", "end")]
colnames(my_geneloc) <- c("geneid", "chr", "left", "right")
my_ge <- exprs(normalize_expt(lp_expt, transform = "log2", filter = TRUE, convert = "cpm"))
used_samples <- tolower(colnames(my_ge)) %in% colnames(exprs(new_snps))
my_ge <- my_ge[, used_samples]
my_snpsloc <- data.frame(rownames = rownames(exprs(new_snps)))
## Oh, caveat here: Because of the way I stored the data,
## I could have duplicate rows which presumably will make matrixEQTL sad
my_snpsloc[["chr"]] <- gsub(pattern = "^chr_(.+)_pos(.+)_ref_.*$", replacement = "\\1",
x = rownames(my_snpsloc))
my_snpsloc[["pos"]] <- gsub(pattern = "^chr_(.+)_pos(.+)_ref_.*$", replacement = "\\2",
x = rownames(my_snpsloc))
test <- duplicated(my_snpsloc)
## Each duplicated row would be another variant at that position;
## so in theory we would do a rle to number them I am guessing
## However, I do not have different variants so I think I can ignore this for the moment
## but will need to make my matrix either 0 or 1.
if (sum(test) > 0) {
message("There are: ", sum(duplicated), " duplicated entries.")
keep_idx <- ! test
my_snpsloc <- my_snpsloc[keep_idx, ]
}
my_snps <- exprs(new_snps)
one_idx <- my_snps > 0
my_snps[one_idx] <- 1
## Ok, at this point I think I have all the pieces which this method wants...
## Oh, no I guess not; it actually wants the data as a set of filenames...
library(MatrixEQTL)
write.table(my_snps, "eqtl/snps.tsv", na = "NA", col.names = TRUE, row.names = TRUE, sep = "\t", quote = TRUE)
## readr::write_tsv(my_snps, "eqtl/snps.tsv", )
write.table(my_snpsloc, "eqtl/snpsloc.tsv", na = "NA", col.names = TRUE, row.names = TRUE, sep = "\t", quote = TRUE)
## readr::write_tsv(my_snpsloc, "eqtl/snpsloc.tsv")
write.table(as.data.frame(my_ge), "eqtl/ge.tsv", na = "NA", col.names = TRUE, row.names = TRUE, sep = "\t", quote = TRUE)
## readr::write_tsv(as.data.frame(my_ge), "eqtl/ge.tsv")
write.table(as.data.frame(my_geneloc), "eqtl/geneloc.tsv", na = "NA", col.names = TRUE, row.names = TRUE, sep = "\t", quote = TRUE)
## readr::write_tsv(as.data.frame(my_geneloc), "eqtl/geneloc.tsv")
write.table(as.data.frame(my_covariates), "eqtl/covariates.tsv", na = "NA", col.names = TRUE, row.names = TRUE, sep = "\t", quote = TRUE)
## readr::write_tsv(as.data.frame(my_covariates), "eqtl/covariates.tsv")
useModel = modelLINEAR # modelANOVA, modelLINEAR, or modelLINEAR_CROSS
# Genotype file name
SNP_file_name = "eqtl/snps.tsv"
snps_location_file_name = "eqtl/snpsloc.tsv"
expression_file_name = "eqtl/ge.tsv"
gene_location_file_name = "eqtl/geneloc.tsv"
covariates_file_name = "eqtl/covariates.tsv"
# Output file name
output_file_name_cis = tempfile()
output_file_name_tra = tempfile()
# Only associations significant at this level will be saved
pvOutputThreshold_cis = 0.1
pvOutputThreshold_tra = 0.1
# Error covariance matrix
# Set to numeric() for identity.
errorCovariance = numeric()
# errorCovariance = read.table("Sample_Data/errorCovariance.txt");
# Distance for local gene-SNP pairs
cisDist = 1e6
## Load genotype data
snps = SlicedData$new()
snps$fileDelimiter = "\t" # the TAB character
snps$fileOmitCharacters = "NA" # denote missing values;
snps$fileSkipRows = 1 # one row of column labels
snps$fileSkipColumns = 1 # one column of row labels
snps$fileSliceSize = 2000 # read file in slices of 2,000 rows
snps$LoadFile(SNP_file_name)
## Load gene expression data
gene = SlicedData$new()
gene$fileDelimiter = "\t" # the TAB character
gene$fileOmitCharacters = "NA" # denote missing values;
gene$fileSkipRows = 1 # one row of column labels
gene$fileSkipColumns = 1 # one column of row labels
gene$fileSliceSize = 2000 # read file in slices of 2,000 rows
gene$LoadFile(expression_file_name)
## Load covariates
cvrt = SlicedData$new()
cvrt$fileDelimiter = "\t" # the TAB character
cvrt$fileOmitCharacters = "NA" # denote missing values;
cvrt$fileSkipRows = 1 # one row of column labels
cvrt$fileSkipColumns = 1 # one column of row labels
if(length(covariates_file_name) > 0) {
cvrt$LoadFile(covariates_file_name)
}
## Run the analysis
snpspos = read.table(snps_location_file_name, header = TRUE, stringsAsFactors = FALSE)
genepos = read.table(gene_location_file_name, header = TRUE, stringsAsFactors = FALSE)
me = Matrix_eQTL_main(
snps = snps,
gene = gene,
cvrt = cvrt,
output_file_name = output_file_name_tra,
pvOutputThreshold = pvOutputThreshold_tra,
useModel = useModel,
errorCovariance = errorCovariance,
verbose = TRUE,
output_file_name.cis = output_file_name_cis,
pvOutputThreshold.cis = pvOutputThreshold_cis,
snpspos = snpspos,
genepos = genepos,
cisDist = cisDist,
pvalue.hist = "qqplot",
min.pv.by.genesnp = FALSE,
noFDRsaveMemory = FALSE);
if (!isTRUE(get0("skip_load"))) {
pander::pander(sessionInfo())
message(paste0("This is hpgltools commit: ", get_git_commit()))
message(paste0("Saving to ", savefile))
tmp <- sm(saveme(filename = savefile))
}
## If you wish to reproduce this exact build of hpgltools, invoke the following:
## > git clone http://github.com/abelew/hpgltools.git
## > git reset 64dc311322615b4a8bfef4517ab3c4ba0d0b0e59
## This is hpgltools commit: Mon Apr 4 16:43:54 2022 -0400: 64dc311322615b4a8bfef4517ab3c4ba0d0b0e59
## Saving to tmrc2_02sample_estimation_v202203.rda.xz
tmp <- loadme(filename = savefile)