Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.60 KB | None | 0 0
  1. aux <- readRDS('tcgaIsoHer2LumA.rds');
  2. counts <- aux$counts;
  3. conds <- aux$conds;
  4. annot <- aux$annot; rownames(annot) <- annot[,'ENST'];
  5. rm(aux);
  6.  
  7. transcAnnot <- data.frame(annot[,c('SYMBOL', 'ENST')]);
  8. colnames(transcAnnot) <- c('GeneID', 'IsoID');
  9.  
  10. table(colnames(counts) == rownames(conds));
  11. table(rownames(counts) == rownames(annot));
  12.  
  13.  
  14. allGenes <- sort(unique(annot[,'SYMBOL']));
  15. geneCounts <- do.call(rbind, lapply(allGenes, function(actGene) {
  16.   colSums(counts[rownames(annot)[annot[,'SYMBOL'] == actGene],,drop=F])
  17. }))
  18. rownames(geneCounts) <- allGenes; rm(allGenes);
  19.  
  20. library('limma');
  21.  
  22. myDesign <- model.matrix(~PAM50, data.frame(PAM50=as.character(conds$PAM50)));
  23.  
  24. ## transcripts
  25. countsDge <- DGEList(counts, genes=transcAnnot);
  26. keep <- filterByExpr(countsDge, myDesign); table(keep);
  27. countsDge <- countsDge[keep,, keep.lib.sizes=FALSE]
  28. countsDge <- calcNormFactors(countsDge)
  29. countsV <- voom(countsDge, myDesign)
  30. transcFit <- lmFit(countsV, myDesign)
  31. transcEx <- diffSplice(transcFit, geneid='GeneID')
  32. table(transcEx$p.value[,2] < 0.05);
  33. # FALSE  TRUE
  34. # 36982  7871
  35.  
  36. ## genes
  37. geneCountsDge <- rowsum(countsDge[rownames(transcEx$genes),], transcEx$genes$GeneID, reorder=FALSE);
  38. # geneCountsDge <- DGEList(counts=geneCounts);
  39. keep <- filterByExpr(geneCountsDge, myDesign); table(keep);
  40. geneCountsDge <- geneCountsDge[keep,,keep.lib.sizes=FALSE];
  41. geneCountsDge <- calcNormFactors(geneCountsDge);
  42. geneCountsV <- voom(geneCountsDge, design=myDesign);
  43. genesFit <- lmFit(geneCountsV, myDesign);
  44. genesFit <- eBayes(genesFit);
  45. table(genesFit$p.value[,2] < 0.05);
  46. # FALSE  TRUE
  47. # 6908  9758
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement