Skip to content

Commit

Permalink
pairwise comparison and description for genes
Browse files Browse the repository at this point in the history
  • Loading branch information
SilasK committed Oct 25, 2023
1 parent 1351500 commit eae1f4c
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions R/Analyze_genecatalog.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,19 @@ library(DESeq2)

Prepare Data:

```{r}
Description <- annotations %>%
select(ko_id, kegg_hit) %>%
distinct(ko_id,.keep_all = TRUE) %>%
column_to_rownames("ko_id") %>%
as.data.frame()
````
```{r }
# Assuming annotation_cpm is your count data (CPM)
dds <- DESeqDataSetFromMatrix(countData = annotation_genecounts,
colData = metadata[colnames(annotation_genecounts),],
rowData = Description,
design = ~ group)
```

Expand All @@ -569,9 +578,12 @@ Normalize the data using the DESeq2 normalization methods, and estimate differen
```

```{r}
res <- results(dds) %>% as.data.frame()
res <- results(dds,contrast=c(group_variable,"AD","HC")) %>% as.data.frame()
res %>% merge( Description, by = "row.names", all = TRUE) %>%
column_to_rownames("Row.names") -> res
head(res %>% arrange(padj),n=10)
res %>% arrange(padj) %>% select(all_of(c("baseMean", "log2FoldChange", "padj","kegg_hit"))) %>% head(n=10)
```

```{r }
Expand All @@ -588,6 +600,7 @@ head(res %>% arrange(padj),n=10)
```



## Alternative ways to normalize

An other interesting way to normalize would be to normalize to single copy genes.
Expand All @@ -596,21 +609,7 @@ Example the one from [MuSiCC](https://github.com/borenstein-lab/MUSiCC/blob/mast
MUSiCC: A marker genes based framework for metagenomic normalization and accurate profiling of gene abundances in the microbiome. Ohad Manor and Elhanan Borenstein. Genome Biology


## Integrate them in a SummarizedExperiment object

```{r }

SE <- SummarizedExperiment(
assays = list(gcpm = annoation_cpm),
colData = metadata[colnames(annoation_cpm), ],
#rowData = annotations
)
```

```{}
library(tidybulk)
```



Expand Down

0 comments on commit eae1f4c

Please sign in to comment.