Source codes: https://github.com/markziemann/dftd_immune_expression

Background

We have designed a target enrichment panel to examine gene expression of immune genes. This is so we can inexpensively profile immune gene expression in devils. We will be looking at a lot of different variables such as dftd-free vs affected, DFTD1 vs DFTD2, etc.

The main comparisons are:

-Wild vs Captive devils

-Healthy vs DFTD infected devils

-DFT1 and DFT2 devils

I have their sex/age/seasons categories there as well if we decide to go with more detail analysis in the future, but I think just stick with these three for now. Some devils are a part of the Captive control and Wild control groups . There are a couple samples that won’t go into the analysis that I made note of. Meliza and Simba.

suppressPackageStartupMessages({
    library("reshape2")
    library("gplots")
    library("DESeq2")
    library("mitch")
    library("limma")
    library("kableExtra")
    library("dplyr")
    library("edgeR")
    library("eulerr")
    library("UpSetR")
})

Functions.

maplot <- function(de,contrast_name) {
  sig <-subset(de, padj < 0.05 )
  up <-rownames(subset(de, padj < 0.05 & log2FoldChange > 0))
  dn <-rownames(subset(de, padj < 0.05 & log2FoldChange < 0))
  GENESUP <- length(up)
  GENESDN <- length(dn)
  DET=nrow(de)
  SUBHEADER = paste(GENESUP, "up, ", GENESDN, "down", DET, "detected")
  ns <-subset(de, padj > 0.05 )
  plot(log2(de$baseMean),de$log2FoldChange, 
       xlab="log2 basemean", ylab="log2 foldchange",
       pch=19, cex=1, col="dark gray",
       main=contrast_name, cex.main=0.7)
  points(log2(sig$baseMean),sig$log2FoldChange,
         pch=19, cex=1, col="red")
  mtext(SUBHEADER,cex = 0.7)
  grid()
}

make_volcano <- function(de,name) {
    sig <- subset(de,padj<0.05)
    N_SIG=nrow(sig)
    N_UP=nrow(subset(sig,log2FoldChange>0))
    N_DN=nrow(subset(sig,log2FoldChange<0))
    DET=nrow(de)
    HEADER=paste(N_SIG,"@5%FDR,", N_UP, "up", N_DN, "dn", DET, "detected")
    plot(de$log2FoldChange,-log10(de$padj),cex=1,pch=19,col="darkgray",
        main=name, xlab="log2 FC", ylab="-log10 pval", xlim=c(-6,6))
    mtext(HEADER)
    grid()
    points(sig$log2FoldChange,-log10(sig$padj),cex=1,pch=19,col="red")
}

Load data

Here we load the data in from the aligner.

tmp <- read.table("3col.tsv.gz")
x <- as.data.frame(acast(tmp, V2~V1, value.var="V3"))
colnames(x) <- gsub("fastq/","",colnames(x))
dim(x)
## [1] 310 143

Remove poor samples

Samples with <1M reads should be omitted. Will also round values to integers.

cs <- colSums(x)
cs <- cs[order(cs)]

barplot(cs,ylim=c(1e2,2e7),log="y",main="All samples",cex.names=0.5)

barplot(head(cs),log="y",main="Samples with low reads",cex.names=0.7)

abline(h=1e6,col="red",lty=2)

x <- x[,colSums(x)>1e6]
x <- round(x)

Identify poorly represented genes

rc <- rowMeans(x)
rc <- rc[order(rc)]
barplot(rc+1,log="y")

hist(log(rc+1))

round(rc[which(rc<10)],digits=1)
##   CNTF   CTF1   PTX3   RAG2    OSM   AIF1  IL17B IL36RN  STAT2 CLEC4E   CD3g 
##    0.0    0.0    0.0    0.0    0.0    0.2    0.4    0.4    0.5    0.5    0.6 
##   CSF2 CXCL13   IL25  Casp9 CX3CL1 CCLD16  IL17A  IFNB1   CSF3  CCL19  CCL26 
##    0.7    0.8    0.8    0.9    0.9    1.3    1.5    1.8    2.0    2.3    2.4 
##  IFNA1  FCAMR  KITLG  IL17F CCLD15    LIF  CCL22   IL11  IFNL1   IL33   IL26 
##    2.5    2.5    2.7    3.2    3.4    3.9    3.9    4.0    4.4    4.5    4.6 
##  IL12A IL1F10  RPS18   CD70  CCL27  ACKR4 IL36L1    FGB IL31Ra CXCL11 CXCL14 
##    4.9    5.0    5.0    5.3    5.6    5.8    6.0    6.2    6.8    7.5    7.7 
## IL36L2 CXCL17    IL4    IL9  CCL17  CCLD4 
##    8.1    8.1    8.2    8.3    8.6    9.8

A lot of the shorter genes (cytokines) had lower expression.

Sample sheet

ss <- read.table("SampleSheet.txt",sep="\t",header=TRUE)

ss %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) #Makes the sample sheet table 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 default S1_LauraGrace 6102461 NA Healthy/Wild FAP F A Spring Channel 2.6219178 7.2 NA NA NA NA NA AGAGTAGC+AAGGCGTA 4,511,702 1.00 98.29 1.71 1,363 100 93.82 35.92 NA NA NA
1 default S1_Kaoota 6102462 NA N/A FAA F A Autumn Channel 4.1808219 10 NA 3 TRUE superficial FALSE 279.276 ACGGAACA+ACGAGAAC 5,202,254 1.00 97.76 2.24 1,571 100 93.72 35.91 NA NA NA
1 default S1_Sarafina 6102463 NA DFT1 FAP F A Spring Channel 2.6191781 6.4 NA NA NA NA 95140.790 ATCCAGAG+TAACGTCG 6,491,488 1.00 74.07 25.93 1,960 100 93.74 35.92 NA NA NA
1 default S1_Lucy 6102464 NA DFT1 FAU F A Summer Channel 2.9178082 7.1 NA 3 TRUE deep TRUE 700825.170 AAGCACTG+AGGTCAAC 6,121,785 1.00 98.00 2.00 1,849 100 93.84 35.93 NA NA NA
1 default S1_Turmeric 6102465 NA Healthy/Wild FAU F A Summer Channel 1.9095890 7.8 NA NA NA NA NA GAAGGAAG+GACGTCAT 6,479,047 1.00 97.28 2.72 1,957 100 93.85 35.94 NA NA NA
1 default S1_Singapore 6102466 NA Healthy FAA F A Autumn Channel 5.0000000 8.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 4,481,213 1.00 97.99 2.01 1,353 100 93.95 35.96 NA NA NA
1 default S2_Belinda 6102467 NA Healthy/Wild FAU F A Summer Channel 1.8657534 6.6 NA NA NA NA NA GCAAGATC+AGTCGAAG 3,296,547 1.00 97.40 2.60 996 100 94.12 35.98 NA NA NA
1 default S2_B99008 6102468 NA Captive FAU F A Summer Monarto 3.7369863 8.12 NA NA NA NA NA GCTATCCT+AACAGGTG 5,338,890 1.00 98.08 1.92 1,612 100 93.69 35.91 NA NA NA
1 default S2_Bonney 6102469 NA Captive FAU F A Summer Healesville 2.5863014 5.4 NA NA NA NA NA ACGTTCAG+AGTTGTGC 14,968,459 3.00 97.82 2.18 4,520 100 93.68 35.91 NA NA NA
1 default S2_Rosie 6102470 NA Healthy/Wild FAU F A Summer Channel 1.8904110 7.4 NA NA NA NA NA CGCATGAT+AAGCCTGA 4,556,781 1.00 95.70 4.30 1,376 100 93.94 35.94 NA NA NA
1 default S2_Hope 6102471 NA DFT1 FAU F A Summer Channel 2.9315068 6.4 NA 4 TRUE deep TRUE 103815.530 AGCACTTC+ACGTCCAA 1,971,776 0.00 97.96 2.04 595 100 93.62 35.88 NA NA NA
1 default S2_Sally 6102472 NA DFT1 FAU F A Summer Channel 2.9945205 7 NA 1 TRUE deep FALSE 1588.272 CGTTGCAA+ATAGAGCG 2,429,449 1.00 97.42 2.58 734 100 93.78 35.93 NA NA NA
1 default S3_Apu 6102473 NA DFT1 MAA M A Autumn Channel 3.1150685 9.5 NA 1 FALSE superficial TRUE 200.000 CCTTGATC+GATGGAGT 4,939,580 1.00 96.94 3.06 1,492 100 93.71 35.91 NA NA NA
1 default S3_Simone 6102474 NA DFT1 FAW F A Winter Channel 3.2739726 10.2 NA 1 TRUE superficial TRUE 2670.678 CGGTTGTT+GTGGTATG 4,015,027 1.00 95.91 4.09 1,213 100 93.42 35.86 NA NA NA
1 default S3_ST62 6102475 NA Healthy/Wild FAW F A Winter Channel 3.2712329 10.2 NA NA NA NA NA TGAGCTAG+GAACGGTT 4,579,681 1.00 96.67 3.33 1,383 100 93.75 35.92 NA NA NA
1 default S3_Jessie 6102476 NA Captive FAW F A Winter Monarto 2.1945205 12.95 NA NA NA NA NA CCGTAAGA+AGAGTCCA 4,340,498 1.00 97.95 2.05 1,311 100 93.54 35.88 NA NA NA
1 default S3_McCauley 6102477 NA Captive MAA M A Autumn Healesville 3.0328767 8.52 NA NA NA NA NA CAACACCT+AGCTACCA 16,944,152 3.00 97.98 2.02 5,117 100 93.05 35.78 NA NA NA
1 default S4_Kerchak 6102478 NA Healthy MAA M A Autumn Channel 4.1863014 11.6 NA NA NA NA NA CGGCTAAT+CTCGTTCT 6,886,511 1.00 97.80 2.20 2,080 100 93.61 35.89 NA NA NA
1 default S4_Duffman 6102479 NA Healthy MAA M A Autumn Channel 3.1123288 12.4 NA NA NA NA NA GACGATCT+TCGTGCAT 8,301,336 2.00 97.75 2.25 2,507 100 93.83 35.93 NA NA NA
1 default S4_Wiggum 6102480 NA DFT1 MAA M A Autumn Channel 3.1178082 8.3 NA 2 FALSE FALSE 7272.309 GTGAAGTG+GAGCAATC 4,201,355 1.00 97.17 2.83 1,269 100 93.64 35.90 NA NA NA
1 default S4_Hogan 6102481 NA Healthy MAA M A Autumn Channel 3.1616438 11.6 NA NA NA NA NA TACGCCTT+GCTACTCT 2,990,345 1.00 97.77 2.23 903 100 93.71 35.90 NA NA NA
1 default S4_Pooh 6102482 NA DFT1 MAA M A Autumn Channel 4.1863014 11.8 NA 1 FALSE FALSE 7577.856 CTTCGACT+GATCTTGC 3,821,151 1.00 97.31 2.69 1,154 100 93.60 35.89 NA NA NA
1 default S4_Milhouse 6102483 NA DFT1 MAA M A Autumn Channel 4.1013699 11 NA 1 TRUE deep TRUE 480.000 AACCGTTC+CTAGCTCA 10,492,900 2.00 98.13 1.87 3,169 100 93.80 35.92 NA NA NA
1 default S5_Fenton 6102484 NA Captive MAU M A Summer Monarto 3.0000000 N/A NA NA NA NA NA GATTACCG+TTGGACTG 5,125,566 1.00 96.21 3.79 1,548 100 93.89 35.94 NA NA NA
1 default S5_Bryan Adams 6102485 NA Captive MAW M A Winter Healesville 4.1616438 8.6 NA NA NA NA NA CACTAGCT+TCGGATTC 5,317,767 1.00 97.33 2.67 1,606 100 93.24 35.83 NA NA NA
1 default S5_Silky 6102486 NA Healthy/Wild MAW M A Winter Channel 2.2849315 9.5 NA NA NA NA NA CTGTTGAC+ACCTCAGT 5,617,260 1.00 97.81 2.19 1,696 100 93.55 35.88 NA NA NA
1 default S5_Longley 6102487 NA Healthy/Wild MAU M A Summer Channel 2.9315068 9.7 NA NA NA NA NA CGCAATCT+ACAGGCAT 2,937,660 1.00 97.71 2.29 887 100 93.75 35.91 NA NA NA
1 default S5_Allen 6102488 NA DFT1 MAU M A Summer Channel 1.9095890 6.7 NA 1 TRUE deep TRUE 55959.750 TTGCAGAC+ATCGTGGT 5,288,435 1.00 96.85 3.15 1,597 100 93.42 35.86 NA NA NA
1 default S5_Cyan 6102489 NA DFT1 MAW M A Winter Channel 3.3945205 9.1 NA 5 TRUE deep TRUE 206006.422 GTAGGAGT+GTCCTAAG 4,138,600 1.00 98.03 1.97 1,250 100 93.67 35.90 NA NA NA
1 default S6_Myanmar 6102490 NA Healthy FAP F A Spring Channel 5.5726027 7.6 NA NA NA NA NA GCACAACT+CTGAACGT 9,604,175 2.00 98.14 1.86 2,900 100 93.93 35.94 NA NA NA
1 default S6_Pakana 6102491 NA Healthy MSP M S Spring Channel 1.6712329 7.8 NA NA NA NA NA GTTACGCA+ATGGCGAT 4,383,521 1.00 98.09 1.91 1,324 100 93.90 35.95 NA NA NA
1 default S6_Shelob 6102492 NA DFT2 FAP F A Spring Channel 4.6219178 7.2 NA NA NA NA 7455.435 GTCATCGA+GATCCACT 3,184,798 1.00 98.21 1.79 962 100 93.90 35.94 NA NA NA
1 default S6_Stuttgart 6102493 NA DFT1 MSP M S Spring Channel 0.5780822 12.7 NA 1 FALSE TRUE 3809.806 AGCGTGTT+CTTCGCAA 3,056,475 1.00 97.50 2.50 923 100 93.95 35.95 NA NA NA
1 default S6_Ben 6102494 NA Wild MAU M A Summer Channel 2.9150685 9.3 NA NA NA NA NA AGAACGAG+ATTAGCCG 3,120,448 1.00 95.32 4.68 942 100 94.24 36.01 NA NA NA
1 default S6_Hobbit 6102495 NA Healthy MSP M S Spring Channel 1.6273973 9 NA NA NA NA NA ATATGCGC+ACGATCAG 7,342,414 2.00 97.00 3.00 2,217 100 93.93 35.96 NA NA NA
1 default S7_Fredo 6102496 NA Captive MAA M A Autumn Healesville 2.9945205 8.8 NA NA NA NA NA AGTGGATC+TCGATGAC 2,690,632 1.00 97.77 2.23 813 100 93.77 35.93 NA NA NA
1 default S7_Piglet 6102497 NA Captive FSU F S Summer Healesville 1.5890411 4.76 NA NA NA NA NA ATCACACG+GTAGCGTA 12,134,750 2.00 96.94 3.06 3,665 100 93.34 35.84 NA NA NA
1 default S7_Violet 6102498 NA DFT2 FSU F S Summer Channel 0.8739726 4.6 NA 1 TRUE superficial TRUE 5517.330 CTTGTCGA+CGATGTTC 2,768,682 1.00 98.19 1.81 836 100 93.85 35.93 NA NA NA
1 default S7_Lieke 6102499 NA Healthy/Wild FSU F S Summer Channel 0.8657534 4.9 NA NA NA NA NA TTCCAAGG+CTACAAGG 1,800,468 0.00 97.79 2.21 544 100 93.58 35.88 NA NA NA
1 default S7_Willie 6102500 NA DFT2 MAA M A Autumn Channel 2.1150685 8.2 NA 2 TRUE deep TRUE 1527.480 TGGACTCT+TCTTACGG 4,539,036 1.00 98.30 1.70 1,371 100 93.84 35.93 NA NA NA
1 default S7_Smithers 6102501 NA Healthy/Wild MAA M A Autumn Channel 3.1013699 8.9 NA NA NA NA NA GCGTCATT+CAGACGTT 6,731,177 1.00 98.04 1.96 2,033 100 93.62 35.89 NA NA NA
1 default S8_Orange 6102502 NA DFT1 FAU F A Summer Channel 1.9150685 7.1 NA 7 TRUE superficial TRUE 43690.461 GTTGACCT+CAGTGCTT 5,072,309 1.00 97.92 2.08 1,532 100 93.36 35.84 NA NA NA
1 default S8_Vinnie 6102503 NA Healthy/Wild MAU M A Summer Channel 2.9150685 8.8 NA NA NA NA NA CGACGTTA+CTCTGGAT 7,901,958 2.00 98.02 1.98 2,386 100 94.09 35.98 NA NA NA
1 default S8_Struggles 6102504 NA Healthy/Wild MAW M A Winter Channel 3.2821918 11.1 NA NA NA NA NA ATCGATCG+TGGAAGCA 5,257,820 1.00 95.13 4.87 1,588 100 93.81 35.93 NA NA NA
1 default S8_ST67 6102505 NA DFT2 MAW M A Winter Channel 4.2794521 10.2 NA 1 TRUE deep TRUE 102246.432 TTGGACGT+GAAGTGCT 5,476,735 1.00 95.44 4.56 1,654 100 93.21 35.82 NA NA NA
1 default S8_SusieQ 6102506 NA Healthy/Wild FAU F A Summer Channel 1.8712329 7.1 NA NA NA NA NA CAGTCCAA+CGGTAATC 454,240 0.00 97.95 2.05 137 100 92.97 35.76 NA NA NA
1 default S8_Yellow 6102507 NA DFT2 MAU M A Summer Channel 1.8657534 10.5 NA 2 TRUE deep TRUE 139389.671 GAAGTTGG+CGAACAAC 6,469,324 1.00 97.99 2.01 1,954 100 94.00 35.97 NA NA NA
1 default S9_Jane 6102508 NA DFT1 FAA F A Autumn Channel 3.1972603 6.1 NA NA NA NA 64646.036 GTTCTCGT+TGTTCCGT 12,489,105 3.00 97.92 2.08 3,772 100 93.54 35.88 NA NA NA
1 default S9_Majula 6102509 NA Healthy FAA F A Autumn Channel 3.1150685 6 NA NA NA NA NA ACTCTCGA+CTGTACCA 8,490,270 2.00 97.99 2.01 2,564 100 93.34 35.84 NA NA NA
1 default S9_Snoopy 6102510 NA Healthy/Wild MSW M S Winter Channel 1.2794521 6.3 NA NA NA NA NA AACTGAGC+CAATCAGG 1,709,078 0.00 98.04 1.96 516 100 93.06 35.78 NA NA NA
1 default S9_Clytemnestra 6102511 NA DFT1 FSP F S Spring Channel 1.6602740 6 NA NA NA NA 34738.080 CATGGCTA+CACACATC 6,141,790 1.00 98.00 2.00 1,855 100 93.42 35.85 NA NA NA
1 default S9_Zeus 6102512 NA DFT2 MSW M S Winter Channel 1.3479452 7.3 NA NA NA NA 100.000 CGTGTGTA+CCAACGAA 699,953 0.00 97.64 2.36 211 100 93.33 35.84 NA NA NA
1 default S9_Sarabi 6102513 NA Healthy/Wild FSP F S Spring Channel 1.6328767 5.8 NA NA NA NA NA CTTAGGAC+ACTCCTAC 3,945,235 1.00 98.11 1.89 1,191 100 93.55 35.88 NA NA NA
1 default S10_McMahon 6102514 NA Captive MSP M S Spring Healesville 1.6493151 8.06 NA NA NA NA NA AACGTCTG+AATGACGC 3,809,607 1.00 96.73 3.27 1,151 100 93.07 35.79 NA NA NA
1 default S10_Logan 6102515 NA Captive MAU M A Summer Healesville 5.6000000 9.02 NA NA NA NA NA GTGCCATA+CTCCTAGT 9,606,720 2.00 97.52 2.48 2,901 100 93.25 35.83 NA NA NA
1 default S10_Laurasia 6102516 NA DFT2 MSP M S Spring Channel 1.6383562 8 NA NA NA NA 2697.152 TACGCTAC+CGTGTGAT 9,716,148 2.00 97.81 2.19 2,934 100 93.97 35.95 NA NA NA
1 default S10_Enchilada 6102517 NA DFT2 MAP M A Spring Channel 3.6438356 9.3 NA 14 FALSE FALSE 301301.905 GATTGCTC+CACTTCAC 11,967,844 2.00 97.82 2.18 3,614 100 93.88 35.94 NA NA NA
1 default S11_Baloo 6102518 NA Healthy/Wild MAA M A Autumn Channel 3.1726027 11.5 NA NA NA NA NA CTGATCGT+GCGCATAT 10,923,019 2.00 98.07 1.93 3,299 100 93.51 35.87 NA NA NA
1 default S11_Murdoch/Washington 6102519 NA DFT2 MAA M A Autumn Channel 1.4438356 8.9 NA NA NA NA 127176.305 ACTGAGGT+GTCAACAG 2,003,509 0.00 97.82 2.18 605 100 93.39 35.85 NA NA NA
1 default S11_Xuki 6102520 NA Captive MAA M A Autumn Monarto 2.0767123 7.95 NA NA NA NA NA ATCGCCAT+TGCGTAAC 6,018,884 1.00 97.88 2.12 1,818 100 93.58 35.89 NA NA NA
1 default S11_Kalamata 6102521 NA Captive MSW M S Winter Healesville 1.2849315 5.58 NA NA NA NA NA GAACATCG+TCGACAAG 6,861,544 1.00 97.76 2.24 2,072 100 93.49 35.87 NA NA NA
1 default S11_Freiburg 6102522 NA N/A MSW M S Winter Channel 1.2575342 8 NA 1 TRUE deep TRUE 0.000 GAATCCGA+AGCTAGTG 5,358,578 1.00 97.95 2.05 1,618 100 94.04 35.96 NA NA NA
1 default S11_DanRhodes 6102523 NA Healthy/Wild MSW M S Winter Channel 1.3917808 6.8 NA NA NA NA NA TCGCTGTT+CAAGTCGT 5,076,673 1.00 97.41 2.59 1,533 100 93.77 35.92 NA NA NA
1 default S12_Abe 6102524 NA DFT1 MAA M A Autumn Channel 3.1150685 7.9 NA 1 TRUE deep TRUE 13125.000 GTTGTTCG+CCAACTTC 6,446,467 1.00 97.60 2.40 1,947 100 93.65 35.90 NA NA NA
1 default S12_Robin 6102525 NA Healthy/Wild MAA M A Autumn Channel 2.1972603 7.7 NA NA NA NA NA ATGACGTC+CTTCCTTC 6,756,342 1.00 97.12 2.88 2,040 100 92.53 35.68 NA NA NA
1 default S12_Lilac 6102526 NA DFT1 MAW M A Winter Channel 3.4109589 9.6 NA 5 TRUE superficial TRUE 37293.844 TATCGGTC+TACCGGAT 4,490,241 1.00 98.15 1.85 1,356 100 93.42 35.85 NA NA NA
1 default S12_Eeyore 6102527 NA Healthy/Wild MAW M A Winter Channel 3.2794521 9 NA NA NA NA NA TCAGGCTT+ATCATGCG 3,071,283 1.00 97.28 2.72 928 100 92.94 35.76 NA NA NA
1 default S12_Wally 6102528 NA Captive MAA M A Autumn Monarto 2.1616438 N/A NA NA NA NA NA ACGACTTG+AACAGCGA 3,000,501 1.00 97.96 2.04 906 100 93.70 35.91 NA NA NA
1 default S12_Naz 6102529 NA Captive MAW M A Winter Monarto 4.4547945 N/A NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,927,942 1.00 97.40 2.60 1,790 100 93.86 35.94 NA NA NA
1 default S13_Humbug 6102530 NA Captive MAU M A Summer Monarto 2.5397260 7.94 NA NA NA NA NA GAGCAGTA+TGAGCTGT 1,702,608 0.00 98.07 1.93 514 100 93.58 35.89 NA NA NA
1 default S13_Green 6102531 NA DFT1 MAA M A Autumn Channel 3.1534247 7.5 NA 2 TRUE superficial TRUE 7407.222 GTCGAAGA+CCACATTG 2,623,695 1.00 97.38 2.62 792 100 92.94 35.76 NA NA NA
1 default S13_Bump 6102532 NA DFT1 MAU M A Summer Channel 3.9068493 9.3 NA NA NA NA 629522.362 AGTTCGTC+ACTCGATC 9,435,053 2.00 98.16 1.84 2,849 100 93.64 35.89 NA NA NA
1 default S13_Pangea 6102533 NA Healthy/Wild MAU M A Summer Channel 1.8794521 7.7 NA NA NA NA NA ACCACGAT+GTCTGCAA 1,732,316 0.00 97.57 2.43 523 100 93.82 35.92 NA NA NA
1 default S13_Finbar 6102534 NA Healthy/Wild MAA M A Autumn Channel 2.1150685 6.8 NA NA NA NA NA GAGACGAT+ACCGGTTA 1,152 0.00 96.70 3.30 0 100 92.06 35.56 NA NA NA
1 default S13_Xerxes 6102535 NA Captive MAA M A Autumn Monarto 2.0767123 N/A NA NA NA NA NA GATAGGCT+CAGTCACA 7,628,257 2.00 98.34 1.66 2,304 100 93.62 35.89 NA NA NA
1 default S14_Purple 6102536 NA DFT1 FAW F A Winter Channel 2.3945205 6.8 NA 1 TRUE deep TRUE 24938.123 CGCTCTAT+TTGCAACG 5,432,182 1.00 97.81 2.19 1,641 100 93.93 35.95 NA NA NA
1 default S14_Simba 6102537 NA N/A MAA M A Autumn Channel 3.1232877 9.4 NA NA NA NA NA ATGCCTGT+AGATTGCG 11,175,146 2.00 97.91 2.09 3,375 100 93.71 35.90 NA NA NA
1 default S14_Catani 6102538 NA Captive FAU F A Summer Healesville 2.8630137 6.46 NA NA NA NA NA TGAAGACG+ACATGCCA 13,381,058 3.00 96.98 3.02 4,041 100 93.36 35.84 NA NA NA
2 default S15_Halls 6102539 NA Wild FAU F A Summer Channel 1.9178082 4.7 NA NA NA NA NA ATGACGTC+CTTCCTTC 1,308,213 0.28 97.48 2.52 395 100 93.03 35.79 NA NA NA
2 default S15_Jessica 6102540 NA Wild FAP F A Spring Channel 3.6191781 7.4 NA NA NA NA NA CATGGCTA+CACACATC 1,840,822 0.40 97.83 2.17 556 100 92.66 35.71 NA NA NA
2 default S15_Amelia 6102541 NA Captive FAU F A Summer Healesville 4.7260274 5.85 NA NA NA NA NA AACGTCTG+AATGACGC 8,041,818 1.73 96.32 3.68 2,429 100 92.18 35.63 NA NA NA
2 default S15_London 6102542 NA Captive FAU F A Summer Healesville 3.7863014 4.8 NA NA NA NA NA GTCATCGA+GATCCACT 5,758,111 1.24 96.72 3.28 1,739 100 91.87 35.55 NA NA NA
2 default S15_Elyse 6102543 NA Captive FAP F A Spring Healesville 4.5232877 7.88 NA NA NA NA NA AGCGTGTT+CTTCGCAA 5,774,637 1.24 96.76 3.24 1,744 100 91.56 35.50 NA NA NA
2 default S15_Munchkin 6102544 NA Wild FAU F A Summer Channel 2.8739726 N/A NA NA NA NA NA AGAGTAGC+AAGGCGTA 7,216,024 1.56 97.99 2.01 2,179 100 93.47 35.87 NA NA NA
2 default S16_Pelverata 6102545 NA Wild FAU F A Summer Channel 2.9287671 8.7 NA NA NA NA NA CGCTCTAT+TTGCAACG 2,918,728 0.63 97.60 2.40 881 100 93.65 35.91 NA NA NA
2 default S16_Lizzie 6102546 NA Wild FAU F A Summer Channel 1.9178082 6.8 NA NA NA NA NA AGTTCGTC+ACTCGATC 10,758,280 2.32 97.92 2.08 3,249 100 93.20 35.82 NA NA NA
2 default S16_Marley 6102547 NA Captive FAU F A Summer Monarto 4.7726027 7.51 NA NA NA NA NA GCAAGATC+AGTCGAAG 348,621 0.08 97.24 2.76 105 100 92.77 35.73 NA NA NA
2 default S16_Milla 6102548 NA Captive FAU F A Summer Healesville 2.7671233 5.82 NA NA NA NA NA TTGCGAAG+AACACGCT 6,376,997 1.37 97.60 2.40 1,926 100 92.44 35.67 NA NA NA
2 default S16_Maleficent 6102549 NA Captive FAU F A Summer Monarto 4.5589041 8.59 NA NA NA NA NA TGCTTCCA+CGATCGAT 9,181,668 1.98 98.08 1.92 2,773 100 93.04 35.79 NA NA NA
2 default S16_Lebanon 6102550 NA Wild FAU F A Summer Channel 5.8986301 9.8 NA NA NA NA NA ATCCAGAG+TAACGTCG 7,154,214 1.54 73.27 26.73 2,161 100 92.95 35.78 NA NA NA
2 default S17_Radiata 6102551 NA Wild FSU F S Summer Channel 0.8767123 3.7 NA NA NA NA NA AACTGAGC+CAATCAGG 7,329,322 1.58 97.89 2.11 2,213 100 92.63 35.71 NA NA NA
2 default S17_Shenzi 6102552 NA Wild FAU F A Summer Channel 1.8821918 7.6 NA NA NA NA NA GTCGAAGA+CCACATTG 5,503,188 1.19 97.18 2.82 1,662 100 92.53 35.69 NA NA NA
2 default S17_Anirak 6102553 NA Captive FSW F S Winter Healesville 1.3424658 5.42 NA NA NA NA NA TGAGCTAG+GAACGGTT 3,740,878 0.81 97.15 2.85 1,130 100 93.03 35.79 NA NA NA
2 default S17_Poly 6102554 NA Captive FSU F S Summer Monarto 1.7917808 6.67 NA NA NA NA NA CTTAGGAC+ACTCCTAC 11,133,566 2.40 97.85 2.15 3,362 100 92.47 35.68 NA NA NA
2 default S17_Vernicosa 6102555 NA Wild FSW F S Winter Channel 1.3643836 5.1 NA NA NA NA NA CAATGTGG+TCTTCGAC 4,353,832 0.94 97.73 2.27 1,315 100 93.72 35.92 NA NA NA
2 default S17_Methyl 6102556 NA Captive FSU F S Summer Healesville 0.7534247 2.72 NA NA NA NA NA TGGTACAG+TCGAGAGT 7,887,375 1.70 97.57 2.43 2,382 100 93.15 35.81 NA NA NA
2 default S18_Paprika 6102557 NA Wild FSW F S Winter Channel 1.2684932 6 NA NA NA NA NA CGGTTGTT+GTGGTATG 11,961,885 2.58 95.85 4.15 3,612 100 92.97 35.78 NA NA NA
2 default S18_Zara 6102558 NA Captive FSW F S Winter Monarto 1.5150685 4.6 NA NA NA NA NA ACCACGAT+GTCTGCAA 7,308,907 1.58 97.70 2.30 2,207 100 92.84 35.75 NA NA NA
2 default S18_Maze 6102559 NA Captive FSW F S Winter Healesville 1.4000000 5.82 NA NA NA NA NA ACTGAGGT+GTCAACAG 2,984,930 0.64 97.59 2.41 901 100 92.49 35.69 NA NA NA
2 default S18_Delores 6102560 NA Captive FSW F S Winter Healesville 1.2986301 5.1 NA NA NA NA NA ACGACTTG+AACAGCGA 98 0.00 94.90 5.10 0 100 89.11 34.91 NA NA NA
2 default S18_Haiko 6102561 NA Wild FSW F S Winter Channel 1.4082192 6.2 NA NA NA NA NA GATCGAGT+GACGAACT 6,506,408 1.40 97.63 2.37 1,965 100 93.11 35.79 NA NA NA
2 default S18_Hermione 6102562 NA Wild FSW F S Winter Channel 1.3424658 5.1 NA NA NA NA NA CCTGATTG+GCTCAGTT 11,494,825 2.48 97.55 2.45 3,471 100 93.66 35.92 NA NA NA
2 default S19_Tammy 6102563 NA Wild FSW F S Winter Channel 1.3671233 6 NA NA NA NA NA ATCGATCG+TGGAAGCA 6,018,258 1.30 92.40 7.60 1,818 100 93.20 35.82 NA NA NA
2 default S19_Morocco 6102564 NA Captive MAU M A Summer Monarto 4.5917808 9.82 NA NA NA NA NA TCAGGCTT+ATCATGCG 4,879,629 1.05 97.38 2.62 1,474 100 92.63 35.71 NA NA NA
2 default S19_Pecorino 6102565 NA Captive FSW F S Winter Healesville 1.1123288 6.02 NA NA NA NA NA ATGCCTGT+AGATTGCG 4,857,395 1.05 97.58 2.42 1,467 100 92.64 35.72 NA NA NA
2 default S19_Hooch 6102566 NA Captive MSA M S Autumn Healesville 1.0164384 6.1 NA NA NA NA NA CCGTAAGA+AGAGTCCA 1,074,345 0.23 97.56 2.44 324 100 92.66 35.72 NA NA NA
2 default S19_Darwin 6102567 NA Wild MAU M A Summer Channel 1.8849315 9 NA NA NA NA NA CACCTGTT+AGGATAGC 0 0.00 NA NA 0 NA NA NA NA NA NA
2 default S19_Tantor 6102568 NA Wild MSA M S Autumn Channel 1.1945205 6.9 NA NA NA NA NA TGGACTCT+TCTTACGG 14,104,602 3.04 98.15 1.85 4,260 100 93.26 35.83 NA NA NA
2 default S20_Muasy 6102569 NA Captive MSU M S Summer Healesville 1.4219178 6.62 NA NA NA NA NA TTCCAAGG+CTACAAGG 10,669,237 2.30 97.64 2.36 3,222 100 92.79 35.74 NA NA NA
2 default S20_Fuse 6102570 NA Captive MSU M S Summer Healesville 1.7315068 6.26 NA NA NA NA NA GTAGGAGT+GTCCTAAG 10,603,179 2.29 97.34 2.66 3,202 100 92.01 35.58 NA NA NA
2 default S20_Joseph 6102571 NA Captive MSU M S Summer Healesville 1.7479452 7.42 NA NA NA NA NA CTTCGACT+GATCTTGC 5,642,025 1.22 96.37 3.63 1,704 100 91.87 35.56 NA NA NA
2 default S20_Hudson 6102572 NA Wild MSU M S Summer Channel 0.9178082 4.1 NA NA NA NA NA AAGCACTG+AGGTCAAC 4,225,812 0.91 97.88 2.12 1,276 100 93.16 35.81 NA NA NA
2 default S20_Mace 6102573 NA Wild MSU M S Summer Channel 0.9068493 6 NA NA NA NA NA CGTTGCAA+ATAGAGCG 6,385,393 1.38 95.82 4.18 1,928 100 92.04 35.61 NA NA NA
2 default S20_Mint 6102574 NA Wild MSU M S Summer Channel 0.9068493 6.2 NA NA NA NA NA GAAGGAAG+GACGTCAT 5,390,453 1.16 97.29 2.71 1,628 100 93.28 35.84 NA NA NA
2 default S21_Sylvester 6102575 NA Wild MAW M A Winter Channel 2.2739726 8.5 NA NA NA NA NA GTTGACCT+CAGTGCTT 5,450,970 1.18 97.62 2.38 1,646 100 93.04 35.79 NA NA NA
2 default S21_Moama 6102576 NA Captive MAW M A Winter Monarto 1.6986301 8.75 NA NA NA NA NA TTGGACGT+GAAGTGCT 10,821,895 2.33 96.02 3.98 3,268 100 92.72 35.73 NA NA NA
2 default S21_Nauset 6102577 NA Captive MSW M S Winter Healesville 1.3041096 4.036 NA NA NA NA NA TATCGGTC+TACCGGAT 8,693,920 1.87 98.13 1.87 2,626 100 92.32 35.65 NA NA NA
2 default S21_Graham 6102578 NA Captive MSW M S Winter Healesville 1.3616438 6.4 NA NA NA NA NA TACGCCTT+GCTACTCT 3,422,010 0.74 97.72 2.28 1,033 100 92.94 35.76 NA NA NA
2 default S21_Harry 6102579 NA Wild MSW M S Winter Channel 1.3972603 7.2 NA NA NA NA NA TTCGTTGG+TACACACG 10,720,172 2.31 97.18 2.82 3,237 100 92.73 35.72 NA NA NA
2 default S21_Thor 6102580 NA Wild MSW M S Winter Channel 1.3452055 8.2 NA NA NA NA NA GATGTGTG+TAGCCATG 6,051,140 1.30 97.63 2.37 1,827 100 93.21 35.83 NA NA NA
2 default S22_Yanni 6102581 NA Captive MSW M S Winter Monarto 1.5178082 8.15 NA NA NA NA NA CGTGTGTA+CCAACGAA 4,811,453 1.04 97.67 2.33 1,453 100 92.30 35.65 NA NA NA
2 default S22_Gherkin 6102582 NA Captive MSW M S Winter Healesville 1.2630137 6.32 NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,913,586 1.27 97.05 2.95 1,786 100 92.92 35.77 NA NA NA
2 default S22_Utah 6102583 NA Wild MSW M S Winter Channel 1.4438356 8.2 NA NA NA NA NA ACTAGGAG+TATGGCAC 7,229,403 1.56 94.10 5.90 2,183 100 93.10 35.80 NA NA NA
2 default S22_Stilton 6102584 NA Captive MSW M S Winter Healesville 1.2986301 5.76 NA NA NA NA NA CGCAATCT+ACAGGCAT 8,306,537 1.79 96.94 3.06 2,509 100 91.86 35.55 NA NA NA
2 default S22_Wellington 6102585 NA Wild MSW M S Winter Channel 1.4027397 6 NA NA NA NA NA ACGGAACA+ACGAGAAC 7,783,546 1.68 97.13 2.87 2,351 100 92.96 35.78 NA NA NA
2 default S22_Ginger 6102586 NA Healthy/Wild MSW M S Winter Channel 1.2712329 7.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 9,742,792 2.10 97.63 2.37 2,942 100 93.00 35.78 NA NA NA
2 default S23_Meliza 6102587 NA Ignore-Wild FSW F S Winter Channel 1.4109589 7.3 NA NA NA NA NA ACTCTCGA+CTGTACCA 6,770,476 1.46 97.75 2.25 2,045 100 93.04 35.79 NA NA NA
2 default S23_Osiris 6102588 NA Captive MSW M S Winter Healesville 1.1753425 5.34 NA NA NA NA NA AGTGGATC+TCGATGAC 3,528,471 0.76 97.24 2.76 1,066 100 93.08 35.79 NA NA NA
2 default S23_X-boxx 6102589 NA Captive FSW F S Winter Monarto 1.4657534 4.34 NA NA NA NA NA CTGTTGAC+ACCTCAGT 23 0.00 100.00 NaN 0 100 95.85 36.37 NA NA NA
2 default S23_Quince 6102590 NA Captive MSW M S Winter Healesville 1.3835616 N/A NA NA NA NA NA AACCGTTC+CTAGCTCA 7,247,793 1.56 97.63 2.37 2,189 100 92.28 35.63 NA NA NA
2 default S23_Saffron 6102591 NA Wild MSW M S Winter Channel 1.2164384 7.3 NA NA NA NA NA GAAGTTGG+CGAACAAC 7,212,495 1.55 97.63 2.37 2,178 100 93.09 35.80 NA NA NA
2 default S23_Gandalf 6102592 NA Wild MSW M S Winter Channel 1.3013699 6.4 NA NA NA NA NA GATTGCTC+CACTTCAC 4,756,766 1.03 97.26 2.74 1,437 100 93.49 35.88 NA NA NA
2 default S24_Boy 6102593 NA Healthy/Wild MAA M A Autumn Channel 3.1452055 8.3 NA NA NA NA NA CGACGTTA+CTCTGGAT 1,476,427 0.32 97.63 2.37 446 100 93.25 35.82 NA NA NA
2 default S24_ST74 6102594 NA Wild MAW M A Winter Channel 4.2876712 10.4 NA NA NA NA NA TGGTAGCT+AGGTGTTG 2,413,884 0.52 96.34 3.66 729 100 92.34 35.64 NA NA NA
2 default S24_Malfoy 6102595 NA Captive MAW M A Winter Healesville 5.1041096 8.02 NA NA NA NA NA TAACCGGT+ATCGTCTC 6,908,416 1.49 97.09 2.91 2,086 100 91.90 35.56 NA NA NA
2 default S24_Licorice 6102596 NA Captive FSA F S Autumn Healesville 1.8246575 5.94 NA NA NA NA NA TTGCAGAC+ATCGTGGT 4,475,461 0.96 95.05 4.95 1,352 100 91.42 35.46 NA NA NA
2 default S24_Lisa 6102597 NA Wild FSA F S Autumn Channel 1.1013699 6.6 NA NA NA NA NA CGCATGAT+AAGCCTGA 17,006,305 3.67 96.93 3.07 5,136 100 92.91 35.77 NA NA NA
2 default S24_Shazza 6102598 NA Healthy FAW F A Winter Channel 2.0273973 6.2 NA NA NA NA NA GAGCAGTA+TGAGCTGT 2,693,655 0.58 97.51 2.49 813 100 93.01 35.79 NA NA NA
2 default S25_Tofu 6102599 NA Captive FAU F A Summer Healesville 2.7452055 N/A NA NA NA NA NA GAGACGAT+ACCGGTTA 12,024,421 2.59 95.37 4.63 3,631 100 93.06 35.79 NA NA NA
2 default S25_Colette 6102600 NA Captive FAP F A Spring Healesville 6.6273973 7.52 NA NA NA NA NA CTTGTCGA+CGATGTTC 10,751,797 2.32 97.49 2.51 3,247 100 92.77 35.74 NA NA NA
2 default S25_CannonBall 6102601 NA Captive MSW M S Winter Healesville 1.1479452 6.54 NA NA NA NA NA TACGCTAC+CGTGTGAT 13,015,081 2.81 97.36 2.64 3,931 100 92.61 35.70 NA NA NA
2 default S25_Cornelius 6102602 NA Captive MAU M A Summer Healesville 3.6904110 7.74 NA NA NA NA NA GAATCCGA+AGCTAGTG 3,336,983 0.72 97.10 2.90 1,008 100 93.09 35.79 NA NA NA
2 default S25_Mardook 6102603 NA Captive MAW M A Winter Healesville 4.3013699 9.16 NA NA NA NA NA GCACAACT+CTGAACGT 6,826,313 1.47 97.66 2.34 2,062 100 92.67 35.71 NA NA NA
2 default S25_Negroni 6102604 NA Captive FSP F S Spring Healesville 1.6767123 5.86 NA NA NA NA NA TGTGACTG+AGCCTATC 4,566,180 0.98 97.68 2.32 1,379 100 92.13 35.61 NA NA NA

MDS

# sample level
plotMDS(x)

# gene level
plotMDS(t(x))

DESeq2

ssHvDAV <- ss[which(grepl("Healthy",ss$Category) + grepl("DFT",ss$Category)>0),]
ssHvDAV
##     Lane Project              Client.ID  Sample  X     Category Sex.Age.Season
## 1      1 default          S1_LauraGrace 6102461 NA Healthy/Wild            FAP
## 3      1 default            S1_Sarafina 6102463 NA         DFT1            FAP
## 4      1 default                S1_Lucy 6102464 NA         DFT1            FAU
## 5      1 default            S1_Turmeric 6102465 NA Healthy/Wild            FAU
## 6      1 default           S1_Singapore 6102466 NA      Healthy            FAA
## 7      1 default             S2_Belinda 6102467 NA Healthy/Wild            FAU
## 10     1 default               S2_Rosie 6102470 NA Healthy/Wild            FAU
## 11     1 default                S2_Hope 6102471 NA         DFT1            FAU
## 12     1 default               S2_Sally 6102472 NA         DFT1            FAU
## 13     1 default                 S3_Apu 6102473 NA         DFT1            MAA
## 14     1 default              S3_Simone 6102474 NA         DFT1            FAW
## 15     1 default                S3_ST62 6102475 NA Healthy/Wild            FAW
## 18     1 default             S4_Kerchak 6102478 NA      Healthy            MAA
## 19     1 default             S4_Duffman 6102479 NA      Healthy            MAA
## 20     1 default              S4_Wiggum 6102480 NA         DFT1            MAA
## 21     1 default               S4_Hogan 6102481 NA      Healthy            MAA
## 22     1 default                S4_Pooh 6102482 NA         DFT1            MAA
## 23     1 default            S4_Milhouse 6102483 NA         DFT1            MAA
## 26     1 default               S5_Silky 6102486 NA Healthy/Wild            MAW
## 27     1 default             S5_Longley 6102487 NA Healthy/Wild            MAU
## 28     1 default               S5_Allen 6102488 NA         DFT1            MAU
## 29     1 default                S5_Cyan 6102489 NA         DFT1            MAW
## 30     1 default             S6_Myanmar 6102490 NA      Healthy            FAP
## 31     1 default              S6_Pakana 6102491 NA      Healthy            MSP
## 32     1 default              S6_Shelob 6102492 NA         DFT2            FAP
## 33     1 default           S6_Stuttgart 6102493 NA         DFT1            MSP
## 35     1 default              S6_Hobbit 6102495 NA      Healthy            MSP
## 38     1 default              S7_Violet 6102498 NA         DFT2            FSU
## 39     1 default               S7_Lieke 6102499 NA Healthy/Wild            FSU
## 40     1 default              S7_Willie 6102500 NA         DFT2            MAA
## 41     1 default            S7_Smithers 6102501 NA Healthy/Wild            MAA
## 42     1 default              S8_Orange 6102502 NA         DFT1            FAU
## 43     1 default              S8_Vinnie 6102503 NA Healthy/Wild            MAU
## 44     1 default           S8_Struggles 6102504 NA Healthy/Wild            MAW
## 45     1 default                S8_ST67 6102505 NA         DFT2            MAW
## 46     1 default              S8_SusieQ 6102506 NA Healthy/Wild            FAU
## 47     1 default              S8_Yellow 6102507 NA         DFT2            MAU
## 48     1 default                S9_Jane 6102508 NA         DFT1            FAA
## 49     1 default              S9_Majula 6102509 NA      Healthy            FAA
## 50     1 default              S9_Snoopy 6102510 NA Healthy/Wild            MSW
## 51     1 default        S9_Clytemnestra 6102511 NA         DFT1            FSP
## 52     1 default                S9_Zeus 6102512 NA         DFT2            MSW
## 53     1 default              S9_Sarabi 6102513 NA Healthy/Wild            FSP
## 56     1 default           S10_Laurasia 6102516 NA         DFT2            MSP
## 57     1 default          S10_Enchilada 6102517 NA         DFT2            MAP
## 58     1 default              S11_Baloo 6102518 NA Healthy/Wild            MAA
## 59     1 default S11_Murdoch/Washington 6102519 NA         DFT2            MAA
## 63     1 default          S11_DanRhodes 6102523 NA Healthy/Wild            MSW
## 64     1 default                S12_Abe 6102524 NA         DFT1            MAA
## 65     1 default              S12_Robin 6102525 NA Healthy/Wild            MAA
## 66     1 default              S12_Lilac 6102526 NA         DFT1            MAW
## 67     1 default             S12_Eeyore 6102527 NA Healthy/Wild            MAW
## 71     1 default              S13_Green 6102531 NA         DFT1            MAA
## 72     1 default               S13_Bump 6102532 NA         DFT1            MAU
## 73     1 default             S13_Pangea 6102533 NA Healthy/Wild            MAU
## 74     1 default             S13_Finbar 6102534 NA Healthy/Wild            MAA
## 76     1 default             S14_Purple 6102536 NA         DFT1            FAW
## 126    2 default             S22_Ginger 6102586 NA Healthy/Wild            MSW
## 133    2 default                S24_Boy 6102593 NA Healthy/Wild            MAA
## 138    2 default             S24_Shazza 6102598 NA      Healthy            FAW
##     Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1     F   A Spring  Channel 2.6219178    7.2  NA                NA        NA
## 3     F   A Spring  Channel 2.6191781    6.4  NA                NA        NA
## 4     F   A Summer  Channel 2.9178082    7.1  NA                 3      TRUE
## 5     F   A Summer  Channel 1.9095890    7.8  NA                NA        NA
## 6     F   A Autumn  Channel 5.0000000    8.6  NA                NA        NA
## 7     F   A Summer  Channel 1.8657534    6.6  NA                NA        NA
## 10    F   A Summer  Channel 1.8904110    7.4  NA                NA        NA
## 11    F   A Summer  Channel 2.9315068    6.4  NA                 4      TRUE
## 12    F   A Summer  Channel 2.9945205      7  NA                 1      TRUE
## 13    M   A Autumn  Channel 3.1150685    9.5  NA                 1     FALSE
## 14    F   A Winter  Channel 3.2739726   10.2  NA                 1      TRUE
## 15    F   A Winter  Channel 3.2712329   10.2  NA                NA        NA
## 18    M   A Autumn  Channel 4.1863014   11.6  NA                NA        NA
## 19    M   A Autumn  Channel 3.1123288   12.4  NA                NA        NA
## 20    M   A Autumn  Channel 3.1178082    8.3  NA                 2     FALSE
## 21    M   A Autumn  Channel 3.1616438   11.6  NA                NA        NA
## 22    M   A Autumn  Channel 4.1863014   11.8  NA                 1     FALSE
## 23    M   A Autumn  Channel 4.1013699     11  NA                 1      TRUE
## 26    M   A Winter  Channel 2.2849315    9.5  NA                NA        NA
## 27    M   A Summer  Channel 2.9315068    9.7  NA                NA        NA
## 28    M   A Summer  Channel 1.9095890    6.7  NA                 1      TRUE
## 29    M   A Winter  Channel 3.3945205    9.1  NA                 5      TRUE
## 30    F   A Spring  Channel 5.5726027    7.6  NA                NA        NA
## 31    M   S Spring  Channel 1.6712329    7.8  NA                NA        NA
## 32    F   A Spring  Channel 4.6219178    7.2  NA                NA        NA
## 33    M   S Spring  Channel 0.5780822   12.7  NA                 1     FALSE
## 35    M   S Spring  Channel 1.6273973      9  NA                NA        NA
## 38    F   S Summer  Channel 0.8739726    4.6  NA                 1      TRUE
## 39    F   S Summer  Channel 0.8657534    4.9  NA                NA        NA
## 40    M   A Autumn  Channel 2.1150685    8.2  NA                 2      TRUE
## 41    M   A Autumn  Channel 3.1013699    8.9  NA                NA        NA
## 42    F   A Summer  Channel 1.9150685    7.1  NA                 7      TRUE
## 43    M   A Summer  Channel 2.9150685    8.8  NA                NA        NA
## 44    M   A Winter  Channel 3.2821918   11.1  NA                NA        NA
## 45    M   A Winter  Channel 4.2794521   10.2  NA                 1      TRUE
## 46    F   A Summer  Channel 1.8712329    7.1  NA                NA        NA
## 47    M   A Summer  Channel 1.8657534   10.5  NA                 2      TRUE
## 48    F   A Autumn  Channel 3.1972603    6.1  NA                NA        NA
## 49    F   A Autumn  Channel 3.1150685      6  NA                NA        NA
## 50    M   S Winter  Channel 1.2794521    6.3  NA                NA        NA
## 51    F   S Spring  Channel 1.6602740      6  NA                NA        NA
## 52    M   S Winter  Channel 1.3479452    7.3  NA                NA        NA
## 53    F   S Spring  Channel 1.6328767    5.8  NA                NA        NA
## 56    M   S Spring  Channel 1.6383562      8  NA                NA        NA
## 57    M   A Spring  Channel 3.6438356    9.3  NA                14     FALSE
## 58    M   A Autumn  Channel 3.1726027   11.5  NA                NA        NA
## 59    M   A Autumn  Channel 1.4438356    8.9  NA                NA        NA
## 63    M   S Winter  Channel 1.3917808    6.8  NA                NA        NA
## 64    M   A Autumn  Channel 3.1150685    7.9  NA                 1      TRUE
## 65    M   A Autumn  Channel 2.1972603    7.7  NA                NA        NA
## 66    M   A Winter  Channel 3.4109589    9.6  NA                 5      TRUE
## 67    M   A Winter  Channel 3.2794521      9  NA                NA        NA
## 71    M   A Autumn  Channel 3.1534247    7.5  NA                 2      TRUE
## 72    M   A Summer  Channel 3.9068493    9.3  NA                NA        NA
## 73    M   A Summer  Channel 1.8794521    7.7  NA                NA        NA
## 74    M   A Autumn  Channel 2.1150685    6.8  NA                NA        NA
## 76    F   A Winter  Channel 2.3945205    6.8  NA                 1      TRUE
## 126   M   S Winter  Channel 1.2712329    7.6  NA                NA        NA
## 133   M   A Autumn  Channel 3.1452055    8.3  NA                NA        NA
## 138   F   A Winter  Channel 2.0273973    6.2  NA                NA        NA
##     UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                    NA                  NA AGAGTAGC+AAGGCGTA
## 3                                    NA           95140.790 ATCCAGAG+TAACGTCG
## 4              deep                TRUE          700825.170 AAGCACTG+AGGTCAAC
## 5                                    NA                  NA GAAGGAAG+GACGTCAT
## 6                                    NA                  NA ACAGCTCA+TACTGCTC
## 7                                    NA                  NA GCAAGATC+AGTCGAAG
## 10                                   NA                  NA CGCATGAT+AAGCCTGA
## 11             deep                TRUE          103815.530 AGCACTTC+ACGTCCAA
## 12             deep               FALSE            1588.272 CGTTGCAA+ATAGAGCG
## 13      superficial                TRUE             200.000 CCTTGATC+GATGGAGT
## 14      superficial                TRUE            2670.678 CGGTTGTT+GTGGTATG
## 15                                   NA                  NA TGAGCTAG+GAACGGTT
## 18                                   NA                  NA CGGCTAAT+CTCGTTCT
## 19                                   NA                  NA GACGATCT+TCGTGCAT
## 20                                FALSE            7272.309 GTGAAGTG+GAGCAATC
## 21                                   NA                  NA TACGCCTT+GCTACTCT
## 22                                FALSE            7577.856 CTTCGACT+GATCTTGC
## 23             deep                TRUE             480.000 AACCGTTC+CTAGCTCA
## 26                                   NA                  NA CTGTTGAC+ACCTCAGT
## 27                                   NA                  NA CGCAATCT+ACAGGCAT
## 28             deep                TRUE           55959.750 TTGCAGAC+ATCGTGGT
## 29             deep                TRUE          206006.422 GTAGGAGT+GTCCTAAG
## 30                                   NA                  NA GCACAACT+CTGAACGT
## 31                                   NA                  NA GTTACGCA+ATGGCGAT
## 32                                   NA            7455.435 GTCATCGA+GATCCACT
## 33                                 TRUE            3809.806 AGCGTGTT+CTTCGCAA
## 35                                   NA                  NA ATATGCGC+ACGATCAG
## 38      superficial                TRUE            5517.330 CTTGTCGA+CGATGTTC
## 39                                   NA                  NA TTCCAAGG+CTACAAGG
## 40             deep                TRUE            1527.480 TGGACTCT+TCTTACGG
## 41                                   NA                  NA GCGTCATT+CAGACGTT
## 42      superficial                TRUE           43690.461 GTTGACCT+CAGTGCTT
## 43                                   NA                  NA CGACGTTA+CTCTGGAT
## 44                                   NA                  NA ATCGATCG+TGGAAGCA
## 45             deep                TRUE          102246.432 TTGGACGT+GAAGTGCT
## 46                                   NA                  NA CAGTCCAA+CGGTAATC
## 47             deep                TRUE          139389.671 GAAGTTGG+CGAACAAC
## 48                                   NA           64646.036 GTTCTCGT+TGTTCCGT
## 49                                   NA                  NA ACTCTCGA+CTGTACCA
## 50                                   NA                  NA AACTGAGC+CAATCAGG
## 51                                   NA           34738.080 CATGGCTA+CACACATC
## 52                                   NA             100.000 CGTGTGTA+CCAACGAA
## 53                                   NA                  NA CTTAGGAC+ACTCCTAC
## 56                                   NA            2697.152 TACGCTAC+CGTGTGAT
## 57                                FALSE          301301.905 GATTGCTC+CACTTCAC
## 58                                   NA                  NA CTGATCGT+GCGCATAT
## 59                                   NA          127176.305 ACTGAGGT+GTCAACAG
## 63                                   NA                  NA TCGCTGTT+CAAGTCGT
## 64             deep                TRUE           13125.000 GTTGTTCG+CCAACTTC
## 65                                   NA                  NA ATGACGTC+CTTCCTTC
## 66      superficial                TRUE           37293.844 TATCGGTC+TACCGGAT
## 67                                   NA                  NA TCAGGCTT+ATCATGCG
## 71      superficial                TRUE            7407.222 GTCGAAGA+CCACATTG
## 72                                   NA          629522.362 AGTTCGTC+ACTCGATC
## 73                                   NA                  NA ACCACGAT+GTCTGCAA
## 74                                   NA                  NA GAGACGAT+ACCGGTTA
## 76             deep                TRUE           24938.123 CGCTCTAT+TTGCAACG
## 126                                  NA                  NA ACAGCTCA+TACTGCTC
## 133                                  NA                  NA CGACGTTA+CTCTGGAT
## 138                                  NA                  NA GAGCAGTA+TGAGCTGT
##     PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1     4,511,702           1.00              98.29                    1.71
## 3     6,491,488           1.00              74.07                   25.93
## 4     6,121,785           1.00              98.00                    2.00
## 5     6,479,047           1.00              97.28                    2.72
## 6     4,481,213           1.00              97.99                    2.01
## 7     3,296,547           1.00              97.40                    2.60
## 10    4,556,781           1.00              95.70                    4.30
## 11    1,971,776           0.00              97.96                    2.04
## 12    2,429,449           1.00              97.42                    2.58
## 13    4,939,580           1.00              96.94                    3.06
## 14    4,015,027           1.00              95.91                    4.09
## 15    4,579,681           1.00              96.67                    3.33
## 18    6,886,511           1.00              97.80                    2.20
## 19    8,301,336           2.00              97.75                    2.25
## 20    4,201,355           1.00              97.17                    2.83
## 21    2,990,345           1.00              97.77                    2.23
## 22    3,821,151           1.00              97.31                    2.69
## 23   10,492,900           2.00              98.13                    1.87
## 26    5,617,260           1.00              97.81                    2.19
## 27    2,937,660           1.00              97.71                    2.29
## 28    5,288,435           1.00              96.85                    3.15
## 29    4,138,600           1.00              98.03                    1.97
## 30    9,604,175           2.00              98.14                    1.86
## 31    4,383,521           1.00              98.09                    1.91
## 32    3,184,798           1.00              98.21                    1.79
## 33    3,056,475           1.00              97.50                    2.50
## 35    7,342,414           2.00              97.00                    3.00
## 38    2,768,682           1.00              98.19                    1.81
## 39    1,800,468           0.00              97.79                    2.21
## 40    4,539,036           1.00              98.30                    1.70
## 41    6,731,177           1.00              98.04                    1.96
## 42    5,072,309           1.00              97.92                    2.08
## 43    7,901,958           2.00              98.02                    1.98
## 44    5,257,820           1.00              95.13                    4.87
## 45    5,476,735           1.00              95.44                    4.56
## 46      454,240           0.00              97.95                    2.05
## 47    6,469,324           1.00              97.99                    2.01
## 48   12,489,105           3.00              97.92                    2.08
## 49    8,490,270           2.00              97.99                    2.01
## 50    1,709,078           0.00              98.04                    1.96
## 51    6,141,790           1.00              98.00                    2.00
## 52      699,953           0.00              97.64                    2.36
## 53    3,945,235           1.00              98.11                    1.89
## 56    9,716,148           2.00              97.81                    2.19
## 57   11,967,844           2.00              97.82                    2.18
## 58   10,923,019           2.00              98.07                    1.93
## 59    2,003,509           0.00              97.82                    2.18
## 63    5,076,673           1.00              97.41                    2.59
## 64    6,446,467           1.00              97.60                    2.40
## 65    6,756,342           1.00              97.12                    2.88
## 66    4,490,241           1.00              98.15                    1.85
## 67    3,071,283           1.00              97.28                    2.72
## 71    2,623,695           1.00              97.38                    2.62
## 72    9,435,053           2.00              98.16                    1.84
## 73    1,732,316           0.00              97.57                    2.43
## 74        1,152           0.00              96.70                    3.30
## 76    5,432,182           1.00              97.81                    2.19
## 126   9,742,792           2.10              97.63                    2.37
## 133   1,476,427           0.32              97.63                    2.37
## 138   2,693,655           0.58              97.51                    2.49
##     Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1            1,363           100     93.82        35.92  NA  NA  NA
## 3            1,960           100     93.74        35.92  NA  NA  NA
## 4            1,849           100     93.84        35.93  NA  NA  NA
## 5            1,957           100     93.85        35.94  NA  NA  NA
## 6            1,353           100     93.95        35.96  NA  NA  NA
## 7              996           100     94.12        35.98  NA  NA  NA
## 10           1,376           100     93.94        35.94  NA  NA  NA
## 11             595           100     93.62        35.88  NA  NA  NA
## 12             734           100     93.78        35.93  NA  NA  NA
## 13           1,492           100     93.71        35.91  NA  NA  NA
## 14           1,213           100     93.42        35.86  NA  NA  NA
## 15           1,383           100     93.75        35.92  NA  NA  NA
## 18           2,080           100     93.61        35.89  NA  NA  NA
## 19           2,507           100     93.83        35.93  NA  NA  NA
## 20           1,269           100     93.64        35.90  NA  NA  NA
## 21             903           100     93.71        35.90  NA  NA  NA
## 22           1,154           100     93.60        35.89  NA  NA  NA
## 23           3,169           100     93.80        35.92  NA  NA  NA
## 26           1,696           100     93.55        35.88  NA  NA  NA
## 27             887           100     93.75        35.91  NA  NA  NA
## 28           1,597           100     93.42        35.86  NA  NA  NA
## 29           1,250           100     93.67        35.90  NA  NA  NA
## 30           2,900           100     93.93        35.94  NA  NA  NA
## 31           1,324           100     93.90        35.95  NA  NA  NA
## 32             962           100     93.90        35.94  NA  NA  NA
## 33             923           100     93.95        35.95  NA  NA  NA
## 35           2,217           100     93.93        35.96  NA  NA  NA
## 38             836           100     93.85        35.93  NA  NA  NA
## 39             544           100     93.58        35.88  NA  NA  NA
## 40           1,371           100     93.84        35.93  NA  NA  NA
## 41           2,033           100     93.62        35.89  NA  NA  NA
## 42           1,532           100     93.36        35.84  NA  NA  NA
## 43           2,386           100     94.09        35.98  NA  NA  NA
## 44           1,588           100     93.81        35.93  NA  NA  NA
## 45           1,654           100     93.21        35.82  NA  NA  NA
## 46             137           100     92.97        35.76  NA  NA  NA
## 47           1,954           100     94.00        35.97  NA  NA  NA
## 48           3,772           100     93.54        35.88  NA  NA  NA
## 49           2,564           100     93.34        35.84  NA  NA  NA
## 50             516           100     93.06        35.78  NA  NA  NA
## 51           1,855           100     93.42        35.85  NA  NA  NA
## 52             211           100     93.33        35.84  NA  NA  NA
## 53           1,191           100     93.55        35.88  NA  NA  NA
## 56           2,934           100     93.97        35.95  NA  NA  NA
## 57           3,614           100     93.88        35.94  NA  NA  NA
## 58           3,299           100     93.51        35.87  NA  NA  NA
## 59             605           100     93.39        35.85  NA  NA  NA
## 63           1,533           100     93.77        35.92  NA  NA  NA
## 64           1,947           100     93.65        35.90  NA  NA  NA
## 65           2,040           100     92.53        35.68  NA  NA  NA
## 66           1,356           100     93.42        35.85  NA  NA  NA
## 67             928           100     92.94        35.76  NA  NA  NA
## 71             792           100     92.94        35.76  NA  NA  NA
## 72           2,849           100     93.64        35.89  NA  NA  NA
## 73             523           100     93.82        35.92  NA  NA  NA
## 74               0           100     92.06        35.56  NA  NA  NA
## 76           1,641           100     93.93        35.95  NA  NA  NA
## 126          2,942           100     93.00        35.78  NA  NA  NA
## 133            446           100     93.25        35.82  NA  NA  NA
## 138            813           100     93.01        35.79  NA  NA  NA
ssHvDAV <- ssHvDAV[ssHvDAV$Sample %in% colnames(x),]

dim(ssHvDAV)
## [1] 57 31
x1 <- x[,which(colnames(x) %in% ssHvDAV$Sample)]
dim(x1)
## [1] 310  57
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 259  57
ssHvDAV %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S1_LauraGrace 6102461 NA Healthy/Wild FAP F A Spring Channel 2.6219178 7.2 NA NA NA NA NA AGAGTAGC+AAGGCGTA 4,511,702 1.00 98.29 1.71 1,363 100 93.82 35.92 NA NA NA
3 1 default S1_Sarafina 6102463 NA DFT1 FAP F A Spring Channel 2.6191781 6.4 NA NA NA NA 95140.790 ATCCAGAG+TAACGTCG 6,491,488 1.00 74.07 25.93 1,960 100 93.74 35.92 NA NA NA
4 1 default S1_Lucy 6102464 NA DFT1 FAU F A Summer Channel 2.9178082 7.1 NA 3 TRUE deep TRUE 700825.170 AAGCACTG+AGGTCAAC 6,121,785 1.00 98.00 2.00 1,849 100 93.84 35.93 NA NA NA
5 1 default S1_Turmeric 6102465 NA Healthy/Wild FAU F A Summer Channel 1.9095890 7.8 NA NA NA NA NA GAAGGAAG+GACGTCAT 6,479,047 1.00 97.28 2.72 1,957 100 93.85 35.94 NA NA NA
6 1 default S1_Singapore 6102466 NA Healthy FAA F A Autumn Channel 5.0000000 8.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 4,481,213 1.00 97.99 2.01 1,353 100 93.95 35.96 NA NA NA
7 1 default S2_Belinda 6102467 NA Healthy/Wild FAU F A Summer Channel 1.8657534 6.6 NA NA NA NA NA GCAAGATC+AGTCGAAG 3,296,547 1.00 97.40 2.60 996 100 94.12 35.98 NA NA NA
10 1 default S2_Rosie 6102470 NA Healthy/Wild FAU F A Summer Channel 1.8904110 7.4 NA NA NA NA NA CGCATGAT+AAGCCTGA 4,556,781 1.00 95.70 4.30 1,376 100 93.94 35.94 NA NA NA
11 1 default S2_Hope 6102471 NA DFT1 FAU F A Summer Channel 2.9315068 6.4 NA 4 TRUE deep TRUE 103815.530 AGCACTTC+ACGTCCAA 1,971,776 0.00 97.96 2.04 595 100 93.62 35.88 NA NA NA
12 1 default S2_Sally 6102472 NA DFT1 FAU F A Summer Channel 2.9945205 7 NA 1 TRUE deep FALSE 1588.272 CGTTGCAA+ATAGAGCG 2,429,449 1.00 97.42 2.58 734 100 93.78 35.93 NA NA NA
13 1 default S3_Apu 6102473 NA DFT1 MAA M A Autumn Channel 3.1150685 9.5 NA 1 FALSE superficial TRUE 200.000 CCTTGATC+GATGGAGT 4,939,580 1.00 96.94 3.06 1,492 100 93.71 35.91 NA NA NA
14 1 default S3_Simone 6102474 NA DFT1 FAW F A Winter Channel 3.2739726 10.2 NA 1 TRUE superficial TRUE 2670.678 CGGTTGTT+GTGGTATG 4,015,027 1.00 95.91 4.09 1,213 100 93.42 35.86 NA NA NA
15 1 default S3_ST62 6102475 NA Healthy/Wild FAW F A Winter Channel 3.2712329 10.2 NA NA NA NA NA TGAGCTAG+GAACGGTT 4,579,681 1.00 96.67 3.33 1,383 100 93.75 35.92 NA NA NA
18 1 default S4_Kerchak 6102478 NA Healthy MAA M A Autumn Channel 4.1863014 11.6 NA NA NA NA NA CGGCTAAT+CTCGTTCT 6,886,511 1.00 97.80 2.20 2,080 100 93.61 35.89 NA NA NA
19 1 default S4_Duffman 6102479 NA Healthy MAA M A Autumn Channel 3.1123288 12.4 NA NA NA NA NA GACGATCT+TCGTGCAT 8,301,336 2.00 97.75 2.25 2,507 100 93.83 35.93 NA NA NA
20 1 default S4_Wiggum 6102480 NA DFT1 MAA M A Autumn Channel 3.1178082 8.3 NA 2 FALSE FALSE 7272.309 GTGAAGTG+GAGCAATC 4,201,355 1.00 97.17 2.83 1,269 100 93.64 35.90 NA NA NA
21 1 default S4_Hogan 6102481 NA Healthy MAA M A Autumn Channel 3.1616438 11.6 NA NA NA NA NA TACGCCTT+GCTACTCT 2,990,345 1.00 97.77 2.23 903 100 93.71 35.90 NA NA NA
22 1 default S4_Pooh 6102482 NA DFT1 MAA M A Autumn Channel 4.1863014 11.8 NA 1 FALSE FALSE 7577.856 CTTCGACT+GATCTTGC 3,821,151 1.00 97.31 2.69 1,154 100 93.60 35.89 NA NA NA
23 1 default S4_Milhouse 6102483 NA DFT1 MAA M A Autumn Channel 4.1013699 11 NA 1 TRUE deep TRUE 480.000 AACCGTTC+CTAGCTCA 10,492,900 2.00 98.13 1.87 3,169 100 93.80 35.92 NA NA NA
26 1 default S5_Silky 6102486 NA Healthy/Wild MAW M A Winter Channel 2.2849315 9.5 NA NA NA NA NA CTGTTGAC+ACCTCAGT 5,617,260 1.00 97.81 2.19 1,696 100 93.55 35.88 NA NA NA
27 1 default S5_Longley 6102487 NA Healthy/Wild MAU M A Summer Channel 2.9315068 9.7 NA NA NA NA NA CGCAATCT+ACAGGCAT 2,937,660 1.00 97.71 2.29 887 100 93.75 35.91 NA NA NA
28 1 default S5_Allen 6102488 NA DFT1 MAU M A Summer Channel 1.9095890 6.7 NA 1 TRUE deep TRUE 55959.750 TTGCAGAC+ATCGTGGT 5,288,435 1.00 96.85 3.15 1,597 100 93.42 35.86 NA NA NA
29 1 default S5_Cyan 6102489 NA DFT1 MAW M A Winter Channel 3.3945205 9.1 NA 5 TRUE deep TRUE 206006.422 GTAGGAGT+GTCCTAAG 4,138,600 1.00 98.03 1.97 1,250 100 93.67 35.90 NA NA NA
30 1 default S6_Myanmar 6102490 NA Healthy FAP F A Spring Channel 5.5726027 7.6 NA NA NA NA NA GCACAACT+CTGAACGT 9,604,175 2.00 98.14 1.86 2,900 100 93.93 35.94 NA NA NA
31 1 default S6_Pakana 6102491 NA Healthy MSP M S Spring Channel 1.6712329 7.8 NA NA NA NA NA GTTACGCA+ATGGCGAT 4,383,521 1.00 98.09 1.91 1,324 100 93.90 35.95 NA NA NA
32 1 default S6_Shelob 6102492 NA DFT2 FAP F A Spring Channel 4.6219178 7.2 NA NA NA NA 7455.435 GTCATCGA+GATCCACT 3,184,798 1.00 98.21 1.79 962 100 93.90 35.94 NA NA NA
33 1 default S6_Stuttgart 6102493 NA DFT1 MSP M S Spring Channel 0.5780822 12.7 NA 1 FALSE TRUE 3809.806 AGCGTGTT+CTTCGCAA 3,056,475 1.00 97.50 2.50 923 100 93.95 35.95 NA NA NA
35 1 default S6_Hobbit 6102495 NA Healthy MSP M S Spring Channel 1.6273973 9 NA NA NA NA NA ATATGCGC+ACGATCAG 7,342,414 2.00 97.00 3.00 2,217 100 93.93 35.96 NA NA NA
38 1 default S7_Violet 6102498 NA DFT2 FSU F S Summer Channel 0.8739726 4.6 NA 1 TRUE superficial TRUE 5517.330 CTTGTCGA+CGATGTTC 2,768,682 1.00 98.19 1.81 836 100 93.85 35.93 NA NA NA
39 1 default S7_Lieke 6102499 NA Healthy/Wild FSU F S Summer Channel 0.8657534 4.9 NA NA NA NA NA TTCCAAGG+CTACAAGG 1,800,468 0.00 97.79 2.21 544 100 93.58 35.88 NA NA NA
40 1 default S7_Willie 6102500 NA DFT2 MAA M A Autumn Channel 2.1150685 8.2 NA 2 TRUE deep TRUE 1527.480 TGGACTCT+TCTTACGG 4,539,036 1.00 98.30 1.70 1,371 100 93.84 35.93 NA NA NA
41 1 default S7_Smithers 6102501 NA Healthy/Wild MAA M A Autumn Channel 3.1013699 8.9 NA NA NA NA NA GCGTCATT+CAGACGTT 6,731,177 1.00 98.04 1.96 2,033 100 93.62 35.89 NA NA NA
42 1 default S8_Orange 6102502 NA DFT1 FAU F A Summer Channel 1.9150685 7.1 NA 7 TRUE superficial TRUE 43690.461 GTTGACCT+CAGTGCTT 5,072,309 1.00 97.92 2.08 1,532 100 93.36 35.84 NA NA NA
43 1 default S8_Vinnie 6102503 NA Healthy/Wild MAU M A Summer Channel 2.9150685 8.8 NA NA NA NA NA CGACGTTA+CTCTGGAT 7,901,958 2.00 98.02 1.98 2,386 100 94.09 35.98 NA NA NA
44 1 default S8_Struggles 6102504 NA Healthy/Wild MAW M A Winter Channel 3.2821918 11.1 NA NA NA NA NA ATCGATCG+TGGAAGCA 5,257,820 1.00 95.13 4.87 1,588 100 93.81 35.93 NA NA NA
45 1 default S8_ST67 6102505 NA DFT2 MAW M A Winter Channel 4.2794521 10.2 NA 1 TRUE deep TRUE 102246.432 TTGGACGT+GAAGTGCT 5,476,735 1.00 95.44 4.56 1,654 100 93.21 35.82 NA NA NA
47 1 default S8_Yellow 6102507 NA DFT2 MAU M A Summer Channel 1.8657534 10.5 NA 2 TRUE deep TRUE 139389.671 GAAGTTGG+CGAACAAC 6,469,324 1.00 97.99 2.01 1,954 100 94.00 35.97 NA NA NA
48 1 default S9_Jane 6102508 NA DFT1 FAA F A Autumn Channel 3.1972603 6.1 NA NA NA NA 64646.036 GTTCTCGT+TGTTCCGT 12,489,105 3.00 97.92 2.08 3,772 100 93.54 35.88 NA NA NA
49 1 default S9_Majula 6102509 NA Healthy FAA F A Autumn Channel 3.1150685 6 NA NA NA NA NA ACTCTCGA+CTGTACCA 8,490,270 2.00 97.99 2.01 2,564 100 93.34 35.84 NA NA NA
50 1 default S9_Snoopy 6102510 NA Healthy/Wild MSW M S Winter Channel 1.2794521 6.3 NA NA NA NA NA AACTGAGC+CAATCAGG 1,709,078 0.00 98.04 1.96 516 100 93.06 35.78 NA NA NA
51 1 default S9_Clytemnestra 6102511 NA DFT1 FSP F S Spring Channel 1.6602740 6 NA NA NA NA 34738.080 CATGGCTA+CACACATC 6,141,790 1.00 98.00 2.00 1,855 100 93.42 35.85 NA NA NA
53 1 default S9_Sarabi 6102513 NA Healthy/Wild FSP F S Spring Channel 1.6328767 5.8 NA NA NA NA NA CTTAGGAC+ACTCCTAC 3,945,235 1.00 98.11 1.89 1,191 100 93.55 35.88 NA NA NA
56 1 default S10_Laurasia 6102516 NA DFT2 MSP M S Spring Channel 1.6383562 8 NA NA NA NA 2697.152 TACGCTAC+CGTGTGAT 9,716,148 2.00 97.81 2.19 2,934 100 93.97 35.95 NA NA NA
57 1 default S10_Enchilada 6102517 NA DFT2 MAP M A Spring Channel 3.6438356 9.3 NA 14 FALSE FALSE 301301.905 GATTGCTC+CACTTCAC 11,967,844 2.00 97.82 2.18 3,614 100 93.88 35.94 NA NA NA
58 1 default S11_Baloo 6102518 NA Healthy/Wild MAA M A Autumn Channel 3.1726027 11.5 NA NA NA NA NA CTGATCGT+GCGCATAT 10,923,019 2.00 98.07 1.93 3,299 100 93.51 35.87 NA NA NA
59 1 default S11_Murdoch/Washington 6102519 NA DFT2 MAA M A Autumn Channel 1.4438356 8.9 NA NA NA NA 127176.305 ACTGAGGT+GTCAACAG 2,003,509 0.00 97.82 2.18 605 100 93.39 35.85 NA NA NA
63 1 default S11_DanRhodes 6102523 NA Healthy/Wild MSW M S Winter Channel 1.3917808 6.8 NA NA NA NA NA TCGCTGTT+CAAGTCGT 5,076,673 1.00 97.41 2.59 1,533 100 93.77 35.92 NA NA NA
64 1 default S12_Abe 6102524 NA DFT1 MAA M A Autumn Channel 3.1150685 7.9 NA 1 TRUE deep TRUE 13125.000 GTTGTTCG+CCAACTTC 6,446,467 1.00 97.60 2.40 1,947 100 93.65 35.90 NA NA NA
65 1 default S12_Robin 6102525 NA Healthy/Wild MAA M A Autumn Channel 2.1972603 7.7 NA NA NA NA NA ATGACGTC+CTTCCTTC 6,756,342 1.00 97.12 2.88 2,040 100 92.53 35.68 NA NA NA
66 1 default S12_Lilac 6102526 NA DFT1 MAW M A Winter Channel 3.4109589 9.6 NA 5 TRUE superficial TRUE 37293.844 TATCGGTC+TACCGGAT 4,490,241 1.00 98.15 1.85 1,356 100 93.42 35.85 NA NA NA
67 1 default S12_Eeyore 6102527 NA Healthy/Wild MAW M A Winter Channel 3.2794521 9 NA NA NA NA NA TCAGGCTT+ATCATGCG 3,071,283 1.00 97.28 2.72 928 100 92.94 35.76 NA NA NA
71 1 default S13_Green 6102531 NA DFT1 MAA M A Autumn Channel 3.1534247 7.5 NA 2 TRUE superficial TRUE 7407.222 GTCGAAGA+CCACATTG 2,623,695 1.00 97.38 2.62 792 100 92.94 35.76 NA NA NA
72 1 default S13_Bump 6102532 NA DFT1 MAU M A Summer Channel 3.9068493 9.3 NA NA NA NA 629522.362 AGTTCGTC+ACTCGATC 9,435,053 2.00 98.16 1.84 2,849 100 93.64 35.89 NA NA NA
73 1 default S13_Pangea 6102533 NA Healthy/Wild MAU M A Summer Channel 1.8794521 7.7 NA NA NA NA NA ACCACGAT+GTCTGCAA 1,732,316 0.00 97.57 2.43 523 100 93.82 35.92 NA NA NA
76 1 default S14_Purple 6102536 NA DFT1 FAW F A Winter Channel 2.3945205 6.8 NA 1 TRUE deep TRUE 24938.123 CGCTCTAT+TTGCAACG 5,432,182 1.00 97.81 2.19 1,641 100 93.93 35.95 NA NA NA
126 2 default S22_Ginger 6102586 NA Healthy/Wild MSW M S Winter Channel 1.2712329 7.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 9,742,792 2.10 97.63 2.37 2,942 100 93.00 35.78 NA NA NA
133 2 default S24_Boy 6102593 NA Healthy/Wild MAA M A Autumn Channel 3.1452055 8.3 NA NA NA NA NA CGACGTTA+CTCTGGAT 1,476,427 0.32 97.63 2.37 446 100 93.25 35.82 NA NA NA
138 2 default S24_Shazza 6102598 NA Healthy FAW F A Winter Channel 2.0273973 6.2 NA NA NA NA NA GAGCAGTA+TGAGCTGT 2,693,655 0.58 97.51 2.49 813 100 93.01 35.79 NA NA NA
col <- as.character(as.numeric(grepl("DFT",ssHvDAV$Category)))
col <- gsub("0","lightgreen",col)
col <- gsub("1","pink",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot:Healthy and DFTD infected devils")
mtext("Healthy=green, DFTD=Red")

ssHvDAV$HelvDFT <- grepl("DFT",ssHvDAV$Category)
ssHvDAV$HelvDFT <- factor(ssHvDAV$HelvDFT)
ssHvDAV$MvF <- factor(ssHvDAV$Sex)
ssHvDAV$SubAdvAd <- as.numeric(factor(ssHvDAV$Age,levels=c("S","A"),ordered = TRUE))
ssHvDAV$Season <- factor(ssHvDAV$Season)
str(ssHvDAV)
## 'data.frame':    57 obs. of  34 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S1_LauraGrace" "S1_Sarafina" "S1_Lucy" "S1_Turmeric" ...
##  $ Sample                 : int  6102461 6102463 6102464 6102465 6102466 6102467 6102470 6102471 6102472 6102473 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "Healthy/Wild" "DFT1" "DFT1" "Healthy/Wild" ...
##  $ Sex.Age.Season         : chr  "FAP" "FAP" "FAU" "FAU" ...
##  $ Sex                    : chr  "F" "F" "F" "F" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 2 2 3 3 1 3 3 3 3 1 ...
##  $ Location               : chr  "Channel" "Channel" "Channel" "Channel" ...
##  $ Agebyyear              : num  2.62 2.62 2.92 1.91 5 ...
##  $ Weight                 : chr  "7.2" "6.4" "7.1" "7.8" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA NA 3 NA NA NA NA 4 1 1 ...
##  $ Ulcerated              : logi  NA NA TRUE NA NA NA ...
##  $ UlcerationDepth        : chr  "" "" "deep" "" ...
##  $ Secondary.infection    : logi  NA NA TRUE NA NA NA ...
##  $ Total.tumour.volume    : num  NA 95141 700825 NA NA ...
##  $ Barcode.sequence       : chr  "AGAGTAGC+AAGGCGTA" "ATCCAGAG+TAACGTCG" "AAGCACTG+AGGTCAAC" "GAAGGAAG+GACGTCAT" ...
##  $ PF.Clusters            : chr  "4,511,702" "6,491,488" "6,121,785" "6,479,047" ...
##  $ X..of.the.lane         : num  1 1 1 1 1 1 1 0 1 1 ...
##  $ X..Perfect.barcode     : num  98.3 74.1 98 97.3 98 ...
##  $ X..One.mismatch.barcode: num  1.71 25.93 2 2.72 2.01 ...
##  $ Yield..Mbases.         : chr  "1,363" "1,960" "1,849" "1,957" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.8 93.7 93.8 93.8 94 ...
##  $ Mean.Quality           : num  35.9 35.9 35.9 35.9 36 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ HelvDFT                : Factor w/ 2 levels "FALSE","TRUE": 1 2 2 1 1 1 1 2 2 2 ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 1 1 1 1 1 1 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 2 2 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssHvDAV, design = ~ Season + SubAdvAd + MvF + HelvDFT )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 3 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeHvDAV <-dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 47
length(sig1_dn)
## [1] 38
maplot(dgeHvDAV,"Healthy vs DFTD infected devils")

make_volcano(dgeHvDAV,"Healthy vs DFTD infected devils")

col <- as.character(as.numeric(grepl("DFT",ssHvDAV$Category)))
col <- gsub("0","lightgreen",col)
col <- gsub("1","pink",col)

#The 100 in "sig 1:100, 1:6" can change to number of gene in the significant table
sig[1:100,1:6] %>%
  kbl(caption="Comparison of Healthy vs DFTD infected devils") %>%
  kable_paper("hover", full_width = T)
Comparison of Healthy vs DFTD infected devils
baseMean log2FoldChange lfcSE stat pvalue padj
IL18 1378.89171 1.4216987 0.2278241 6.240335 0.0000000 0.0000001
CD177 4036.44726 2.2675933 0.3955005 5.733478 0.0000000 0.0000013
SIRPA 230.15168 1.4403323 0.2700664 5.333253 0.0000001 0.0000083
TNFRSF1A 7937.40538 0.6563928 0.1244032 5.276334 0.0000001 0.0000085
IL18R1 1505.15210 0.7106447 0.1421932 4.997739 0.0000006 0.0000248
TLR6 2241.01267 0.6599388 0.1328564 4.967308 0.0000007 0.0000248
CXCR2 15626.02598 0.8829527 0.1780537 4.958912 0.0000007 0.0000248
CXCR1 13293.18040 0.8295716 0.1678130 4.943428 0.0000008 0.0000248
CATH3 41831.39927 1.9695546 0.4012904 4.908054 0.0000009 0.0000264
IL10Rb 357.91402 0.8703684 0.1816991 4.790165 0.0000017 0.0000430
CEBPA 1546.03019 0.8162664 0.1735768 4.702625 0.0000026 0.0000602
IL1B 7189.49256 0.7695187 0.1700345 4.525662 0.0000060 0.0001294
SELL 61542.23445 0.5666564 0.1297063 4.368765 0.0000125 0.0002480
TLR2 4878.38882 0.6994241 0.1642979 4.257048 0.0000207 0.0003817
CD14 47238.90486 0.7992779 0.1933159 4.134570 0.0000356 0.0006117
CCR2 5392.98323 0.7714379 0.1903951 4.051774 0.0000508 0.0008013
IgM 44362.50039 -0.7914067 0.1957534 -4.042875 0.0000528 0.0008013
CD40 1709.62513 -0.6188927 0.1552339 -3.986840 0.0000670 0.0009175
FCGR3 2004.31378 0.8128539 0.2039936 3.984704 0.0000676 0.0009175
Lgals3 15424.59804 0.5452460 0.1410398 3.865901 0.0001107 0.0014278
NOD2 1131.39181 0.9314895 0.2418769 3.851089 0.0001176 0.0014447
IgA 11875.23357 -0.8032157 0.2107693 -3.810876 0.0001385 0.0016239
NLRP3 7142.93996 0.6246242 0.1646698 3.793193 0.0001487 0.0016683
CSF1 1107.34083 0.9334962 0.2478123 3.766949 0.0001653 0.0017765
IL3Ra 5574.61380 0.6065126 0.1648544 3.679081 0.0002341 0.0024157
Tap2 13286.56312 -0.4281996 0.1183264 -3.618801 0.0002960 0.0029369
IL13Ra1 3129.07452 0.8650256 0.2404430 3.597632 0.0003211 0.0030686
MS4A1 5307.69234 -0.7278618 0.2030655 -3.584370 0.0003379 0.0031134
TLR4 1759.37709 0.7199813 0.2017320 3.569000 0.0003583 0.0031881
CCL20 21.72043 3.0066104 0.8679418 3.464069 0.0005321 0.0045758
IRF4 391.68295 -0.8209784 0.2447083 -3.354927 0.0007939 0.0066070
IL1RN 1792.35749 0.7901072 0.2383586 3.314784 0.0009171 0.0073944
CD244 1118.27272 -0.6869924 0.2088520 -3.289375 0.0010041 0.0077274
VEGF-A 181.78814 -0.7960213 0.2423643 -3.284401 0.0010220 0.0077274
IL21R 2132.21019 -0.6185323 0.1887360 -3.277235 0.0010483 0.0077274
KIT 1926.29479 -0.7498471 0.2360605 -3.176504 0.0014906 0.0104756
IDO1 926.99455 1.0603486 0.3346408 3.168617 0.0015317 0.0104756
CCL21 12.25281 -2.7704523 0.8749288 -3.166489 0.0015429 0.0104756
IL7RA 2601.36757 -0.5879152 0.1876978 -3.132244 0.0017348 0.0112587
cGAS 305.53336 0.5119667 0.1638031 3.125501 0.0017750 0.0112587
CCLD7 386.32632 -0.8248264 0.2640995 -3.123166 0.0017892 0.0112587
CD68 5148.75966 0.5270435 0.1706686 3.088111 0.0020143 0.0116402
IL5Ra 759.48031 -0.6883783 0.2229492 -3.087601 0.0020178 0.0116402
IL17RA 5030.35130 0.4178305 0.1353635 3.086728 0.0020237 0.0116402
GZMB 77.73320 -0.8442568 0.2735968 -3.085769 0.0020303 0.0116402
FCMR 23733.50231 -0.7326530 0.2406091 -3.044993 0.0023269 0.0130367
CD3e 9187.52833 -0.5089037 0.1674664 -3.038840 0.0023749 0.0130367
TLR9 549.28809 -0.4963321 0.1637184 -3.031621 0.0024324 0.0130744
CXCL16 4738.52901 0.8099241 0.2688476 3.012577 0.0025904 0.0136392
TLR8 4406.94924 0.4507645 0.1502565 2.999967 0.0027001 0.0139325
Spi1 40971.81009 0.5951804 0.2016170 2.952034 0.0031569 0.0159701
TNFSF13 504.93798 0.4468982 0.1517142 2.945658 0.0032227 0.0159895
CCR3 6015.04603 -0.6069859 0.2088550 -2.906255 0.0036578 0.0178060
CCLD5 307.67215 -0.7145179 0.2532231 -2.821693 0.0047771 0.0228239
TBX21 1030.11918 -0.6019088 0.2148120 -2.802026 0.0050783 0.0238218
IL4I0 109.48549 -1.1552694 0.4140615 -2.790091 0.0052693 0.0241643
CD3d 2941.03788 -0.5445226 0.1954596 -2.785858 0.0053386 0.0241643
STAT4 822.70369 -0.5962374 0.2153705 -2.768426 0.0056328 0.0250561
STAT5A 11504.87208 0.1993526 0.0724774 2.750547 0.0059496 0.0253656
CD22 7391.09535 -0.3975971 0.1446730 -2.748247 0.0059915 0.0253656
KLRK1 127.70924 -0.8030980 0.2922557 -2.747929 0.0059973 0.0253656
GUSB 3743.34687 0.3574039 0.1307987 2.732472 0.0062861 0.0261583
HPRT 1383.34298 0.4270392 0.1569867 2.720225 0.0065237 0.0265173
C3 50230.44991 0.3751699 0.1380576 2.717489 0.0065779 0.0265173
CXCR3 1268.03841 0.3301578 0.1225246 2.694626 0.0070468 0.0279703
IL11Ra 868.84154 -0.4293178 0.1611256 -2.664491 0.0077105 0.0301410
FCGR2B 758.37919 0.7344109 0.2762461 2.658538 0.0078480 0.0302208
PDCD1 838.36148 -0.5222280 0.1968652 -2.652719 0.0079846 0.0302947
CD37 23957.10438 0.2058992 0.0785338 2.621792 0.0087469 0.0327058
STAT1 4556.40471 -0.3647814 0.1398807 -2.607804 0.0091125 0.0335862
CD40LG 518.11160 -0.3817034 0.1474343 -2.588973 0.0096263 0.0347910
LTB 9370.96982 -0.5525602 0.2136720 -2.586021 0.0097091 0.0347910
MRC1 1697.86388 0.5573935 0.2169524 2.569198 0.0101934 0.0356522
NLCR5 5102.47684 -0.3591879 0.1398653 -2.568099 0.0102258 0.0356522
TCRa 4848.11526 -0.3827734 0.1510140 -2.534689 0.0112547 0.0386591
IgE 7126.86220 -0.6575153 0.2598296 -2.530563 0.0113880 0.0386591
CD19 2149.43290 -0.5530937 0.2201509 -2.512340 0.0119934 0.0401855
LAMP1 18568.59604 0.2741809 0.1101358 2.489480 0.0127930 0.0422512
FCER2 68.08283 0.8681775 0.3492985 2.485488 0.0129374 0.0422512
LTa 158.97038 -0.5176755 0.2089638 -2.477346 0.0132364 0.0426873
CD4 2011.71083 -0.2791259 0.1129334 -2.471597 0.0134511 0.0428443
FGF2 29.42641 -0.8305677 0.3382594 -2.455417 0.0140721 0.0442757
STAT3 5607.51291 0.4616450 0.1899225 2.430702 0.0150696 0.0466590
MME 57.45498 1.8071972 0.7443808 2.427786 0.0151913 0.0466590
TNFSF18 29.42332 2.0926135 0.8667106 2.414432 0.0157598 0.0478355
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
write.table(dge,file="dgeHvDAV.tsv",sep="\t")

mx <- sig[,7:ncol(sig)]
mx <- head(mx,30)
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(as.matrix(mx),trace="none",scale="row",
          col=colfunc(25),ColSideColors=col,mar=c(5,12)) 

ssDFTAV <- ss[which(grepl("DFT1",ss$Category) + grepl("DFT2",ss$Category)>0),]
ssDFTAV
##    Lane Project              Client.ID  Sample  X Category Sex.Age.Season Sex
## 3     1 default            S1_Sarafina 6102463 NA     DFT1            FAP   F
## 4     1 default                S1_Lucy 6102464 NA     DFT1            FAU   F
## 11    1 default                S2_Hope 6102471 NA     DFT1            FAU   F
## 12    1 default               S2_Sally 6102472 NA     DFT1            FAU   F
## 13    1 default                 S3_Apu 6102473 NA     DFT1            MAA   M
## 14    1 default              S3_Simone 6102474 NA     DFT1            FAW   F
## 20    1 default              S4_Wiggum 6102480 NA     DFT1            MAA   M
## 22    1 default                S4_Pooh 6102482 NA     DFT1            MAA   M
## 23    1 default            S4_Milhouse 6102483 NA     DFT1            MAA   M
## 28    1 default               S5_Allen 6102488 NA     DFT1            MAU   M
## 29    1 default                S5_Cyan 6102489 NA     DFT1            MAW   M
## 32    1 default              S6_Shelob 6102492 NA     DFT2            FAP   F
## 33    1 default           S6_Stuttgart 6102493 NA     DFT1            MSP   M
## 38    1 default              S7_Violet 6102498 NA     DFT2            FSU   F
## 40    1 default              S7_Willie 6102500 NA     DFT2            MAA   M
## 42    1 default              S8_Orange 6102502 NA     DFT1            FAU   F
## 45    1 default                S8_ST67 6102505 NA     DFT2            MAW   M
## 47    1 default              S8_Yellow 6102507 NA     DFT2            MAU   M
## 48    1 default                S9_Jane 6102508 NA     DFT1            FAA   F
## 51    1 default        S9_Clytemnestra 6102511 NA     DFT1            FSP   F
## 52    1 default                S9_Zeus 6102512 NA     DFT2            MSW   M
## 56    1 default           S10_Laurasia 6102516 NA     DFT2            MSP   M
## 57    1 default          S10_Enchilada 6102517 NA     DFT2            MAP   M
## 59    1 default S11_Murdoch/Washington 6102519 NA     DFT2            MAA   M
## 64    1 default                S12_Abe 6102524 NA     DFT1            MAA   M
## 66    1 default              S12_Lilac 6102526 NA     DFT1            MAW   M
## 71    1 default              S13_Green 6102531 NA     DFT1            MAA   M
## 72    1 default               S13_Bump 6102532 NA     DFT1            MAU   M
## 76    1 default             S14_Purple 6102536 NA     DFT1            FAW   F
##    Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 3    A Spring  Channel 2.6191781    6.4  NA                NA        NA
## 4    A Summer  Channel 2.9178082    7.1  NA                 3      TRUE
## 11   A Summer  Channel 2.9315068    6.4  NA                 4      TRUE
## 12   A Summer  Channel 2.9945205      7  NA                 1      TRUE
## 13   A Autumn  Channel 3.1150685    9.5  NA                 1     FALSE
## 14   A Winter  Channel 3.2739726   10.2  NA                 1      TRUE
## 20   A Autumn  Channel 3.1178082    8.3  NA                 2     FALSE
## 22   A Autumn  Channel 4.1863014   11.8  NA                 1     FALSE
## 23   A Autumn  Channel 4.1013699     11  NA                 1      TRUE
## 28   A Summer  Channel 1.9095890    6.7  NA                 1      TRUE
## 29   A Winter  Channel 3.3945205    9.1  NA                 5      TRUE
## 32   A Spring  Channel 4.6219178    7.2  NA                NA        NA
## 33   S Spring  Channel 0.5780822   12.7  NA                 1     FALSE
## 38   S Summer  Channel 0.8739726    4.6  NA                 1      TRUE
## 40   A Autumn  Channel 2.1150685    8.2  NA                 2      TRUE
## 42   A Summer  Channel 1.9150685    7.1  NA                 7      TRUE
## 45   A Winter  Channel 4.2794521   10.2  NA                 1      TRUE
## 47   A Summer  Channel 1.8657534   10.5  NA                 2      TRUE
## 48   A Autumn  Channel 3.1972603    6.1  NA                NA        NA
## 51   S Spring  Channel 1.6602740      6  NA                NA        NA
## 52   S Winter  Channel 1.3479452    7.3  NA                NA        NA
## 56   S Spring  Channel 1.6383562      8  NA                NA        NA
## 57   A Spring  Channel 3.6438356    9.3  NA                14     FALSE
## 59   A Autumn  Channel 1.4438356    8.9  NA                NA        NA
## 64   A Autumn  Channel 3.1150685    7.9  NA                 1      TRUE
## 66   A Winter  Channel 3.4109589    9.6  NA                 5      TRUE
## 71   A Autumn  Channel 3.1534247    7.5  NA                 2      TRUE
## 72   A Summer  Channel 3.9068493    9.3  NA                NA        NA
## 76   A Winter  Channel 2.3945205    6.8  NA                 1      TRUE
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 3                                   NA           95140.790 ATCCAGAG+TAACGTCG
## 4             deep                TRUE          700825.170 AAGCACTG+AGGTCAAC
## 11            deep                TRUE          103815.530 AGCACTTC+ACGTCCAA
## 12            deep               FALSE            1588.272 CGTTGCAA+ATAGAGCG
## 13     superficial                TRUE             200.000 CCTTGATC+GATGGAGT
## 14     superficial                TRUE            2670.678 CGGTTGTT+GTGGTATG
## 20                               FALSE            7272.309 GTGAAGTG+GAGCAATC
## 22                               FALSE            7577.856 CTTCGACT+GATCTTGC
## 23            deep                TRUE             480.000 AACCGTTC+CTAGCTCA
## 28            deep                TRUE           55959.750 TTGCAGAC+ATCGTGGT
## 29            deep                TRUE          206006.422 GTAGGAGT+GTCCTAAG
## 32                                  NA            7455.435 GTCATCGA+GATCCACT
## 33                                TRUE            3809.806 AGCGTGTT+CTTCGCAA
## 38     superficial                TRUE            5517.330 CTTGTCGA+CGATGTTC
## 40            deep                TRUE            1527.480 TGGACTCT+TCTTACGG
## 42     superficial                TRUE           43690.461 GTTGACCT+CAGTGCTT
## 45            deep                TRUE          102246.432 TTGGACGT+GAAGTGCT
## 47            deep                TRUE          139389.671 GAAGTTGG+CGAACAAC
## 48                                  NA           64646.036 GTTCTCGT+TGTTCCGT
## 51                                  NA           34738.080 CATGGCTA+CACACATC
## 52                                  NA             100.000 CGTGTGTA+CCAACGAA
## 56                                  NA            2697.152 TACGCTAC+CGTGTGAT
## 57                               FALSE          301301.905 GATTGCTC+CACTTCAC
## 59                                  NA          127176.305 ACTGAGGT+GTCAACAG
## 64            deep                TRUE           13125.000 GTTGTTCG+CCAACTTC
## 66     superficial                TRUE           37293.844 TATCGGTC+TACCGGAT
## 71     superficial                TRUE            7407.222 GTCGAAGA+CCACATTG
## 72                                  NA          629522.362 AGTTCGTC+ACTCGATC
## 76            deep                TRUE           24938.123 CGCTCTAT+TTGCAACG
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 3    6,491,488              1              74.07                   25.93
## 4    6,121,785              1              98.00                    2.00
## 11   1,971,776              0              97.96                    2.04
## 12   2,429,449              1              97.42                    2.58
## 13   4,939,580              1              96.94                    3.06
## 14   4,015,027              1              95.91                    4.09
## 20   4,201,355              1              97.17                    2.83
## 22   3,821,151              1              97.31                    2.69
## 23  10,492,900              2              98.13                    1.87
## 28   5,288,435              1              96.85                    3.15
## 29   4,138,600              1              98.03                    1.97
## 32   3,184,798              1              98.21                    1.79
## 33   3,056,475              1              97.50                    2.50
## 38   2,768,682              1              98.19                    1.81
## 40   4,539,036              1              98.30                    1.70
## 42   5,072,309              1              97.92                    2.08
## 45   5,476,735              1              95.44                    4.56
## 47   6,469,324              1              97.99                    2.01
## 48  12,489,105              3              97.92                    2.08
## 51   6,141,790              1              98.00                    2.00
## 52     699,953              0              97.64                    2.36
## 56   9,716,148              2              97.81                    2.19
## 57  11,967,844              2              97.82                    2.18
## 59   2,003,509              0              97.82                    2.18
## 64   6,446,467              1              97.60                    2.40
## 66   4,490,241              1              98.15                    1.85
## 71   2,623,695              1              97.38                    2.62
## 72   9,435,053              2              98.16                    1.84
## 76   5,432,182              1              97.81                    2.19
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 3           1,960           100     93.74        35.92  NA  NA  NA
## 4           1,849           100     93.84        35.93  NA  NA  NA
## 11            595           100     93.62        35.88  NA  NA  NA
## 12            734           100     93.78        35.93  NA  NA  NA
## 13          1,492           100     93.71        35.91  NA  NA  NA
## 14          1,213           100     93.42        35.86  NA  NA  NA
## 20          1,269           100     93.64        35.90  NA  NA  NA
## 22          1,154           100     93.60        35.89  NA  NA  NA
## 23          3,169           100     93.80        35.92  NA  NA  NA
## 28          1,597           100     93.42        35.86  NA  NA  NA
## 29          1,250           100     93.67        35.90  NA  NA  NA
## 32            962           100     93.90        35.94  NA  NA  NA
## 33            923           100     93.95        35.95  NA  NA  NA
## 38            836           100     93.85        35.93  NA  NA  NA
## 40          1,371           100     93.84        35.93  NA  NA  NA
## 42          1,532           100     93.36        35.84  NA  NA  NA
## 45          1,654           100     93.21        35.82  NA  NA  NA
## 47          1,954           100     94.00        35.97  NA  NA  NA
## 48          3,772           100     93.54        35.88  NA  NA  NA
## 51          1,855           100     93.42        35.85  NA  NA  NA
## 52            211           100     93.33        35.84  NA  NA  NA
## 56          2,934           100     93.97        35.95  NA  NA  NA
## 57          3,614           100     93.88        35.94  NA  NA  NA
## 59            605           100     93.39        35.85  NA  NA  NA
## 64          1,947           100     93.65        35.90  NA  NA  NA
## 66          1,356           100     93.42        35.85  NA  NA  NA
## 71            792           100     92.94        35.76  NA  NA  NA
## 72          2,849           100     93.64        35.89  NA  NA  NA
## 76          1,641           100     93.93        35.95  NA  NA  NA
ssDFTAV <- ssDFTAV[ssDFTAV$Sample %in% colnames(x),]

dim(ssDFTAV)
## [1] 28 31
x1 <- x[,which(colnames(x) %in% ssDFTAV$Sample)]
dim(x1)
## [1] 310  28
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 258  28
ssDFTAV %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
3 1 default S1_Sarafina 6102463 NA DFT1 FAP F A Spring Channel 2.6191781 6.4 NA NA NA NA 95140.790 ATCCAGAG+TAACGTCG 6,491,488 1 74.07 25.93 1,960 100 93.74 35.92 NA NA NA
4 1 default S1_Lucy 6102464 NA DFT1 FAU F A Summer Channel 2.9178082 7.1 NA 3 TRUE deep TRUE 700825.170 AAGCACTG+AGGTCAAC 6,121,785 1 98.00 2.00 1,849 100 93.84 35.93 NA NA NA
11 1 default S2_Hope 6102471 NA DFT1 FAU F A Summer Channel 2.9315068 6.4 NA 4 TRUE deep TRUE 103815.530 AGCACTTC+ACGTCCAA 1,971,776 0 97.96 2.04 595 100 93.62 35.88 NA NA NA
12 1 default S2_Sally 6102472 NA DFT1 FAU F A Summer Channel 2.9945205 7 NA 1 TRUE deep FALSE 1588.272 CGTTGCAA+ATAGAGCG 2,429,449 1 97.42 2.58 734 100 93.78 35.93 NA NA NA
13 1 default S3_Apu 6102473 NA DFT1 MAA M A Autumn Channel 3.1150685 9.5 NA 1 FALSE superficial TRUE 200.000 CCTTGATC+GATGGAGT 4,939,580 1 96.94 3.06 1,492 100 93.71 35.91 NA NA NA
14 1 default S3_Simone 6102474 NA DFT1 FAW F A Winter Channel 3.2739726 10.2 NA 1 TRUE superficial TRUE 2670.678 CGGTTGTT+GTGGTATG 4,015,027 1 95.91 4.09 1,213 100 93.42 35.86 NA NA NA
20 1 default S4_Wiggum 6102480 NA DFT1 MAA M A Autumn Channel 3.1178082 8.3 NA 2 FALSE FALSE 7272.309 GTGAAGTG+GAGCAATC 4,201,355 1 97.17 2.83 1,269 100 93.64 35.90 NA NA NA
22 1 default S4_Pooh 6102482 NA DFT1 MAA M A Autumn Channel 4.1863014 11.8 NA 1 FALSE FALSE 7577.856 CTTCGACT+GATCTTGC 3,821,151 1 97.31 2.69 1,154 100 93.60 35.89 NA NA NA
23 1 default S4_Milhouse 6102483 NA DFT1 MAA M A Autumn Channel 4.1013699 11 NA 1 TRUE deep TRUE 480.000 AACCGTTC+CTAGCTCA 10,492,900 2 98.13 1.87 3,169 100 93.80 35.92 NA NA NA
28 1 default S5_Allen 6102488 NA DFT1 MAU M A Summer Channel 1.9095890 6.7 NA 1 TRUE deep TRUE 55959.750 TTGCAGAC+ATCGTGGT 5,288,435 1 96.85 3.15 1,597 100 93.42 35.86 NA NA NA
29 1 default S5_Cyan 6102489 NA DFT1 MAW M A Winter Channel 3.3945205 9.1 NA 5 TRUE deep TRUE 206006.422 GTAGGAGT+GTCCTAAG 4,138,600 1 98.03 1.97 1,250 100 93.67 35.90 NA NA NA
32 1 default S6_Shelob 6102492 NA DFT2 FAP F A Spring Channel 4.6219178 7.2 NA NA NA NA 7455.435 GTCATCGA+GATCCACT 3,184,798 1 98.21 1.79 962 100 93.90 35.94 NA NA NA
33 1 default S6_Stuttgart 6102493 NA DFT1 MSP M S Spring Channel 0.5780822 12.7 NA 1 FALSE TRUE 3809.806 AGCGTGTT+CTTCGCAA 3,056,475 1 97.50 2.50 923 100 93.95 35.95 NA NA NA
38 1 default S7_Violet 6102498 NA DFT2 FSU F S Summer Channel 0.8739726 4.6 NA 1 TRUE superficial TRUE 5517.330 CTTGTCGA+CGATGTTC 2,768,682 1 98.19 1.81 836 100 93.85 35.93 NA NA NA
40 1 default S7_Willie 6102500 NA DFT2 MAA M A Autumn Channel 2.1150685 8.2 NA 2 TRUE deep TRUE 1527.480 TGGACTCT+TCTTACGG 4,539,036 1 98.30 1.70 1,371 100 93.84 35.93 NA NA NA
42 1 default S8_Orange 6102502 NA DFT1 FAU F A Summer Channel 1.9150685 7.1 NA 7 TRUE superficial TRUE 43690.461 GTTGACCT+CAGTGCTT 5,072,309 1 97.92 2.08 1,532 100 93.36 35.84 NA NA NA
45 1 default S8_ST67 6102505 NA DFT2 MAW M A Winter Channel 4.2794521 10.2 NA 1 TRUE deep TRUE 102246.432 TTGGACGT+GAAGTGCT 5,476,735 1 95.44 4.56 1,654 100 93.21 35.82 NA NA NA
47 1 default S8_Yellow 6102507 NA DFT2 MAU M A Summer Channel 1.8657534 10.5 NA 2 TRUE deep TRUE 139389.671 GAAGTTGG+CGAACAAC 6,469,324 1 97.99 2.01 1,954 100 94.00 35.97 NA NA NA
48 1 default S9_Jane 6102508 NA DFT1 FAA F A Autumn Channel 3.1972603 6.1 NA NA NA NA 64646.036 GTTCTCGT+TGTTCCGT 12,489,105 3 97.92 2.08 3,772 100 93.54 35.88 NA NA NA
51 1 default S9_Clytemnestra 6102511 NA DFT1 FSP F S Spring Channel 1.6602740 6 NA NA NA NA 34738.080 CATGGCTA+CACACATC 6,141,790 1 98.00 2.00 1,855 100 93.42 35.85 NA NA NA
56 1 default S10_Laurasia 6102516 NA DFT2 MSP M S Spring Channel 1.6383562 8 NA NA NA NA 2697.152 TACGCTAC+CGTGTGAT 9,716,148 2 97.81 2.19 2,934 100 93.97 35.95 NA NA NA
57 1 default S10_Enchilada 6102517 NA DFT2 MAP M A Spring Channel 3.6438356 9.3 NA 14 FALSE FALSE 301301.905 GATTGCTC+CACTTCAC 11,967,844 2 97.82 2.18 3,614 100 93.88 35.94 NA NA NA
59 1 default S11_Murdoch/Washington 6102519 NA DFT2 MAA M A Autumn Channel 1.4438356 8.9 NA NA NA NA 127176.305 ACTGAGGT+GTCAACAG 2,003,509 0 97.82 2.18 605 100 93.39 35.85 NA NA NA
64 1 default S12_Abe 6102524 NA DFT1 MAA M A Autumn Channel 3.1150685 7.9 NA 1 TRUE deep TRUE 13125.000 GTTGTTCG+CCAACTTC 6,446,467 1 97.60 2.40 1,947 100 93.65 35.90 NA NA NA
66 1 default S12_Lilac 6102526 NA DFT1 MAW M A Winter Channel 3.4109589 9.6 NA 5 TRUE superficial TRUE 37293.844 TATCGGTC+TACCGGAT 4,490,241 1 98.15 1.85 1,356 100 93.42 35.85 NA NA NA
71 1 default S13_Green 6102531 NA DFT1 MAA M A Autumn Channel 3.1534247 7.5 NA 2 TRUE superficial TRUE 7407.222 GTCGAAGA+CCACATTG 2,623,695 1 97.38 2.62 792 100 92.94 35.76 NA NA NA
72 1 default S13_Bump 6102532 NA DFT1 MAU M A Summer Channel 3.9068493 9.3 NA NA NA NA 629522.362 AGTTCGTC+ACTCGATC 9,435,053 2 98.16 1.84 2,849 100 93.64 35.89 NA NA NA
76 1 default S14_Purple 6102536 NA DFT1 FAW F A Winter Channel 2.3945205 6.8 NA 1 TRUE deep TRUE 24938.123 CGCTCTAT+TTGCAACG 5,432,182 1 97.81 2.19 1,641 100 93.93 35.95 NA NA NA
col <- as.character(as.numeric(grepl("DFT2",ssDFTAV$Category)))
col <- gsub("0","red",col)
col <- gsub("1","darkred",col)

mds<-plotMDS(x1,pch=18,cex=4,col=col,main="MDS plot:DFT1 and DFT2 infected devils")
mtext("DFT1=Red, DFT2=dark Red")

ssDFTAV$DFTDStat <- grepl("DFT2",ssDFTAV$Category)
ssDFTAV$MvF <- factor(ssDFTAV$Sex)
ssDFTAV$SubAdvAd <- as.numeric(factor(ssDFTAV$Age,levels=c("S","A"),ordered = TRUE))
ssDFTAV$Season <- factor(ssDFTAV$Season)
str(ssDFTAV)
## 'data.frame':    28 obs. of  34 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S1_Sarafina" "S1_Lucy" "S2_Hope" "S2_Sally" ...
##  $ Sample                 : int  6102463 6102464 6102471 6102472 6102473 6102474 6102480 6102482 6102483 6102488 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "DFT1" "DFT1" "DFT1" "DFT1" ...
##  $ Sex.Age.Season         : chr  "FAP" "FAU" "FAU" "FAU" ...
##  $ Sex                    : chr  "F" "F" "F" "F" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 2 3 3 3 1 4 1 1 1 3 ...
##  $ Location               : chr  "Channel" "Channel" "Channel" "Channel" ...
##  $ Agebyyear              : num  2.62 2.92 2.93 2.99 3.12 ...
##  $ Weight                 : chr  "6.4" "7.1" "6.4" "7" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA 3 4 1 1 1 2 1 1 1 ...
##  $ Ulcerated              : logi  NA TRUE TRUE TRUE FALSE TRUE ...
##  $ UlcerationDepth        : chr  "" "deep" "deep" "deep" ...
##  $ Secondary.infection    : logi  NA TRUE TRUE FALSE TRUE TRUE ...
##  $ Total.tumour.volume    : num  95141 700825 103816 1588 200 ...
##  $ Barcode.sequence       : chr  "ATCCAGAG+TAACGTCG" "AAGCACTG+AGGTCAAC" "AGCACTTC+ACGTCCAA" "CGTTGCAA+ATAGAGCG" ...
##  $ PF.Clusters            : chr  "6,491,488" "6,121,785" "1,971,776" "2,429,449" ...
##  $ X..of.the.lane         : num  1 1 0 1 1 1 1 1 2 1 ...
##  $ X..Perfect.barcode     : num  74.1 98 98 97.4 96.9 ...
##  $ X..One.mismatch.barcode: num  25.93 2 2.04 2.58 3.06 ...
##  $ Yield..Mbases.         : chr  "1,960" "1,849" "595" "734" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.7 93.8 93.6 93.8 93.7 ...
##  $ Mean.Quality           : num  35.9 35.9 35.9 35.9 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ DFTDStat               : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 1 2 1 2 2 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 2 2 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssDFTAV, design = ~ Season + SubAdvAd + MvF + DFTDStat )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeDFTAV <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 0
length(sig1_dn)
## [1] 0
maplot(dgeDFTAV,"DFT1 vs DFT2 infected devils")

make_volcano(dgeDFTAV,"DFT1 vs DFT2 infected devils")

ssWvCAV <- ss[which(grepl("Wild",ss$Category) + grepl("Captive",ss$Category)>0),]
ssWvCAV
##     Lane Project      Client.ID  Sample  X     Category Sex.Age.Season Sex Age
## 1      1 default  S1_LauraGrace 6102461 NA Healthy/Wild            FAP   F   A
## 5      1 default    S1_Turmeric 6102465 NA Healthy/Wild            FAU   F   A
## 7      1 default     S2_Belinda 6102467 NA Healthy/Wild            FAU   F   A
## 8      1 default      S2_B99008 6102468 NA      Captive            FAU   F   A
## 9      1 default      S2_Bonney 6102469 NA      Captive            FAU   F   A
## 10     1 default       S2_Rosie 6102470 NA Healthy/Wild            FAU   F   A
## 15     1 default        S3_ST62 6102475 NA Healthy/Wild            FAW   F   A
## 16     1 default      S3_Jessie 6102476 NA      Captive            FAW   F   A
## 17     1 default    S3_McCauley 6102477 NA      Captive            MAA   M   A
## 24     1 default      S5_Fenton 6102484 NA      Captive            MAU   M   A
## 25     1 default S5_Bryan Adams 6102485 NA      Captive            MAW   M   A
## 26     1 default       S5_Silky 6102486 NA Healthy/Wild            MAW   M   A
## 27     1 default     S5_Longley 6102487 NA Healthy/Wild            MAU   M   A
## 34     1 default         S6_Ben 6102494 NA         Wild            MAU   M   A
## 36     1 default       S7_Fredo 6102496 NA      Captive            MAA   M   A
## 37     1 default      S7_Piglet 6102497 NA      Captive            FSU   F   S
## 39     1 default       S7_Lieke 6102499 NA Healthy/Wild            FSU   F   S
## 41     1 default    S7_Smithers 6102501 NA Healthy/Wild            MAA   M   A
## 43     1 default      S8_Vinnie 6102503 NA Healthy/Wild            MAU   M   A
## 44     1 default   S8_Struggles 6102504 NA Healthy/Wild            MAW   M   A
## 46     1 default      S8_SusieQ 6102506 NA Healthy/Wild            FAU   F   A
## 50     1 default      S9_Snoopy 6102510 NA Healthy/Wild            MSW   M   S
## 53     1 default      S9_Sarabi 6102513 NA Healthy/Wild            FSP   F   S
## 54     1 default    S10_McMahon 6102514 NA      Captive            MSP   M   S
## 55     1 default      S10_Logan 6102515 NA      Captive            MAU   M   A
## 58     1 default      S11_Baloo 6102518 NA Healthy/Wild            MAA   M   A
## 60     1 default       S11_Xuki 6102520 NA      Captive            MAA   M   A
## 61     1 default   S11_Kalamata 6102521 NA      Captive            MSW   M   S
## 63     1 default  S11_DanRhodes 6102523 NA Healthy/Wild            MSW   M   S
## 65     1 default      S12_Robin 6102525 NA Healthy/Wild            MAA   M   A
## 67     1 default     S12_Eeyore 6102527 NA Healthy/Wild            MAW   M   A
## 68     1 default      S12_Wally 6102528 NA      Captive            MAA   M   A
## 69     1 default        S12_Naz 6102529 NA      Captive            MAW   M   A
## 70     1 default     S13_Humbug 6102530 NA      Captive            MAU   M   A
## 73     1 default     S13_Pangea 6102533 NA Healthy/Wild            MAU   M   A
## 74     1 default     S13_Finbar 6102534 NA Healthy/Wild            MAA   M   A
## 75     1 default     S13_Xerxes 6102535 NA      Captive            MAA   M   A
## 78     1 default     S14_Catani 6102538 NA      Captive            FAU   F   A
## 79     2 default      S15_Halls 6102539 NA         Wild            FAU   F   A
## 80     2 default    S15_Jessica 6102540 NA         Wild            FAP   F   A
## 81     2 default     S15_Amelia 6102541 NA      Captive            FAU   F   A
## 82     2 default     S15_London 6102542 NA      Captive            FAU   F   A
## 83     2 default      S15_Elyse 6102543 NA      Captive            FAP   F   A
## 84     2 default   S15_Munchkin 6102544 NA         Wild            FAU   F   A
## 85     2 default  S16_Pelverata 6102545 NA         Wild            FAU   F   A
## 86     2 default     S16_Lizzie 6102546 NA         Wild            FAU   F   A
## 87     2 default     S16_Marley 6102547 NA      Captive            FAU   F   A
## 88     2 default      S16_Milla 6102548 NA      Captive            FAU   F   A
## 89     2 default S16_Maleficent 6102549 NA      Captive            FAU   F   A
## 90     2 default    S16_Lebanon 6102550 NA         Wild            FAU   F   A
## 91     2 default    S17_Radiata 6102551 NA         Wild            FSU   F   S
## 92     2 default     S17_Shenzi 6102552 NA         Wild            FAU   F   A
## 93     2 default     S17_Anirak 6102553 NA      Captive            FSW   F   S
## 94     2 default       S17_Poly 6102554 NA      Captive            FSU   F   S
## 95     2 default  S17_Vernicosa 6102555 NA         Wild            FSW   F   S
## 96     2 default     S17_Methyl 6102556 NA      Captive            FSU   F   S
## 97     2 default    S18_Paprika 6102557 NA         Wild            FSW   F   S
## 98     2 default       S18_Zara 6102558 NA      Captive            FSW   F   S
## 99     2 default       S18_Maze 6102559 NA      Captive            FSW   F   S
## 100    2 default    S18_Delores 6102560 NA      Captive            FSW   F   S
## 101    2 default      S18_Haiko 6102561 NA         Wild            FSW   F   S
## 102    2 default   S18_Hermione 6102562 NA         Wild            FSW   F   S
## 103    2 default      S19_Tammy 6102563 NA         Wild            FSW   F   S
## 104    2 default    S19_Morocco 6102564 NA      Captive            MAU   M   A
## 105    2 default   S19_Pecorino 6102565 NA      Captive            FSW   F   S
## 106    2 default      S19_Hooch 6102566 NA      Captive            MSA   M   S
## 107    2 default     S19_Darwin 6102567 NA         Wild            MAU   M   A
## 108    2 default     S19_Tantor 6102568 NA         Wild            MSA   M   S
## 109    2 default      S20_Muasy 6102569 NA      Captive            MSU   M   S
## 110    2 default       S20_Fuse 6102570 NA      Captive            MSU   M   S
## 111    2 default     S20_Joseph 6102571 NA      Captive            MSU   M   S
## 112    2 default     S20_Hudson 6102572 NA         Wild            MSU   M   S
## 113    2 default       S20_Mace 6102573 NA         Wild            MSU   M   S
## 114    2 default       S20_Mint 6102574 NA         Wild            MSU   M   S
## 115    2 default  S21_Sylvester 6102575 NA         Wild            MAW   M   A
## 116    2 default      S21_Moama 6102576 NA      Captive            MAW   M   A
## 117    2 default     S21_Nauset 6102577 NA      Captive            MSW   M   S
## 118    2 default     S21_Graham 6102578 NA      Captive            MSW   M   S
## 119    2 default      S21_Harry 6102579 NA         Wild            MSW   M   S
## 120    2 default       S21_Thor 6102580 NA         Wild            MSW   M   S
## 121    2 default      S22_Yanni 6102581 NA      Captive            MSW   M   S
## 122    2 default    S22_Gherkin 6102582 NA      Captive            MSW   M   S
## 123    2 default       S22_Utah 6102583 NA         Wild            MSW   M   S
## 124    2 default    S22_Stilton 6102584 NA      Captive            MSW   M   S
## 125    2 default S22_Wellington 6102585 NA         Wild            MSW   M   S
## 126    2 default     S22_Ginger 6102586 NA Healthy/Wild            MSW   M   S
## 127    2 default     S23_Meliza 6102587 NA  Ignore-Wild            FSW   F   S
## 128    2 default     S23_Osiris 6102588 NA      Captive            MSW   M   S
## 129    2 default     S23_X-boxx 6102589 NA      Captive            FSW   F   S
## 130    2 default     S23_Quince 6102590 NA      Captive            MSW   M   S
## 131    2 default    S23_Saffron 6102591 NA         Wild            MSW   M   S
## 132    2 default    S23_Gandalf 6102592 NA         Wild            MSW   M   S
## 133    2 default        S24_Boy 6102593 NA Healthy/Wild            MAA   M   A
## 134    2 default       S24_ST74 6102594 NA         Wild            MAW   M   A
## 135    2 default     S24_Malfoy 6102595 NA      Captive            MAW   M   A
## 136    2 default   S24_Licorice 6102596 NA      Captive            FSA   F   S
## 137    2 default       S24_Lisa 6102597 NA         Wild            FSA   F   S
## 139    2 default       S25_Tofu 6102599 NA      Captive            FAU   F   A
## 140    2 default    S25_Colette 6102600 NA      Captive            FAP   F   A
## 141    2 default S25_CannonBall 6102601 NA      Captive            MSW   M   S
## 142    2 default  S25_Cornelius 6102602 NA      Captive            MAU   M   A
## 143    2 default    S25_Mardook 6102603 NA      Captive            MAW   M   A
## 144    2 default    S25_Negroni 6102604 NA      Captive            FSP   F   S
##     Season    Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1   Spring     Channel 2.6219178    7.2  NA                NA        NA
## 5   Summer     Channel 1.9095890    7.8  NA                NA        NA
## 7   Summer     Channel 1.8657534    6.6  NA                NA        NA
## 8   Summer     Monarto 3.7369863   8.12  NA                NA        NA
## 9   Summer Healesville 2.5863014    5.4  NA                NA        NA
## 10  Summer     Channel 1.8904110    7.4  NA                NA        NA
## 15  Winter     Channel 3.2712329   10.2  NA                NA        NA
## 16  Winter     Monarto 2.1945205  12.95  NA                NA        NA
## 17  Autumn Healesville 3.0328767   8.52  NA                NA        NA
## 24  Summer     Monarto 3.0000000    N/A  NA                NA        NA
## 25  Winter Healesville 4.1616438    8.6  NA                NA        NA
## 26  Winter     Channel 2.2849315    9.5  NA                NA        NA
## 27  Summer     Channel 2.9315068    9.7  NA                NA        NA
## 34  Summer     Channel 2.9150685    9.3  NA                NA        NA
## 36  Autumn Healesville 2.9945205    8.8  NA                NA        NA
## 37  Summer Healesville 1.5890411   4.76  NA                NA        NA
## 39  Summer     Channel 0.8657534    4.9  NA                NA        NA
## 41  Autumn     Channel 3.1013699    8.9  NA                NA        NA
## 43  Summer     Channel 2.9150685    8.8  NA                NA        NA
## 44  Winter     Channel 3.2821918   11.1  NA                NA        NA
## 46  Summer     Channel 1.8712329    7.1  NA                NA        NA
## 50  Winter     Channel 1.2794521    6.3  NA                NA        NA
## 53  Spring     Channel 1.6328767    5.8  NA                NA        NA
## 54  Spring Healesville 1.6493151   8.06  NA                NA        NA
## 55  Summer Healesville 5.6000000   9.02  NA                NA        NA
## 58  Autumn     Channel 3.1726027   11.5  NA                NA        NA
## 60  Autumn     Monarto 2.0767123   7.95  NA                NA        NA
## 61  Winter Healesville 1.2849315   5.58  NA                NA        NA
## 63  Winter     Channel 1.3917808    6.8  NA                NA        NA
## 65  Autumn     Channel 2.1972603    7.7  NA                NA        NA
## 67  Winter     Channel 3.2794521      9  NA                NA        NA
## 68  Autumn     Monarto 2.1616438    N/A  NA                NA        NA
## 69  Winter     Monarto 4.4547945    N/A  NA                NA        NA
## 70  Summer     Monarto 2.5397260   7.94  NA                NA        NA
## 73  Summer     Channel 1.8794521    7.7  NA                NA        NA
## 74  Autumn     Channel 2.1150685    6.8  NA                NA        NA
## 75  Autumn     Monarto 2.0767123    N/A  NA                NA        NA
## 78  Summer Healesville 2.8630137   6.46  NA                NA        NA
## 79  Summer     Channel 1.9178082    4.7  NA                NA        NA
## 80  Spring     Channel 3.6191781    7.4  NA                NA        NA
## 81  Summer Healesville 4.7260274   5.85  NA                NA        NA
## 82  Summer Healesville 3.7863014    4.8  NA                NA        NA
## 83  Spring Healesville 4.5232877   7.88  NA                NA        NA
## 84  Summer     Channel 2.8739726    N/A  NA                NA        NA
## 85  Summer     Channel 2.9287671    8.7  NA                NA        NA
## 86  Summer     Channel 1.9178082    6.8  NA                NA        NA
## 87  Summer     Monarto 4.7726027   7.51  NA                NA        NA
## 88  Summer Healesville 2.7671233   5.82  NA                NA        NA
## 89  Summer     Monarto 4.5589041   8.59  NA                NA        NA
## 90  Summer     Channel 5.8986301    9.8  NA                NA        NA
## 91  Summer     Channel 0.8767123    3.7  NA                NA        NA
## 92  Summer     Channel 1.8821918    7.6  NA                NA        NA
## 93  Winter Healesville 1.3424658   5.42  NA                NA        NA
## 94  Summer     Monarto 1.7917808   6.67  NA                NA        NA
## 95  Winter     Channel 1.3643836    5.1  NA                NA        NA
## 96  Summer Healesville 0.7534247   2.72  NA                NA        NA
## 97  Winter     Channel 1.2684932      6  NA                NA        NA
## 98  Winter     Monarto 1.5150685    4.6  NA                NA        NA
## 99  Winter Healesville 1.4000000   5.82  NA                NA        NA
## 100 Winter Healesville 1.2986301    5.1  NA                NA        NA
## 101 Winter     Channel 1.4082192    6.2  NA                NA        NA
## 102 Winter     Channel 1.3424658    5.1  NA                NA        NA
## 103 Winter     Channel 1.3671233      6  NA                NA        NA
## 104 Summer     Monarto 4.5917808   9.82  NA                NA        NA
## 105 Winter Healesville 1.1123288   6.02  NA                NA        NA
## 106 Autumn Healesville 1.0164384    6.1  NA                NA        NA
## 107 Summer     Channel 1.8849315      9  NA                NA        NA
## 108 Autumn     Channel 1.1945205    6.9  NA                NA        NA
## 109 Summer Healesville 1.4219178   6.62  NA                NA        NA
## 110 Summer Healesville 1.7315068   6.26  NA                NA        NA
## 111 Summer Healesville 1.7479452   7.42  NA                NA        NA
## 112 Summer     Channel 0.9178082    4.1  NA                NA        NA
## 113 Summer     Channel 0.9068493      6  NA                NA        NA
## 114 Summer     Channel 0.9068493    6.2  NA                NA        NA
## 115 Winter     Channel 2.2739726    8.5  NA                NA        NA
## 116 Winter     Monarto 1.6986301   8.75  NA                NA        NA
## 117 Winter Healesville 1.3041096  4.036  NA                NA        NA
## 118 Winter Healesville 1.3616438    6.4  NA                NA        NA
## 119 Winter     Channel 1.3972603    7.2  NA                NA        NA
## 120 Winter     Channel 1.3452055    8.2  NA                NA        NA
## 121 Winter     Monarto 1.5178082   8.15  NA                NA        NA
## 122 Winter Healesville 1.2630137   6.32  NA                NA        NA
## 123 Winter     Channel 1.4438356    8.2  NA                NA        NA
## 124 Winter Healesville 1.2986301   5.76  NA                NA        NA
## 125 Winter     Channel 1.4027397      6  NA                NA        NA
## 126 Winter     Channel 1.2712329    7.6  NA                NA        NA
## 127 Winter     Channel 1.4109589    7.3  NA                NA        NA
## 128 Winter Healesville 1.1753425   5.34  NA                NA        NA
## 129 Winter     Monarto 1.4657534   4.34  NA                NA        NA
## 130 Winter Healesville 1.3835616    N/A  NA                NA        NA
## 131 Winter     Channel 1.2164384    7.3  NA                NA        NA
## 132 Winter     Channel 1.3013699    6.4  NA                NA        NA
## 133 Autumn     Channel 3.1452055    8.3  NA                NA        NA
## 134 Winter     Channel 4.2876712   10.4  NA                NA        NA
## 135 Winter Healesville 5.1041096   8.02  NA                NA        NA
## 136 Autumn Healesville 1.8246575   5.94  NA                NA        NA
## 137 Autumn     Channel 1.1013699    6.6  NA                NA        NA
## 139 Summer Healesville 2.7452055    N/A  NA                NA        NA
## 140 Spring Healesville 6.6273973   7.52  NA                NA        NA
## 141 Winter Healesville 1.1479452   6.54  NA                NA        NA
## 142 Summer Healesville 3.6904110   7.74  NA                NA        NA
## 143 Winter Healesville 4.3013699   9.16  NA                NA        NA
## 144 Spring Healesville 1.6767123   5.86  NA                NA        NA
##     UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                    NA                  NA AGAGTAGC+AAGGCGTA
## 5                                    NA                  NA GAAGGAAG+GACGTCAT
## 7                                    NA                  NA GCAAGATC+AGTCGAAG
## 8                                    NA                  NA GCTATCCT+AACAGGTG
## 9                                    NA                  NA ACGTTCAG+AGTTGTGC
## 10                                   NA                  NA CGCATGAT+AAGCCTGA
## 15                                   NA                  NA TGAGCTAG+GAACGGTT
## 16                                   NA                  NA CCGTAAGA+AGAGTCCA
## 17                                   NA                  NA CAACACCT+AGCTACCA
## 24                                   NA                  NA GATTACCG+TTGGACTG
## 25                                   NA                  NA CACTAGCT+TCGGATTC
## 26                                   NA                  NA CTGTTGAC+ACCTCAGT
## 27                                   NA                  NA CGCAATCT+ACAGGCAT
## 34                                   NA                  NA AGAACGAG+ATTAGCCG
## 36                                   NA                  NA AGTGGATC+TCGATGAC
## 37                                   NA                  NA ATCACACG+GTAGCGTA
## 39                                   NA                  NA TTCCAAGG+CTACAAGG
## 41                                   NA                  NA GCGTCATT+CAGACGTT
## 43                                   NA                  NA CGACGTTA+CTCTGGAT
## 44                                   NA                  NA ATCGATCG+TGGAAGCA
## 46                                   NA                  NA CAGTCCAA+CGGTAATC
## 50                                   NA                  NA AACTGAGC+CAATCAGG
## 53                                   NA                  NA CTTAGGAC+ACTCCTAC
## 54                                   NA                  NA AACGTCTG+AATGACGC
## 55                                   NA                  NA GTGCCATA+CTCCTAGT
## 58                                   NA                  NA CTGATCGT+GCGCATAT
## 60                                   NA                  NA ATCGCCAT+TGCGTAAC
## 61                                   NA                  NA GAACATCG+TCGACAAG
## 63                                   NA                  NA TCGCTGTT+CAAGTCGT
## 65                                   NA                  NA ATGACGTC+CTTCCTTC
## 67                                   NA                  NA TCAGGCTT+ATCATGCG
## 68                                   NA                  NA ACGACTTG+AACAGCGA
## 69                                   NA                  NA CCTTGTAG+CCTTGGAA
## 70                                   NA                  NA GAGCAGTA+TGAGCTGT
## 73                                   NA                  NA ACCACGAT+GTCTGCAA
## 74                                   NA                  NA GAGACGAT+ACCGGTTA
## 75                                   NA                  NA GATAGGCT+CAGTCACA
## 78                                   NA                  NA TGAAGACG+ACATGCCA
## 79                                   NA                  NA ATGACGTC+CTTCCTTC
## 80                                   NA                  NA CATGGCTA+CACACATC
## 81                                   NA                  NA AACGTCTG+AATGACGC
## 82                                   NA                  NA GTCATCGA+GATCCACT
## 83                                   NA                  NA AGCGTGTT+CTTCGCAA
## 84                                   NA                  NA AGAGTAGC+AAGGCGTA
## 85                                   NA                  NA CGCTCTAT+TTGCAACG
## 86                                   NA                  NA AGTTCGTC+ACTCGATC
## 87                                   NA                  NA GCAAGATC+AGTCGAAG
## 88                                   NA                  NA TTGCGAAG+AACACGCT
## 89                                   NA                  NA TGCTTCCA+CGATCGAT
## 90                                   NA                  NA ATCCAGAG+TAACGTCG
## 91                                   NA                  NA AACTGAGC+CAATCAGG
## 92                                   NA                  NA GTCGAAGA+CCACATTG
## 93                                   NA                  NA TGAGCTAG+GAACGGTT
## 94                                   NA                  NA CTTAGGAC+ACTCCTAC
## 95                                   NA                  NA CAATGTGG+TCTTCGAC
## 96                                   NA                  NA TGGTACAG+TCGAGAGT
## 97                                   NA                  NA CGGTTGTT+GTGGTATG
## 98                                   NA                  NA ACCACGAT+GTCTGCAA
## 99                                   NA                  NA ACTGAGGT+GTCAACAG
## 100                                  NA                  NA ACGACTTG+AACAGCGA
## 101                                  NA                  NA GATCGAGT+GACGAACT
## 102                                  NA                  NA CCTGATTG+GCTCAGTT
## 103                                  NA                  NA ATCGATCG+TGGAAGCA
## 104                                  NA                  NA TCAGGCTT+ATCATGCG
## 105                                  NA                  NA ATGCCTGT+AGATTGCG
## 106                                  NA                  NA CCGTAAGA+AGAGTCCA
## 107                                  NA                  NA CACCTGTT+AGGATAGC
## 108                                  NA                  NA TGGACTCT+TCTTACGG
## 109                                  NA                  NA TTCCAAGG+CTACAAGG
## 110                                  NA                  NA GTAGGAGT+GTCCTAAG
## 111                                  NA                  NA CTTCGACT+GATCTTGC
## 112                                  NA                  NA AAGCACTG+AGGTCAAC
## 113                                  NA                  NA CGTTGCAA+ATAGAGCG
## 114                                  NA                  NA GAAGGAAG+GACGTCAT
## 115                                  NA                  NA GTTGACCT+CAGTGCTT
## 116                                  NA                  NA TTGGACGT+GAAGTGCT
## 117                                  NA                  NA TATCGGTC+TACCGGAT
## 118                                  NA                  NA TACGCCTT+GCTACTCT
## 119                                  NA                  NA TTCGTTGG+TACACACG
## 120                                  NA                  NA GATGTGTG+TAGCCATG
## 121                                  NA                  NA CGTGTGTA+CCAACGAA
## 122                                  NA                  NA CCTTGTAG+CCTTGGAA
## 123                                  NA                  NA ACTAGGAG+TATGGCAC
## 124                                  NA                  NA CGCAATCT+ACAGGCAT
## 125                                  NA                  NA ACGGAACA+ACGAGAAC
## 126                                  NA                  NA ACAGCTCA+TACTGCTC
## 127                                  NA                  NA ACTCTCGA+CTGTACCA
## 128                                  NA                  NA AGTGGATC+TCGATGAC
## 129                                  NA                  NA CTGTTGAC+ACCTCAGT
## 130                                  NA                  NA AACCGTTC+CTAGCTCA
## 131                                  NA                  NA GAAGTTGG+CGAACAAC
## 132                                  NA                  NA GATTGCTC+CACTTCAC
## 133                                  NA                  NA CGACGTTA+CTCTGGAT
## 134                                  NA                  NA TGGTAGCT+AGGTGTTG
## 135                                  NA                  NA TAACCGGT+ATCGTCTC
## 136                                  NA                  NA TTGCAGAC+ATCGTGGT
## 137                                  NA                  NA CGCATGAT+AAGCCTGA
## 139                                  NA                  NA GAGACGAT+ACCGGTTA
## 140                                  NA                  NA CTTGTCGA+CGATGTTC
## 141                                  NA                  NA TACGCTAC+CGTGTGAT
## 142                                  NA                  NA GAATCCGA+AGCTAGTG
## 143                                  NA                  NA GCACAACT+CTGAACGT
## 144                                  NA                  NA TGTGACTG+AGCCTATC
##     PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1     4,511,702           1.00              98.29                    1.71
## 5     6,479,047           1.00              97.28                    2.72
## 7     3,296,547           1.00              97.40                    2.60
## 8     5,338,890           1.00              98.08                    1.92
## 9    14,968,459           3.00              97.82                    2.18
## 10    4,556,781           1.00              95.70                    4.30
## 15    4,579,681           1.00              96.67                    3.33
## 16    4,340,498           1.00              97.95                    2.05
## 17   16,944,152           3.00              97.98                    2.02
## 24    5,125,566           1.00              96.21                    3.79
## 25    5,317,767           1.00              97.33                    2.67
## 26    5,617,260           1.00              97.81                    2.19
## 27    2,937,660           1.00              97.71                    2.29
## 34    3,120,448           1.00              95.32                    4.68
## 36    2,690,632           1.00              97.77                    2.23
## 37   12,134,750           2.00              96.94                    3.06
## 39    1,800,468           0.00              97.79                    2.21
## 41    6,731,177           1.00              98.04                    1.96
## 43    7,901,958           2.00              98.02                    1.98
## 44    5,257,820           1.00              95.13                    4.87
## 46      454,240           0.00              97.95                    2.05
## 50    1,709,078           0.00              98.04                    1.96
## 53    3,945,235           1.00              98.11                    1.89
## 54    3,809,607           1.00              96.73                    3.27
## 55    9,606,720           2.00              97.52                    2.48
## 58   10,923,019           2.00              98.07                    1.93
## 60    6,018,884           1.00              97.88                    2.12
## 61    6,861,544           1.00              97.76                    2.24
## 63    5,076,673           1.00              97.41                    2.59
## 65    6,756,342           1.00              97.12                    2.88
## 67    3,071,283           1.00              97.28                    2.72
## 68    3,000,501           1.00              97.96                    2.04
## 69    5,927,942           1.00              97.40                    2.60
## 70    1,702,608           0.00              98.07                    1.93
## 73    1,732,316           0.00              97.57                    2.43
## 74        1,152           0.00              96.70                    3.30
## 75    7,628,257           2.00              98.34                    1.66
## 78   13,381,058           3.00              96.98                    3.02
## 79    1,308,213           0.28              97.48                    2.52
## 80    1,840,822           0.40              97.83                    2.17
## 81    8,041,818           1.73              96.32                    3.68
## 82    5,758,111           1.24              96.72                    3.28
## 83    5,774,637           1.24              96.76                    3.24
## 84    7,216,024           1.56              97.99                    2.01
## 85    2,918,728           0.63              97.60                    2.40
## 86   10,758,280           2.32              97.92                    2.08
## 87      348,621           0.08              97.24                    2.76
## 88    6,376,997           1.37              97.60                    2.40
## 89    9,181,668           1.98              98.08                    1.92
## 90    7,154,214           1.54              73.27                   26.73
## 91    7,329,322           1.58              97.89                    2.11
## 92    5,503,188           1.19              97.18                    2.82
## 93    3,740,878           0.81              97.15                    2.85
## 94   11,133,566           2.40              97.85                    2.15
## 95    4,353,832           0.94              97.73                    2.27
## 96    7,887,375           1.70              97.57                    2.43
## 97   11,961,885           2.58              95.85                    4.15
## 98    7,308,907           1.58              97.70                    2.30
## 99    2,984,930           0.64              97.59                    2.41
## 100          98           0.00              94.90                    5.10
## 101   6,506,408           1.40              97.63                    2.37
## 102  11,494,825           2.48              97.55                    2.45
## 103   6,018,258           1.30              92.40                    7.60
## 104   4,879,629           1.05              97.38                    2.62
## 105   4,857,395           1.05              97.58                    2.42
## 106   1,074,345           0.23              97.56                    2.44
## 107           0           0.00                 NA                      NA
## 108  14,104,602           3.04              98.15                    1.85
## 109  10,669,237           2.30              97.64                    2.36
## 110  10,603,179           2.29              97.34                    2.66
## 111   5,642,025           1.22              96.37                    3.63
## 112   4,225,812           0.91              97.88                    2.12
## 113   6,385,393           1.38              95.82                    4.18
## 114   5,390,453           1.16              97.29                    2.71
## 115   5,450,970           1.18              97.62                    2.38
## 116  10,821,895           2.33              96.02                    3.98
## 117   8,693,920           1.87              98.13                    1.87
## 118   3,422,010           0.74              97.72                    2.28
## 119  10,720,172           2.31              97.18                    2.82
## 120   6,051,140           1.30              97.63                    2.37
## 121   4,811,453           1.04              97.67                    2.33
## 122   5,913,586           1.27              97.05                    2.95
## 123   7,229,403           1.56              94.10                    5.90
## 124   8,306,537           1.79              96.94                    3.06
## 125   7,783,546           1.68              97.13                    2.87
## 126   9,742,792           2.10              97.63                    2.37
## 127   6,770,476           1.46              97.75                    2.25
## 128   3,528,471           0.76              97.24                    2.76
## 129          23           0.00             100.00                     NaN
## 130   7,247,793           1.56              97.63                    2.37
## 131   7,212,495           1.55              97.63                    2.37
## 132   4,756,766           1.03              97.26                    2.74
## 133   1,476,427           0.32              97.63                    2.37
## 134   2,413,884           0.52              96.34                    3.66
## 135   6,908,416           1.49              97.09                    2.91
## 136   4,475,461           0.96              95.05                    4.95
## 137  17,006,305           3.67              96.93                    3.07
## 139  12,024,421           2.59              95.37                    4.63
## 140  10,751,797           2.32              97.49                    2.51
## 141  13,015,081           2.81              97.36                    2.64
## 142   3,336,983           0.72              97.10                    2.90
## 143   6,826,313           1.47              97.66                    2.34
## 144   4,566,180           0.98              97.68                    2.32
##     Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1            1,363           100     93.82        35.92  NA  NA  NA
## 5            1,957           100     93.85        35.94  NA  NA  NA
## 7              996           100     94.12        35.98  NA  NA  NA
## 8            1,612           100     93.69        35.91  NA  NA  NA
## 9            4,520           100     93.68        35.91  NA  NA  NA
## 10           1,376           100     93.94        35.94  NA  NA  NA
## 15           1,383           100     93.75        35.92  NA  NA  NA
## 16           1,311           100     93.54        35.88  NA  NA  NA
## 17           5,117           100     93.05        35.78  NA  NA  NA
## 24           1,548           100     93.89        35.94  NA  NA  NA
## 25           1,606           100     93.24        35.83  NA  NA  NA
## 26           1,696           100     93.55        35.88  NA  NA  NA
## 27             887           100     93.75        35.91  NA  NA  NA
## 34             942           100     94.24        36.01  NA  NA  NA
## 36             813           100     93.77        35.93  NA  NA  NA
## 37           3,665           100     93.34        35.84  NA  NA  NA
## 39             544           100     93.58        35.88  NA  NA  NA
## 41           2,033           100     93.62        35.89  NA  NA  NA
## 43           2,386           100     94.09        35.98  NA  NA  NA
## 44           1,588           100     93.81        35.93  NA  NA  NA
## 46             137           100     92.97        35.76  NA  NA  NA
## 50             516           100     93.06        35.78  NA  NA  NA
## 53           1,191           100     93.55        35.88  NA  NA  NA
## 54           1,151           100     93.07        35.79  NA  NA  NA
## 55           2,901           100     93.25        35.83  NA  NA  NA
## 58           3,299           100     93.51        35.87  NA  NA  NA
## 60           1,818           100     93.58        35.89  NA  NA  NA
## 61           2,072           100     93.49        35.87  NA  NA  NA
## 63           1,533           100     93.77        35.92  NA  NA  NA
## 65           2,040           100     92.53        35.68  NA  NA  NA
## 67             928           100     92.94        35.76  NA  NA  NA
## 68             906           100     93.70        35.91  NA  NA  NA
## 69           1,790           100     93.86        35.94  NA  NA  NA
## 70             514           100     93.58        35.89  NA  NA  NA
## 73             523           100     93.82        35.92  NA  NA  NA
## 74               0           100     92.06        35.56  NA  NA  NA
## 75           2,304           100     93.62        35.89  NA  NA  NA
## 78           4,041           100     93.36        35.84  NA  NA  NA
## 79             395           100     93.03        35.79  NA  NA  NA
## 80             556           100     92.66        35.71  NA  NA  NA
## 81           2,429           100     92.18        35.63  NA  NA  NA
## 82           1,739           100     91.87        35.55  NA  NA  NA
## 83           1,744           100     91.56        35.50  NA  NA  NA
## 84           2,179           100     93.47        35.87  NA  NA  NA
## 85             881           100     93.65        35.91  NA  NA  NA
## 86           3,249           100     93.20        35.82  NA  NA  NA
## 87             105           100     92.77        35.73  NA  NA  NA
## 88           1,926           100     92.44        35.67  NA  NA  NA
## 89           2,773           100     93.04        35.79  NA  NA  NA
## 90           2,161           100     92.95        35.78  NA  NA  NA
## 91           2,213           100     92.63        35.71  NA  NA  NA
## 92           1,662           100     92.53        35.69  NA  NA  NA
## 93           1,130           100     93.03        35.79  NA  NA  NA
## 94           3,362           100     92.47        35.68  NA  NA  NA
## 95           1,315           100     93.72        35.92  NA  NA  NA
## 96           2,382           100     93.15        35.81  NA  NA  NA
## 97           3,612           100     92.97        35.78  NA  NA  NA
## 98           2,207           100     92.84        35.75  NA  NA  NA
## 99             901           100     92.49        35.69  NA  NA  NA
## 100              0           100     89.11        34.91  NA  NA  NA
## 101          1,965           100     93.11        35.79  NA  NA  NA
## 102          3,471           100     93.66        35.92  NA  NA  NA
## 103          1,818           100     93.20        35.82  NA  NA  NA
## 104          1,474           100     92.63        35.71  NA  NA  NA
## 105          1,467           100     92.64        35.72  NA  NA  NA
## 106            324           100     92.66        35.72  NA  NA  NA
## 107              0            NA        NA           NA  NA  NA  NA
## 108          4,260           100     93.26        35.83  NA  NA  NA
## 109          3,222           100     92.79        35.74  NA  NA  NA
## 110          3,202           100     92.01        35.58  NA  NA  NA
## 111          1,704           100     91.87        35.56  NA  NA  NA
## 112          1,276           100     93.16        35.81  NA  NA  NA
## 113          1,928           100     92.04        35.61  NA  NA  NA
## 114          1,628           100     93.28        35.84  NA  NA  NA
## 115          1,646           100     93.04        35.79  NA  NA  NA
## 116          3,268           100     92.72        35.73  NA  NA  NA
## 117          2,626           100     92.32        35.65  NA  NA  NA
## 118          1,033           100     92.94        35.76  NA  NA  NA
## 119          3,237           100     92.73        35.72  NA  NA  NA
## 120          1,827           100     93.21        35.83  NA  NA  NA
## 121          1,453           100     92.30        35.65  NA  NA  NA
## 122          1,786           100     92.92        35.77  NA  NA  NA
## 123          2,183           100     93.10        35.80  NA  NA  NA
## 124          2,509           100     91.86        35.55  NA  NA  NA
## 125          2,351           100     92.96        35.78  NA  NA  NA
## 126          2,942           100     93.00        35.78  NA  NA  NA
## 127          2,045           100     93.04        35.79  NA  NA  NA
## 128          1,066           100     93.08        35.79  NA  NA  NA
## 129              0           100     95.85        36.37  NA  NA  NA
## 130          2,189           100     92.28        35.63  NA  NA  NA
## 131          2,178           100     93.09        35.80  NA  NA  NA
## 132          1,437           100     93.49        35.88  NA  NA  NA
## 133            446           100     93.25        35.82  NA  NA  NA
## 134            729           100     92.34        35.64  NA  NA  NA
## 135          2,086           100     91.90        35.56  NA  NA  NA
## 136          1,352           100     91.42        35.46  NA  NA  NA
## 137          5,136           100     92.91        35.77  NA  NA  NA
## 139          3,631           100     93.06        35.79  NA  NA  NA
## 140          3,247           100     92.77        35.74  NA  NA  NA
## 141          3,931           100     92.61        35.70  NA  NA  NA
## 142          1,008           100     93.09        35.79  NA  NA  NA
## 143          2,062           100     92.67        35.71  NA  NA  NA
## 144          1,379           100     92.13        35.61  NA  NA  NA
ssWvCAV <- ssWvCAV[ssWvCAV$Sample %in% colnames(x),]

dim(ssWvCAV)
## [1] 96 31
x1 <- x[,which(colnames(x) %in% ssWvCAV$Sample)]
dim(x1)
## [1] 310  96
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 261  96
ssWvCAV %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S1_LauraGrace 6102461 NA Healthy/Wild FAP F A Spring Channel 2.6219178 7.2 NA NA NA NA NA AGAGTAGC+AAGGCGTA 4,511,702 1.00 98.29 1.71 1,363 100 93.82 35.92 NA NA NA
5 1 default S1_Turmeric 6102465 NA Healthy/Wild FAU F A Summer Channel 1.9095890 7.8 NA NA NA NA NA GAAGGAAG+GACGTCAT 6,479,047 1.00 97.28 2.72 1,957 100 93.85 35.94 NA NA NA
7 1 default S2_Belinda 6102467 NA Healthy/Wild FAU F A Summer Channel 1.8657534 6.6 NA NA NA NA NA GCAAGATC+AGTCGAAG 3,296,547 1.00 97.40 2.60 996 100 94.12 35.98 NA NA NA
8 1 default S2_B99008 6102468 NA Captive FAU F A Summer Monarto 3.7369863 8.12 NA NA NA NA NA GCTATCCT+AACAGGTG 5,338,890 1.00 98.08 1.92 1,612 100 93.69 35.91 NA NA NA
9 1 default S2_Bonney 6102469 NA Captive FAU F A Summer Healesville 2.5863014 5.4 NA NA NA NA NA ACGTTCAG+AGTTGTGC 14,968,459 3.00 97.82 2.18 4,520 100 93.68 35.91 NA NA NA
10 1 default S2_Rosie 6102470 NA Healthy/Wild FAU F A Summer Channel 1.8904110 7.4 NA NA NA NA NA CGCATGAT+AAGCCTGA 4,556,781 1.00 95.70 4.30 1,376 100 93.94 35.94 NA NA NA
15 1 default S3_ST62 6102475 NA Healthy/Wild FAW F A Winter Channel 3.2712329 10.2 NA NA NA NA NA TGAGCTAG+GAACGGTT 4,579,681 1.00 96.67 3.33 1,383 100 93.75 35.92 NA NA NA
16 1 default S3_Jessie 6102476 NA Captive FAW F A Winter Monarto 2.1945205 12.95 NA NA NA NA NA CCGTAAGA+AGAGTCCA 4,340,498 1.00 97.95 2.05 1,311 100 93.54 35.88 NA NA NA
17 1 default S3_McCauley 6102477 NA Captive MAA M A Autumn Healesville 3.0328767 8.52 NA NA NA NA NA CAACACCT+AGCTACCA 16,944,152 3.00 97.98 2.02 5,117 100 93.05 35.78 NA NA NA
24 1 default S5_Fenton 6102484 NA Captive MAU M A Summer Monarto 3.0000000 N/A NA NA NA NA NA GATTACCG+TTGGACTG 5,125,566 1.00 96.21 3.79 1,548 100 93.89 35.94 NA NA NA
25 1 default S5_Bryan Adams 6102485 NA Captive MAW M A Winter Healesville 4.1616438 8.6 NA NA NA NA NA CACTAGCT+TCGGATTC 5,317,767 1.00 97.33 2.67 1,606 100 93.24 35.83 NA NA NA
26 1 default S5_Silky 6102486 NA Healthy/Wild MAW M A Winter Channel 2.2849315 9.5 NA NA NA NA NA CTGTTGAC+ACCTCAGT 5,617,260 1.00 97.81 2.19 1,696 100 93.55 35.88 NA NA NA
27 1 default S5_Longley 6102487 NA Healthy/Wild MAU M A Summer Channel 2.9315068 9.7 NA NA NA NA NA CGCAATCT+ACAGGCAT 2,937,660 1.00 97.71 2.29 887 100 93.75 35.91 NA NA NA
34 1 default S6_Ben 6102494 NA Wild MAU M A Summer Channel 2.9150685 9.3 NA NA NA NA NA AGAACGAG+ATTAGCCG 3,120,448 1.00 95.32 4.68 942 100 94.24 36.01 NA NA NA
36 1 default S7_Fredo 6102496 NA Captive MAA M A Autumn Healesville 2.9945205 8.8 NA NA NA NA NA AGTGGATC+TCGATGAC 2,690,632 1.00 97.77 2.23 813 100 93.77 35.93 NA NA NA
37 1 default S7_Piglet 6102497 NA Captive FSU F S Summer Healesville 1.5890411 4.76 NA NA NA NA NA ATCACACG+GTAGCGTA 12,134,750 2.00 96.94 3.06 3,665 100 93.34 35.84 NA NA NA
39 1 default S7_Lieke 6102499 NA Healthy/Wild FSU F S Summer Channel 0.8657534 4.9 NA NA NA NA NA TTCCAAGG+CTACAAGG 1,800,468 0.00 97.79 2.21 544 100 93.58 35.88 NA NA NA
41 1 default S7_Smithers 6102501 NA Healthy/Wild MAA M A Autumn Channel 3.1013699 8.9 NA NA NA NA NA GCGTCATT+CAGACGTT 6,731,177 1.00 98.04 1.96 2,033 100 93.62 35.89 NA NA NA
43 1 default S8_Vinnie 6102503 NA Healthy/Wild MAU M A Summer Channel 2.9150685 8.8 NA NA NA NA NA CGACGTTA+CTCTGGAT 7,901,958 2.00 98.02 1.98 2,386 100 94.09 35.98 NA NA NA
44 1 default S8_Struggles 6102504 NA Healthy/Wild MAW M A Winter Channel 3.2821918 11.1 NA NA NA NA NA ATCGATCG+TGGAAGCA 5,257,820 1.00 95.13 4.87 1,588 100 93.81 35.93 NA NA NA
50 1 default S9_Snoopy 6102510 NA Healthy/Wild MSW M S Winter Channel 1.2794521 6.3 NA NA NA NA NA AACTGAGC+CAATCAGG 1,709,078 0.00 98.04 1.96 516 100 93.06 35.78 NA NA NA
53 1 default S9_Sarabi 6102513 NA Healthy/Wild FSP F S Spring Channel 1.6328767 5.8 NA NA NA NA NA CTTAGGAC+ACTCCTAC 3,945,235 1.00 98.11 1.89 1,191 100 93.55 35.88 NA NA NA
54 1 default S10_McMahon 6102514 NA Captive MSP M S Spring Healesville 1.6493151 8.06 NA NA NA NA NA AACGTCTG+AATGACGC 3,809,607 1.00 96.73 3.27 1,151 100 93.07 35.79 NA NA NA
55 1 default S10_Logan 6102515 NA Captive MAU M A Summer Healesville 5.6000000 9.02 NA NA NA NA NA GTGCCATA+CTCCTAGT 9,606,720 2.00 97.52 2.48 2,901 100 93.25 35.83 NA NA NA
58 1 default S11_Baloo 6102518 NA Healthy/Wild MAA M A Autumn Channel 3.1726027 11.5 NA NA NA NA NA CTGATCGT+GCGCATAT 10,923,019 2.00 98.07 1.93 3,299 100 93.51 35.87 NA NA NA
60 1 default S11_Xuki 6102520 NA Captive MAA M A Autumn Monarto 2.0767123 7.95 NA NA NA NA NA ATCGCCAT+TGCGTAAC 6,018,884 1.00 97.88 2.12 1,818 100 93.58 35.89 NA NA NA
61 1 default S11_Kalamata 6102521 NA Captive MSW M S Winter Healesville 1.2849315 5.58 NA NA NA NA NA GAACATCG+TCGACAAG 6,861,544 1.00 97.76 2.24 2,072 100 93.49 35.87 NA NA NA
63 1 default S11_DanRhodes 6102523 NA Healthy/Wild MSW M S Winter Channel 1.3917808 6.8 NA NA NA NA NA TCGCTGTT+CAAGTCGT 5,076,673 1.00 97.41 2.59 1,533 100 93.77 35.92 NA NA NA
65 1 default S12_Robin 6102525 NA Healthy/Wild MAA M A Autumn Channel 2.1972603 7.7 NA NA NA NA NA ATGACGTC+CTTCCTTC 6,756,342 1.00 97.12 2.88 2,040 100 92.53 35.68 NA NA NA
67 1 default S12_Eeyore 6102527 NA Healthy/Wild MAW M A Winter Channel 3.2794521 9 NA NA NA NA NA TCAGGCTT+ATCATGCG 3,071,283 1.00 97.28 2.72 928 100 92.94 35.76 NA NA NA
68 1 default S12_Wally 6102528 NA Captive MAA M A Autumn Monarto 2.1616438 N/A NA NA NA NA NA ACGACTTG+AACAGCGA 3,000,501 1.00 97.96 2.04 906 100 93.70 35.91 NA NA NA
69 1 default S12_Naz 6102529 NA Captive MAW M A Winter Monarto 4.4547945 N/A NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,927,942 1.00 97.40 2.60 1,790 100 93.86 35.94 NA NA NA
70 1 default S13_Humbug 6102530 NA Captive MAU M A Summer Monarto 2.5397260 7.94 NA NA NA NA NA GAGCAGTA+TGAGCTGT 1,702,608 0.00 98.07 1.93 514 100 93.58 35.89 NA NA NA
73 1 default S13_Pangea 6102533 NA Healthy/Wild MAU M A Summer Channel 1.8794521 7.7 NA NA NA NA NA ACCACGAT+GTCTGCAA 1,732,316 0.00 97.57 2.43 523 100 93.82 35.92 NA NA NA
75 1 default S13_Xerxes 6102535 NA Captive MAA M A Autumn Monarto 2.0767123 N/A NA NA NA NA NA GATAGGCT+CAGTCACA 7,628,257 2.00 98.34 1.66 2,304 100 93.62 35.89 NA NA NA
78 1 default S14_Catani 6102538 NA Captive FAU F A Summer Healesville 2.8630137 6.46 NA NA NA NA NA TGAAGACG+ACATGCCA 13,381,058 3.00 96.98 3.02 4,041 100 93.36 35.84 NA NA NA
79 2 default S15_Halls 6102539 NA Wild FAU F A Summer Channel 1.9178082 4.7 NA NA NA NA NA ATGACGTC+CTTCCTTC 1,308,213 0.28 97.48 2.52 395 100 93.03 35.79 NA NA NA
80 2 default S15_Jessica 6102540 NA Wild FAP F A Spring Channel 3.6191781 7.4 NA NA NA NA NA CATGGCTA+CACACATC 1,840,822 0.40 97.83 2.17 556 100 92.66 35.71 NA NA NA
81 2 default S15_Amelia 6102541 NA Captive FAU F A Summer Healesville 4.7260274 5.85 NA NA NA NA NA AACGTCTG+AATGACGC 8,041,818 1.73 96.32 3.68 2,429 100 92.18 35.63 NA NA NA
82 2 default S15_London 6102542 NA Captive FAU F A Summer Healesville 3.7863014 4.8 NA NA NA NA NA GTCATCGA+GATCCACT 5,758,111 1.24 96.72 3.28 1,739 100 91.87 35.55 NA NA NA
83 2 default S15_Elyse 6102543 NA Captive FAP F A Spring Healesville 4.5232877 7.88 NA NA NA NA NA AGCGTGTT+CTTCGCAA 5,774,637 1.24 96.76 3.24 1,744 100 91.56 35.50 NA NA NA
84 2 default S15_Munchkin 6102544 NA Wild FAU F A Summer Channel 2.8739726 N/A NA NA NA NA NA AGAGTAGC+AAGGCGTA 7,216,024 1.56 97.99 2.01 2,179 100 93.47 35.87 NA NA NA
85 2 default S16_Pelverata 6102545 NA Wild FAU F A Summer Channel 2.9287671 8.7 NA NA NA NA NA CGCTCTAT+TTGCAACG 2,918,728 0.63 97.60 2.40 881 100 93.65 35.91 NA NA NA
86 2 default S16_Lizzie 6102546 NA Wild FAU F A Summer Channel 1.9178082 6.8 NA NA NA NA NA AGTTCGTC+ACTCGATC 10,758,280 2.32 97.92 2.08 3,249 100 93.20 35.82 NA NA NA
88 2 default S16_Milla 6102548 NA Captive FAU F A Summer Healesville 2.7671233 5.82 NA NA NA NA NA TTGCGAAG+AACACGCT 6,376,997 1.37 97.60 2.40 1,926 100 92.44 35.67 NA NA NA
89 2 default S16_Maleficent 6102549 NA Captive FAU F A Summer Monarto 4.5589041 8.59 NA NA NA NA NA TGCTTCCA+CGATCGAT 9,181,668 1.98 98.08 1.92 2,773 100 93.04 35.79 NA NA NA
90 2 default S16_Lebanon 6102550 NA Wild FAU F A Summer Channel 5.8986301 9.8 NA NA NA NA NA ATCCAGAG+TAACGTCG 7,154,214 1.54 73.27 26.73 2,161 100 92.95 35.78 NA NA NA
91 2 default S17_Radiata 6102551 NA Wild FSU F S Summer Channel 0.8767123 3.7 NA NA NA NA NA AACTGAGC+CAATCAGG 7,329,322 1.58 97.89 2.11 2,213 100 92.63 35.71 NA NA NA
92 2 default S17_Shenzi 6102552 NA Wild FAU F A Summer Channel 1.8821918 7.6 NA NA NA NA NA GTCGAAGA+CCACATTG 5,503,188 1.19 97.18 2.82 1,662 100 92.53 35.69 NA NA NA
93 2 default S17_Anirak 6102553 NA Captive FSW F S Winter Healesville 1.3424658 5.42 NA NA NA NA NA TGAGCTAG+GAACGGTT 3,740,878 0.81 97.15 2.85 1,130 100 93.03 35.79 NA NA NA
94 2 default S17_Poly 6102554 NA Captive FSU F S Summer Monarto 1.7917808 6.67 NA NA NA NA NA CTTAGGAC+ACTCCTAC 11,133,566 2.40 97.85 2.15 3,362 100 92.47 35.68 NA NA NA
95 2 default S17_Vernicosa 6102555 NA Wild FSW F S Winter Channel 1.3643836 5.1 NA NA NA NA NA CAATGTGG+TCTTCGAC 4,353,832 0.94 97.73 2.27 1,315 100 93.72 35.92 NA NA NA
96 2 default S17_Methyl 6102556 NA Captive FSU F S Summer Healesville 0.7534247 2.72 NA NA NA NA NA TGGTACAG+TCGAGAGT 7,887,375 1.70 97.57 2.43 2,382 100 93.15 35.81 NA NA NA
97 2 default S18_Paprika 6102557 NA Wild FSW F S Winter Channel 1.2684932 6 NA NA NA NA NA CGGTTGTT+GTGGTATG 11,961,885 2.58 95.85 4.15 3,612 100 92.97 35.78 NA NA NA
98 2 default S18_Zara 6102558 NA Captive FSW F S Winter Monarto 1.5150685 4.6 NA NA NA NA NA ACCACGAT+GTCTGCAA 7,308,907 1.58 97.70 2.30 2,207 100 92.84 35.75 NA NA NA
99 2 default S18_Maze 6102559 NA Captive FSW F S Winter Healesville 1.4000000 5.82 NA NA NA NA NA ACTGAGGT+GTCAACAG 2,984,930 0.64 97.59 2.41 901 100 92.49 35.69 NA NA NA
101 2 default S18_Haiko 6102561 NA Wild FSW F S Winter Channel 1.4082192 6.2 NA NA NA NA NA GATCGAGT+GACGAACT 6,506,408 1.40 97.63 2.37 1,965 100 93.11 35.79 NA NA NA
102 2 default S18_Hermione 6102562 NA Wild FSW F S Winter Channel 1.3424658 5.1 NA NA NA NA NA CCTGATTG+GCTCAGTT 11,494,825 2.48 97.55 2.45 3,471 100 93.66 35.92 NA NA NA
103 2 default S19_Tammy 6102563 NA Wild FSW F S Winter Channel 1.3671233 6 NA NA NA NA NA ATCGATCG+TGGAAGCA 6,018,258 1.30 92.40 7.60 1,818 100 93.20 35.82 NA NA NA
104 2 default S19_Morocco 6102564 NA Captive MAU M A Summer Monarto 4.5917808 9.82 NA NA NA NA NA TCAGGCTT+ATCATGCG 4,879,629 1.05 97.38 2.62 1,474 100 92.63 35.71 NA NA NA
105 2 default S19_Pecorino 6102565 NA Captive FSW F S Winter Healesville 1.1123288 6.02 NA NA NA NA NA ATGCCTGT+AGATTGCG 4,857,395 1.05 97.58 2.42 1,467 100 92.64 35.72 NA NA NA
108 2 default S19_Tantor 6102568 NA Wild MSA M S Autumn Channel 1.1945205 6.9 NA NA NA NA NA TGGACTCT+TCTTACGG 14,104,602 3.04 98.15 1.85 4,260 100 93.26 35.83 NA NA NA
109 2 default S20_Muasy 6102569 NA Captive MSU M S Summer Healesville 1.4219178 6.62 NA NA NA NA NA TTCCAAGG+CTACAAGG 10,669,237 2.30 97.64 2.36 3,222 100 92.79 35.74 NA NA NA
110 2 default S20_Fuse 6102570 NA Captive MSU M S Summer Healesville 1.7315068 6.26 NA NA NA NA NA GTAGGAGT+GTCCTAAG 10,603,179 2.29 97.34 2.66 3,202 100 92.01 35.58 NA NA NA
111 2 default S20_Joseph 6102571 NA Captive MSU M S Summer Healesville 1.7479452 7.42 NA NA NA NA NA CTTCGACT+GATCTTGC 5,642,025 1.22 96.37 3.63 1,704 100 91.87 35.56 NA NA NA
112 2 default S20_Hudson 6102572 NA Wild MSU M S Summer Channel 0.9178082 4.1 NA NA NA NA NA AAGCACTG+AGGTCAAC 4,225,812 0.91 97.88 2.12 1,276 100 93.16 35.81 NA NA NA
113 2 default S20_Mace 6102573 NA Wild MSU M S Summer Channel 0.9068493 6 NA NA NA NA NA CGTTGCAA+ATAGAGCG 6,385,393 1.38 95.82 4.18 1,928 100 92.04 35.61 NA NA NA
114 2 default S20_Mint 6102574 NA Wild MSU M S Summer Channel 0.9068493 6.2 NA NA NA NA NA GAAGGAAG+GACGTCAT 5,390,453 1.16 97.29 2.71 1,628 100 93.28 35.84 NA NA NA
115 2 default S21_Sylvester 6102575 NA Wild MAW M A Winter Channel 2.2739726 8.5 NA NA NA NA NA GTTGACCT+CAGTGCTT 5,450,970 1.18 97.62 2.38 1,646 100 93.04 35.79 NA NA NA
116 2 default S21_Moama 6102576 NA Captive MAW M A Winter Monarto 1.6986301 8.75 NA NA NA NA NA TTGGACGT+GAAGTGCT 10,821,895 2.33 96.02 3.98 3,268 100 92.72 35.73 NA NA NA
117 2 default S21_Nauset 6102577 NA Captive MSW M S Winter Healesville 1.3041096 4.036 NA NA NA NA NA TATCGGTC+TACCGGAT 8,693,920 1.87 98.13 1.87 2,626 100 92.32 35.65 NA NA NA
118 2 default S21_Graham 6102578 NA Captive MSW M S Winter Healesville 1.3616438 6.4 NA NA NA NA NA TACGCCTT+GCTACTCT 3,422,010 0.74 97.72 2.28 1,033 100 92.94 35.76 NA NA NA
119 2 default S21_Harry 6102579 NA Wild MSW M S Winter Channel 1.3972603 7.2 NA NA NA NA NA TTCGTTGG+TACACACG 10,720,172 2.31 97.18 2.82 3,237 100 92.73 35.72 NA NA NA
120 2 default S21_Thor 6102580 NA Wild MSW M S Winter Channel 1.3452055 8.2 NA NA NA NA NA GATGTGTG+TAGCCATG 6,051,140 1.30 97.63 2.37 1,827 100 93.21 35.83 NA NA NA
121 2 default S22_Yanni 6102581 NA Captive MSW M S Winter Monarto 1.5178082 8.15 NA NA NA NA NA CGTGTGTA+CCAACGAA 4,811,453 1.04 97.67 2.33 1,453 100 92.30 35.65 NA NA NA
122 2 default S22_Gherkin 6102582 NA Captive MSW M S Winter Healesville 1.2630137 6.32 NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,913,586 1.27 97.05 2.95 1,786 100 92.92 35.77 NA NA NA
123 2 default S22_Utah 6102583 NA Wild MSW M S Winter Channel 1.4438356 8.2 NA NA NA NA NA ACTAGGAG+TATGGCAC 7,229,403 1.56 94.10 5.90 2,183 100 93.10 35.80 NA NA NA
124 2 default S22_Stilton 6102584 NA Captive MSW M S Winter Healesville 1.2986301 5.76 NA NA NA NA NA CGCAATCT+ACAGGCAT 8,306,537 1.79 96.94 3.06 2,509 100 91.86 35.55 NA NA NA
125 2 default S22_Wellington 6102585 NA Wild MSW M S Winter Channel 1.4027397 6 NA NA NA NA NA ACGGAACA+ACGAGAAC 7,783,546 1.68 97.13 2.87 2,351 100 92.96 35.78 NA NA NA
126 2 default S22_Ginger 6102586 NA Healthy/Wild MSW M S Winter Channel 1.2712329 7.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 9,742,792 2.10 97.63 2.37 2,942 100 93.00 35.78 NA NA NA
127 2 default S23_Meliza 6102587 NA Ignore-Wild FSW F S Winter Channel 1.4109589 7.3 NA NA NA NA NA ACTCTCGA+CTGTACCA 6,770,476 1.46 97.75 2.25 2,045 100 93.04 35.79 NA NA NA
128 2 default S23_Osiris 6102588 NA Captive MSW M S Winter Healesville 1.1753425 5.34 NA NA NA NA NA AGTGGATC+TCGATGAC 3,528,471 0.76 97.24 2.76 1,066 100 93.08 35.79 NA NA NA
130 2 default S23_Quince 6102590 NA Captive MSW M S Winter Healesville 1.3835616 N/A NA NA NA NA NA AACCGTTC+CTAGCTCA 7,247,793 1.56 97.63 2.37 2,189 100 92.28 35.63 NA NA NA
131 2 default S23_Saffron 6102591 NA Wild MSW M S Winter Channel 1.2164384 7.3 NA NA NA NA NA GAAGTTGG+CGAACAAC 7,212,495 1.55 97.63 2.37 2,178 100 93.09 35.80 NA NA NA
132 2 default S23_Gandalf 6102592 NA Wild MSW M S Winter Channel 1.3013699 6.4 NA NA NA NA NA GATTGCTC+CACTTCAC 4,756,766 1.03 97.26 2.74 1,437 100 93.49 35.88 NA NA NA
133 2 default S24_Boy 6102593 NA Healthy/Wild MAA M A Autumn Channel 3.1452055 8.3 NA NA NA NA NA CGACGTTA+CTCTGGAT 1,476,427 0.32 97.63 2.37 446 100 93.25 35.82 NA NA NA
134 2 default S24_ST74 6102594 NA Wild MAW M A Winter Channel 4.2876712 10.4 NA NA NA NA NA TGGTAGCT+AGGTGTTG 2,413,884 0.52 96.34 3.66 729 100 92.34 35.64 NA NA NA
135 2 default S24_Malfoy 6102595 NA Captive MAW M A Winter Healesville 5.1041096 8.02 NA NA NA NA NA TAACCGGT+ATCGTCTC 6,908,416 1.49 97.09 2.91 2,086 100 91.90 35.56 NA NA NA
136 2 default S24_Licorice 6102596 NA Captive FSA F S Autumn Healesville 1.8246575 5.94 NA NA NA NA NA TTGCAGAC+ATCGTGGT 4,475,461 0.96 95.05 4.95 1,352 100 91.42 35.46 NA NA NA
137 2 default S24_Lisa 6102597 NA Wild FSA F S Autumn Channel 1.1013699 6.6 NA NA NA NA NA CGCATGAT+AAGCCTGA 17,006,305 3.67 96.93 3.07 5,136 100 92.91 35.77 NA NA NA
139 2 default S25_Tofu 6102599 NA Captive FAU F A Summer Healesville 2.7452055 N/A NA NA NA NA NA GAGACGAT+ACCGGTTA 12,024,421 2.59 95.37 4.63 3,631 100 93.06 35.79 NA NA NA
140 2 default S25_Colette 6102600 NA Captive FAP F A Spring Healesville 6.6273973 7.52 NA NA NA NA NA CTTGTCGA+CGATGTTC 10,751,797 2.32 97.49 2.51 3,247 100 92.77 35.74 NA NA NA
141 2 default S25_CannonBall 6102601 NA Captive MSW M S Winter Healesville 1.1479452 6.54 NA NA NA NA NA TACGCTAC+CGTGTGAT 13,015,081 2.81 97.36 2.64 3,931 100 92.61 35.70 NA NA NA
142 2 default S25_Cornelius 6102602 NA Captive MAU M A Summer Healesville 3.6904110 7.74 NA NA NA NA NA GAATCCGA+AGCTAGTG 3,336,983 0.72 97.10 2.90 1,008 100 93.09 35.79 NA NA NA
143 2 default S25_Mardook 6102603 NA Captive MAW M A Winter Healesville 4.3013699 9.16 NA NA NA NA NA GCACAACT+CTGAACGT 6,826,313 1.47 97.66 2.34 2,062 100 92.67 35.71 NA NA NA
144 2 default S25_Negroni 6102604 NA Captive FSP F S Spring Healesville 1.6767123 5.86 NA NA NA NA NA TGTGACTG+AGCCTATC 4,566,180 0.98 97.68 2.32 1,379 100 92.13 35.61 NA NA NA
col <- as.character(as.numeric(grepl("Captive",ssWvCAV$Category)))
col <- gsub("0","lightgreen",col)
col <- gsub("1","lightblue",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Wild vs Captive devils")
mtext("Wild=green, Captive=Blue")

ssWvCAV$Capstat <- grepl("Captive",ssWvCAV$Category)
ssWvCAV$MvF <- factor(ssWvCAV$Sex)
ssWvCAV$SubAdvAd <- as.numeric(factor(ssWvCAV$Age,levels=c("S","A"),ordered = TRUE))
ssWvCAV$Season <- factor(ssWvCAV$Season)
str(ssWvCAV)
## 'data.frame':    96 obs. of  34 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S1_LauraGrace" "S1_Turmeric" "S2_Belinda" "S2_B99008" ...
##  $ Sample                 : int  6102461 6102465 6102467 6102468 6102469 6102470 6102475 6102476 6102477 6102484 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "Healthy/Wild" "Healthy/Wild" "Healthy/Wild" "Captive" ...
##  $ Sex.Age.Season         : chr  "FAP" "FAU" "FAU" "FAU" ...
##  $ Sex                    : chr  "F" "F" "F" "F" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 2 3 3 3 3 3 4 4 1 3 ...
##  $ Location               : chr  "Channel" "Channel" "Channel" "Monarto" ...
##  $ Agebyyear              : num  2.62 1.91 1.87 3.74 2.59 ...
##  $ Weight                 : chr  "7.2" "7.8" "6.6" "8.12" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ Ulcerated              : logi  NA NA NA NA NA NA ...
##  $ UlcerationDepth        : chr  "" "" "" "" ...
##  $ Secondary.infection    : logi  NA NA NA NA NA NA ...
##  $ Total.tumour.volume    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Barcode.sequence       : chr  "AGAGTAGC+AAGGCGTA" "GAAGGAAG+GACGTCAT" "GCAAGATC+AGTCGAAG" "GCTATCCT+AACAGGTG" ...
##  $ PF.Clusters            : chr  "4,511,702" "6,479,047" "3,296,547" "5,338,890" ...
##  $ X..of.the.lane         : num  1 1 1 1 3 1 1 1 3 1 ...
##  $ X..Perfect.barcode     : num  98.3 97.3 97.4 98.1 97.8 ...
##  $ X..One.mismatch.barcode: num  1.71 2.72 2.6 1.92 2.18 4.3 3.33 2.05 2.02 3.79 ...
##  $ Yield..Mbases.         : chr  "1,363" "1,957" "996" "1,612" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.8 93.8 94.1 93.7 93.7 ...
##  $ Mean.Quality           : num  35.9 35.9 36 35.9 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ Capstat                : logi  FALSE FALSE FALSE TRUE TRUE FALSE ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 1 1 1 1 1 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 2 2 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssWvCAV, design = ~ Season + SubAdvAd + MvF + Capstat )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 8 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeWvCAV <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 74
length(sig1_dn)
## [1] 68
maplot(dgeWvCAV,"Wild vs Captive devils")

make_volcano(dgeWvCAV,"Wild vs Captive devils")

sig[1:150,1:6] %>%
  kbl(caption="Comparison of Wild vs Captive devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Wild vs Captive devils
baseMean log2FoldChange lfcSE stat pvalue padj
CCR7 1.767790e+04 1.2271697 0.1157199 10.604653 0.0000000 0.0000000
CD28 1.007240e+03 1.3905020 0.1484543 9.366536 0.0000000 0.0000000
CCR6 9.699889e+02 1.2372421 0.1326737 9.325453 0.0000000 0.0000000
TNFSF8 4.693606e+02 1.1511491 0.1307664 8.803095 0.0000000 0.0000000
Saha-UA 3.380555e+05 -1.2981149 0.1586440 -8.182566 0.0000000 0.0000000
PTPRC 3.958119e+04 1.0317417 0.1263583 8.165208 0.0000000 0.0000000
CXCR4 1.932450e+04 0.8056240 0.0989773 8.139481 0.0000000 0.0000000
CD1d 1.439792e+03 1.2576224 0.1552812 8.099000 0.0000000 0.0000000
IL10RA 1.142249e+04 1.1031254 0.1371707 8.041991 0.0000000 0.0000000
Saha-UK 2.183494e+05 -1.2089024 0.1503608 -8.040008 0.0000000 0.0000000
IL34 1.509099e+03 -1.8571371 0.2327797 -7.978089 0.0000000 0.0000000
CCL21 2.061270e+01 -6.4187162 0.8103442 -7.920975 0.0000000 0.0000000
Tap1 7.390331e+03 1.2820445 0.1622120 7.903511 0.0000000 0.0000000
TCF3 3.346812e+04 -1.1948086 0.1533903 -7.789335 0.0000000 0.0000000
EPX 3.946627e+03 -2.4814322 0.3195928 -7.764354 0.0000000 0.0000000
TLR3 5.283182e+02 0.9381514 0.1208608 7.762247 0.0000000 0.0000000
Saha-UC 5.052002e+05 -1.3170849 0.1698108 -7.756193 0.0000000 0.0000000
Saha-UD 1.028609e+06 -1.6972330 0.2205947 -7.693899 0.0000000 0.0000000
OAZ1 4.795188e+05 -1.4648367 0.1959791 -7.474454 0.0000000 0.0000000
LBR 9.041156e+03 0.9204106 0.1258553 7.313244 0.0000000 0.0000000
CCR4 1.319401e+03 0.9829831 0.1360250 7.226488 0.0000000 0.0000000
NFKB1 6.909295e+03 0.4549534 0.0630087 7.220485 0.0000000 0.0000000
TCRm 4.921642e+03 1.0222417 0.1416743 7.215437 0.0000000 0.0000000
ITGAX 6.031127e+03 -0.6612363 0.0918345 -7.200304 0.0000000 0.0000000
TGFb1 6.722329e+04 -0.9719383 0.1361172 -7.140451 0.0000000 0.0000000
IL10Rb 4.791712e+02 0.8730255 0.1242193 7.028099 0.0000000 0.0000000
STAT1 9.191622e+03 0.7508500 0.1090351 6.886316 0.0000000 0.0000000
IL7RA 6.847889e+03 0.9672449 0.1446519 6.686705 0.0000000 0.0000000
CCLD3 9.353998e+01 -2.3791038 0.3565814 -6.671979 0.0000000 0.0000000
IL2RA 2.234007e+02 1.1872530 0.1782697 6.659870 0.0000000 0.0000000
IL4R 6.524709e+03 0.8489715 0.1279479 6.635292 0.0000000 0.0000000
IgE 1.088380e+04 -1.7316618 0.2810735 -6.160885 0.0000000 0.0000000
GATA1 2.828681e+05 -2.0275587 0.3326270 -6.095592 0.0000000 0.0000000
TLR9 8.438999e+02 -0.9111577 0.1529552 -5.957022 0.0000000 0.0000000
Spi1 3.562727e+04 -0.8540119 0.1447617 -5.899433 0.0000000 0.0000000
IFIH1 1.955888e+03 0.7560749 0.1284833 5.884617 0.0000000 0.0000000
CD68 4.568176e+03 -0.7457534 0.1300779 -5.733129 0.0000000 0.0000001
TXLNA 4.446539e+03 -0.4643271 0.0825299 -5.626167 0.0000000 0.0000001
IRF8 1.753715e+03 0.8378874 0.1493430 5.610490 0.0000000 0.0000001
CIITA 1.709255e+03 0.7807442 0.1395429 5.595012 0.0000000 0.0000001
ICOS 5.716729e+02 0.8723781 0.1573448 5.544371 0.0000000 0.0000002
RPS29 2.719380e+04 -0.9794448 0.1772357 -5.526228 0.0000000 0.0000002
CCR8 1.850348e+02 1.0631347 0.1929769 5.509128 0.0000000 0.0000002
IL27Ra 1.216205e+03 0.8222411 0.1507574 5.454067 0.0000000 0.0000003
CCR2 4.309248e+03 -0.7255652 0.1339795 -5.415496 0.0000001 0.0000003
NLRP1 6.701689e+02 0.6887285 0.1273068 5.409988 0.0000001 0.0000003
GZMB 1.148661e+02 -1.2194297 0.2267256 -5.378440 0.0000001 0.0000004
IRF4 8.283538e+02 0.9532707 0.1780981 5.352505 0.0000001 0.0000005
RPLP0 1.679208e+05 -0.7973465 0.1491190 -5.347048 0.0000001 0.0000005
C3 4.582611e+04 -0.8216269 0.1542203 -5.327617 0.0000001 0.0000005
B2M 2.528038e+05 -0.9454463 0.1781885 -5.305876 0.0000001 0.0000006
Saha-MR1 2.499019e+02 0.6998754 0.1322361 5.292620 0.0000001 0.0000006
MYD88 5.384900e+03 0.7348046 0.1396863 5.260392 0.0000001 0.0000007
CXCL16 4.583658e+03 -0.9865119 0.1880591 -5.245755 0.0000002 0.0000007
IRF3 1.534376e+04 -0.7058176 0.1354579 -5.210606 0.0000002 0.0000009
IL5 2.703264e+02 2.9506055 0.5802679 5.084902 0.0000004 0.0000017
STAT3 7.656527e+03 0.6113772 0.1219203 5.014564 0.0000005 0.0000024
FLT3 1.402967e+03 0.8506604 0.1708691 4.978434 0.0000006 0.0000028
IL17RA 6.712231e+03 0.5871760 0.1219273 4.815786 0.0000015 0.0000063
PPIA 4.331074e+04 -0.6335900 0.1322751 -4.789941 0.0000017 0.0000071
STAT4 1.550386e+03 0.6420960 0.1345222 4.773159 0.0000018 0.0000076
CCR5 3.287396e+02 -0.6803694 0.1426450 -4.769670 0.0000018 0.0000076
TNFSF11 9.463621e+01 0.9907651 0.2098695 4.720862 0.0000023 0.0000095
IL5Ra 1.390130e+03 0.7261932 0.1554580 4.671315 0.0000030 0.0000119
CCLD14 2.527101e+02 -1.3662385 0.2928320 -4.665605 0.0000031 0.0000120
CCLD6 2.207176e+02 -0.9379357 0.2017742 -4.648441 0.0000033 0.0000129
TLR7 8.029070e+02 0.7555176 0.1636708 4.616079 0.0000039 0.0000148
CD59 2.008714e+04 -0.9962481 0.2172948 -4.584776 0.0000045 0.0000170
TCRd 2.667412e+02 0.9097317 0.1985964 4.580807 0.0000046 0.0000171
FGF2 6.673852e+01 0.9375102 0.2080684 4.505780 0.0000066 0.0000240
PRF1 1.789604e+03 0.8302502 0.1859961 4.463803 0.0000081 0.0000288
CCLD8 1.474595e+02 -0.8913450 0.2001414 -4.453577 0.0000084 0.0000298
CCLD5 4.730407e+02 -0.8420599 0.1902532 -4.425996 0.0000096 0.0000334
TCRg 2.489601e+03 -0.9398577 0.2126068 -4.420638 0.0000098 0.0000338
CCLD7 6.581604e+02 -0.8683252 0.1979701 -4.386142 0.0000115 0.0000391
CFI 5.246528e+02 0.4939781 0.1150217 4.294651 0.0000175 0.0000585
CD96 2.144166e+02 1.0580932 0.2474078 4.276718 0.0000190 0.0000626
TNFSF10 3.974518e+02 0.5064721 0.1186402 4.268974 0.0000196 0.0000639
KIT 3.189999e+03 0.6377188 0.1496893 4.260283 0.0000204 0.0000656
TNFSF13 5.170078e+02 -0.4802154 0.1147286 -4.185663 0.0000284 0.0000903
PRG3 9.291671e+03 0.8332135 0.2037356 4.089680 0.0000432 0.0001355
IL6 8.500763e+01 0.7378048 0.1842052 4.005342 0.0000619 0.0001918
CTLA4 2.653248e+02 0.5573867 0.1396224 3.992100 0.0000655 0.0002004
CD4 3.567471e+03 0.3524847 0.0885147 3.982217 0.0000683 0.0002065
CCL17 9.410251e+00 -3.2913368 0.8271205 -3.979271 0.0000691 0.0002066
IL13Ra1 3.102653e+03 0.6664027 0.1686731 3.950853 0.0000779 0.0002300
IL17D 2.486597e+02 0.8248296 0.2097502 3.932439 0.0000841 0.0002455
NOD2 1.330970e+03 0.7066856 0.1807951 3.908765 0.0000928 0.0002678
CCLD1 3.942714e+01 -1.6719777 0.4308829 -3.880353 0.0001043 0.0002977
VEGF-A 2.938225e+02 0.7097308 0.1843899 3.849076 0.0001186 0.0003346
GATA2 1.404719e+03 -0.5751660 0.1506359 -3.818252 0.0001344 0.0003751
AIM2 4.463174e+02 -0.4944053 0.1298133 -3.808589 0.0001398 0.0003812
IFNGR1 1.136194e+04 0.3649175 0.0958668 3.806506 0.0001409 0.0003812
STING1 9.494296e+02 0.4619155 0.1214383 3.803704 0.0001425 0.0003812
CCR1 4.428027e+02 -0.5949763 0.1564219 -3.803663 0.0001426 0.0003812
MMP2 6.184562e+01 -1.2668641 0.3357803 -3.772896 0.0001614 0.0004269
CD14 3.859311e+04 -0.6356577 0.1687375 -3.767139 0.0001651 0.0004324
IL4I0 1.167283e+02 -1.0237970 0.2745489 -3.729015 0.0001922 0.0004982
CD83 1.112830e+02 0.7355203 0.1990113 3.695871 0.0002191 0.0005622
Saha-UB 2.929331e+05 -0.6316950 0.1723459 -3.665275 0.0002471 0.0006276
IRF9 2.067724e+04 -0.2506027 0.0691738 -3.622801 0.0002914 0.0007329
FCGR2B 7.544089e+02 0.6658803 0.1849940 3.599470 0.0003189 0.0007940
FAS 1.207219e+03 0.4777228 0.1367249 3.494044 0.0004758 0.0011732
CCLD13 2.611072e+02 -0.7596304 0.2183393 -3.479129 0.0005030 0.0012176
EIF2AK2 5.172143e+02 0.4247775 0.1220985 3.478975 0.0005033 0.0012176
TLR8 5.257142e+03 0.4528657 0.1364788 3.318212 0.0009060 0.0021709
IL15 6.370138e+01 -1.0111239 0.3095030 -3.266928 0.0010872 0.0025809
TLR4 2.026238e+03 0.5583244 0.1716267 3.253133 0.0011414 0.0026844
IRF2 5.034485e+03 0.2034296 0.0635152 3.202849 0.0013608 0.0031709
TBX21 1.682176e+03 -0.4773975 0.1502198 -3.177994 0.0014830 0.0034243
CD209 1.970259e+01 -1.0888942 0.3447425 -3.158573 0.0015854 0.0036279
PDGFA 1.452147e+03 -0.7139984 0.2319908 -3.077701 0.0020860 0.0047308
CCLD2 1.408927e+01 -1.5992543 0.5287415 -3.024643 0.0024893 0.0055953
CXCR3 1.281664e+03 -0.4177267 0.1388065 -3.009418 0.0026175 0.0058133
IL27 3.762465e+02 0.3077496 0.1023192 3.007740 0.0026320 0.0058133
Saha-DAB3 8.420757e+04 -0.2600073 0.0871336 -2.984006 0.0028450 0.0062296
CCL24 1.131879e+03 -0.4965219 0.1669632 -2.973841 0.0029410 0.0063847
IL12Rb1 1.078035e+03 0.3652633 0.1240513 2.944454 0.0032353 0.0069640
CD40LG 9.253404e+02 0.2775242 0.0958157 2.896438 0.0037742 0.0080560
MRC1 1.246960e+03 -0.4707819 0.1653583 -2.847041 0.0044128 0.0093404
IFNAR1 2.921068e+03 0.2710338 0.0969812 2.794704 0.0051947 0.0109046
Saha-DAB2 1.377242e+04 -0.2773343 0.1009608 -2.746949 0.0060152 0.0125236
CD86 3.089243e+02 -0.3597305 0.1313234 -2.739273 0.0061575 0.0127155
TNFSF15 1.498152e+01 1.2243209 0.4509685 2.714870 0.0066302 0.0135812
XCLA 8.400273e+02 -0.3772685 0.1404018 -2.687063 0.0072083 0.0146473
Tap2 1.944570e+04 -0.2328117 0.0873179 -2.666254 0.0076702 0.0154621
RPL4 2.089100e+05 -0.2639778 0.1012556 -2.607044 0.0091328 0.0182655
FCER1A 2.737214e+02 -0.4957212 0.1913086 -2.591213 0.0095638 0.0189782
IL21R 4.836290e+03 0.3202950 0.1259769 2.542490 0.0110066 0.0216718
EEF1A1 3.186484e+01 0.8245803 0.3273708 2.518796 0.0117757 0.0229685
NLCR5 8.129648e+03 0.2483898 0.0986966 2.516700 0.0118460 0.0229685
CXCR5 2.227051e+03 0.3418899 0.1382471 2.473035 0.0133971 0.0257792
MS4A1 1.214175e+04 -0.3519964 0.1460125 -2.410728 0.0159207 0.0304049
IL16 1.891656e+04 0.1320063 0.0563511 2.342567 0.0191516 0.0363023
CCLD9 4.575973e+01 -0.6005962 0.2574661 -2.332719 0.0196629 0.0369954
FCMR 5.396858e+04 -0.3973649 0.1746454 -2.275267 0.0228899 0.0427503
IFNL2 2.660477e+01 -0.8378638 0.3702900 -2.262723 0.0236528 0.0438526
IDO1 2.441286e+03 0.9196361 0.4075943 2.256254 0.0240547 0.0442747
Saha-DAA 8.958693e+04 0.2047506 0.0916460 2.234147 0.0254734 0.0465485
TNFSF13B 5.193844e+01 -0.5561523 0.2498534 -2.225915 0.0260199 0.0472075
CSF1 1.065547e+03 0.4711923 0.2125562 2.216789 0.0266375 0.0479852
TNFSF9 2.951905e+02 -0.3953574 0.1798061 -2.198799 0.0278922 0.0498918
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
write.table(dge,file="dgeWvCAV.tsv",sep="\t")

mx <- sig[,7:ncol(sig)]
mx <- head(mx,30)
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(as.matrix(mx),trace="none",scale="row",
          col=colfunc(25),ColSideColors=col,mar=c(5,12)) 

ssCap <- filter(ss, Category %in% c('Captive'))

ssCLAV <- ssCap[which(grepl("Healesville",ssCap$Location) + grepl("Monarto",ssCap$Location)>0),]
ssCLAV
##    Lane Project      Client.ID  Sample  X Category Sex.Age.Season Sex Age
## 1     1 default      S2_B99008 6102468 NA  Captive            FAU   F   A
## 2     1 default      S2_Bonney 6102469 NA  Captive            FAU   F   A
## 3     1 default      S3_Jessie 6102476 NA  Captive            FAW   F   A
## 4     1 default    S3_McCauley 6102477 NA  Captive            MAA   M   A
## 5     1 default      S5_Fenton 6102484 NA  Captive            MAU   M   A
## 6     1 default S5_Bryan Adams 6102485 NA  Captive            MAW   M   A
## 7     1 default       S7_Fredo 6102496 NA  Captive            MAA   M   A
## 8     1 default      S7_Piglet 6102497 NA  Captive            FSU   F   S
## 9     1 default    S10_McMahon 6102514 NA  Captive            MSP   M   S
## 10    1 default      S10_Logan 6102515 NA  Captive            MAU   M   A
## 11    1 default       S11_Xuki 6102520 NA  Captive            MAA   M   A
## 12    1 default   S11_Kalamata 6102521 NA  Captive            MSW   M   S
## 13    1 default      S12_Wally 6102528 NA  Captive            MAA   M   A
## 14    1 default        S12_Naz 6102529 NA  Captive            MAW   M   A
## 15    1 default     S13_Humbug 6102530 NA  Captive            MAU   M   A
## 16    1 default     S13_Xerxes 6102535 NA  Captive            MAA   M   A
## 17    1 default     S14_Catani 6102538 NA  Captive            FAU   F   A
## 18    2 default     S15_Amelia 6102541 NA  Captive            FAU   F   A
## 19    2 default     S15_London 6102542 NA  Captive            FAU   F   A
## 20    2 default      S15_Elyse 6102543 NA  Captive            FAP   F   A
## 21    2 default     S16_Marley 6102547 NA  Captive            FAU   F   A
## 22    2 default      S16_Milla 6102548 NA  Captive            FAU   F   A
## 23    2 default S16_Maleficent 6102549 NA  Captive            FAU   F   A
## 24    2 default     S17_Anirak 6102553 NA  Captive            FSW   F   S
## 25    2 default       S17_Poly 6102554 NA  Captive            FSU   F   S
## 26    2 default     S17_Methyl 6102556 NA  Captive            FSU   F   S
## 27    2 default       S18_Zara 6102558 NA  Captive            FSW   F   S
## 28    2 default       S18_Maze 6102559 NA  Captive            FSW   F   S
## 29    2 default    S18_Delores 6102560 NA  Captive            FSW   F   S
## 30    2 default    S19_Morocco 6102564 NA  Captive            MAU   M   A
## 31    2 default   S19_Pecorino 6102565 NA  Captive            FSW   F   S
## 32    2 default      S19_Hooch 6102566 NA  Captive            MSA   M   S
## 33    2 default      S20_Muasy 6102569 NA  Captive            MSU   M   S
## 34    2 default       S20_Fuse 6102570 NA  Captive            MSU   M   S
## 35    2 default     S20_Joseph 6102571 NA  Captive            MSU   M   S
## 36    2 default      S21_Moama 6102576 NA  Captive            MAW   M   A
## 37    2 default     S21_Nauset 6102577 NA  Captive            MSW   M   S
## 38    2 default     S21_Graham 6102578 NA  Captive            MSW   M   S
## 39    2 default      S22_Yanni 6102581 NA  Captive            MSW   M   S
## 40    2 default    S22_Gherkin 6102582 NA  Captive            MSW   M   S
## 41    2 default    S22_Stilton 6102584 NA  Captive            MSW   M   S
## 42    2 default     S23_Osiris 6102588 NA  Captive            MSW   M   S
## 43    2 default     S23_X-boxx 6102589 NA  Captive            FSW   F   S
## 44    2 default     S23_Quince 6102590 NA  Captive            MSW   M   S
## 45    2 default     S24_Malfoy 6102595 NA  Captive            MAW   M   A
## 46    2 default   S24_Licorice 6102596 NA  Captive            FSA   F   S
## 47    2 default       S25_Tofu 6102599 NA  Captive            FAU   F   A
## 48    2 default    S25_Colette 6102600 NA  Captive            FAP   F   A
## 49    2 default S25_CannonBall 6102601 NA  Captive            MSW   M   S
## 50    2 default  S25_Cornelius 6102602 NA  Captive            MAU   M   A
## 51    2 default    S25_Mardook 6102603 NA  Captive            MAW   M   A
## 52    2 default    S25_Negroni 6102604 NA  Captive            FSP   F   S
##    Season    Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1  Summer     Monarto 3.7369863   8.12  NA                NA        NA
## 2  Summer Healesville 2.5863014    5.4  NA                NA        NA
## 3  Winter     Monarto 2.1945205  12.95  NA                NA        NA
## 4  Autumn Healesville 3.0328767   8.52  NA                NA        NA
## 5  Summer     Monarto 3.0000000    N/A  NA                NA        NA
## 6  Winter Healesville 4.1616438    8.6  NA                NA        NA
## 7  Autumn Healesville 2.9945205    8.8  NA                NA        NA
## 8  Summer Healesville 1.5890411   4.76  NA                NA        NA
## 9  Spring Healesville 1.6493151   8.06  NA                NA        NA
## 10 Summer Healesville 5.6000000   9.02  NA                NA        NA
## 11 Autumn     Monarto 2.0767123   7.95  NA                NA        NA
## 12 Winter Healesville 1.2849315   5.58  NA                NA        NA
## 13 Autumn     Monarto 2.1616438    N/A  NA                NA        NA
## 14 Winter     Monarto 4.4547945    N/A  NA                NA        NA
## 15 Summer     Monarto 2.5397260   7.94  NA                NA        NA
## 16 Autumn     Monarto 2.0767123    N/A  NA                NA        NA
## 17 Summer Healesville 2.8630137   6.46  NA                NA        NA
## 18 Summer Healesville 4.7260274   5.85  NA                NA        NA
## 19 Summer Healesville 3.7863014    4.8  NA                NA        NA
## 20 Spring Healesville 4.5232877   7.88  NA                NA        NA
## 21 Summer     Monarto 4.7726027   7.51  NA                NA        NA
## 22 Summer Healesville 2.7671233   5.82  NA                NA        NA
## 23 Summer     Monarto 4.5589041   8.59  NA                NA        NA
## 24 Winter Healesville 1.3424658   5.42  NA                NA        NA
## 25 Summer     Monarto 1.7917808   6.67  NA                NA        NA
## 26 Summer Healesville 0.7534247   2.72  NA                NA        NA
## 27 Winter     Monarto 1.5150685    4.6  NA                NA        NA
## 28 Winter Healesville 1.4000000   5.82  NA                NA        NA
## 29 Winter Healesville 1.2986301    5.1  NA                NA        NA
## 30 Summer     Monarto 4.5917808   9.82  NA                NA        NA
## 31 Winter Healesville 1.1123288   6.02  NA                NA        NA
## 32 Autumn Healesville 1.0164384    6.1  NA                NA        NA
## 33 Summer Healesville 1.4219178   6.62  NA                NA        NA
## 34 Summer Healesville 1.7315068   6.26  NA                NA        NA
## 35 Summer Healesville 1.7479452   7.42  NA                NA        NA
## 36 Winter     Monarto 1.6986301   8.75  NA                NA        NA
## 37 Winter Healesville 1.3041096  4.036  NA                NA        NA
## 38 Winter Healesville 1.3616438    6.4  NA                NA        NA
## 39 Winter     Monarto 1.5178082   8.15  NA                NA        NA
## 40 Winter Healesville 1.2630137   6.32  NA                NA        NA
## 41 Winter Healesville 1.2986301   5.76  NA                NA        NA
## 42 Winter Healesville 1.1753425   5.34  NA                NA        NA
## 43 Winter     Monarto 1.4657534   4.34  NA                NA        NA
## 44 Winter Healesville 1.3835616    N/A  NA                NA        NA
## 45 Winter Healesville 5.1041096   8.02  NA                NA        NA
## 46 Autumn Healesville 1.8246575   5.94  NA                NA        NA
## 47 Summer Healesville 2.7452055    N/A  NA                NA        NA
## 48 Spring Healesville 6.6273973   7.52  NA                NA        NA
## 49 Winter Healesville 1.1479452   6.54  NA                NA        NA
## 50 Summer Healesville 3.6904110   7.74  NA                NA        NA
## 51 Winter Healesville 4.3013699   9.16  NA                NA        NA
## 52 Spring Healesville 1.6767123   5.86  NA                NA        NA
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA                  NA GCTATCCT+AACAGGTG
## 2                                   NA                  NA ACGTTCAG+AGTTGTGC
## 3                                   NA                  NA CCGTAAGA+AGAGTCCA
## 4                                   NA                  NA CAACACCT+AGCTACCA
## 5                                   NA                  NA GATTACCG+TTGGACTG
## 6                                   NA                  NA CACTAGCT+TCGGATTC
## 7                                   NA                  NA AGTGGATC+TCGATGAC
## 8                                   NA                  NA ATCACACG+GTAGCGTA
## 9                                   NA                  NA AACGTCTG+AATGACGC
## 10                                  NA                  NA GTGCCATA+CTCCTAGT
## 11                                  NA                  NA ATCGCCAT+TGCGTAAC
## 12                                  NA                  NA GAACATCG+TCGACAAG
## 13                                  NA                  NA ACGACTTG+AACAGCGA
## 14                                  NA                  NA CCTTGTAG+CCTTGGAA
## 15                                  NA                  NA GAGCAGTA+TGAGCTGT
## 16                                  NA                  NA GATAGGCT+CAGTCACA
## 17                                  NA                  NA TGAAGACG+ACATGCCA
## 18                                  NA                  NA AACGTCTG+AATGACGC
## 19                                  NA                  NA GTCATCGA+GATCCACT
## 20                                  NA                  NA AGCGTGTT+CTTCGCAA
## 21                                  NA                  NA GCAAGATC+AGTCGAAG
## 22                                  NA                  NA TTGCGAAG+AACACGCT
## 23                                  NA                  NA TGCTTCCA+CGATCGAT
## 24                                  NA                  NA TGAGCTAG+GAACGGTT
## 25                                  NA                  NA CTTAGGAC+ACTCCTAC
## 26                                  NA                  NA TGGTACAG+TCGAGAGT
## 27                                  NA                  NA ACCACGAT+GTCTGCAA
## 28                                  NA                  NA ACTGAGGT+GTCAACAG
## 29                                  NA                  NA ACGACTTG+AACAGCGA
## 30                                  NA                  NA TCAGGCTT+ATCATGCG
## 31                                  NA                  NA ATGCCTGT+AGATTGCG
## 32                                  NA                  NA CCGTAAGA+AGAGTCCA
## 33                                  NA                  NA TTCCAAGG+CTACAAGG
## 34                                  NA                  NA GTAGGAGT+GTCCTAAG
## 35                                  NA                  NA CTTCGACT+GATCTTGC
## 36                                  NA                  NA TTGGACGT+GAAGTGCT
## 37                                  NA                  NA TATCGGTC+TACCGGAT
## 38                                  NA                  NA TACGCCTT+GCTACTCT
## 39                                  NA                  NA CGTGTGTA+CCAACGAA
## 40                                  NA                  NA CCTTGTAG+CCTTGGAA
## 41                                  NA                  NA CGCAATCT+ACAGGCAT
## 42                                  NA                  NA AGTGGATC+TCGATGAC
## 43                                  NA                  NA CTGTTGAC+ACCTCAGT
## 44                                  NA                  NA AACCGTTC+CTAGCTCA
## 45                                  NA                  NA TAACCGGT+ATCGTCTC
## 46                                  NA                  NA TTGCAGAC+ATCGTGGT
## 47                                  NA                  NA GAGACGAT+ACCGGTTA
## 48                                  NA                  NA CTTGTCGA+CGATGTTC
## 49                                  NA                  NA TACGCTAC+CGTGTGAT
## 50                                  NA                  NA GAATCCGA+AGCTAGTG
## 51                                  NA                  NA GCACAACT+CTGAACGT
## 52                                  NA                  NA TGTGACTG+AGCCTATC
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    5,338,890           1.00              98.08                    1.92
## 2   14,968,459           3.00              97.82                    2.18
## 3    4,340,498           1.00              97.95                    2.05
## 4   16,944,152           3.00              97.98                    2.02
## 5    5,125,566           1.00              96.21                    3.79
## 6    5,317,767           1.00              97.33                    2.67
## 7    2,690,632           1.00              97.77                    2.23
## 8   12,134,750           2.00              96.94                    3.06
## 9    3,809,607           1.00              96.73                    3.27
## 10   9,606,720           2.00              97.52                    2.48
## 11   6,018,884           1.00              97.88                    2.12
## 12   6,861,544           1.00              97.76                    2.24
## 13   3,000,501           1.00              97.96                    2.04
## 14   5,927,942           1.00              97.40                    2.60
## 15   1,702,608           0.00              98.07                    1.93
## 16   7,628,257           2.00              98.34                    1.66
## 17  13,381,058           3.00              96.98                    3.02
## 18   8,041,818           1.73              96.32                    3.68
## 19   5,758,111           1.24              96.72                    3.28
## 20   5,774,637           1.24              96.76                    3.24
## 21     348,621           0.08              97.24                    2.76
## 22   6,376,997           1.37              97.60                    2.40
## 23   9,181,668           1.98              98.08                    1.92
## 24   3,740,878           0.81              97.15                    2.85
## 25  11,133,566           2.40              97.85                    2.15
## 26   7,887,375           1.70              97.57                    2.43
## 27   7,308,907           1.58              97.70                    2.30
## 28   2,984,930           0.64              97.59                    2.41
## 29          98           0.00              94.90                    5.10
## 30   4,879,629           1.05              97.38                    2.62
## 31   4,857,395           1.05              97.58                    2.42
## 32   1,074,345           0.23              97.56                    2.44
## 33  10,669,237           2.30              97.64                    2.36
## 34  10,603,179           2.29              97.34                    2.66
## 35   5,642,025           1.22              96.37                    3.63
## 36  10,821,895           2.33              96.02                    3.98
## 37   8,693,920           1.87              98.13                    1.87
## 38   3,422,010           0.74              97.72                    2.28
## 39   4,811,453           1.04              97.67                    2.33
## 40   5,913,586           1.27              97.05                    2.95
## 41   8,306,537           1.79              96.94                    3.06
## 42   3,528,471           0.76              97.24                    2.76
## 43          23           0.00             100.00                     NaN
## 44   7,247,793           1.56              97.63                    2.37
## 45   6,908,416           1.49              97.09                    2.91
## 46   4,475,461           0.96              95.05                    4.95
## 47  12,024,421           2.59              95.37                    4.63
## 48  10,751,797           2.32              97.49                    2.51
## 49  13,015,081           2.81              97.36                    2.64
## 50   3,336,983           0.72              97.10                    2.90
## 51   6,826,313           1.47              97.66                    2.34
## 52   4,566,180           0.98              97.68                    2.32
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,612           100     93.69        35.91  NA  NA  NA
## 2           4,520           100     93.68        35.91  NA  NA  NA
## 3           1,311           100     93.54        35.88  NA  NA  NA
## 4           5,117           100     93.05        35.78  NA  NA  NA
## 5           1,548           100     93.89        35.94  NA  NA  NA
## 6           1,606           100     93.24        35.83  NA  NA  NA
## 7             813           100     93.77        35.93  NA  NA  NA
## 8           3,665           100     93.34        35.84  NA  NA  NA
## 9           1,151           100     93.07        35.79  NA  NA  NA
## 10          2,901           100     93.25        35.83  NA  NA  NA
## 11          1,818           100     93.58        35.89  NA  NA  NA
## 12          2,072           100     93.49        35.87  NA  NA  NA
## 13            906           100     93.70        35.91  NA  NA  NA
## 14          1,790           100     93.86        35.94  NA  NA  NA
## 15            514           100     93.58        35.89  NA  NA  NA
## 16          2,304           100     93.62        35.89  NA  NA  NA
## 17          4,041           100     93.36        35.84  NA  NA  NA
## 18          2,429           100     92.18        35.63  NA  NA  NA
## 19          1,739           100     91.87        35.55  NA  NA  NA
## 20          1,744           100     91.56        35.50  NA  NA  NA
## 21            105           100     92.77        35.73  NA  NA  NA
## 22          1,926           100     92.44        35.67  NA  NA  NA
## 23          2,773           100     93.04        35.79  NA  NA  NA
## 24          1,130           100     93.03        35.79  NA  NA  NA
## 25          3,362           100     92.47        35.68  NA  NA  NA
## 26          2,382           100     93.15        35.81  NA  NA  NA
## 27          2,207           100     92.84        35.75  NA  NA  NA
## 28            901           100     92.49        35.69  NA  NA  NA
## 29              0           100     89.11        34.91  NA  NA  NA
## 30          1,474           100     92.63        35.71  NA  NA  NA
## 31          1,467           100     92.64        35.72  NA  NA  NA
## 32            324           100     92.66        35.72  NA  NA  NA
## 33          3,222           100     92.79        35.74  NA  NA  NA
## 34          3,202           100     92.01        35.58  NA  NA  NA
## 35          1,704           100     91.87        35.56  NA  NA  NA
## 36          3,268           100     92.72        35.73  NA  NA  NA
## 37          2,626           100     92.32        35.65  NA  NA  NA
## 38          1,033           100     92.94        35.76  NA  NA  NA
## 39          1,453           100     92.30        35.65  NA  NA  NA
## 40          1,786           100     92.92        35.77  NA  NA  NA
## 41          2,509           100     91.86        35.55  NA  NA  NA
## 42          1,066           100     93.08        35.79  NA  NA  NA
## 43              0           100     95.85        36.37  NA  NA  NA
## 44          2,189           100     92.28        35.63  NA  NA  NA
## 45          2,086           100     91.90        35.56  NA  NA  NA
## 46          1,352           100     91.42        35.46  NA  NA  NA
## 47          3,631           100     93.06        35.79  NA  NA  NA
## 48          3,247           100     92.77        35.74  NA  NA  NA
## 49          3,931           100     92.61        35.70  NA  NA  NA
## 50          1,008           100     93.09        35.79  NA  NA  NA
## 51          2,062           100     92.67        35.71  NA  NA  NA
## 52          1,379           100     92.13        35.61  NA  NA  NA
ssCLAV <- ssCLAV[ssCLAV$Sample %in% colnames(x),]

dim(ssCLAV)
## [1] 48 31
x1 <- x[,which(colnames(x) %in% ssCLAV$Sample)]
dim(x1)
## [1] 310  48
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 261  48
ssCLAV %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S2_B99008 6102468 NA Captive FAU F A Summer Monarto 3.7369863 8.12 NA NA NA NA NA GCTATCCT+AACAGGTG 5,338,890 1.00 98.08 1.92 1,612 100 93.69 35.91 NA NA NA
2 1 default S2_Bonney 6102469 NA Captive FAU F A Summer Healesville 2.5863014 5.4 NA NA NA NA NA ACGTTCAG+AGTTGTGC 14,968,459 3.00 97.82 2.18 4,520 100 93.68 35.91 NA NA NA
3 1 default S3_Jessie 6102476 NA Captive FAW F A Winter Monarto 2.1945205 12.95 NA NA NA NA NA CCGTAAGA+AGAGTCCA 4,340,498 1.00 97.95 2.05 1,311 100 93.54 35.88 NA NA NA
4 1 default S3_McCauley 6102477 NA Captive MAA M A Autumn Healesville 3.0328767 8.52 NA NA NA NA NA CAACACCT+AGCTACCA 16,944,152 3.00 97.98 2.02 5,117 100 93.05 35.78 NA NA NA
5 1 default S5_Fenton 6102484 NA Captive MAU M A Summer Monarto 3.0000000 N/A NA NA NA NA NA GATTACCG+TTGGACTG 5,125,566 1.00 96.21 3.79 1,548 100 93.89 35.94 NA NA NA
6 1 default S5_Bryan Adams 6102485 NA Captive MAW M A Winter Healesville 4.1616438 8.6 NA NA NA NA NA CACTAGCT+TCGGATTC 5,317,767 1.00 97.33 2.67 1,606 100 93.24 35.83 NA NA NA
7 1 default S7_Fredo 6102496 NA Captive MAA M A Autumn Healesville 2.9945205 8.8 NA NA NA NA NA AGTGGATC+TCGATGAC 2,690,632 1.00 97.77 2.23 813 100 93.77 35.93 NA NA NA
8 1 default S7_Piglet 6102497 NA Captive FSU F S Summer Healesville 1.5890411 4.76 NA NA NA NA NA ATCACACG+GTAGCGTA 12,134,750 2.00 96.94 3.06 3,665 100 93.34 35.84 NA NA NA
9 1 default S10_McMahon 6102514 NA Captive MSP M S Spring Healesville 1.6493151 8.06 NA NA NA NA NA AACGTCTG+AATGACGC 3,809,607 1.00 96.73 3.27 1,151 100 93.07 35.79 NA NA NA
10 1 default S10_Logan 6102515 NA Captive MAU M A Summer Healesville 5.6000000 9.02 NA NA NA NA NA GTGCCATA+CTCCTAGT 9,606,720 2.00 97.52 2.48 2,901 100 93.25 35.83 NA NA NA
11 1 default S11_Xuki 6102520 NA Captive MAA M A Autumn Monarto 2.0767123 7.95 NA NA NA NA NA ATCGCCAT+TGCGTAAC 6,018,884 1.00 97.88 2.12 1,818 100 93.58 35.89 NA NA NA
12 1 default S11_Kalamata 6102521 NA Captive MSW M S Winter Healesville 1.2849315 5.58 NA NA NA NA NA GAACATCG+TCGACAAG 6,861,544 1.00 97.76 2.24 2,072 100 93.49 35.87 NA NA NA
13 1 default S12_Wally 6102528 NA Captive MAA M A Autumn Monarto 2.1616438 N/A NA NA NA NA NA ACGACTTG+AACAGCGA 3,000,501 1.00 97.96 2.04 906 100 93.70 35.91 NA NA NA
14 1 default S12_Naz 6102529 NA Captive MAW M A Winter Monarto 4.4547945 N/A NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,927,942 1.00 97.40 2.60 1,790 100 93.86 35.94 NA NA NA
15 1 default S13_Humbug 6102530 NA Captive MAU M A Summer Monarto 2.5397260 7.94 NA NA NA NA NA GAGCAGTA+TGAGCTGT 1,702,608 0.00 98.07 1.93 514 100 93.58 35.89 NA NA NA
16 1 default S13_Xerxes 6102535 NA Captive MAA M A Autumn Monarto 2.0767123 N/A NA NA NA NA NA GATAGGCT+CAGTCACA 7,628,257 2.00 98.34 1.66 2,304 100 93.62 35.89 NA NA NA
17 1 default S14_Catani 6102538 NA Captive FAU F A Summer Healesville 2.8630137 6.46 NA NA NA NA NA TGAAGACG+ACATGCCA 13,381,058 3.00 96.98 3.02 4,041 100 93.36 35.84 NA NA NA
18 2 default S15_Amelia 6102541 NA Captive FAU F A Summer Healesville 4.7260274 5.85 NA NA NA NA NA AACGTCTG+AATGACGC 8,041,818 1.73 96.32 3.68 2,429 100 92.18 35.63 NA NA NA
19 2 default S15_London 6102542 NA Captive FAU F A Summer Healesville 3.7863014 4.8 NA NA NA NA NA GTCATCGA+GATCCACT 5,758,111 1.24 96.72 3.28 1,739 100 91.87 35.55 NA NA NA
20 2 default S15_Elyse 6102543 NA Captive FAP F A Spring Healesville 4.5232877 7.88 NA NA NA NA NA AGCGTGTT+CTTCGCAA 5,774,637 1.24 96.76 3.24 1,744 100 91.56 35.50 NA NA NA
22 2 default S16_Milla 6102548 NA Captive FAU F A Summer Healesville 2.7671233 5.82 NA NA NA NA NA TTGCGAAG+AACACGCT 6,376,997 1.37 97.60 2.40 1,926 100 92.44 35.67 NA NA NA
23 2 default S16_Maleficent 6102549 NA Captive FAU F A Summer Monarto 4.5589041 8.59 NA NA NA NA NA TGCTTCCA+CGATCGAT 9,181,668 1.98 98.08 1.92 2,773 100 93.04 35.79 NA NA NA
24 2 default S17_Anirak 6102553 NA Captive FSW F S Winter Healesville 1.3424658 5.42 NA NA NA NA NA TGAGCTAG+GAACGGTT 3,740,878 0.81 97.15 2.85 1,130 100 93.03 35.79 NA NA NA
25 2 default S17_Poly 6102554 NA Captive FSU F S Summer Monarto 1.7917808 6.67 NA NA NA NA NA CTTAGGAC+ACTCCTAC 11,133,566 2.40 97.85 2.15 3,362 100 92.47 35.68 NA NA NA
26 2 default S17_Methyl 6102556 NA Captive FSU F S Summer Healesville 0.7534247 2.72 NA NA NA NA NA TGGTACAG+TCGAGAGT 7,887,375 1.70 97.57 2.43 2,382 100 93.15 35.81 NA NA NA
27 2 default S18_Zara 6102558 NA Captive FSW F S Winter Monarto 1.5150685 4.6 NA NA NA NA NA ACCACGAT+GTCTGCAA 7,308,907 1.58 97.70 2.30 2,207 100 92.84 35.75 NA NA NA
28 2 default S18_Maze 6102559 NA Captive FSW F S Winter Healesville 1.4000000 5.82 NA NA NA NA NA ACTGAGGT+GTCAACAG 2,984,930 0.64 97.59 2.41 901 100 92.49 35.69 NA NA NA
30 2 default S19_Morocco 6102564 NA Captive MAU M A Summer Monarto 4.5917808 9.82 NA NA NA NA NA TCAGGCTT+ATCATGCG 4,879,629 1.05 97.38 2.62 1,474 100 92.63 35.71 NA NA NA
31 2 default S19_Pecorino 6102565 NA Captive FSW F S Winter Healesville 1.1123288 6.02 NA NA NA NA NA ATGCCTGT+AGATTGCG 4,857,395 1.05 97.58 2.42 1,467 100 92.64 35.72 NA NA NA
33 2 default S20_Muasy 6102569 NA Captive MSU M S Summer Healesville 1.4219178 6.62 NA NA NA NA NA TTCCAAGG+CTACAAGG 10,669,237 2.30 97.64 2.36 3,222 100 92.79 35.74 NA NA NA
34 2 default S20_Fuse 6102570 NA Captive MSU M S Summer Healesville 1.7315068 6.26 NA NA NA NA NA GTAGGAGT+GTCCTAAG 10,603,179 2.29 97.34 2.66 3,202 100 92.01 35.58 NA NA NA
35 2 default S20_Joseph 6102571 NA Captive MSU M S Summer Healesville 1.7479452 7.42 NA NA NA NA NA CTTCGACT+GATCTTGC 5,642,025 1.22 96.37 3.63 1,704 100 91.87 35.56 NA NA NA
36 2 default S21_Moama 6102576 NA Captive MAW M A Winter Monarto 1.6986301 8.75 NA NA NA NA NA TTGGACGT+GAAGTGCT 10,821,895 2.33 96.02 3.98 3,268 100 92.72 35.73 NA NA NA
37 2 default S21_Nauset 6102577 NA Captive MSW M S Winter Healesville 1.3041096 4.036 NA NA NA NA NA TATCGGTC+TACCGGAT 8,693,920 1.87 98.13 1.87 2,626 100 92.32 35.65 NA NA NA
38 2 default S21_Graham 6102578 NA Captive MSW M S Winter Healesville 1.3616438 6.4 NA NA NA NA NA TACGCCTT+GCTACTCT 3,422,010 0.74 97.72 2.28 1,033 100 92.94 35.76 NA NA NA
39 2 default S22_Yanni 6102581 NA Captive MSW M S Winter Monarto 1.5178082 8.15 NA NA NA NA NA CGTGTGTA+CCAACGAA 4,811,453 1.04 97.67 2.33 1,453 100 92.30 35.65 NA NA NA
40 2 default S22_Gherkin 6102582 NA Captive MSW M S Winter Healesville 1.2630137 6.32 NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,913,586 1.27 97.05 2.95 1,786 100 92.92 35.77 NA NA NA
41 2 default S22_Stilton 6102584 NA Captive MSW M S Winter Healesville 1.2986301 5.76 NA NA NA NA NA CGCAATCT+ACAGGCAT 8,306,537 1.79 96.94 3.06 2,509 100 91.86 35.55 NA NA NA
42 2 default S23_Osiris 6102588 NA Captive MSW M S Winter Healesville 1.1753425 5.34 NA NA NA NA NA AGTGGATC+TCGATGAC 3,528,471 0.76 97.24 2.76 1,066 100 93.08 35.79 NA NA NA
44 2 default S23_Quince 6102590 NA Captive MSW M S Winter Healesville 1.3835616 N/A NA NA NA NA NA AACCGTTC+CTAGCTCA 7,247,793 1.56 97.63 2.37 2,189 100 92.28 35.63 NA NA NA
45 2 default S24_Malfoy 6102595 NA Captive MAW M A Winter Healesville 5.1041096 8.02 NA NA NA NA NA TAACCGGT+ATCGTCTC 6,908,416 1.49 97.09 2.91 2,086 100 91.90 35.56 NA NA NA
46 2 default S24_Licorice 6102596 NA Captive FSA F S Autumn Healesville 1.8246575 5.94 NA NA NA NA NA TTGCAGAC+ATCGTGGT 4,475,461 0.96 95.05 4.95 1,352 100 91.42 35.46 NA NA NA
47 2 default S25_Tofu 6102599 NA Captive FAU F A Summer Healesville 2.7452055 N/A NA NA NA NA NA GAGACGAT+ACCGGTTA 12,024,421 2.59 95.37 4.63 3,631 100 93.06 35.79 NA NA NA
48 2 default S25_Colette 6102600 NA Captive FAP F A Spring Healesville 6.6273973 7.52 NA NA NA NA NA CTTGTCGA+CGATGTTC 10,751,797 2.32 97.49 2.51 3,247 100 92.77 35.74 NA NA NA
49 2 default S25_CannonBall 6102601 NA Captive MSW M S Winter Healesville 1.1479452 6.54 NA NA NA NA NA TACGCTAC+CGTGTGAT 13,015,081 2.81 97.36 2.64 3,931 100 92.61 35.70 NA NA NA
50 2 default S25_Cornelius 6102602 NA Captive MAU M A Summer Healesville 3.6904110 7.74 NA NA NA NA NA GAATCCGA+AGCTAGTG 3,336,983 0.72 97.10 2.90 1,008 100 93.09 35.79 NA NA NA
51 2 default S25_Mardook 6102603 NA Captive MAW M A Winter Healesville 4.3013699 9.16 NA NA NA NA NA GCACAACT+CTGAACGT 6,826,313 1.47 97.66 2.34 2,062 100 92.67 35.71 NA NA NA
52 2 default S25_Negroni 6102604 NA Captive FSP F S Spring Healesville 1.6767123 5.86 NA NA NA NA NA TGTGACTG+AGCCTATC 4,566,180 0.98 97.68 2.32 1,379 100 92.13 35.61 NA NA NA
col <- as.character(as.numeric(grepl("Monarto",ssCLAV$Location)))
col <- gsub("0","darkblue",col)
col <- gsub("1","blue",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Captive location: Healesville vs Monarto devils")
mtext("Healesville=Dark Blue, Monarto=Light Blue")

ssCLAV$CapLoc <- grepl("Monarto",ssCLAV$Location)
ssCLAV$MvF <- factor(ssCLAV$Sex)
ssCLAV$SubAdvAd <- as.numeric(factor(ssCLAV$Age,levels=c("S","A"),ordered = TRUE))
ssCLAV$Season <- factor(ssCLAV$Season)
str(ssCLAV)
## 'data.frame':    48 obs. of  34 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S2_B99008" "S2_Bonney" "S3_Jessie" "S3_McCauley" ...
##  $ Sample                 : int  6102468 6102469 6102476 6102477 6102484 6102485 6102496 6102497 6102514 6102515 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "Captive" "Captive" "Captive" "Captive" ...
##  $ Sex.Age.Season         : chr  "FAU" "FAU" "FAW" "MAA" ...
##  $ Sex                    : chr  "F" "F" "F" "M" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 3 3 4 1 3 4 1 3 2 3 ...
##  $ Location               : chr  "Monarto" "Healesville" "Monarto" "Healesville" ...
##  $ Agebyyear              : num  3.74 2.59 2.19 3.03 3 ...
##  $ Weight                 : chr  "8.12" "5.4" "12.95" "8.52" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ Ulcerated              : logi  NA NA NA NA NA NA ...
##  $ UlcerationDepth        : chr  "" "" "" "" ...
##  $ Secondary.infection    : logi  NA NA NA NA NA NA ...
##  $ Total.tumour.volume    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Barcode.sequence       : chr  "GCTATCCT+AACAGGTG" "ACGTTCAG+AGTTGTGC" "CCGTAAGA+AGAGTCCA" "CAACACCT+AGCTACCA" ...
##  $ PF.Clusters            : chr  "5,338,890" "14,968,459" "4,340,498" "16,944,152" ...
##  $ X..of.the.lane         : num  1 3 1 3 1 1 1 2 1 2 ...
##  $ X..Perfect.barcode     : num  98.1 97.8 98 98 96.2 ...
##  $ X..One.mismatch.barcode: num  1.92 2.18 2.05 2.02 3.79 2.67 2.23 3.06 3.27 2.48 ...
##  $ Yield..Mbases.         : chr  "1,612" "4,520" "1,311" "5,117" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.7 93.7 93.5 93 93.9 ...
##  $ Mean.Quality           : num  35.9 35.9 35.9 35.8 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ CapLoc                 : logi  TRUE FALSE TRUE FALSE TRUE FALSE ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 2 2 2 2 1 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 1 1 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssCLAV, design = ~ Season + SubAdvAd + MvF + CapLoc )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 10 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeCLAV <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 1
maplot(dgeCLAV,"Captive loacation: Healesville vs Monarto devils")

make_volcano(dgeCLAV,"Captive loacation: Healesville vs Monarto devils")

sig[1:150,1:6] %>%
  kbl(caption="Comparison of Wild vs Captive devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Wild vs Captive devils
baseMean log2FoldChange lfcSE stat pvalue padj
IDO1 5484.326 3.144914 0.7196113 4.370296 1.24e-05 0.0031764
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
NA.28 NA NA NA NA NA NA
NA.29 NA NA NA NA NA NA
NA.30 NA NA NA NA NA NA
NA.31 NA NA NA NA NA NA
NA.32 NA NA NA NA NA NA
NA.33 NA NA NA NA NA NA
NA.34 NA NA NA NA NA NA
NA.35 NA NA NA NA NA NA
NA.36 NA NA NA NA NA NA
NA.37 NA NA NA NA NA NA
NA.38 NA NA NA NA NA NA
NA.39 NA NA NA NA NA NA
NA.40 NA NA NA NA NA NA
NA.41 NA NA NA NA NA NA
NA.42 NA NA NA NA NA NA
NA.43 NA NA NA NA NA NA
NA.44 NA NA NA NA NA NA
NA.45 NA NA NA NA NA NA
NA.46 NA NA NA NA NA NA
NA.47 NA NA NA NA NA NA
NA.48 NA NA NA NA NA NA
NA.49 NA NA NA NA NA NA
NA.50 NA NA NA NA NA NA
NA.51 NA NA NA NA NA NA
NA.52 NA NA NA NA NA NA
NA.53 NA NA NA NA NA NA
NA.54 NA NA NA NA NA NA
NA.55 NA NA NA NA NA NA
NA.56 NA NA NA NA NA NA
NA.57 NA NA NA NA NA NA
NA.58 NA NA NA NA NA NA
NA.59 NA NA NA NA NA NA
NA.60 NA NA NA NA NA NA
NA.61 NA NA NA NA NA NA
NA.62 NA NA NA NA NA NA
NA.63 NA NA NA NA NA NA
NA.64 NA NA NA NA NA NA
NA.65 NA NA NA NA NA NA
NA.66 NA NA NA NA NA NA
NA.67 NA NA NA NA NA NA
NA.68 NA NA NA NA NA NA
NA.69 NA NA NA NA NA NA
NA.70 NA NA NA NA NA NA
NA.71 NA NA NA NA NA NA
NA.72 NA NA NA NA NA NA
NA.73 NA NA NA NA NA NA
NA.74 NA NA NA NA NA NA
NA.75 NA NA NA NA NA NA
NA.76 NA NA NA NA NA NA
NA.77 NA NA NA NA NA NA
NA.78 NA NA NA NA NA NA
NA.79 NA NA NA NA NA NA
NA.80 NA NA NA NA NA NA
NA.81 NA NA NA NA NA NA
NA.82 NA NA NA NA NA NA
NA.83 NA NA NA NA NA NA
NA.84 NA NA NA NA NA NA
NA.85 NA NA NA NA NA NA
NA.86 NA NA NA NA NA NA
NA.87 NA NA NA NA NA NA
NA.88 NA NA NA NA NA NA
NA.89 NA NA NA NA NA NA
NA.90 NA NA NA NA NA NA
NA.91 NA NA NA NA NA NA
NA.92 NA NA NA NA NA NA
NA.93 NA NA NA NA NA NA
NA.94 NA NA NA NA NA NA
NA.95 NA NA NA NA NA NA
NA.96 NA NA NA NA NA NA
NA.97 NA NA NA NA NA NA
NA.98 NA NA NA NA NA NA
NA.99 NA NA NA NA NA NA
NA.100 NA NA NA NA NA NA
NA.101 NA NA NA NA NA NA
NA.102 NA NA NA NA NA NA
NA.103 NA NA NA NA NA NA
NA.104 NA NA NA NA NA NA
NA.105 NA NA NA NA NA NA
NA.106 NA NA NA NA NA NA
NA.107 NA NA NA NA NA NA
NA.108 NA NA NA NA NA NA
NA.109 NA NA NA NA NA NA
NA.110 NA NA NA NA NA NA
NA.111 NA NA NA NA NA NA
NA.112 NA NA NA NA NA NA
NA.113 NA NA NA NA NA NA
NA.114 NA NA NA NA NA NA
NA.115 NA NA NA NA NA NA
NA.116 NA NA NA NA NA NA
NA.117 NA NA NA NA NA NA
NA.118 NA NA NA NA NA NA
NA.119 NA NA NA NA NA NA
NA.120 NA NA NA NA NA NA
NA.121 NA NA NA NA NA NA
NA.122 NA NA NA NA NA NA
NA.123 NA NA NA NA NA NA
NA.124 NA NA NA NA NA NA
NA.125 NA NA NA NA NA NA
NA.126 NA NA NA NA NA NA
NA.127 NA NA NA NA NA NA
NA.128 NA NA NA NA NA NA
NA.129 NA NA NA NA NA NA
NA.130 NA NA NA NA NA NA
NA.131 NA NA NA NA NA NA
NA.132 NA NA NA NA NA NA
NA.133 NA NA NA NA NA NA
NA.134 NA NA NA NA NA NA
NA.135 NA NA NA NA NA NA
NA.136 NA NA NA NA NA NA
NA.137 NA NA NA NA NA NA
NA.138 NA NA NA NA NA NA
NA.139 NA NA NA NA NA NA
NA.140 NA NA NA NA NA NA
NA.141 NA NA NA NA NA NA
NA.142 NA NA NA NA NA NA
NA.143 NA NA NA NA NA NA
NA.144 NA NA NA NA NA NA
NA.145 NA NA NA NA NA NA
NA.146 NA NA NA NA NA NA
NA.147 NA NA NA NA NA NA
NA.148 NA NA NA NA NA NA
write.table(dge,file="dgeWvCAV.tsv",sep="\t")
ssCvD <- filter(ss, Category %in% c('DFT1','DFT2', 'Captive'))

ssCvDAV <- ssCvD[which(grepl("Captive",ssCvD$Category) + grepl("DFT",ssCvD$Category)>0),]
ssCvDAV
##    Lane Project              Client.ID  Sample  X Category Sex.Age.Season Sex
## 1     1 default            S1_Sarafina 6102463 NA     DFT1            FAP   F
## 2     1 default                S1_Lucy 6102464 NA     DFT1            FAU   F
## 3     1 default              S2_B99008 6102468 NA  Captive            FAU   F
## 4     1 default              S2_Bonney 6102469 NA  Captive            FAU   F
## 5     1 default                S2_Hope 6102471 NA     DFT1            FAU   F
## 6     1 default               S2_Sally 6102472 NA     DFT1            FAU   F
## 7     1 default                 S3_Apu 6102473 NA     DFT1            MAA   M
## 8     1 default              S3_Simone 6102474 NA     DFT1            FAW   F
## 9     1 default              S3_Jessie 6102476 NA  Captive            FAW   F
## 10    1 default            S3_McCauley 6102477 NA  Captive            MAA   M
## 11    1 default              S4_Wiggum 6102480 NA     DFT1            MAA   M
## 12    1 default                S4_Pooh 6102482 NA     DFT1            MAA   M
## 13    1 default            S4_Milhouse 6102483 NA     DFT1            MAA   M
## 14    1 default              S5_Fenton 6102484 NA  Captive            MAU   M
## 15    1 default         S5_Bryan Adams 6102485 NA  Captive            MAW   M
## 16    1 default               S5_Allen 6102488 NA     DFT1            MAU   M
## 17    1 default                S5_Cyan 6102489 NA     DFT1            MAW   M
## 18    1 default              S6_Shelob 6102492 NA     DFT2            FAP   F
## 19    1 default           S6_Stuttgart 6102493 NA     DFT1            MSP   M
## 20    1 default               S7_Fredo 6102496 NA  Captive            MAA   M
## 21    1 default              S7_Piglet 6102497 NA  Captive            FSU   F
## 22    1 default              S7_Violet 6102498 NA     DFT2            FSU   F
## 23    1 default              S7_Willie 6102500 NA     DFT2            MAA   M
## 24    1 default              S8_Orange 6102502 NA     DFT1            FAU   F
## 25    1 default                S8_ST67 6102505 NA     DFT2            MAW   M
## 26    1 default              S8_Yellow 6102507 NA     DFT2            MAU   M
## 27    1 default                S9_Jane 6102508 NA     DFT1            FAA   F
## 28    1 default        S9_Clytemnestra 6102511 NA     DFT1            FSP   F
## 29    1 default                S9_Zeus 6102512 NA     DFT2            MSW   M
## 30    1 default            S10_McMahon 6102514 NA  Captive            MSP   M
## 31    1 default              S10_Logan 6102515 NA  Captive            MAU   M
## 32    1 default           S10_Laurasia 6102516 NA     DFT2            MSP   M
## 33    1 default          S10_Enchilada 6102517 NA     DFT2            MAP   M
## 34    1 default S11_Murdoch/Washington 6102519 NA     DFT2            MAA   M
## 35    1 default               S11_Xuki 6102520 NA  Captive            MAA   M
## 36    1 default           S11_Kalamata 6102521 NA  Captive            MSW   M
## 37    1 default                S12_Abe 6102524 NA     DFT1            MAA   M
## 38    1 default              S12_Lilac 6102526 NA     DFT1            MAW   M
## 39    1 default              S12_Wally 6102528 NA  Captive            MAA   M
## 40    1 default                S12_Naz 6102529 NA  Captive            MAW   M
## 41    1 default             S13_Humbug 6102530 NA  Captive            MAU   M
## 42    1 default              S13_Green 6102531 NA     DFT1            MAA   M
## 43    1 default               S13_Bump 6102532 NA     DFT1            MAU   M
## 44    1 default             S13_Xerxes 6102535 NA  Captive            MAA   M
## 45    1 default             S14_Purple 6102536 NA     DFT1            FAW   F
## 46    1 default             S14_Catani 6102538 NA  Captive            FAU   F
## 47    2 default             S15_Amelia 6102541 NA  Captive            FAU   F
## 48    2 default             S15_London 6102542 NA  Captive            FAU   F
## 49    2 default              S15_Elyse 6102543 NA  Captive            FAP   F
## 50    2 default             S16_Marley 6102547 NA  Captive            FAU   F
## 51    2 default              S16_Milla 6102548 NA  Captive            FAU   F
## 52    2 default         S16_Maleficent 6102549 NA  Captive            FAU   F
## 53    2 default             S17_Anirak 6102553 NA  Captive            FSW   F
## 54    2 default               S17_Poly 6102554 NA  Captive            FSU   F
## 55    2 default             S17_Methyl 6102556 NA  Captive            FSU   F
## 56    2 default               S18_Zara 6102558 NA  Captive            FSW   F
## 57    2 default               S18_Maze 6102559 NA  Captive            FSW   F
## 58    2 default            S18_Delores 6102560 NA  Captive            FSW   F
## 59    2 default            S19_Morocco 6102564 NA  Captive            MAU   M
## 60    2 default           S19_Pecorino 6102565 NA  Captive            FSW   F
## 61    2 default              S19_Hooch 6102566 NA  Captive            MSA   M
## 62    2 default              S20_Muasy 6102569 NA  Captive            MSU   M
## 63    2 default               S20_Fuse 6102570 NA  Captive            MSU   M
## 64    2 default             S20_Joseph 6102571 NA  Captive            MSU   M
## 65    2 default              S21_Moama 6102576 NA  Captive            MAW   M
## 66    2 default             S21_Nauset 6102577 NA  Captive            MSW   M
## 67    2 default             S21_Graham 6102578 NA  Captive            MSW   M
## 68    2 default              S22_Yanni 6102581 NA  Captive            MSW   M
## 69    2 default            S22_Gherkin 6102582 NA  Captive            MSW   M
## 70    2 default            S22_Stilton 6102584 NA  Captive            MSW   M
## 71    2 default             S23_Osiris 6102588 NA  Captive            MSW   M
## 72    2 default             S23_X-boxx 6102589 NA  Captive            FSW   F
## 73    2 default             S23_Quince 6102590 NA  Captive            MSW   M
## 74    2 default             S24_Malfoy 6102595 NA  Captive            MAW   M
## 75    2 default           S24_Licorice 6102596 NA  Captive            FSA   F
## 76    2 default               S25_Tofu 6102599 NA  Captive            FAU   F
## 77    2 default            S25_Colette 6102600 NA  Captive            FAP   F
## 78    2 default         S25_CannonBall 6102601 NA  Captive            MSW   M
## 79    2 default          S25_Cornelius 6102602 NA  Captive            MAU   M
## 80    2 default            S25_Mardook 6102603 NA  Captive            MAW   M
## 81    2 default            S25_Negroni 6102604 NA  Captive            FSP   F
##    Age Season    Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1    A Spring     Channel 2.6191781    6.4  NA                NA        NA
## 2    A Summer     Channel 2.9178082    7.1  NA                 3      TRUE
## 3    A Summer     Monarto 3.7369863   8.12  NA                NA        NA
## 4    A Summer Healesville 2.5863014    5.4  NA                NA        NA
## 5    A Summer     Channel 2.9315068    6.4  NA                 4      TRUE
## 6    A Summer     Channel 2.9945205      7  NA                 1      TRUE
## 7    A Autumn     Channel 3.1150685    9.5  NA                 1     FALSE
## 8    A Winter     Channel 3.2739726   10.2  NA                 1      TRUE
## 9    A Winter     Monarto 2.1945205  12.95  NA                NA        NA
## 10   A Autumn Healesville 3.0328767   8.52  NA                NA        NA
## 11   A Autumn     Channel 3.1178082    8.3  NA                 2     FALSE
## 12   A Autumn     Channel 4.1863014   11.8  NA                 1     FALSE
## 13   A Autumn     Channel 4.1013699     11  NA                 1      TRUE
## 14   A Summer     Monarto 3.0000000    N/A  NA                NA        NA
## 15   A Winter Healesville 4.1616438    8.6  NA                NA        NA
## 16   A Summer     Channel 1.9095890    6.7  NA                 1      TRUE
## 17   A Winter     Channel 3.3945205    9.1  NA                 5      TRUE
## 18   A Spring     Channel 4.6219178    7.2  NA                NA        NA
## 19   S Spring     Channel 0.5780822   12.7  NA                 1     FALSE
## 20   A Autumn Healesville 2.9945205    8.8  NA                NA        NA
## 21   S Summer Healesville 1.5890411   4.76  NA                NA        NA
## 22   S Summer     Channel 0.8739726    4.6  NA                 1      TRUE
## 23   A Autumn     Channel 2.1150685    8.2  NA                 2      TRUE
## 24   A Summer     Channel 1.9150685    7.1  NA                 7      TRUE
## 25   A Winter     Channel 4.2794521   10.2  NA                 1      TRUE
## 26   A Summer     Channel 1.8657534   10.5  NA                 2      TRUE
## 27   A Autumn     Channel 3.1972603    6.1  NA                NA        NA
## 28   S Spring     Channel 1.6602740      6  NA                NA        NA
## 29   S Winter     Channel 1.3479452    7.3  NA                NA        NA
## 30   S Spring Healesville 1.6493151   8.06  NA                NA        NA
## 31   A Summer Healesville 5.6000000   9.02  NA                NA        NA
## 32   S Spring     Channel 1.6383562      8  NA                NA        NA
## 33   A Spring     Channel 3.6438356    9.3  NA                14     FALSE
## 34   A Autumn     Channel 1.4438356    8.9  NA                NA        NA
## 35   A Autumn     Monarto 2.0767123   7.95  NA                NA        NA
## 36   S Winter Healesville 1.2849315   5.58  NA                NA        NA
## 37   A Autumn     Channel 3.1150685    7.9  NA                 1      TRUE
## 38   A Winter     Channel 3.4109589    9.6  NA                 5      TRUE
## 39   A Autumn     Monarto 2.1616438    N/A  NA                NA        NA
## 40   A Winter     Monarto 4.4547945    N/A  NA                NA        NA
## 41   A Summer     Monarto 2.5397260   7.94  NA                NA        NA
## 42   A Autumn     Channel 3.1534247    7.5  NA                 2      TRUE
## 43   A Summer     Channel 3.9068493    9.3  NA                NA        NA
## 44   A Autumn     Monarto 2.0767123    N/A  NA                NA        NA
## 45   A Winter     Channel 2.3945205    6.8  NA                 1      TRUE
## 46   A Summer Healesville 2.8630137   6.46  NA                NA        NA
## 47   A Summer Healesville 4.7260274   5.85  NA                NA        NA
## 48   A Summer Healesville 3.7863014    4.8  NA                NA        NA
## 49   A Spring Healesville 4.5232877   7.88  NA                NA        NA
## 50   A Summer     Monarto 4.7726027   7.51  NA                NA        NA
## 51   A Summer Healesville 2.7671233   5.82  NA                NA        NA
## 52   A Summer     Monarto 4.5589041   8.59  NA                NA        NA
## 53   S Winter Healesville 1.3424658   5.42  NA                NA        NA
## 54   S Summer     Monarto 1.7917808   6.67  NA                NA        NA
## 55   S Summer Healesville 0.7534247   2.72  NA                NA        NA
## 56   S Winter     Monarto 1.5150685    4.6  NA                NA        NA
## 57   S Winter Healesville 1.4000000   5.82  NA                NA        NA
## 58   S Winter Healesville 1.2986301    5.1  NA                NA        NA
## 59   A Summer     Monarto 4.5917808   9.82  NA                NA        NA
## 60   S Winter Healesville 1.1123288   6.02  NA                NA        NA
## 61   S Autumn Healesville 1.0164384    6.1  NA                NA        NA
## 62   S Summer Healesville 1.4219178   6.62  NA                NA        NA
## 63   S Summer Healesville 1.7315068   6.26  NA                NA        NA
## 64   S Summer Healesville 1.7479452   7.42  NA                NA        NA
## 65   A Winter     Monarto 1.6986301   8.75  NA                NA        NA
## 66   S Winter Healesville 1.3041096  4.036  NA                NA        NA
## 67   S Winter Healesville 1.3616438    6.4  NA                NA        NA
## 68   S Winter     Monarto 1.5178082   8.15  NA                NA        NA
## 69   S Winter Healesville 1.2630137   6.32  NA                NA        NA
## 70   S Winter Healesville 1.2986301   5.76  NA                NA        NA
## 71   S Winter Healesville 1.1753425   5.34  NA                NA        NA
## 72   S Winter     Monarto 1.4657534   4.34  NA                NA        NA
## 73   S Winter Healesville 1.3835616    N/A  NA                NA        NA
## 74   A Winter Healesville 5.1041096   8.02  NA                NA        NA
## 75   S Autumn Healesville 1.8246575   5.94  NA                NA        NA
## 76   A Summer Healesville 2.7452055    N/A  NA                NA        NA
## 77   A Spring Healesville 6.6273973   7.52  NA                NA        NA
## 78   S Winter Healesville 1.1479452   6.54  NA                NA        NA
## 79   A Summer Healesville 3.6904110   7.74  NA                NA        NA
## 80   A Winter Healesville 4.3013699   9.16  NA                NA        NA
## 81   S Spring Healesville 1.6767123   5.86  NA                NA        NA
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA           95140.790 ATCCAGAG+TAACGTCG
## 2             deep                TRUE          700825.170 AAGCACTG+AGGTCAAC
## 3                                   NA                  NA GCTATCCT+AACAGGTG
## 4                                   NA                  NA ACGTTCAG+AGTTGTGC
## 5             deep                TRUE          103815.530 AGCACTTC+ACGTCCAA
## 6             deep               FALSE            1588.272 CGTTGCAA+ATAGAGCG
## 7      superficial                TRUE             200.000 CCTTGATC+GATGGAGT
## 8      superficial                TRUE            2670.678 CGGTTGTT+GTGGTATG
## 9                                   NA                  NA CCGTAAGA+AGAGTCCA
## 10                                  NA                  NA CAACACCT+AGCTACCA
## 11                               FALSE            7272.309 GTGAAGTG+GAGCAATC
## 12                               FALSE            7577.856 CTTCGACT+GATCTTGC
## 13            deep                TRUE             480.000 AACCGTTC+CTAGCTCA
## 14                                  NA                  NA GATTACCG+TTGGACTG
## 15                                  NA                  NA CACTAGCT+TCGGATTC
## 16            deep                TRUE           55959.750 TTGCAGAC+ATCGTGGT
## 17            deep                TRUE          206006.422 GTAGGAGT+GTCCTAAG
## 18                                  NA            7455.435 GTCATCGA+GATCCACT
## 19                                TRUE            3809.806 AGCGTGTT+CTTCGCAA
## 20                                  NA                  NA AGTGGATC+TCGATGAC
## 21                                  NA                  NA ATCACACG+GTAGCGTA
## 22     superficial                TRUE            5517.330 CTTGTCGA+CGATGTTC
## 23            deep                TRUE            1527.480 TGGACTCT+TCTTACGG
## 24     superficial                TRUE           43690.461 GTTGACCT+CAGTGCTT
## 25            deep                TRUE          102246.432 TTGGACGT+GAAGTGCT
## 26            deep                TRUE          139389.671 GAAGTTGG+CGAACAAC
## 27                                  NA           64646.036 GTTCTCGT+TGTTCCGT
## 28                                  NA           34738.080 CATGGCTA+CACACATC
## 29                                  NA             100.000 CGTGTGTA+CCAACGAA
## 30                                  NA                  NA AACGTCTG+AATGACGC
## 31                                  NA                  NA GTGCCATA+CTCCTAGT
## 32                                  NA            2697.152 TACGCTAC+CGTGTGAT
## 33                               FALSE          301301.905 GATTGCTC+CACTTCAC
## 34                                  NA          127176.305 ACTGAGGT+GTCAACAG
## 35                                  NA                  NA ATCGCCAT+TGCGTAAC
## 36                                  NA                  NA GAACATCG+TCGACAAG
## 37            deep                TRUE           13125.000 GTTGTTCG+CCAACTTC
## 38     superficial                TRUE           37293.844 TATCGGTC+TACCGGAT
## 39                                  NA                  NA ACGACTTG+AACAGCGA
## 40                                  NA                  NA CCTTGTAG+CCTTGGAA
## 41                                  NA                  NA GAGCAGTA+TGAGCTGT
## 42     superficial                TRUE            7407.222 GTCGAAGA+CCACATTG
## 43                                  NA          629522.362 AGTTCGTC+ACTCGATC
## 44                                  NA                  NA GATAGGCT+CAGTCACA
## 45            deep                TRUE           24938.123 CGCTCTAT+TTGCAACG
## 46                                  NA                  NA TGAAGACG+ACATGCCA
## 47                                  NA                  NA AACGTCTG+AATGACGC
## 48                                  NA                  NA GTCATCGA+GATCCACT
## 49                                  NA                  NA AGCGTGTT+CTTCGCAA
## 50                                  NA                  NA GCAAGATC+AGTCGAAG
## 51                                  NA                  NA TTGCGAAG+AACACGCT
## 52                                  NA                  NA TGCTTCCA+CGATCGAT
## 53                                  NA                  NA TGAGCTAG+GAACGGTT
## 54                                  NA                  NA CTTAGGAC+ACTCCTAC
## 55                                  NA                  NA TGGTACAG+TCGAGAGT
## 56                                  NA                  NA ACCACGAT+GTCTGCAA
## 57                                  NA                  NA ACTGAGGT+GTCAACAG
## 58                                  NA                  NA ACGACTTG+AACAGCGA
## 59                                  NA                  NA TCAGGCTT+ATCATGCG
## 60                                  NA                  NA ATGCCTGT+AGATTGCG
## 61                                  NA                  NA CCGTAAGA+AGAGTCCA
## 62                                  NA                  NA TTCCAAGG+CTACAAGG
## 63                                  NA                  NA GTAGGAGT+GTCCTAAG
## 64                                  NA                  NA CTTCGACT+GATCTTGC
## 65                                  NA                  NA TTGGACGT+GAAGTGCT
## 66                                  NA                  NA TATCGGTC+TACCGGAT
## 67                                  NA                  NA TACGCCTT+GCTACTCT
## 68                                  NA                  NA CGTGTGTA+CCAACGAA
## 69                                  NA                  NA CCTTGTAG+CCTTGGAA
## 70                                  NA                  NA CGCAATCT+ACAGGCAT
## 71                                  NA                  NA AGTGGATC+TCGATGAC
## 72                                  NA                  NA CTGTTGAC+ACCTCAGT
## 73                                  NA                  NA AACCGTTC+CTAGCTCA
## 74                                  NA                  NA TAACCGGT+ATCGTCTC
## 75                                  NA                  NA TTGCAGAC+ATCGTGGT
## 76                                  NA                  NA GAGACGAT+ACCGGTTA
## 77                                  NA                  NA CTTGTCGA+CGATGTTC
## 78                                  NA                  NA TACGCTAC+CGTGTGAT
## 79                                  NA                  NA GAATCCGA+AGCTAGTG
## 80                                  NA                  NA GCACAACT+CTGAACGT
## 81                                  NA                  NA TGTGACTG+AGCCTATC
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    6,491,488           1.00              74.07                   25.93
## 2    6,121,785           1.00              98.00                    2.00
## 3    5,338,890           1.00              98.08                    1.92
## 4   14,968,459           3.00              97.82                    2.18
## 5    1,971,776           0.00              97.96                    2.04
## 6    2,429,449           1.00              97.42                    2.58
## 7    4,939,580           1.00              96.94                    3.06
## 8    4,015,027           1.00              95.91                    4.09
## 9    4,340,498           1.00              97.95                    2.05
## 10  16,944,152           3.00              97.98                    2.02
## 11   4,201,355           1.00              97.17                    2.83
## 12   3,821,151           1.00              97.31                    2.69
## 13  10,492,900           2.00              98.13                    1.87
## 14   5,125,566           1.00              96.21                    3.79
## 15   5,317,767           1.00              97.33                    2.67
## 16   5,288,435           1.00              96.85                    3.15
## 17   4,138,600           1.00              98.03                    1.97
## 18   3,184,798           1.00              98.21                    1.79
## 19   3,056,475           1.00              97.50                    2.50
## 20   2,690,632           1.00              97.77                    2.23
## 21  12,134,750           2.00              96.94                    3.06
## 22   2,768,682           1.00              98.19                    1.81
## 23   4,539,036           1.00              98.30                    1.70
## 24   5,072,309           1.00              97.92                    2.08
## 25   5,476,735           1.00              95.44                    4.56
## 26   6,469,324           1.00              97.99                    2.01
## 27  12,489,105           3.00              97.92                    2.08
## 28   6,141,790           1.00              98.00                    2.00
## 29     699,953           0.00              97.64                    2.36
## 30   3,809,607           1.00              96.73                    3.27
## 31   9,606,720           2.00              97.52                    2.48
## 32   9,716,148           2.00              97.81                    2.19
## 33  11,967,844           2.00              97.82                    2.18
## 34   2,003,509           0.00              97.82                    2.18
## 35   6,018,884           1.00              97.88                    2.12
## 36   6,861,544           1.00              97.76                    2.24
## 37   6,446,467           1.00              97.60                    2.40
## 38   4,490,241           1.00              98.15                    1.85
## 39   3,000,501           1.00              97.96                    2.04
## 40   5,927,942           1.00              97.40                    2.60
## 41   1,702,608           0.00              98.07                    1.93
## 42   2,623,695           1.00              97.38                    2.62
## 43   9,435,053           2.00              98.16                    1.84
## 44   7,628,257           2.00              98.34                    1.66
## 45   5,432,182           1.00              97.81                    2.19
## 46  13,381,058           3.00              96.98                    3.02
## 47   8,041,818           1.73              96.32                    3.68
## 48   5,758,111           1.24              96.72                    3.28
## 49   5,774,637           1.24              96.76                    3.24
## 50     348,621           0.08              97.24                    2.76
## 51   6,376,997           1.37              97.60                    2.40
## 52   9,181,668           1.98              98.08                    1.92
## 53   3,740,878           0.81              97.15                    2.85
## 54  11,133,566           2.40              97.85                    2.15
## 55   7,887,375           1.70              97.57                    2.43
## 56   7,308,907           1.58              97.70                    2.30
## 57   2,984,930           0.64              97.59                    2.41
## 58          98           0.00              94.90                    5.10
## 59   4,879,629           1.05              97.38                    2.62
## 60   4,857,395           1.05              97.58                    2.42
## 61   1,074,345           0.23              97.56                    2.44
## 62  10,669,237           2.30              97.64                    2.36
## 63  10,603,179           2.29              97.34                    2.66
## 64   5,642,025           1.22              96.37                    3.63
## 65  10,821,895           2.33              96.02                    3.98
## 66   8,693,920           1.87              98.13                    1.87
## 67   3,422,010           0.74              97.72                    2.28
## 68   4,811,453           1.04              97.67                    2.33
## 69   5,913,586           1.27              97.05                    2.95
## 70   8,306,537           1.79              96.94                    3.06
## 71   3,528,471           0.76              97.24                    2.76
## 72          23           0.00             100.00                     NaN
## 73   7,247,793           1.56              97.63                    2.37
## 74   6,908,416           1.49              97.09                    2.91
## 75   4,475,461           0.96              95.05                    4.95
## 76  12,024,421           2.59              95.37                    4.63
## 77  10,751,797           2.32              97.49                    2.51
## 78  13,015,081           2.81              97.36                    2.64
## 79   3,336,983           0.72              97.10                    2.90
## 80   6,826,313           1.47              97.66                    2.34
## 81   4,566,180           0.98              97.68                    2.32
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,960           100     93.74        35.92  NA  NA  NA
## 2           1,849           100     93.84        35.93  NA  NA  NA
## 3           1,612           100     93.69        35.91  NA  NA  NA
## 4           4,520           100     93.68        35.91  NA  NA  NA
## 5             595           100     93.62        35.88  NA  NA  NA
## 6             734           100     93.78        35.93  NA  NA  NA
## 7           1,492           100     93.71        35.91  NA  NA  NA
## 8           1,213           100     93.42        35.86  NA  NA  NA
## 9           1,311           100     93.54        35.88  NA  NA  NA
## 10          5,117           100     93.05        35.78  NA  NA  NA
## 11          1,269           100     93.64        35.90  NA  NA  NA
## 12          1,154           100     93.60        35.89  NA  NA  NA
## 13          3,169           100     93.80        35.92  NA  NA  NA
## 14          1,548           100     93.89        35.94  NA  NA  NA
## 15          1,606           100     93.24        35.83  NA  NA  NA
## 16          1,597           100     93.42        35.86  NA  NA  NA
## 17          1,250           100     93.67        35.90  NA  NA  NA
## 18            962           100     93.90        35.94  NA  NA  NA
## 19            923           100     93.95        35.95  NA  NA  NA
## 20            813           100     93.77        35.93  NA  NA  NA
## 21          3,665           100     93.34        35.84  NA  NA  NA
## 22            836           100     93.85        35.93  NA  NA  NA
## 23          1,371           100     93.84        35.93  NA  NA  NA
## 24          1,532           100     93.36        35.84  NA  NA  NA
## 25          1,654           100     93.21        35.82  NA  NA  NA
## 26          1,954           100     94.00        35.97  NA  NA  NA
## 27          3,772           100     93.54        35.88  NA  NA  NA
## 28          1,855           100     93.42        35.85  NA  NA  NA
## 29            211           100     93.33        35.84  NA  NA  NA
## 30          1,151           100     93.07        35.79  NA  NA  NA
## 31          2,901           100     93.25        35.83  NA  NA  NA
## 32          2,934           100     93.97        35.95  NA  NA  NA
## 33          3,614           100     93.88        35.94  NA  NA  NA
## 34            605           100     93.39        35.85  NA  NA  NA
## 35          1,818           100     93.58        35.89  NA  NA  NA
## 36          2,072           100     93.49        35.87  NA  NA  NA
## 37          1,947           100     93.65        35.90  NA  NA  NA
## 38          1,356           100     93.42        35.85  NA  NA  NA
## 39            906           100     93.70        35.91  NA  NA  NA
## 40          1,790           100     93.86        35.94  NA  NA  NA
## 41            514           100     93.58        35.89  NA  NA  NA
## 42            792           100     92.94        35.76  NA  NA  NA
## 43          2,849           100     93.64        35.89  NA  NA  NA
## 44          2,304           100     93.62        35.89  NA  NA  NA
## 45          1,641           100     93.93        35.95  NA  NA  NA
## 46          4,041           100     93.36        35.84  NA  NA  NA
## 47          2,429           100     92.18        35.63  NA  NA  NA
## 48          1,739           100     91.87        35.55  NA  NA  NA
## 49          1,744           100     91.56        35.50  NA  NA  NA
## 50            105           100     92.77        35.73  NA  NA  NA
## 51          1,926           100     92.44        35.67  NA  NA  NA
## 52          2,773           100     93.04        35.79  NA  NA  NA
## 53          1,130           100     93.03        35.79  NA  NA  NA
## 54          3,362           100     92.47        35.68  NA  NA  NA
## 55          2,382           100     93.15        35.81  NA  NA  NA
## 56          2,207           100     92.84        35.75  NA  NA  NA
## 57            901           100     92.49        35.69  NA  NA  NA
## 58              0           100     89.11        34.91  NA  NA  NA
## 59          1,474           100     92.63        35.71  NA  NA  NA
## 60          1,467           100     92.64        35.72  NA  NA  NA
## 61            324           100     92.66        35.72  NA  NA  NA
## 62          3,222           100     92.79        35.74  NA  NA  NA
## 63          3,202           100     92.01        35.58  NA  NA  NA
## 64          1,704           100     91.87        35.56  NA  NA  NA
## 65          3,268           100     92.72        35.73  NA  NA  NA
## 66          2,626           100     92.32        35.65  NA  NA  NA
## 67          1,033           100     92.94        35.76  NA  NA  NA
## 68          1,453           100     92.30        35.65  NA  NA  NA
## 69          1,786           100     92.92        35.77  NA  NA  NA
## 70          2,509           100     91.86        35.55  NA  NA  NA
## 71          1,066           100     93.08        35.79  NA  NA  NA
## 72              0           100     95.85        36.37  NA  NA  NA
## 73          2,189           100     92.28        35.63  NA  NA  NA
## 74          2,086           100     91.90        35.56  NA  NA  NA
## 75          1,352           100     91.42        35.46  NA  NA  NA
## 76          3,631           100     93.06        35.79  NA  NA  NA
## 77          3,247           100     92.77        35.74  NA  NA  NA
## 78          3,931           100     92.61        35.70  NA  NA  NA
## 79          1,008           100     93.09        35.79  NA  NA  NA
## 80          2,062           100     92.67        35.71  NA  NA  NA
## 81          1,379           100     92.13        35.61  NA  NA  NA
ssCvDAV <- ssCvDAV[ssCvDAV$Sample %in% colnames(x),]

dim(ssCvDAV)
## [1] 76 31
x1 <- x[,which(colnames(x) %in% ssCvDAV$Sample)]
dim(x1)
## [1] 310  76
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 264  76
ssCvDAV %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S1_Sarafina 6102463 NA DFT1 FAP F A Spring Channel 2.6191781 6.4 NA NA NA NA 95140.790 ATCCAGAG+TAACGTCG 6,491,488 1.00 74.07 25.93 1,960 100 93.74 35.92 NA NA NA
2 1 default S1_Lucy 6102464 NA DFT1 FAU F A Summer Channel 2.9178082 7.1 NA 3 TRUE deep TRUE 700825.170 AAGCACTG+AGGTCAAC 6,121,785 1.00 98.00 2.00 1,849 100 93.84 35.93 NA NA NA
3 1 default S2_B99008 6102468 NA Captive FAU F A Summer Monarto 3.7369863 8.12 NA NA NA NA NA GCTATCCT+AACAGGTG 5,338,890 1.00 98.08 1.92 1,612 100 93.69 35.91 NA NA NA
4 1 default S2_Bonney 6102469 NA Captive FAU F A Summer Healesville 2.5863014 5.4 NA NA NA NA NA ACGTTCAG+AGTTGTGC 14,968,459 3.00 97.82 2.18 4,520 100 93.68 35.91 NA NA NA
5 1 default S2_Hope 6102471 NA DFT1 FAU F A Summer Channel 2.9315068 6.4 NA 4 TRUE deep TRUE 103815.530 AGCACTTC+ACGTCCAA 1,971,776 0.00 97.96 2.04 595 100 93.62 35.88 NA NA NA
6 1 default S2_Sally 6102472 NA DFT1 FAU F A Summer Channel 2.9945205 7 NA 1 TRUE deep FALSE 1588.272 CGTTGCAA+ATAGAGCG 2,429,449 1.00 97.42 2.58 734 100 93.78 35.93 NA NA NA
7 1 default S3_Apu 6102473 NA DFT1 MAA M A Autumn Channel 3.1150685 9.5 NA 1 FALSE superficial TRUE 200.000 CCTTGATC+GATGGAGT 4,939,580 1.00 96.94 3.06 1,492 100 93.71 35.91 NA NA NA
8 1 default S3_Simone 6102474 NA DFT1 FAW F A Winter Channel 3.2739726 10.2 NA 1 TRUE superficial TRUE 2670.678 CGGTTGTT+GTGGTATG 4,015,027 1.00 95.91 4.09 1,213 100 93.42 35.86 NA NA NA
9 1 default S3_Jessie 6102476 NA Captive FAW F A Winter Monarto 2.1945205 12.95 NA NA NA NA NA CCGTAAGA+AGAGTCCA 4,340,498 1.00 97.95 2.05 1,311 100 93.54 35.88 NA NA NA
10 1 default S3_McCauley 6102477 NA Captive MAA M A Autumn Healesville 3.0328767 8.52 NA NA NA NA NA CAACACCT+AGCTACCA 16,944,152 3.00 97.98 2.02 5,117 100 93.05 35.78 NA NA NA
11 1 default S4_Wiggum 6102480 NA DFT1 MAA M A Autumn Channel 3.1178082 8.3 NA 2 FALSE FALSE 7272.309 GTGAAGTG+GAGCAATC 4,201,355 1.00 97.17 2.83 1,269 100 93.64 35.90 NA NA NA
12 1 default S4_Pooh 6102482 NA DFT1 MAA M A Autumn Channel 4.1863014 11.8 NA 1 FALSE FALSE 7577.856 CTTCGACT+GATCTTGC 3,821,151 1.00 97.31 2.69 1,154 100 93.60 35.89 NA NA NA
13 1 default S4_Milhouse 6102483 NA DFT1 MAA M A Autumn Channel 4.1013699 11 NA 1 TRUE deep TRUE 480.000 AACCGTTC+CTAGCTCA 10,492,900 2.00 98.13 1.87 3,169 100 93.80 35.92 NA NA NA
14 1 default S5_Fenton 6102484 NA Captive MAU M A Summer Monarto 3.0000000 N/A NA NA NA NA NA GATTACCG+TTGGACTG 5,125,566 1.00 96.21 3.79 1,548 100 93.89 35.94 NA NA NA
15 1 default S5_Bryan Adams 6102485 NA Captive MAW M A Winter Healesville 4.1616438 8.6 NA NA NA NA NA CACTAGCT+TCGGATTC 5,317,767 1.00 97.33 2.67 1,606 100 93.24 35.83 NA NA NA
16 1 default S5_Allen 6102488 NA DFT1 MAU M A Summer Channel 1.9095890 6.7 NA 1 TRUE deep TRUE 55959.750 TTGCAGAC+ATCGTGGT 5,288,435 1.00 96.85 3.15 1,597 100 93.42 35.86 NA NA NA
17 1 default S5_Cyan 6102489 NA DFT1 MAW M A Winter Channel 3.3945205 9.1 NA 5 TRUE deep TRUE 206006.422 GTAGGAGT+GTCCTAAG 4,138,600 1.00 98.03 1.97 1,250 100 93.67 35.90 NA NA NA
18 1 default S6_Shelob 6102492 NA DFT2 FAP F A Spring Channel 4.6219178 7.2 NA NA NA NA 7455.435 GTCATCGA+GATCCACT 3,184,798 1.00 98.21 1.79 962 100 93.90 35.94 NA NA NA
19 1 default S6_Stuttgart 6102493 NA DFT1 MSP M S Spring Channel 0.5780822 12.7 NA 1 FALSE TRUE 3809.806 AGCGTGTT+CTTCGCAA 3,056,475 1.00 97.50 2.50 923 100 93.95 35.95 NA NA NA
20 1 default S7_Fredo 6102496 NA Captive MAA M A Autumn Healesville 2.9945205 8.8 NA NA NA NA NA AGTGGATC+TCGATGAC 2,690,632 1.00 97.77 2.23 813 100 93.77 35.93 NA NA NA
21 1 default S7_Piglet 6102497 NA Captive FSU F S Summer Healesville 1.5890411 4.76 NA NA NA NA NA ATCACACG+GTAGCGTA 12,134,750 2.00 96.94 3.06 3,665 100 93.34 35.84 NA NA NA
22 1 default S7_Violet 6102498 NA DFT2 FSU F S Summer Channel 0.8739726 4.6 NA 1 TRUE superficial TRUE 5517.330 CTTGTCGA+CGATGTTC 2,768,682 1.00 98.19 1.81 836 100 93.85 35.93 NA NA NA
23 1 default S7_Willie 6102500 NA DFT2 MAA M A Autumn Channel 2.1150685 8.2 NA 2 TRUE deep TRUE 1527.480 TGGACTCT+TCTTACGG 4,539,036 1.00 98.30 1.70 1,371 100 93.84 35.93 NA NA NA
24 1 default S8_Orange 6102502 NA DFT1 FAU F A Summer Channel 1.9150685 7.1 NA 7 TRUE superficial TRUE 43690.461 GTTGACCT+CAGTGCTT 5,072,309 1.00 97.92 2.08 1,532 100 93.36 35.84 NA NA NA
25 1 default S8_ST67 6102505 NA DFT2 MAW M A Winter Channel 4.2794521 10.2 NA 1 TRUE deep TRUE 102246.432 TTGGACGT+GAAGTGCT 5,476,735 1.00 95.44 4.56 1,654 100 93.21 35.82 NA NA NA
26 1 default S8_Yellow 6102507 NA DFT2 MAU M A Summer Channel 1.8657534 10.5 NA 2 TRUE deep TRUE 139389.671 GAAGTTGG+CGAACAAC 6,469,324 1.00 97.99 2.01 1,954 100 94.00 35.97 NA NA NA
27 1 default S9_Jane 6102508 NA DFT1 FAA F A Autumn Channel 3.1972603 6.1 NA NA NA NA 64646.036 GTTCTCGT+TGTTCCGT 12,489,105 3.00 97.92 2.08 3,772 100 93.54 35.88 NA NA NA
28 1 default S9_Clytemnestra 6102511 NA DFT1 FSP F S Spring Channel 1.6602740 6 NA NA NA NA 34738.080 CATGGCTA+CACACATC 6,141,790 1.00 98.00 2.00 1,855 100 93.42 35.85 NA NA NA
30 1 default S10_McMahon 6102514 NA Captive MSP M S Spring Healesville 1.6493151 8.06 NA NA NA NA NA AACGTCTG+AATGACGC 3,809,607 1.00 96.73 3.27 1,151 100 93.07 35.79 NA NA NA
31 1 default S10_Logan 6102515 NA Captive MAU M A Summer Healesville 5.6000000 9.02 NA NA NA NA NA GTGCCATA+CTCCTAGT 9,606,720 2.00 97.52 2.48 2,901 100 93.25 35.83 NA NA NA
32 1 default S10_Laurasia 6102516 NA DFT2 MSP M S Spring Channel 1.6383562 8 NA NA NA NA 2697.152 TACGCTAC+CGTGTGAT 9,716,148 2.00 97.81 2.19 2,934 100 93.97 35.95 NA NA NA
33 1 default S10_Enchilada 6102517 NA DFT2 MAP M A Spring Channel 3.6438356 9.3 NA 14 FALSE FALSE 301301.905 GATTGCTC+CACTTCAC 11,967,844 2.00 97.82 2.18 3,614 100 93.88 35.94 NA NA NA
34 1 default S11_Murdoch/Washington 6102519 NA DFT2 MAA M A Autumn Channel 1.4438356 8.9 NA NA NA NA 127176.305 ACTGAGGT+GTCAACAG 2,003,509 0.00 97.82 2.18 605 100 93.39 35.85 NA NA NA
35 1 default S11_Xuki 6102520 NA Captive MAA M A Autumn Monarto 2.0767123 7.95 NA NA NA NA NA ATCGCCAT+TGCGTAAC 6,018,884 1.00 97.88 2.12 1,818 100 93.58 35.89 NA NA NA
36 1 default S11_Kalamata 6102521 NA Captive MSW M S Winter Healesville 1.2849315 5.58 NA NA NA NA NA GAACATCG+TCGACAAG 6,861,544 1.00 97.76 2.24 2,072 100 93.49 35.87 NA NA NA
37 1 default S12_Abe 6102524 NA DFT1 MAA M A Autumn Channel 3.1150685 7.9 NA 1 TRUE deep TRUE 13125.000 GTTGTTCG+CCAACTTC 6,446,467 1.00 97.60 2.40 1,947 100 93.65 35.90 NA NA NA
38 1 default S12_Lilac 6102526 NA DFT1 MAW M A Winter Channel 3.4109589 9.6 NA 5 TRUE superficial TRUE 37293.844 TATCGGTC+TACCGGAT 4,490,241 1.00 98.15 1.85 1,356 100 93.42 35.85 NA NA NA
39 1 default S12_Wally 6102528 NA Captive MAA M A Autumn Monarto 2.1616438 N/A NA NA NA NA NA ACGACTTG+AACAGCGA 3,000,501 1.00 97.96 2.04 906 100 93.70 35.91 NA NA NA
40 1 default S12_Naz 6102529 NA Captive MAW M A Winter Monarto 4.4547945 N/A NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,927,942 1.00 97.40 2.60 1,790 100 93.86 35.94 NA NA NA
41 1 default S13_Humbug 6102530 NA Captive MAU M A Summer Monarto 2.5397260 7.94 NA NA NA NA NA GAGCAGTA+TGAGCTGT 1,702,608 0.00 98.07 1.93 514 100 93.58 35.89 NA NA NA
42 1 default S13_Green 6102531 NA DFT1 MAA M A Autumn Channel 3.1534247 7.5 NA 2 TRUE superficial TRUE 7407.222 GTCGAAGA+CCACATTG 2,623,695 1.00 97.38 2.62 792 100 92.94 35.76 NA NA NA
43 1 default S13_Bump 6102532 NA DFT1 MAU M A Summer Channel 3.9068493 9.3 NA NA NA NA 629522.362 AGTTCGTC+ACTCGATC 9,435,053 2.00 98.16 1.84 2,849 100 93.64 35.89 NA NA NA
44 1 default S13_Xerxes 6102535 NA Captive MAA M A Autumn Monarto 2.0767123 N/A NA NA NA NA NA GATAGGCT+CAGTCACA 7,628,257 2.00 98.34 1.66 2,304 100 93.62 35.89 NA NA NA
45 1 default S14_Purple 6102536 NA DFT1 FAW F A Winter Channel 2.3945205 6.8 NA 1 TRUE deep TRUE 24938.123 CGCTCTAT+TTGCAACG 5,432,182 1.00 97.81 2.19 1,641 100 93.93 35.95 NA NA NA
46 1 default S14_Catani 6102538 NA Captive FAU F A Summer Healesville 2.8630137 6.46 NA NA NA NA NA TGAAGACG+ACATGCCA 13,381,058 3.00 96.98 3.02 4,041 100 93.36 35.84 NA NA NA
47 2 default S15_Amelia 6102541 NA Captive FAU F A Summer Healesville 4.7260274 5.85 NA NA NA NA NA AACGTCTG+AATGACGC 8,041,818 1.73 96.32 3.68 2,429 100 92.18 35.63 NA NA NA
48 2 default S15_London 6102542 NA Captive FAU F A Summer Healesville 3.7863014 4.8 NA NA NA NA NA GTCATCGA+GATCCACT 5,758,111 1.24 96.72 3.28 1,739 100 91.87 35.55 NA NA NA
49 2 default S15_Elyse 6102543 NA Captive FAP F A Spring Healesville 4.5232877 7.88 NA NA NA NA NA AGCGTGTT+CTTCGCAA 5,774,637 1.24 96.76 3.24 1,744 100 91.56 35.50 NA NA NA
51 2 default S16_Milla 6102548 NA Captive FAU F A Summer Healesville 2.7671233 5.82 NA NA NA NA NA TTGCGAAG+AACACGCT 6,376,997 1.37 97.60 2.40 1,926 100 92.44 35.67 NA NA NA
52 2 default S16_Maleficent 6102549 NA Captive FAU F A Summer Monarto 4.5589041 8.59 NA NA NA NA NA TGCTTCCA+CGATCGAT 9,181,668 1.98 98.08 1.92 2,773 100 93.04 35.79 NA NA NA
53 2 default S17_Anirak 6102553 NA Captive FSW F S Winter Healesville 1.3424658 5.42 NA NA NA NA NA TGAGCTAG+GAACGGTT 3,740,878 0.81 97.15 2.85 1,130 100 93.03 35.79 NA NA NA
54 2 default S17_Poly 6102554 NA Captive FSU F S Summer Monarto 1.7917808 6.67 NA NA NA NA NA CTTAGGAC+ACTCCTAC 11,133,566 2.40 97.85 2.15 3,362 100 92.47 35.68 NA NA NA
55 2 default S17_Methyl 6102556 NA Captive FSU F S Summer Healesville 0.7534247 2.72 NA NA NA NA NA TGGTACAG+TCGAGAGT 7,887,375 1.70 97.57 2.43 2,382 100 93.15 35.81 NA NA NA
56 2 default S18_Zara 6102558 NA Captive FSW F S Winter Monarto 1.5150685 4.6 NA NA NA NA NA ACCACGAT+GTCTGCAA 7,308,907 1.58 97.70 2.30 2,207 100 92.84 35.75 NA NA NA
57 2 default S18_Maze 6102559 NA Captive FSW F S Winter Healesville 1.4000000 5.82 NA NA NA NA NA ACTGAGGT+GTCAACAG 2,984,930 0.64 97.59 2.41 901 100 92.49 35.69 NA NA NA
59 2 default S19_Morocco 6102564 NA Captive MAU M A Summer Monarto 4.5917808 9.82 NA NA NA NA NA TCAGGCTT+ATCATGCG 4,879,629 1.05 97.38 2.62 1,474 100 92.63 35.71 NA NA NA
60 2 default S19_Pecorino 6102565 NA Captive FSW F S Winter Healesville 1.1123288 6.02 NA NA NA NA NA ATGCCTGT+AGATTGCG 4,857,395 1.05 97.58 2.42 1,467 100 92.64 35.72 NA NA NA
62 2 default S20_Muasy 6102569 NA Captive MSU M S Summer Healesville 1.4219178 6.62 NA NA NA NA NA TTCCAAGG+CTACAAGG 10,669,237 2.30 97.64 2.36 3,222 100 92.79 35.74 NA NA NA
63 2 default S20_Fuse 6102570 NA Captive MSU M S Summer Healesville 1.7315068 6.26 NA NA NA NA NA GTAGGAGT+GTCCTAAG 10,603,179 2.29 97.34 2.66 3,202 100 92.01 35.58 NA NA NA
64 2 default S20_Joseph 6102571 NA Captive MSU M S Summer Healesville 1.7479452 7.42 NA NA NA NA NA CTTCGACT+GATCTTGC 5,642,025 1.22 96.37 3.63 1,704 100 91.87 35.56 NA NA NA
65 2 default S21_Moama 6102576 NA Captive MAW M A Winter Monarto 1.6986301 8.75 NA NA NA NA NA TTGGACGT+GAAGTGCT 10,821,895 2.33 96.02 3.98 3,268 100 92.72 35.73 NA NA NA
66 2 default S21_Nauset 6102577 NA Captive MSW M S Winter Healesville 1.3041096 4.036 NA NA NA NA NA TATCGGTC+TACCGGAT 8,693,920 1.87 98.13 1.87 2,626 100 92.32 35.65 NA NA NA
67 2 default S21_Graham 6102578 NA Captive MSW M S Winter Healesville 1.3616438 6.4 NA NA NA NA NA TACGCCTT+GCTACTCT 3,422,010 0.74 97.72 2.28 1,033 100 92.94 35.76 NA NA NA
68 2 default S22_Yanni 6102581 NA Captive MSW M S Winter Monarto 1.5178082 8.15 NA NA NA NA NA CGTGTGTA+CCAACGAA 4,811,453 1.04 97.67 2.33 1,453 100 92.30 35.65 NA NA NA
69 2 default S22_Gherkin 6102582 NA Captive MSW M S Winter Healesville 1.2630137 6.32 NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,913,586 1.27 97.05 2.95 1,786 100 92.92 35.77 NA NA NA
70 2 default S22_Stilton 6102584 NA Captive MSW M S Winter Healesville 1.2986301 5.76 NA NA NA NA NA CGCAATCT+ACAGGCAT 8,306,537 1.79 96.94 3.06 2,509 100 91.86 35.55 NA NA NA
71 2 default S23_Osiris 6102588 NA Captive MSW M S Winter Healesville 1.1753425 5.34 NA NA NA NA NA AGTGGATC+TCGATGAC 3,528,471 0.76 97.24 2.76 1,066 100 93.08 35.79 NA NA NA
73 2 default S23_Quince 6102590 NA Captive MSW M S Winter Healesville 1.3835616 N/A NA NA NA NA NA AACCGTTC+CTAGCTCA 7,247,793 1.56 97.63 2.37 2,189 100 92.28 35.63 NA NA NA
74 2 default S24_Malfoy 6102595 NA Captive MAW M A Winter Healesville 5.1041096 8.02 NA NA NA NA NA TAACCGGT+ATCGTCTC 6,908,416 1.49 97.09 2.91 2,086 100 91.90 35.56 NA NA NA
75 2 default S24_Licorice 6102596 NA Captive FSA F S Autumn Healesville 1.8246575 5.94 NA NA NA NA NA TTGCAGAC+ATCGTGGT 4,475,461 0.96 95.05 4.95 1,352 100 91.42 35.46 NA NA NA
76 2 default S25_Tofu 6102599 NA Captive FAU F A Summer Healesville 2.7452055 N/A NA NA NA NA NA GAGACGAT+ACCGGTTA 12,024,421 2.59 95.37 4.63 3,631 100 93.06 35.79 NA NA NA
77 2 default S25_Colette 6102600 NA Captive FAP F A Spring Healesville 6.6273973 7.52 NA NA NA NA NA CTTGTCGA+CGATGTTC 10,751,797 2.32 97.49 2.51 3,247 100 92.77 35.74 NA NA NA
78 2 default S25_CannonBall 6102601 NA Captive MSW M S Winter Healesville 1.1479452 6.54 NA NA NA NA NA TACGCTAC+CGTGTGAT 13,015,081 2.81 97.36 2.64 3,931 100 92.61 35.70 NA NA NA
79 2 default S25_Cornelius 6102602 NA Captive MAU M A Summer Healesville 3.6904110 7.74 NA NA NA NA NA GAATCCGA+AGCTAGTG 3,336,983 0.72 97.10 2.90 1,008 100 93.09 35.79 NA NA NA
80 2 default S25_Mardook 6102603 NA Captive MAW M A Winter Healesville 4.3013699 9.16 NA NA NA NA NA GCACAACT+CTGAACGT 6,826,313 1.47 97.66 2.34 2,062 100 92.67 35.71 NA NA NA
81 2 default S25_Negroni 6102604 NA Captive FSP F S Spring Healesville 1.6767123 5.86 NA NA NA NA NA TGTGACTG+AGCCTATC 4,566,180 0.98 97.68 2.32 1,379 100 92.13 35.61 NA NA NA
col <- as.character(as.numeric(grepl("DFT",ssCvDAV$Category)))
col <- gsub("0","lightblue",col)
col <- gsub("1","pink",col)
mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Captive vs DFTD infected devils")
mtext("Captive=Blue, DFTD Infected=Red")

ssCvDAV$DFTDStat <- grepl("DFT",ssCvDAV$Category)
ssCvDAV$CapLoc <- grepl("Channel",ssCvDAV$Location)
ssCvDAV$MvF <- factor(ssCvDAV$Sex)
ssCvDAV$SubAdvAd <- as.numeric(factor(ssCvDAV$Age,levels=c("S","A"),ordered = TRUE))
ssCvDAV$Season <- factor(ssCvDAV$Season)
str(ssCvDAV)
## 'data.frame':    76 obs. of  35 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S1_Sarafina" "S1_Lucy" "S2_B99008" "S2_Bonney" ...
##  $ Sample                 : int  6102463 6102464 6102468 6102469 6102471 6102472 6102473 6102474 6102476 6102477 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "DFT1" "DFT1" "Captive" "Captive" ...
##  $ Sex.Age.Season         : chr  "FAP" "FAU" "FAU" "FAU" ...
##  $ Sex                    : chr  "F" "F" "F" "F" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 2 3 3 3 3 3 1 4 4 1 ...
##  $ Location               : chr  "Channel" "Channel" "Monarto" "Healesville" ...
##  $ Agebyyear              : num  2.62 2.92 3.74 2.59 2.93 ...
##  $ Weight                 : chr  "6.4" "7.1" "8.12" "5.4" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA 3 NA NA 4 1 1 1 NA NA ...
##  $ Ulcerated              : logi  NA TRUE NA NA TRUE TRUE ...
##  $ UlcerationDepth        : chr  "" "deep" "" "" ...
##  $ Secondary.infection    : logi  NA TRUE NA NA TRUE FALSE ...
##  $ Total.tumour.volume    : num  95141 700825 NA NA 103816 ...
##  $ Barcode.sequence       : chr  "ATCCAGAG+TAACGTCG" "AAGCACTG+AGGTCAAC" "GCTATCCT+AACAGGTG" "ACGTTCAG+AGTTGTGC" ...
##  $ PF.Clusters            : chr  "6,491,488" "6,121,785" "5,338,890" "14,968,459" ...
##  $ X..of.the.lane         : num  1 1 1 3 0 1 1 1 1 3 ...
##  $ X..Perfect.barcode     : num  74.1 98 98.1 97.8 98 ...
##  $ X..One.mismatch.barcode: num  25.93 2 1.92 2.18 2.04 ...
##  $ Yield..Mbases.         : chr  "1,960" "1,849" "1,612" "4,520" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.7 93.8 93.7 93.7 93.6 ...
##  $ Mean.Quality           : num  35.9 35.9 35.9 35.9 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ DFTDStat               : logi  TRUE TRUE FALSE FALSE TRUE TRUE ...
##  $ CapLoc                 : logi  TRUE TRUE FALSE FALSE TRUE TRUE ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 1 1 1 2 1 1 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 2 2 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssCvDAV, design = ~ Season + SubAdvAd + MvF + DFTDStat)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 1 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeCvDAV <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 95
length(sig1_dn)
## [1] 77
maplot(dgeCvDAV,"Captive vs DFTD infected devils")

make_volcano(dgeCvDAV,"Captive vs DFTD infected devils")

sig[1:200,1:6] %>%
  kbl(caption="Comparison of Captive vs DFTD infected devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Captive vs DFTD infected devils
baseMean log2FoldChange lfcSE stat pvalue padj
CCR2 6595.31407 1.7628439 0.1894639 9.304381 0.0000000 0.0000000
CCR7 20785.67540 -1.6900738 0.1824349 -9.263985 0.0000000 0.0000000
Spi1 48601.23340 1.7169624 0.1888967 9.089424 0.0000000 0.0000000
EPX 4106.91806 3.1410435 0.3649473 8.606840 0.0000000 0.0000000
CD68 6236.28055 1.5313916 0.1839810 8.323639 0.0000000 0.0000000
CCR6 1142.29906 -1.7638245 0.2119380 -8.322361 0.0000000 0.0000000
CD1d 1670.11674 -1.7395569 0.2123495 -8.191950 0.0000000 0.0000000
IL10RA 13131.82917 -1.5401583 0.1927183 -7.991760 0.0000000 0.0000000
CD177 7563.42898 4.2907346 0.5495403 7.807861 0.0000000 0.0000000
SIRPA 310.79955 2.4243983 0.3142203 7.715600 0.0000000 0.0000000
IL7RA 7625.62756 -1.5767051 0.2051315 -7.686314 0.0000000 0.0000000
CD14 59164.24661 1.7361596 0.2307464 7.524102 0.0000000 0.0000000
MRC1 1905.57913 1.5799426 0.2103578 7.510738 0.0000000 0.0000000
CD28 1204.61105 -1.9386374 0.2585637 -7.497717 0.0000000 0.0000000
CATH3 70782.75127 3.9138615 0.5267362 7.430401 0.0000000 0.0000000
TGFb1 72798.56452 1.1546551 0.1585888 7.280810 0.0000000 0.0000000
C3 59510.17158 1.5245188 0.2115578 7.206159 0.0000000 0.0000000
ITGAX 7071.19445 0.9302686 0.1301772 7.146173 0.0000000 0.0000000
TNFSF13 669.05251 1.1184076 0.1590279 7.032775 0.0000000 0.0000000
TLR3 610.86609 -1.1555779 0.1656864 -6.974489 0.0000000 0.0000000
IFIH1 2295.17103 -0.8283654 0.1198019 -6.914458 0.0000000 0.0000000
TNFRSF1A 11338.94883 1.0872456 0.1582227 6.871615 0.0000000 0.0000000
Tap1 8878.07862 -1.5175057 0.2266103 -6.696544 0.0000000 0.0000000
TCRm 5713.97921 -1.4101570 0.2106794 -6.693379 0.0000000 0.0000000
FGF2 75.19974 -1.5390625 0.2353199 -6.540299 0.0000000 0.0000000
STAT1 10514.83671 -0.9653122 0.1508351 -6.399786 0.0000000 0.0000000
CEBPA 2170.22294 1.2652016 0.1995792 6.339344 0.0000000 0.0000000
TNFSF8 589.88958 -1.0666587 0.1690706 -6.308956 0.0000000 0.0000000
PTPRC 48346.24334 -1.0048798 0.1592967 -6.308226 0.0000000 0.0000000
CCLD14 318.72037 1.9966513 0.3186352 6.266262 0.0000000 0.0000000
IL18R1 2221.09499 1.0150233 0.1632209 6.218709 0.0000000 0.0000000
IL18 2072.65292 1.8732642 0.3019994 6.202875 0.0000000 0.0000000
STAT4 1723.35298 -1.1763912 0.1915870 -6.140245 0.0000000 0.0000000
CCR5 381.17965 0.9863201 0.1612636 6.116198 0.0000000 0.0000000
IRF4 931.91435 -1.4154399 0.2315111 -6.113918 0.0000000 0.0000000
CCLD13 377.73327 1.6841255 0.2768392 6.083406 0.0000000 0.0000000
LTB 21724.42164 -1.1167049 0.1865801 -5.985124 0.0000000 0.0000000
FCER2 78.30588 1.9493500 0.3300478 5.906265 0.0000000 0.0000000
MPO 487.56014 3.3312762 0.5647298 5.898885 0.0000000 0.0000000
IL2RA 278.50289 -1.1604301 0.1969970 -5.890599 0.0000000 0.0000000
CXCL16 5847.10141 1.4212656 0.2413738 5.888236 0.0000000 0.0000000
KIT 3614.55293 -1.2016988 0.2062461 -5.826530 0.0000000 0.0000000
TXLNA 4753.20519 0.5177159 0.0889270 5.821808 0.0000000 0.0000000
CD3e 18974.73756 -0.9390289 0.1623856 -5.782710 0.0000000 0.0000000
SELL 92179.26381 0.8164635 0.1412998 5.778235 0.0000000 0.0000000
IL5Ra 1587.67232 -1.2694307 0.2218427 -5.722211 0.0000000 0.0000001
CXCR4 23987.24605 -0.6301161 0.1112654 -5.663180 0.0000000 0.0000001
IgM 90902.80325 -1.0635994 0.1893216 -5.617951 0.0000000 0.0000001
IL21R 4772.00660 -1.0316789 0.1843718 -5.595645 0.0000000 0.0000001
CXCR3 1639.34455 0.9731334 0.1740210 5.592046 0.0000000 0.0000001
CD3d 6106.56175 -0.9746055 0.1750196 -5.568550 0.0000000 0.0000001
IRF9 23943.62163 0.5318834 0.0960078 5.540000 0.0000000 0.0000002
IL16 19995.70779 -0.3991385 0.0724832 -5.506638 0.0000000 0.0000002
IRF3 15893.37284 0.7550161 0.1391981 5.424040 0.0000001 0.0000003
CD40LG 995.14219 -0.7062460 0.1314943 -5.370926 0.0000001 0.0000004
CCR4 1635.38696 -1.1050368 0.2057567 -5.370599 0.0000001 0.0000004
CTLA4 291.48526 -1.1646254 0.2175880 -5.352433 0.0000001 0.0000004
EEF1A1 30.42759 -2.2454000 0.4210478 -5.332887 0.0000001 0.0000004
TCRa 9885.66057 -0.7949798 0.1508248 -5.270884 0.0000001 0.0000006
GUSB 5430.86734 0.6561268 0.1256013 5.223887 0.0000002 0.0000008
FLT3 1546.95694 -1.1779143 0.2297419 -5.127120 0.0000003 0.0000013
CCR1 580.58192 1.0664381 0.2081348 5.123787 0.0000003 0.0000013
NLRP3 10200.30811 0.9881662 0.1930455 5.118826 0.0000003 0.0000013
CXCR2 22859.13461 1.1521996 0.2280400 5.052620 0.0000004 0.0000018
IL1RN 2740.26174 1.6201851 0.3255919 4.976122 0.0000006 0.0000026
CD244 2049.01235 -0.9532676 0.1942448 -4.907558 0.0000009 0.0000037
CFI 576.15605 -0.7734236 0.1579854 -4.895538 0.0000010 0.0000039
Saha-UA 326568.98815 1.1620194 0.2377119 4.888351 0.0000010 0.0000039
IL34 1265.08113 1.6305350 0.3339322 4.882832 0.0000010 0.0000040
PRF1 2057.85268 -1.2838806 0.2632662 -4.876740 0.0000011 0.0000041
VEGF-A 335.33370 -0.9981717 0.2068060 -4.826610 0.0000014 0.0000052
Lgals3 23573.84408 0.7661443 0.1599527 4.789817 0.0000017 0.0000061
CD40 3431.56768 -0.8314972 0.1752767 -4.743912 0.0000021 0.0000076
ENPP3 45.82988 3.4732672 0.7330787 4.737919 0.0000022 0.0000077
TNFSF18 41.48744 3.7583786 0.8041913 4.673488 0.0000030 0.0000104
CXCR5 2200.94792 -0.9768638 0.2106687 -4.636968 0.0000035 0.0000123
KLRK1 236.61904 -1.1047489 0.2390111 -4.622166 0.0000038 0.0000130
cGAS 457.72297 0.6876746 0.1520666 4.522193 0.0000061 0.0000207
CCL24 1594.89608 1.0851567 0.2412950 4.497221 0.0000069 0.0000230
Saha-UD 910589.56488 1.3871469 0.3092074 4.486137 0.0000073 0.0000239
CIITA 1959.50372 -0.7996516 0.1793462 -4.458705 0.0000082 0.0000269
CD37 36277.54190 0.5363980 0.1210850 4.429931 0.0000094 0.0000303
PRG3 10936.84771 -0.9726263 0.2197290 -4.426481 0.0000096 0.0000305
TCRd 298.43726 -1.1394236 0.2577267 -4.421054 0.0000098 0.0000309
CXCL10 19.92272 -1.9681184 0.4485562 -4.387674 0.0000115 0.0000356
CSF1 1793.55358 1.1655950 0.2663464 4.376237 0.0000121 0.0000367
GATA2 1779.73980 0.8343123 0.1906553 4.376024 0.0000121 0.0000367
CD96 256.43242 -1.3931349 0.3189889 -4.367346 0.0000126 0.0000377
ICOS 683.63416 -0.9139098 0.2095503 -4.361292 0.0000129 0.0000384
TLR2 7784.66544 0.7902484 0.1824227 4.331963 0.0000148 0.0000429
LTa 311.33897 -0.8096034 0.1868992 -4.331765 0.0000148 0.0000429
Saha-UK 202061.16063 0.9562961 0.2221303 4.305114 0.0000167 0.0000479
IL17D 279.03183 -1.0183420 0.2370458 -4.295971 0.0000174 0.0000494
IgA 20533.60052 -0.8926403 0.2080516 -4.290476 0.0000178 0.0000501
CD4 3926.32061 -0.5744018 0.1345503 -4.269048 0.0000196 0.0000546
IL3Ra 8541.32152 0.8266584 0.1950334 4.238547 0.0000225 0.0000615
IL27Ra 1460.74743 -0.7578981 0.1788534 -4.237537 0.0000226 0.0000615
NLRP1 813.45656 -0.6281317 0.1492535 -4.208490 0.0000257 0.0000693
OAZ1 436243.29529 1.1854687 0.2822569 4.199964 0.0000267 0.0000709
CCR8 233.73296 -1.0146397 0.2416606 -4.198615 0.0000269 0.0000709
MMP9 86718.33560 0.8690983 0.2088778 4.160798 0.0000317 0.0000829
TLR6 3701.06582 0.6400968 0.1569884 4.077350 0.0000456 0.0001179
NLCR5 8935.68079 -0.4778819 0.1174987 -4.067125 0.0000476 0.0001220
MME 83.69032 2.8028358 0.6947003 4.034597 0.0000547 0.0001388
LAMP1 27646.70111 0.4968364 0.1268988 3.915216 0.0000903 0.0002271
Saha-UC 445789.17402 0.9721053 0.2491490 3.901703 0.0000955 0.0002379
IL12Rb1 1149.75656 -0.7842206 0.2020325 -3.881655 0.0001037 0.0002560
MS4A1 9550.15427 -0.7761226 0.2058008 -3.771232 0.0001624 0.0003971
CD8a 16139.16908 -0.8342460 0.2216477 -3.763838 0.0001673 0.0004053
NOD2 2114.61644 0.9388651 0.2543915 3.690631 0.0002237 0.0005369
TCF3 28653.36118 0.7816314 0.2130729 3.668375 0.0002441 0.0005806
GATA1 240511.67585 1.8590753 0.5121881 3.629673 0.0002838 0.0006689
CCLD4 12.03493 2.8798841 0.8002184 3.598873 0.0003196 0.0007467
IgG 27016.42383 -0.6329984 0.1769999 -3.576265 0.0003485 0.0008071
CXCR1 21268.15185 0.7931668 0.2222147 3.569371 0.0003578 0.0008190
TNFSF11 109.63951 -1.1007786 0.3085949 -3.567067 0.0003610 0.0008190
CXCL12 62.46433 2.3727275 0.6654415 3.565644 0.0003630 0.0008190
IL13Ra1 5086.15677 0.7323276 0.2066633 3.543579 0.0003947 0.0008831
FCGRT 23963.28246 0.5179049 0.1470108 3.522903 0.0004268 0.0009470
NFKB1 8351.22345 -0.2921498 0.0832019 -3.511335 0.0004459 0.0009809
IL13 52.61872 1.3313022 0.3828160 3.477656 0.0005058 0.0011036
CD22 14182.64661 -0.5313198 0.1539821 -3.450531 0.0005595 0.0012107
IL1A 66.27029 1.6590112 0.4970575 3.337665 0.0008449 0.0018133
CD19 4205.36702 -0.7153143 0.2161675 -3.309074 0.0009361 0.0019929
EIF2AK2 563.99610 -0.5462142 0.1653914 -3.302556 0.0009581 0.0020235
CCR3 10070.10610 -0.6353389 0.1932225 -3.288121 0.0010086 0.0021132
EGFR 31.56224 2.8048318 0.8582738 3.267992 0.0010831 0.0022516
HPRT 2297.60196 0.4026545 0.1241855 3.242364 0.0011854 0.0024449
IL22 29.73360 2.6576227 0.8209645 3.237196 0.0012071 0.0024704
B2M 255730.15462 0.7834729 0.2424410 3.231602 0.0012310 0.0024998
CCL25 22.38266 2.1864533 0.6780864 3.224447 0.0012622 0.0025436
IL9 13.55122 2.9848147 0.9401041 3.174983 0.0014985 0.0029969
CCLD1 34.13033 1.7488189 0.5518121 3.169229 0.0015284 0.0030339
IL1B 11185.11259 0.7673939 0.2423074 3.167026 0.0015401 0.0030342
PDGFA 1679.68658 0.9585078 0.3048941 3.143740 0.0016680 0.0032619
LBR 11673.65753 -0.5103961 0.1637741 -3.116465 0.0018303 0.0035530
CXCLD1 27.12006 2.2073198 0.7104699 3.106845 0.0018910 0.0036439
CCL20 31.37279 2.4030741 0.7811868 3.076184 0.0020967 0.0040111
FCMR 42443.99542 -0.7353009 0.2435269 -3.019383 0.0025329 0.0048107
FCGR3 3391.15896 0.8132064 0.2750600 2.956469 0.0031118 0.0058399
CD163 1059.81784 0.6119408 0.2071436 2.954186 0.0031349 0.0058399
IL17C 23.95429 1.2331731 0.4175185 2.953577 0.0031411 0.0058399
RPS29 25020.74854 0.6529513 0.2239404 2.915737 0.0035485 0.0065511
TCRb 15926.45146 -0.5459267 0.1884074 -2.897586 0.0037605 0.0068624
CXCL11 13.56342 3.3359497 1.1515719 2.896866 0.0037691 0.0068624
IL15 62.43146 1.1388644 0.3976160 2.864232 0.0041802 0.0075588
CCN2 66.79228 1.1552848 0.4103421 2.815419 0.0048714 0.0087486
IRF5 5351.44309 0.4302444 0.1541647 2.790811 0.0052576 0.0093785
CCLD3 54.40737 1.4559248 0.5221450 2.788353 0.0052977 0.0093865
CD83 127.33281 -0.7455680 0.2696338 -2.765114 0.0056903 0.0100149
FASLG 426.10547 -0.6578068 0.2386281 -2.756619 0.0058402 0.0101565
C5 107.20039 1.0367952 0.3761682 2.756201 0.0058477 0.0101565
IL1RL1 776.13709 -0.5546638 0.2021642 -2.743630 0.0060764 0.0104848
RPLP0 156083.89647 0.4839232 0.1775205 2.726013 0.0064104 0.0109893
C4A 336.08605 0.5017211 0.1845782 2.718204 0.0065637 0.0111795
Foxp3 252.26349 -0.6708044 0.2498293 -2.685051 0.0072519 0.0122447
STAT5A 18586.09438 0.2651481 0.0988005 2.683671 0.0072819 0.0122447
Saha-DAA 97439.75912 -0.3218055 0.1214113 -2.650539 0.0080363 0.0134278
STING1 1079.34186 -0.4374169 0.1702508 -2.569250 0.0101919 0.0169224
TNF 114.79779 -0.6100376 0.2432089 -2.508287 0.0121318 0.0200175
TLR4 3048.61911 0.5532104 0.2223160 2.488396 0.0128321 0.0210414
IL4R 8400.10036 -0.3617917 0.1456036 -2.484771 0.0129635 0.0211233
XCR1 57.11254 0.7321103 0.2948943 2.482619 0.0130420 0.0211233
CXCLD2 25.47679 1.7362336 0.7113817 2.440650 0.0146609 0.0236004
IL10 31.95184 0.9174660 0.3795057 2.417529 0.0156263 0.0248753
IL23R 100.05620 0.6950963 0.2875650 2.417180 0.0156413 0.0248753
Rorc 290.94293 -0.4334494 0.1803270 -2.403686 0.0162307 0.0256581
STAT6 18756.91043 0.1793280 0.0753319 2.380506 0.0172889 0.0271682
IFNLR1 95.27446 -0.8812767 0.3820964 -2.306425 0.0210869 0.0329405
IL11Ra 1481.26646 -0.3499738 0.1528059 -2.290316 0.0220030 0.0341693
CD59 18742.52151 0.6715034 0.2935864 2.287243 0.0221816 0.0342453
TNFRSF1B 7406.74606 0.2633392 0.1215656 2.166231 0.0302935 0.0464971
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
write.table(dge,file="dgeCvDAV.tsv",sep="\t")

mx <- sig[,7:ncol(sig)]
mx <- head(mx,30)
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(as.matrix(mx),trace="none",scale="row",
          col=colfunc(25),ColSideColors=col,mar=c(5,12)) 

ssHS <- filter(ss, Category %in% c('Healthy', 'Healthy/Wild'))

ssHSA <- ssHS[which(grepl("S",ssHS$Age) + grepl("A",ssHS$Age)>0),]
ssHSA
##    Lane Project     Client.ID  Sample  X     Category Sex.Age.Season Sex Age
## 1     1 default S1_LauraGrace 6102461 NA Healthy/Wild            FAP   F   A
## 2     1 default   S1_Turmeric 6102465 NA Healthy/Wild            FAU   F   A
## 3     1 default  S1_Singapore 6102466 NA      Healthy            FAA   F   A
## 4     1 default    S2_Belinda 6102467 NA Healthy/Wild            FAU   F   A
## 5     1 default      S2_Rosie 6102470 NA Healthy/Wild            FAU   F   A
## 6     1 default       S3_ST62 6102475 NA Healthy/Wild            FAW   F   A
## 7     1 default    S4_Kerchak 6102478 NA      Healthy            MAA   M   A
## 8     1 default    S4_Duffman 6102479 NA      Healthy            MAA   M   A
## 9     1 default      S4_Hogan 6102481 NA      Healthy            MAA   M   A
## 10    1 default      S5_Silky 6102486 NA Healthy/Wild            MAW   M   A
## 11    1 default    S5_Longley 6102487 NA Healthy/Wild            MAU   M   A
## 12    1 default    S6_Myanmar 6102490 NA      Healthy            FAP   F   A
## 13    1 default     S6_Pakana 6102491 NA      Healthy            MSP   M   S
## 14    1 default     S6_Hobbit 6102495 NA      Healthy            MSP   M   S
## 15    1 default      S7_Lieke 6102499 NA Healthy/Wild            FSU   F   S
## 16    1 default   S7_Smithers 6102501 NA Healthy/Wild            MAA   M   A
## 17    1 default     S8_Vinnie 6102503 NA Healthy/Wild            MAU   M   A
## 18    1 default  S8_Struggles 6102504 NA Healthy/Wild            MAW   M   A
## 19    1 default     S8_SusieQ 6102506 NA Healthy/Wild            FAU   F   A
## 20    1 default     S9_Majula 6102509 NA      Healthy            FAA   F   A
## 21    1 default     S9_Snoopy 6102510 NA Healthy/Wild            MSW   M   S
## 22    1 default     S9_Sarabi 6102513 NA Healthy/Wild            FSP   F   S
## 23    1 default     S11_Baloo 6102518 NA Healthy/Wild            MAA   M   A
## 24    1 default S11_DanRhodes 6102523 NA Healthy/Wild            MSW   M   S
## 25    1 default     S12_Robin 6102525 NA Healthy/Wild            MAA   M   A
## 26    1 default    S12_Eeyore 6102527 NA Healthy/Wild            MAW   M   A
## 27    1 default    S13_Pangea 6102533 NA Healthy/Wild            MAU   M   A
## 28    1 default    S13_Finbar 6102534 NA Healthy/Wild            MAA   M   A
## 29    2 default    S22_Ginger 6102586 NA Healthy/Wild            MSW   M   S
## 30    2 default       S24_Boy 6102593 NA Healthy/Wild            MAA   M   A
## 31    2 default    S24_Shazza 6102598 NA      Healthy            FAW   F   A
##    Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1  Spring  Channel 2.6219178    7.2  NA                NA        NA
## 2  Summer  Channel 1.9095890    7.8  NA                NA        NA
## 3  Autumn  Channel 5.0000000    8.6  NA                NA        NA
## 4  Summer  Channel 1.8657534    6.6  NA                NA        NA
## 5  Summer  Channel 1.8904110    7.4  NA                NA        NA
## 6  Winter  Channel 3.2712329   10.2  NA                NA        NA
## 7  Autumn  Channel 4.1863014   11.6  NA                NA        NA
## 8  Autumn  Channel 3.1123288   12.4  NA                NA        NA
## 9  Autumn  Channel 3.1616438   11.6  NA                NA        NA
## 10 Winter  Channel 2.2849315    9.5  NA                NA        NA
## 11 Summer  Channel 2.9315068    9.7  NA                NA        NA
## 12 Spring  Channel 5.5726027    7.6  NA                NA        NA
## 13 Spring  Channel 1.6712329    7.8  NA                NA        NA
## 14 Spring  Channel 1.6273973      9  NA                NA        NA
## 15 Summer  Channel 0.8657534    4.9  NA                NA        NA
## 16 Autumn  Channel 3.1013699    8.9  NA                NA        NA
## 17 Summer  Channel 2.9150685    8.8  NA                NA        NA
## 18 Winter  Channel 3.2821918   11.1  NA                NA        NA
## 19 Summer  Channel 1.8712329    7.1  NA                NA        NA
## 20 Autumn  Channel 3.1150685      6  NA                NA        NA
## 21 Winter  Channel 1.2794521    6.3  NA                NA        NA
## 22 Spring  Channel 1.6328767    5.8  NA                NA        NA
## 23 Autumn  Channel 3.1726027   11.5  NA                NA        NA
## 24 Winter  Channel 1.3917808    6.8  NA                NA        NA
## 25 Autumn  Channel 2.1972603    7.7  NA                NA        NA
## 26 Winter  Channel 3.2794521      9  NA                NA        NA
## 27 Summer  Channel 1.8794521    7.7  NA                NA        NA
## 28 Autumn  Channel 2.1150685    6.8  NA                NA        NA
## 29 Winter  Channel 1.2712329    7.6  NA                NA        NA
## 30 Autumn  Channel 3.1452055    8.3  NA                NA        NA
## 31 Winter  Channel 2.0273973    6.2  NA                NA        NA
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA                  NA AGAGTAGC+AAGGCGTA
## 2                                   NA                  NA GAAGGAAG+GACGTCAT
## 3                                   NA                  NA ACAGCTCA+TACTGCTC
## 4                                   NA                  NA GCAAGATC+AGTCGAAG
## 5                                   NA                  NA CGCATGAT+AAGCCTGA
## 6                                   NA                  NA TGAGCTAG+GAACGGTT
## 7                                   NA                  NA CGGCTAAT+CTCGTTCT
## 8                                   NA                  NA GACGATCT+TCGTGCAT
## 9                                   NA                  NA TACGCCTT+GCTACTCT
## 10                                  NA                  NA CTGTTGAC+ACCTCAGT
## 11                                  NA                  NA CGCAATCT+ACAGGCAT
## 12                                  NA                  NA GCACAACT+CTGAACGT
## 13                                  NA                  NA GTTACGCA+ATGGCGAT
## 14                                  NA                  NA ATATGCGC+ACGATCAG
## 15                                  NA                  NA TTCCAAGG+CTACAAGG
## 16                                  NA                  NA GCGTCATT+CAGACGTT
## 17                                  NA                  NA CGACGTTA+CTCTGGAT
## 18                                  NA                  NA ATCGATCG+TGGAAGCA
## 19                                  NA                  NA CAGTCCAA+CGGTAATC
## 20                                  NA                  NA ACTCTCGA+CTGTACCA
## 21                                  NA                  NA AACTGAGC+CAATCAGG
## 22                                  NA                  NA CTTAGGAC+ACTCCTAC
## 23                                  NA                  NA CTGATCGT+GCGCATAT
## 24                                  NA                  NA TCGCTGTT+CAAGTCGT
## 25                                  NA                  NA ATGACGTC+CTTCCTTC
## 26                                  NA                  NA TCAGGCTT+ATCATGCG
## 27                                  NA                  NA ACCACGAT+GTCTGCAA
## 28                                  NA                  NA GAGACGAT+ACCGGTTA
## 29                                  NA                  NA ACAGCTCA+TACTGCTC
## 30                                  NA                  NA CGACGTTA+CTCTGGAT
## 31                                  NA                  NA GAGCAGTA+TGAGCTGT
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    4,511,702           1.00              98.29                    1.71
## 2    6,479,047           1.00              97.28                    2.72
## 3    4,481,213           1.00              97.99                    2.01
## 4    3,296,547           1.00              97.40                    2.60
## 5    4,556,781           1.00              95.70                    4.30
## 6    4,579,681           1.00              96.67                    3.33
## 7    6,886,511           1.00              97.80                    2.20
## 8    8,301,336           2.00              97.75                    2.25
## 9    2,990,345           1.00              97.77                    2.23
## 10   5,617,260           1.00              97.81                    2.19
## 11   2,937,660           1.00              97.71                    2.29
## 12   9,604,175           2.00              98.14                    1.86
## 13   4,383,521           1.00              98.09                    1.91
## 14   7,342,414           2.00              97.00                    3.00
## 15   1,800,468           0.00              97.79                    2.21
## 16   6,731,177           1.00              98.04                    1.96
## 17   7,901,958           2.00              98.02                    1.98
## 18   5,257,820           1.00              95.13                    4.87
## 19     454,240           0.00              97.95                    2.05
## 20   8,490,270           2.00              97.99                    2.01
## 21   1,709,078           0.00              98.04                    1.96
## 22   3,945,235           1.00              98.11                    1.89
## 23  10,923,019           2.00              98.07                    1.93
## 24   5,076,673           1.00              97.41                    2.59
## 25   6,756,342           1.00              97.12                    2.88
## 26   3,071,283           1.00              97.28                    2.72
## 27   1,732,316           0.00              97.57                    2.43
## 28       1,152           0.00              96.70                    3.30
## 29   9,742,792           2.10              97.63                    2.37
## 30   1,476,427           0.32              97.63                    2.37
## 31   2,693,655           0.58              97.51                    2.49
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,363           100     93.82        35.92  NA  NA  NA
## 2           1,957           100     93.85        35.94  NA  NA  NA
## 3           1,353           100     93.95        35.96  NA  NA  NA
## 4             996           100     94.12        35.98  NA  NA  NA
## 5           1,376           100     93.94        35.94  NA  NA  NA
## 6           1,383           100     93.75        35.92  NA  NA  NA
## 7           2,080           100     93.61        35.89  NA  NA  NA
## 8           2,507           100     93.83        35.93  NA  NA  NA
## 9             903           100     93.71        35.90  NA  NA  NA
## 10          1,696           100     93.55        35.88  NA  NA  NA
## 11            887           100     93.75        35.91  NA  NA  NA
## 12          2,900           100     93.93        35.94  NA  NA  NA
## 13          1,324           100     93.90        35.95  NA  NA  NA
## 14          2,217           100     93.93        35.96  NA  NA  NA
## 15            544           100     93.58        35.88  NA  NA  NA
## 16          2,033           100     93.62        35.89  NA  NA  NA
## 17          2,386           100     94.09        35.98  NA  NA  NA
## 18          1,588           100     93.81        35.93  NA  NA  NA
## 19            137           100     92.97        35.76  NA  NA  NA
## 20          2,564           100     93.34        35.84  NA  NA  NA
## 21            516           100     93.06        35.78  NA  NA  NA
## 22          1,191           100     93.55        35.88  NA  NA  NA
## 23          3,299           100     93.51        35.87  NA  NA  NA
## 24          1,533           100     93.77        35.92  NA  NA  NA
## 25          2,040           100     92.53        35.68  NA  NA  NA
## 26            928           100     92.94        35.76  NA  NA  NA
## 27            523           100     93.82        35.92  NA  NA  NA
## 28              0           100     92.06        35.56  NA  NA  NA
## 29          2,942           100     93.00        35.78  NA  NA  NA
## 30            446           100     93.25        35.82  NA  NA  NA
## 31            813           100     93.01        35.79  NA  NA  NA
ssHSA <- ssHSA[ssHSA$Sample %in% colnames(x),]

dim(ssHSA)
## [1] 29 31
x1 <- x[,which(colnames(x) %in% ssHSA$Sample)]
dim(x1)
## [1] 310  29
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 256  29
ssHSA %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S1_LauraGrace 6102461 NA Healthy/Wild FAP F A Spring Channel 2.6219178 7.2 NA NA NA NA NA AGAGTAGC+AAGGCGTA 4,511,702 1.00 98.29 1.71 1,363 100 93.82 35.92 NA NA NA
2 1 default S1_Turmeric 6102465 NA Healthy/Wild FAU F A Summer Channel 1.9095890 7.8 NA NA NA NA NA GAAGGAAG+GACGTCAT 6,479,047 1.00 97.28 2.72 1,957 100 93.85 35.94 NA NA NA
3 1 default S1_Singapore 6102466 NA Healthy FAA F A Autumn Channel 5.0000000 8.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 4,481,213 1.00 97.99 2.01 1,353 100 93.95 35.96 NA NA NA
4 1 default S2_Belinda 6102467 NA Healthy/Wild FAU F A Summer Channel 1.8657534 6.6 NA NA NA NA NA GCAAGATC+AGTCGAAG 3,296,547 1.00 97.40 2.60 996 100 94.12 35.98 NA NA NA
5 1 default S2_Rosie 6102470 NA Healthy/Wild FAU F A Summer Channel 1.8904110 7.4 NA NA NA NA NA CGCATGAT+AAGCCTGA 4,556,781 1.00 95.70 4.30 1,376 100 93.94 35.94 NA NA NA
6 1 default S3_ST62 6102475 NA Healthy/Wild FAW F A Winter Channel 3.2712329 10.2 NA NA NA NA NA TGAGCTAG+GAACGGTT 4,579,681 1.00 96.67 3.33 1,383 100 93.75 35.92 NA NA NA
7 1 default S4_Kerchak 6102478 NA Healthy MAA M A Autumn Channel 4.1863014 11.6 NA NA NA NA NA CGGCTAAT+CTCGTTCT 6,886,511 1.00 97.80 2.20 2,080 100 93.61 35.89 NA NA NA
8 1 default S4_Duffman 6102479 NA Healthy MAA M A Autumn Channel 3.1123288 12.4 NA NA NA NA NA GACGATCT+TCGTGCAT 8,301,336 2.00 97.75 2.25 2,507 100 93.83 35.93 NA NA NA
9 1 default S4_Hogan 6102481 NA Healthy MAA M A Autumn Channel 3.1616438 11.6 NA NA NA NA NA TACGCCTT+GCTACTCT 2,990,345 1.00 97.77 2.23 903 100 93.71 35.90 NA NA NA
10 1 default S5_Silky 6102486 NA Healthy/Wild MAW M A Winter Channel 2.2849315 9.5 NA NA NA NA NA CTGTTGAC+ACCTCAGT 5,617,260 1.00 97.81 2.19 1,696 100 93.55 35.88 NA NA NA
11 1 default S5_Longley 6102487 NA Healthy/Wild MAU M A Summer Channel 2.9315068 9.7 NA NA NA NA NA CGCAATCT+ACAGGCAT 2,937,660 1.00 97.71 2.29 887 100 93.75 35.91 NA NA NA
12 1 default S6_Myanmar 6102490 NA Healthy FAP F A Spring Channel 5.5726027 7.6 NA NA NA NA NA GCACAACT+CTGAACGT 9,604,175 2.00 98.14 1.86 2,900 100 93.93 35.94 NA NA NA
13 1 default S6_Pakana 6102491 NA Healthy MSP M S Spring Channel 1.6712329 7.8 NA NA NA NA NA GTTACGCA+ATGGCGAT 4,383,521 1.00 98.09 1.91 1,324 100 93.90 35.95 NA NA NA
14 1 default S6_Hobbit 6102495 NA Healthy MSP M S Spring Channel 1.6273973 9 NA NA NA NA NA ATATGCGC+ACGATCAG 7,342,414 2.00 97.00 3.00 2,217 100 93.93 35.96 NA NA NA
15 1 default S7_Lieke 6102499 NA Healthy/Wild FSU F S Summer Channel 0.8657534 4.9 NA NA NA NA NA TTCCAAGG+CTACAAGG 1,800,468 0.00 97.79 2.21 544 100 93.58 35.88 NA NA NA
16 1 default S7_Smithers 6102501 NA Healthy/Wild MAA M A Autumn Channel 3.1013699 8.9 NA NA NA NA NA GCGTCATT+CAGACGTT 6,731,177 1.00 98.04 1.96 2,033 100 93.62 35.89 NA NA NA
17 1 default S8_Vinnie 6102503 NA Healthy/Wild MAU M A Summer Channel 2.9150685 8.8 NA NA NA NA NA CGACGTTA+CTCTGGAT 7,901,958 2.00 98.02 1.98 2,386 100 94.09 35.98 NA NA NA
18 1 default S8_Struggles 6102504 NA Healthy/Wild MAW M A Winter Channel 3.2821918 11.1 NA NA NA NA NA ATCGATCG+TGGAAGCA 5,257,820 1.00 95.13 4.87 1,588 100 93.81 35.93 NA NA NA
20 1 default S9_Majula 6102509 NA Healthy FAA F A Autumn Channel 3.1150685 6 NA NA NA NA NA ACTCTCGA+CTGTACCA 8,490,270 2.00 97.99 2.01 2,564 100 93.34 35.84 NA NA NA
21 1 default S9_Snoopy 6102510 NA Healthy/Wild MSW M S Winter Channel 1.2794521 6.3 NA NA NA NA NA AACTGAGC+CAATCAGG 1,709,078 0.00 98.04 1.96 516 100 93.06 35.78 NA NA NA
22 1 default S9_Sarabi 6102513 NA Healthy/Wild FSP F S Spring Channel 1.6328767 5.8 NA NA NA NA NA CTTAGGAC+ACTCCTAC 3,945,235 1.00 98.11 1.89 1,191 100 93.55 35.88 NA NA NA
23 1 default S11_Baloo 6102518 NA Healthy/Wild MAA M A Autumn Channel 3.1726027 11.5 NA NA NA NA NA CTGATCGT+GCGCATAT 10,923,019 2.00 98.07 1.93 3,299 100 93.51 35.87 NA NA NA
24 1 default S11_DanRhodes 6102523 NA Healthy/Wild MSW M S Winter Channel 1.3917808 6.8 NA NA NA NA NA TCGCTGTT+CAAGTCGT 5,076,673 1.00 97.41 2.59 1,533 100 93.77 35.92 NA NA NA
25 1 default S12_Robin 6102525 NA Healthy/Wild MAA M A Autumn Channel 2.1972603 7.7 NA NA NA NA NA ATGACGTC+CTTCCTTC 6,756,342 1.00 97.12 2.88 2,040 100 92.53 35.68 NA NA NA
26 1 default S12_Eeyore 6102527 NA Healthy/Wild MAW M A Winter Channel 3.2794521 9 NA NA NA NA NA TCAGGCTT+ATCATGCG 3,071,283 1.00 97.28 2.72 928 100 92.94 35.76 NA NA NA
27 1 default S13_Pangea 6102533 NA Healthy/Wild MAU M A Summer Channel 1.8794521 7.7 NA NA NA NA NA ACCACGAT+GTCTGCAA 1,732,316 0.00 97.57 2.43 523 100 93.82 35.92 NA NA NA
29 2 default S22_Ginger 6102586 NA Healthy/Wild MSW M S Winter Channel 1.2712329 7.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 9,742,792 2.10 97.63 2.37 2,942 100 93.00 35.78 NA NA NA
30 2 default S24_Boy 6102593 NA Healthy/Wild MAA M A Autumn Channel 3.1452055 8.3 NA NA NA NA NA CGACGTTA+CTCTGGAT 1,476,427 0.32 97.63 2.37 446 100 93.25 35.82 NA NA NA
31 2 default S24_Shazza 6102598 NA Healthy FAW F A Winter Channel 2.0273973 6.2 NA NA NA NA NA GAGCAGTA+TGAGCTGT 2,693,655 0.58 97.51 2.49 813 100 93.01 35.79 NA NA NA
col <- as.character(as.numeric(grepl("A",ssHSA$Age)))
col <- gsub("0","orange",col)
col <- gsub("1","brown",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Comparison of Sub-Adult vs Adult Healthy devils")
mtext("Sub-Adult=Orange, Adult=Brown")

ssHSA$MvF <- factor(ssHSA$Sex)
ssHSA$SubAdvAd <- as.numeric(factor(ssHSA$Age,levels=c("S","A"),ordered = TRUE))
ssHSA$Season <- factor(ssHSA$Season)
str(ssHSA)
## 'data.frame':    29 obs. of  33 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S1_LauraGrace" "S1_Turmeric" "S1_Singapore" "S2_Belinda" ...
##  $ Sample                 : int  6102461 6102465 6102466 6102467 6102470 6102475 6102478 6102479 6102481 6102486 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "Healthy/Wild" "Healthy/Wild" "Healthy" "Healthy/Wild" ...
##  $ Sex.Age.Season         : chr  "FAP" "FAU" "FAA" "FAU" ...
##  $ Sex                    : chr  "F" "F" "F" "F" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 2 3 1 3 3 4 1 1 1 4 ...
##  $ Location               : chr  "Channel" "Channel" "Channel" "Channel" ...
##  $ Agebyyear              : num  2.62 1.91 5 1.87 1.89 ...
##  $ Weight                 : chr  "7.2" "7.8" "8.6" "6.6" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ Ulcerated              : logi  NA NA NA NA NA NA ...
##  $ UlcerationDepth        : chr  "" "" "" "" ...
##  $ Secondary.infection    : logi  NA NA NA NA NA NA ...
##  $ Total.tumour.volume    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Barcode.sequence       : chr  "AGAGTAGC+AAGGCGTA" "GAAGGAAG+GACGTCAT" "ACAGCTCA+TACTGCTC" "GCAAGATC+AGTCGAAG" ...
##  $ PF.Clusters            : chr  "4,511,702" "6,479,047" "4,481,213" "3,296,547" ...
##  $ X..of.the.lane         : num  1 1 1 1 1 1 1 2 1 1 ...
##  $ X..Perfect.barcode     : num  98.3 97.3 98 97.4 95.7 ...
##  $ X..One.mismatch.barcode: num  1.71 2.72 2.01 2.6 4.3 3.33 2.2 2.25 2.23 2.19 ...
##  $ Yield..Mbases.         : chr  "1,363" "1,957" "1,353" "996" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.8 93.8 94 94.1 93.9 ...
##  $ Mean.Quality           : num  35.9 35.9 36 36 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 1 1 1 2 2 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 2 2 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssHSA, design = ~ Season + MvF + SubAdvAd)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 10 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeHSA <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 5
maplot(dgeHSA,"Sub-Adult vs Adult Healthy devils")

make_volcano(dgeHSA,"Sub-Adult vs Adult Healthy devils")

col <- as.character(as.numeric(grepl("A",ssHSA$Age)))
col <- gsub("0","orange",col)
col <- gsub("1","brown",col)
mtext("Sub-Adult=Orange, Adult=Brown")

sig[1:100,1:6] %>%
  kbl(caption="Comparison of Sub-Adult vs Adult Healthy devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Sub-Adult vs Adult Healthy devils
baseMean log2FoldChange lfcSE stat pvalue padj
CD19 2631.3365 -1.6606475 0.3167409 -5.242920 0.0000002 0.0000319
FCMR 30389.8997 -1.9153371 0.3730840 -5.133796 0.0000003 0.0000319
MS4A1 6756.4847 -1.5648906 0.3200891 -4.888922 0.0000010 0.0000760
IgM 57530.3797 -1.4691006 0.3060463 -4.800256 0.0000016 0.0000891
CXCR5 1116.1701 -1.3356203 0.2825809 -4.726506 0.0000023 0.0001028
CD40 2105.5735 -1.2661072 0.2865620 -4.418266 0.0000099 0.0003731
CD22 8615.2980 -1.2218493 0.2825749 -4.323983 0.0000153 0.0004925
TLR9 642.7367 -1.0914975 0.2626616 -4.155527 0.0000325 0.0009128
IL16 10766.3462 -0.5052720 0.1256632 -4.020845 0.0000580 0.0014497
PDCD1 998.1827 -1.3735597 0.3646301 -3.766995 0.0001652 0.0037176
Saha-UM 151.8341 1.7735634 0.5327878 3.328836 0.0008721 0.0178383
TLR4 1310.8396 1.1932591 0.3682601 3.240262 0.0011942 0.0206801
CCLD13 277.1329 1.7843477 0.5507065 3.240107 0.0011949 0.0206801
IL1B 5176.4086 0.9592865 0.3225449 2.974117 0.0029383 0.0457211
IL3Ra 4282.2086 0.8604834 0.2904244 2.962848 0.0030481 0.0457211
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
NA.28 NA NA NA NA NA NA
NA.29 NA NA NA NA NA NA
NA.30 NA NA NA NA NA NA
NA.31 NA NA NA NA NA NA
NA.32 NA NA NA NA NA NA
NA.33 NA NA NA NA NA NA
NA.34 NA NA NA NA NA NA
NA.35 NA NA NA NA NA NA
NA.36 NA NA NA NA NA NA
NA.37 NA NA NA NA NA NA
NA.38 NA NA NA NA NA NA
NA.39 NA NA NA NA NA NA
NA.40 NA NA NA NA NA NA
NA.41 NA NA NA NA NA NA
NA.42 NA NA NA NA NA NA
NA.43 NA NA NA NA NA NA
NA.44 NA NA NA NA NA NA
NA.45 NA NA NA NA NA NA
NA.46 NA NA NA NA NA NA
NA.47 NA NA NA NA NA NA
NA.48 NA NA NA NA NA NA
NA.49 NA NA NA NA NA NA
NA.50 NA NA NA NA NA NA
NA.51 NA NA NA NA NA NA
NA.52 NA NA NA NA NA NA
NA.53 NA NA NA NA NA NA
NA.54 NA NA NA NA NA NA
NA.55 NA NA NA NA NA NA
NA.56 NA NA NA NA NA NA
NA.57 NA NA NA NA NA NA
NA.58 NA NA NA NA NA NA
NA.59 NA NA NA NA NA NA
NA.60 NA NA NA NA NA NA
NA.61 NA NA NA NA NA NA
NA.62 NA NA NA NA NA NA
NA.63 NA NA NA NA NA NA
NA.64 NA NA NA NA NA NA
NA.65 NA NA NA NA NA NA
NA.66 NA NA NA NA NA NA
NA.67 NA NA NA NA NA NA
NA.68 NA NA NA NA NA NA
NA.69 NA NA NA NA NA NA
NA.70 NA NA NA NA NA NA
NA.71 NA NA NA NA NA NA
NA.72 NA NA NA NA NA NA
NA.73 NA NA NA NA NA NA
NA.74 NA NA NA NA NA NA
NA.75 NA NA NA NA NA NA
NA.76 NA NA NA NA NA NA
NA.77 NA NA NA NA NA NA
NA.78 NA NA NA NA NA NA
NA.79 NA NA NA NA NA NA
NA.80 NA NA NA NA NA NA
NA.81 NA NA NA NA NA NA
NA.82 NA NA NA NA NA NA
NA.83 NA NA NA NA NA NA
NA.84 NA NA NA NA NA NA
write.table(dge,file="dgeHSA.tsv",sep="\t")

mx <- sig[,7:ncol(sig)]
mx <- head(mx,30)
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(as.matrix(mx),trace="none",scale="row",
          col=colfunc(25),ColSideColors=col,mar=c(5,12))

ssDFT <- filter(ss, Category %in% c('DFT1', 'DFT2'))

ssDFTAg <- ssDFT[which(grepl("S",ssDFT$Age) + grepl("A",ssDFT$Age)>0),]
ssDFTAg
##    Lane Project              Client.ID  Sample  X Category Sex.Age.Season Sex
## 1     1 default            S1_Sarafina 6102463 NA     DFT1            FAP   F
## 2     1 default                S1_Lucy 6102464 NA     DFT1            FAU   F
## 3     1 default                S2_Hope 6102471 NA     DFT1            FAU   F
## 4     1 default               S2_Sally 6102472 NA     DFT1            FAU   F
## 5     1 default                 S3_Apu 6102473 NA     DFT1            MAA   M
## 6     1 default              S3_Simone 6102474 NA     DFT1            FAW   F
## 7     1 default              S4_Wiggum 6102480 NA     DFT1            MAA   M
## 8     1 default                S4_Pooh 6102482 NA     DFT1            MAA   M
## 9     1 default            S4_Milhouse 6102483 NA     DFT1            MAA   M
## 10    1 default               S5_Allen 6102488 NA     DFT1            MAU   M
## 11    1 default                S5_Cyan 6102489 NA     DFT1            MAW   M
## 12    1 default              S6_Shelob 6102492 NA     DFT2            FAP   F
## 13    1 default           S6_Stuttgart 6102493 NA     DFT1            MSP   M
## 14    1 default              S7_Violet 6102498 NA     DFT2            FSU   F
## 15    1 default              S7_Willie 6102500 NA     DFT2            MAA   M
## 16    1 default              S8_Orange 6102502 NA     DFT1            FAU   F
## 17    1 default                S8_ST67 6102505 NA     DFT2            MAW   M
## 18    1 default              S8_Yellow 6102507 NA     DFT2            MAU   M
## 19    1 default                S9_Jane 6102508 NA     DFT1            FAA   F
## 20    1 default        S9_Clytemnestra 6102511 NA     DFT1            FSP   F
## 21    1 default                S9_Zeus 6102512 NA     DFT2            MSW   M
## 22    1 default           S10_Laurasia 6102516 NA     DFT2            MSP   M
## 23    1 default          S10_Enchilada 6102517 NA     DFT2            MAP   M
## 24    1 default S11_Murdoch/Washington 6102519 NA     DFT2            MAA   M
## 25    1 default                S12_Abe 6102524 NA     DFT1            MAA   M
## 26    1 default              S12_Lilac 6102526 NA     DFT1            MAW   M
## 27    1 default              S13_Green 6102531 NA     DFT1            MAA   M
## 28    1 default               S13_Bump 6102532 NA     DFT1            MAU   M
## 29    1 default             S14_Purple 6102536 NA     DFT1            FAW   F
##    Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1    A Spring  Channel 2.6191781    6.4  NA                NA        NA
## 2    A Summer  Channel 2.9178082    7.1  NA                 3      TRUE
## 3    A Summer  Channel 2.9315068    6.4  NA                 4      TRUE
## 4    A Summer  Channel 2.9945205      7  NA                 1      TRUE
## 5    A Autumn  Channel 3.1150685    9.5  NA                 1     FALSE
## 6    A Winter  Channel 3.2739726   10.2  NA                 1      TRUE
## 7    A Autumn  Channel 3.1178082    8.3  NA                 2     FALSE
## 8    A Autumn  Channel 4.1863014   11.8  NA                 1     FALSE
## 9    A Autumn  Channel 4.1013699     11  NA                 1      TRUE
## 10   A Summer  Channel 1.9095890    6.7  NA                 1      TRUE
## 11   A Winter  Channel 3.3945205    9.1  NA                 5      TRUE
## 12   A Spring  Channel 4.6219178    7.2  NA                NA        NA
## 13   S Spring  Channel 0.5780822   12.7  NA                 1     FALSE
## 14   S Summer  Channel 0.8739726    4.6  NA                 1      TRUE
## 15   A Autumn  Channel 2.1150685    8.2  NA                 2      TRUE
## 16   A Summer  Channel 1.9150685    7.1  NA                 7      TRUE
## 17   A Winter  Channel 4.2794521   10.2  NA                 1      TRUE
## 18   A Summer  Channel 1.8657534   10.5  NA                 2      TRUE
## 19   A Autumn  Channel 3.1972603    6.1  NA                NA        NA
## 20   S Spring  Channel 1.6602740      6  NA                NA        NA
## 21   S Winter  Channel 1.3479452    7.3  NA                NA        NA
## 22   S Spring  Channel 1.6383562      8  NA                NA        NA
## 23   A Spring  Channel 3.6438356    9.3  NA                14     FALSE
## 24   A Autumn  Channel 1.4438356    8.9  NA                NA        NA
## 25   A Autumn  Channel 3.1150685    7.9  NA                 1      TRUE
## 26   A Winter  Channel 3.4109589    9.6  NA                 5      TRUE
## 27   A Autumn  Channel 3.1534247    7.5  NA                 2      TRUE
## 28   A Summer  Channel 3.9068493    9.3  NA                NA        NA
## 29   A Winter  Channel 2.3945205    6.8  NA                 1      TRUE
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA           95140.790 ATCCAGAG+TAACGTCG
## 2             deep                TRUE          700825.170 AAGCACTG+AGGTCAAC
## 3             deep                TRUE          103815.530 AGCACTTC+ACGTCCAA
## 4             deep               FALSE            1588.272 CGTTGCAA+ATAGAGCG
## 5      superficial                TRUE             200.000 CCTTGATC+GATGGAGT
## 6      superficial                TRUE            2670.678 CGGTTGTT+GTGGTATG
## 7                                FALSE            7272.309 GTGAAGTG+GAGCAATC
## 8                                FALSE            7577.856 CTTCGACT+GATCTTGC
## 9             deep                TRUE             480.000 AACCGTTC+CTAGCTCA
## 10            deep                TRUE           55959.750 TTGCAGAC+ATCGTGGT
## 11            deep                TRUE          206006.422 GTAGGAGT+GTCCTAAG
## 12                                  NA            7455.435 GTCATCGA+GATCCACT
## 13                                TRUE            3809.806 AGCGTGTT+CTTCGCAA
## 14     superficial                TRUE            5517.330 CTTGTCGA+CGATGTTC
## 15            deep                TRUE            1527.480 TGGACTCT+TCTTACGG
## 16     superficial                TRUE           43690.461 GTTGACCT+CAGTGCTT
## 17            deep                TRUE          102246.432 TTGGACGT+GAAGTGCT
## 18            deep                TRUE          139389.671 GAAGTTGG+CGAACAAC
## 19                                  NA           64646.036 GTTCTCGT+TGTTCCGT
## 20                                  NA           34738.080 CATGGCTA+CACACATC
## 21                                  NA             100.000 CGTGTGTA+CCAACGAA
## 22                                  NA            2697.152 TACGCTAC+CGTGTGAT
## 23                               FALSE          301301.905 GATTGCTC+CACTTCAC
## 24                                  NA          127176.305 ACTGAGGT+GTCAACAG
## 25            deep                TRUE           13125.000 GTTGTTCG+CCAACTTC
## 26     superficial                TRUE           37293.844 TATCGGTC+TACCGGAT
## 27     superficial                TRUE            7407.222 GTCGAAGA+CCACATTG
## 28                                  NA          629522.362 AGTTCGTC+ACTCGATC
## 29            deep                TRUE           24938.123 CGCTCTAT+TTGCAACG
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    6,491,488              1              74.07                   25.93
## 2    6,121,785              1              98.00                    2.00
## 3    1,971,776              0              97.96                    2.04
## 4    2,429,449              1              97.42                    2.58
## 5    4,939,580              1              96.94                    3.06
## 6    4,015,027              1              95.91                    4.09
## 7    4,201,355              1              97.17                    2.83
## 8    3,821,151              1              97.31                    2.69
## 9   10,492,900              2              98.13                    1.87
## 10   5,288,435              1              96.85                    3.15
## 11   4,138,600              1              98.03                    1.97
## 12   3,184,798              1              98.21                    1.79
## 13   3,056,475              1              97.50                    2.50
## 14   2,768,682              1              98.19                    1.81
## 15   4,539,036              1              98.30                    1.70
## 16   5,072,309              1              97.92                    2.08
## 17   5,476,735              1              95.44                    4.56
## 18   6,469,324              1              97.99                    2.01
## 19  12,489,105              3              97.92                    2.08
## 20   6,141,790              1              98.00                    2.00
## 21     699,953              0              97.64                    2.36
## 22   9,716,148              2              97.81                    2.19
## 23  11,967,844              2              97.82                    2.18
## 24   2,003,509              0              97.82                    2.18
## 25   6,446,467              1              97.60                    2.40
## 26   4,490,241              1              98.15                    1.85
## 27   2,623,695              1              97.38                    2.62
## 28   9,435,053              2              98.16                    1.84
## 29   5,432,182              1              97.81                    2.19
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,960           100     93.74        35.92  NA  NA  NA
## 2           1,849           100     93.84        35.93  NA  NA  NA
## 3             595           100     93.62        35.88  NA  NA  NA
## 4             734           100     93.78        35.93  NA  NA  NA
## 5           1,492           100     93.71        35.91  NA  NA  NA
## 6           1,213           100     93.42        35.86  NA  NA  NA
## 7           1,269           100     93.64        35.90  NA  NA  NA
## 8           1,154           100     93.60        35.89  NA  NA  NA
## 9           3,169           100     93.80        35.92  NA  NA  NA
## 10          1,597           100     93.42        35.86  NA  NA  NA
## 11          1,250           100     93.67        35.90  NA  NA  NA
## 12            962           100     93.90        35.94  NA  NA  NA
## 13            923           100     93.95        35.95  NA  NA  NA
## 14            836           100     93.85        35.93  NA  NA  NA
## 15          1,371           100     93.84        35.93  NA  NA  NA
## 16          1,532           100     93.36        35.84  NA  NA  NA
## 17          1,654           100     93.21        35.82  NA  NA  NA
## 18          1,954           100     94.00        35.97  NA  NA  NA
## 19          3,772           100     93.54        35.88  NA  NA  NA
## 20          1,855           100     93.42        35.85  NA  NA  NA
## 21            211           100     93.33        35.84  NA  NA  NA
## 22          2,934           100     93.97        35.95  NA  NA  NA
## 23          3,614           100     93.88        35.94  NA  NA  NA
## 24            605           100     93.39        35.85  NA  NA  NA
## 25          1,947           100     93.65        35.90  NA  NA  NA
## 26          1,356           100     93.42        35.85  NA  NA  NA
## 27            792           100     92.94        35.76  NA  NA  NA
## 28          2,849           100     93.64        35.89  NA  NA  NA
## 29          1,641           100     93.93        35.95  NA  NA  NA
ssDFTAg <- ssDFTAg[ssDFTAg$Sample %in% colnames(x),]

dim(ssDFTAg)
## [1] 28 31
x1 <- x[,which(colnames(x) %in% ssDFTAg$Sample)]
dim(x1)
## [1] 310  28
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 258  28
ssDFTAg %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S1_Sarafina 6102463 NA DFT1 FAP F A Spring Channel 2.6191781 6.4 NA NA NA NA 95140.790 ATCCAGAG+TAACGTCG 6,491,488 1 74.07 25.93 1,960 100 93.74 35.92 NA NA NA
2 1 default S1_Lucy 6102464 NA DFT1 FAU F A Summer Channel 2.9178082 7.1 NA 3 TRUE deep TRUE 700825.170 AAGCACTG+AGGTCAAC 6,121,785 1 98.00 2.00 1,849 100 93.84 35.93 NA NA NA
3 1 default S2_Hope 6102471 NA DFT1 FAU F A Summer Channel 2.9315068 6.4 NA 4 TRUE deep TRUE 103815.530 AGCACTTC+ACGTCCAA 1,971,776 0 97.96 2.04 595 100 93.62 35.88 NA NA NA
4 1 default S2_Sally 6102472 NA DFT1 FAU F A Summer Channel 2.9945205 7 NA 1 TRUE deep FALSE 1588.272 CGTTGCAA+ATAGAGCG 2,429,449 1 97.42 2.58 734 100 93.78 35.93 NA NA NA
5 1 default S3_Apu 6102473 NA DFT1 MAA M A Autumn Channel 3.1150685 9.5 NA 1 FALSE superficial TRUE 200.000 CCTTGATC+GATGGAGT 4,939,580 1 96.94 3.06 1,492 100 93.71 35.91 NA NA NA
6 1 default S3_Simone 6102474 NA DFT1 FAW F A Winter Channel 3.2739726 10.2 NA 1 TRUE superficial TRUE 2670.678 CGGTTGTT+GTGGTATG 4,015,027 1 95.91 4.09 1,213 100 93.42 35.86 NA NA NA
7 1 default S4_Wiggum 6102480 NA DFT1 MAA M A Autumn Channel 3.1178082 8.3 NA 2 FALSE FALSE 7272.309 GTGAAGTG+GAGCAATC 4,201,355 1 97.17 2.83 1,269 100 93.64 35.90 NA NA NA
8 1 default S4_Pooh 6102482 NA DFT1 MAA M A Autumn Channel 4.1863014 11.8 NA 1 FALSE FALSE 7577.856 CTTCGACT+GATCTTGC 3,821,151 1 97.31 2.69 1,154 100 93.60 35.89 NA NA NA
9 1 default S4_Milhouse 6102483 NA DFT1 MAA M A Autumn Channel 4.1013699 11 NA 1 TRUE deep TRUE 480.000 AACCGTTC+CTAGCTCA 10,492,900 2 98.13 1.87 3,169 100 93.80 35.92 NA NA NA
10 1 default S5_Allen 6102488 NA DFT1 MAU M A Summer Channel 1.9095890 6.7 NA 1 TRUE deep TRUE 55959.750 TTGCAGAC+ATCGTGGT 5,288,435 1 96.85 3.15 1,597 100 93.42 35.86 NA NA NA
11 1 default S5_Cyan 6102489 NA DFT1 MAW M A Winter Channel 3.3945205 9.1 NA 5 TRUE deep TRUE 206006.422 GTAGGAGT+GTCCTAAG 4,138,600 1 98.03 1.97 1,250 100 93.67 35.90 NA NA NA
12 1 default S6_Shelob 6102492 NA DFT2 FAP F A Spring Channel 4.6219178 7.2 NA NA NA NA 7455.435 GTCATCGA+GATCCACT 3,184,798 1 98.21 1.79 962 100 93.90 35.94 NA NA NA
13 1 default S6_Stuttgart 6102493 NA DFT1 MSP M S Spring Channel 0.5780822 12.7 NA 1 FALSE TRUE 3809.806 AGCGTGTT+CTTCGCAA 3,056,475 1 97.50 2.50 923 100 93.95 35.95 NA NA NA
14 1 default S7_Violet 6102498 NA DFT2 FSU F S Summer Channel 0.8739726 4.6 NA 1 TRUE superficial TRUE 5517.330 CTTGTCGA+CGATGTTC 2,768,682 1 98.19 1.81 836 100 93.85 35.93 NA NA NA
15 1 default S7_Willie 6102500 NA DFT2 MAA M A Autumn Channel 2.1150685 8.2 NA 2 TRUE deep TRUE 1527.480 TGGACTCT+TCTTACGG 4,539,036 1 98.30 1.70 1,371 100 93.84 35.93 NA NA NA
16 1 default S8_Orange 6102502 NA DFT1 FAU F A Summer Channel 1.9150685 7.1 NA 7 TRUE superficial TRUE 43690.461 GTTGACCT+CAGTGCTT 5,072,309 1 97.92 2.08 1,532 100 93.36 35.84 NA NA NA
17 1 default S8_ST67 6102505 NA DFT2 MAW M A Winter Channel 4.2794521 10.2 NA 1 TRUE deep TRUE 102246.432 TTGGACGT+GAAGTGCT 5,476,735 1 95.44 4.56 1,654 100 93.21 35.82 NA NA NA
18 1 default S8_Yellow 6102507 NA DFT2 MAU M A Summer Channel 1.8657534 10.5 NA 2 TRUE deep TRUE 139389.671 GAAGTTGG+CGAACAAC 6,469,324 1 97.99 2.01 1,954 100 94.00 35.97 NA NA NA
19 1 default S9_Jane 6102508 NA DFT1 FAA F A Autumn Channel 3.1972603 6.1 NA NA NA NA 64646.036 GTTCTCGT+TGTTCCGT 12,489,105 3 97.92 2.08 3,772 100 93.54 35.88 NA NA NA
20 1 default S9_Clytemnestra 6102511 NA DFT1 FSP F S Spring Channel 1.6602740 6 NA NA NA NA 34738.080 CATGGCTA+CACACATC 6,141,790 1 98.00 2.00 1,855 100 93.42 35.85 NA NA NA
22 1 default S10_Laurasia 6102516 NA DFT2 MSP M S Spring Channel 1.6383562 8 NA NA NA NA 2697.152 TACGCTAC+CGTGTGAT 9,716,148 2 97.81 2.19 2,934 100 93.97 35.95 NA NA NA
23 1 default S10_Enchilada 6102517 NA DFT2 MAP M A Spring Channel 3.6438356 9.3 NA 14 FALSE FALSE 301301.905 GATTGCTC+CACTTCAC 11,967,844 2 97.82 2.18 3,614 100 93.88 35.94 NA NA NA
24 1 default S11_Murdoch/Washington 6102519 NA DFT2 MAA M A Autumn Channel 1.4438356 8.9 NA NA NA NA 127176.305 ACTGAGGT+GTCAACAG 2,003,509 0 97.82 2.18 605 100 93.39 35.85 NA NA NA
25 1 default S12_Abe 6102524 NA DFT1 MAA M A Autumn Channel 3.1150685 7.9 NA 1 TRUE deep TRUE 13125.000 GTTGTTCG+CCAACTTC 6,446,467 1 97.60 2.40 1,947 100 93.65 35.90 NA NA NA
26 1 default S12_Lilac 6102526 NA DFT1 MAW M A Winter Channel 3.4109589 9.6 NA 5 TRUE superficial TRUE 37293.844 TATCGGTC+TACCGGAT 4,490,241 1 98.15 1.85 1,356 100 93.42 35.85 NA NA NA
27 1 default S13_Green 6102531 NA DFT1 MAA M A Autumn Channel 3.1534247 7.5 NA 2 TRUE superficial TRUE 7407.222 GTCGAAGA+CCACATTG 2,623,695 1 97.38 2.62 792 100 92.94 35.76 NA NA NA
28 1 default S13_Bump 6102532 NA DFT1 MAU M A Summer Channel 3.9068493 9.3 NA NA NA NA 629522.362 AGTTCGTC+ACTCGATC 9,435,053 2 98.16 1.84 2,849 100 93.64 35.89 NA NA NA
29 1 default S14_Purple 6102536 NA DFT1 FAW F A Winter Channel 2.3945205 6.8 NA 1 TRUE deep TRUE 24938.123 CGCTCTAT+TTGCAACG 5,432,182 1 97.81 2.19 1,641 100 93.93 35.95 NA NA NA
col <- as.character(as.numeric(grepl("A",ssDFTAg$Age)))
col <- gsub("0","orange",col)
col <- gsub("1","brown",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Comparison of Sub-Adult vs Adult DFTD infected devils")
mtext("Sub-Adult=Orange, Adult=Brown")

ssDFTAg$DFTDStat <- grepl("DFT2",ssDFTAg$Category)
ssDFTAg$MvF <- factor(ssDFTAg$Sex)
ssDFTAg$SubAdvAd <- as.numeric(factor(ssDFTAg$Age,levels=c("S","A"),ordered = TRUE))
ssDFTAg$Season <- factor(ssDFTAg$Season)
str(ssDFTAg)
## 'data.frame':    28 obs. of  34 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S1_Sarafina" "S1_Lucy" "S2_Hope" "S2_Sally" ...
##  $ Sample                 : int  6102463 6102464 6102471 6102472 6102473 6102474 6102480 6102482 6102483 6102488 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "DFT1" "DFT1" "DFT1" "DFT1" ...
##  $ Sex.Age.Season         : chr  "FAP" "FAU" "FAU" "FAU" ...
##  $ Sex                    : chr  "F" "F" "F" "F" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 2 3 3 3 1 4 1 1 1 3 ...
##  $ Location               : chr  "Channel" "Channel" "Channel" "Channel" ...
##  $ Agebyyear              : num  2.62 2.92 2.93 2.99 3.12 ...
##  $ Weight                 : chr  "6.4" "7.1" "6.4" "7" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA 3 4 1 1 1 2 1 1 1 ...
##  $ Ulcerated              : logi  NA TRUE TRUE TRUE FALSE TRUE ...
##  $ UlcerationDepth        : chr  "" "deep" "deep" "deep" ...
##  $ Secondary.infection    : logi  NA TRUE TRUE FALSE TRUE TRUE ...
##  $ Total.tumour.volume    : num  95141 700825 103816 1588 200 ...
##  $ Barcode.sequence       : chr  "ATCCAGAG+TAACGTCG" "AAGCACTG+AGGTCAAC" "AGCACTTC+ACGTCCAA" "CGTTGCAA+ATAGAGCG" ...
##  $ PF.Clusters            : chr  "6,491,488" "6,121,785" "1,971,776" "2,429,449" ...
##  $ X..of.the.lane         : num  1 1 0 1 1 1 1 1 2 1 ...
##  $ X..Perfect.barcode     : num  74.1 98 98 97.4 96.9 ...
##  $ X..One.mismatch.barcode: num  25.93 2 2.04 2.58 3.06 ...
##  $ Yield..Mbases.         : chr  "1,960" "1,849" "595" "734" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.7 93.8 93.6 93.8 93.7 ...
##  $ Mean.Quality           : num  35.9 35.9 35.9 35.9 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ DFTDStat               : logi  FALSE FALSE FALSE FALSE FALSE FALSE ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 1 2 1 2 2 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 2 2 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssDFTAg, design = ~ Season + DFTDStat + MvF + SubAdvAd )
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeDFTAg <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 5
maplot(dgeDFTAg,"Sub-Adult vs Adult DFTD infected devils")

make_volcano(dgeDFTAg,"Sub-Adult vs Adult DFTD infected devils")

col <- as.character(as.numeric(grepl("A",ssDFTAg$Age)))
col <- gsub("0","brown",col)
col <- gsub("1","orange",col)

sig[1:100,1:6] %>%
  kbl(caption="Comparison of Sub-Adult vs Adult DFTD infected devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Sub-Adult vs Adult DFTD infected devils
baseMean log2FoldChange lfcSE stat pvalue padj
CXCL10 6.852306 14.595049 2.1152809 6.899816 0.0000000 0.0000000
Saha-UM 127.913054 3.351159 0.7142462 4.691882 0.0000027 0.0003492
CD96 100.034988 4.813349 1.0872594 4.427047 0.0000096 0.0008216
XCR1 44.462082 3.136733 0.9280398 3.379955 0.0007250 0.0467047
FCGR2B 980.116968 2.200527 0.6714226 3.277410 0.0010476 0.0467047
IgE 5611.165649 -2.094462 0.6410565 -3.267204 0.0010862 0.0467047
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
NA.28 NA NA NA NA NA NA
NA.29 NA NA NA NA NA NA
NA.30 NA NA NA NA NA NA
NA.31 NA NA NA NA NA NA
NA.32 NA NA NA NA NA NA
NA.33 NA NA NA NA NA NA
NA.34 NA NA NA NA NA NA
NA.35 NA NA NA NA NA NA
NA.36 NA NA NA NA NA NA
NA.37 NA NA NA NA NA NA
NA.38 NA NA NA NA NA NA
NA.39 NA NA NA NA NA NA
NA.40 NA NA NA NA NA NA
NA.41 NA NA NA NA NA NA
NA.42 NA NA NA NA NA NA
NA.43 NA NA NA NA NA NA
NA.44 NA NA NA NA NA NA
NA.45 NA NA NA NA NA NA
NA.46 NA NA NA NA NA NA
NA.47 NA NA NA NA NA NA
NA.48 NA NA NA NA NA NA
NA.49 NA NA NA NA NA NA
NA.50 NA NA NA NA NA NA
NA.51 NA NA NA NA NA NA
NA.52 NA NA NA NA NA NA
NA.53 NA NA NA NA NA NA
NA.54 NA NA NA NA NA NA
NA.55 NA NA NA NA NA NA
NA.56 NA NA NA NA NA NA
NA.57 NA NA NA NA NA NA
NA.58 NA NA NA NA NA NA
NA.59 NA NA NA NA NA NA
NA.60 NA NA NA NA NA NA
NA.61 NA NA NA NA NA NA
NA.62 NA NA NA NA NA NA
NA.63 NA NA NA NA NA NA
NA.64 NA NA NA NA NA NA
NA.65 NA NA NA NA NA NA
NA.66 NA NA NA NA NA NA
NA.67 NA NA NA NA NA NA
NA.68 NA NA NA NA NA NA
NA.69 NA NA NA NA NA NA
NA.70 NA NA NA NA NA NA
NA.71 NA NA NA NA NA NA
NA.72 NA NA NA NA NA NA
NA.73 NA NA NA NA NA NA
NA.74 NA NA NA NA NA NA
NA.75 NA NA NA NA NA NA
NA.76 NA NA NA NA NA NA
NA.77 NA NA NA NA NA NA
NA.78 NA NA NA NA NA NA
NA.79 NA NA NA NA NA NA
NA.80 NA NA NA NA NA NA
NA.81 NA NA NA NA NA NA
NA.82 NA NA NA NA NA NA
NA.83 NA NA NA NA NA NA
NA.84 NA NA NA NA NA NA
NA.85 NA NA NA NA NA NA
NA.86 NA NA NA NA NA NA
NA.87 NA NA NA NA NA NA
NA.88 NA NA NA NA NA NA
NA.89 NA NA NA NA NA NA
NA.90 NA NA NA NA NA NA
NA.91 NA NA NA NA NA NA
NA.92 NA NA NA NA NA NA
NA.93 NA NA NA NA NA NA
write.table(dge,file="dgeDFTAg.tsv",sep="\t")
ssCap <- filter(ss, Category %in% c('Captive'))

ssCapAg <- ssCap[which(grepl("S",ssCap$Age) + grepl("A",ssCap$Age)>0),]
ssCapAg
##    Lane Project      Client.ID  Sample  X Category Sex.Age.Season Sex Age
## 1     1 default      S2_B99008 6102468 NA  Captive            FAU   F   A
## 2     1 default      S2_Bonney 6102469 NA  Captive            FAU   F   A
## 3     1 default      S3_Jessie 6102476 NA  Captive            FAW   F   A
## 4     1 default    S3_McCauley 6102477 NA  Captive            MAA   M   A
## 5     1 default      S5_Fenton 6102484 NA  Captive            MAU   M   A
## 6     1 default S5_Bryan Adams 6102485 NA  Captive            MAW   M   A
## 7     1 default       S7_Fredo 6102496 NA  Captive            MAA   M   A
## 8     1 default      S7_Piglet 6102497 NA  Captive            FSU   F   S
## 9     1 default    S10_McMahon 6102514 NA  Captive            MSP   M   S
## 10    1 default      S10_Logan 6102515 NA  Captive            MAU   M   A
## 11    1 default       S11_Xuki 6102520 NA  Captive            MAA   M   A
## 12    1 default   S11_Kalamata 6102521 NA  Captive            MSW   M   S
## 13    1 default      S12_Wally 6102528 NA  Captive            MAA   M   A
## 14    1 default        S12_Naz 6102529 NA  Captive            MAW   M   A
## 15    1 default     S13_Humbug 6102530 NA  Captive            MAU   M   A
## 16    1 default     S13_Xerxes 6102535 NA  Captive            MAA   M   A
## 17    1 default     S14_Catani 6102538 NA  Captive            FAU   F   A
## 18    2 default     S15_Amelia 6102541 NA  Captive            FAU   F   A
## 19    2 default     S15_London 6102542 NA  Captive            FAU   F   A
## 20    2 default      S15_Elyse 6102543 NA  Captive            FAP   F   A
## 21    2 default     S16_Marley 6102547 NA  Captive            FAU   F   A
## 22    2 default      S16_Milla 6102548 NA  Captive            FAU   F   A
## 23    2 default S16_Maleficent 6102549 NA  Captive            FAU   F   A
## 24    2 default     S17_Anirak 6102553 NA  Captive            FSW   F   S
## 25    2 default       S17_Poly 6102554 NA  Captive            FSU   F   S
## 26    2 default     S17_Methyl 6102556 NA  Captive            FSU   F   S
## 27    2 default       S18_Zara 6102558 NA  Captive            FSW   F   S
## 28    2 default       S18_Maze 6102559 NA  Captive            FSW   F   S
## 29    2 default    S18_Delores 6102560 NA  Captive            FSW   F   S
## 30    2 default    S19_Morocco 6102564 NA  Captive            MAU   M   A
## 31    2 default   S19_Pecorino 6102565 NA  Captive            FSW   F   S
## 32    2 default      S19_Hooch 6102566 NA  Captive            MSA   M   S
## 33    2 default      S20_Muasy 6102569 NA  Captive            MSU   M   S
## 34    2 default       S20_Fuse 6102570 NA  Captive            MSU   M   S
## 35    2 default     S20_Joseph 6102571 NA  Captive            MSU   M   S
## 36    2 default      S21_Moama 6102576 NA  Captive            MAW   M   A
## 37    2 default     S21_Nauset 6102577 NA  Captive            MSW   M   S
## 38    2 default     S21_Graham 6102578 NA  Captive            MSW   M   S
## 39    2 default      S22_Yanni 6102581 NA  Captive            MSW   M   S
## 40    2 default    S22_Gherkin 6102582 NA  Captive            MSW   M   S
## 41    2 default    S22_Stilton 6102584 NA  Captive            MSW   M   S
## 42    2 default     S23_Osiris 6102588 NA  Captive            MSW   M   S
## 43    2 default     S23_X-boxx 6102589 NA  Captive            FSW   F   S
## 44    2 default     S23_Quince 6102590 NA  Captive            MSW   M   S
## 45    2 default     S24_Malfoy 6102595 NA  Captive            MAW   M   A
## 46    2 default   S24_Licorice 6102596 NA  Captive            FSA   F   S
## 47    2 default       S25_Tofu 6102599 NA  Captive            FAU   F   A
## 48    2 default    S25_Colette 6102600 NA  Captive            FAP   F   A
## 49    2 default S25_CannonBall 6102601 NA  Captive            MSW   M   S
## 50    2 default  S25_Cornelius 6102602 NA  Captive            MAU   M   A
## 51    2 default    S25_Mardook 6102603 NA  Captive            MAW   M   A
## 52    2 default    S25_Negroni 6102604 NA  Captive            FSP   F   S
##    Season    Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1  Summer     Monarto 3.7369863   8.12  NA                NA        NA
## 2  Summer Healesville 2.5863014    5.4  NA                NA        NA
## 3  Winter     Monarto 2.1945205  12.95  NA                NA        NA
## 4  Autumn Healesville 3.0328767   8.52  NA                NA        NA
## 5  Summer     Monarto 3.0000000    N/A  NA                NA        NA
## 6  Winter Healesville 4.1616438    8.6  NA                NA        NA
## 7  Autumn Healesville 2.9945205    8.8  NA                NA        NA
## 8  Summer Healesville 1.5890411   4.76  NA                NA        NA
## 9  Spring Healesville 1.6493151   8.06  NA                NA        NA
## 10 Summer Healesville 5.6000000   9.02  NA                NA        NA
## 11 Autumn     Monarto 2.0767123   7.95  NA                NA        NA
## 12 Winter Healesville 1.2849315   5.58  NA                NA        NA
## 13 Autumn     Monarto 2.1616438    N/A  NA                NA        NA
## 14 Winter     Monarto 4.4547945    N/A  NA                NA        NA
## 15 Summer     Monarto 2.5397260   7.94  NA                NA        NA
## 16 Autumn     Monarto 2.0767123    N/A  NA                NA        NA
## 17 Summer Healesville 2.8630137   6.46  NA                NA        NA
## 18 Summer Healesville 4.7260274   5.85  NA                NA        NA
## 19 Summer Healesville 3.7863014    4.8  NA                NA        NA
## 20 Spring Healesville 4.5232877   7.88  NA                NA        NA
## 21 Summer     Monarto 4.7726027   7.51  NA                NA        NA
## 22 Summer Healesville 2.7671233   5.82  NA                NA        NA
## 23 Summer     Monarto 4.5589041   8.59  NA                NA        NA
## 24 Winter Healesville 1.3424658   5.42  NA                NA        NA
## 25 Summer     Monarto 1.7917808   6.67  NA                NA        NA
## 26 Summer Healesville 0.7534247   2.72  NA                NA        NA
## 27 Winter     Monarto 1.5150685    4.6  NA                NA        NA
## 28 Winter Healesville 1.4000000   5.82  NA                NA        NA
## 29 Winter Healesville 1.2986301    5.1  NA                NA        NA
## 30 Summer     Monarto 4.5917808   9.82  NA                NA        NA
## 31 Winter Healesville 1.1123288   6.02  NA                NA        NA
## 32 Autumn Healesville 1.0164384    6.1  NA                NA        NA
## 33 Summer Healesville 1.4219178   6.62  NA                NA        NA
## 34 Summer Healesville 1.7315068   6.26  NA                NA        NA
## 35 Summer Healesville 1.7479452   7.42  NA                NA        NA
## 36 Winter     Monarto 1.6986301   8.75  NA                NA        NA
## 37 Winter Healesville 1.3041096  4.036  NA                NA        NA
## 38 Winter Healesville 1.3616438    6.4  NA                NA        NA
## 39 Winter     Monarto 1.5178082   8.15  NA                NA        NA
## 40 Winter Healesville 1.2630137   6.32  NA                NA        NA
## 41 Winter Healesville 1.2986301   5.76  NA                NA        NA
## 42 Winter Healesville 1.1753425   5.34  NA                NA        NA
## 43 Winter     Monarto 1.4657534   4.34  NA                NA        NA
## 44 Winter Healesville 1.3835616    N/A  NA                NA        NA
## 45 Winter Healesville 5.1041096   8.02  NA                NA        NA
## 46 Autumn Healesville 1.8246575   5.94  NA                NA        NA
## 47 Summer Healesville 2.7452055    N/A  NA                NA        NA
## 48 Spring Healesville 6.6273973   7.52  NA                NA        NA
## 49 Winter Healesville 1.1479452   6.54  NA                NA        NA
## 50 Summer Healesville 3.6904110   7.74  NA                NA        NA
## 51 Winter Healesville 4.3013699   9.16  NA                NA        NA
## 52 Spring Healesville 1.6767123   5.86  NA                NA        NA
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA                  NA GCTATCCT+AACAGGTG
## 2                                   NA                  NA ACGTTCAG+AGTTGTGC
## 3                                   NA                  NA CCGTAAGA+AGAGTCCA
## 4                                   NA                  NA CAACACCT+AGCTACCA
## 5                                   NA                  NA GATTACCG+TTGGACTG
## 6                                   NA                  NA CACTAGCT+TCGGATTC
## 7                                   NA                  NA AGTGGATC+TCGATGAC
## 8                                   NA                  NA ATCACACG+GTAGCGTA
## 9                                   NA                  NA AACGTCTG+AATGACGC
## 10                                  NA                  NA GTGCCATA+CTCCTAGT
## 11                                  NA                  NA ATCGCCAT+TGCGTAAC
## 12                                  NA                  NA GAACATCG+TCGACAAG
## 13                                  NA                  NA ACGACTTG+AACAGCGA
## 14                                  NA                  NA CCTTGTAG+CCTTGGAA
## 15                                  NA                  NA GAGCAGTA+TGAGCTGT
## 16                                  NA                  NA GATAGGCT+CAGTCACA
## 17                                  NA                  NA TGAAGACG+ACATGCCA
## 18                                  NA                  NA AACGTCTG+AATGACGC
## 19                                  NA                  NA GTCATCGA+GATCCACT
## 20                                  NA                  NA AGCGTGTT+CTTCGCAA
## 21                                  NA                  NA GCAAGATC+AGTCGAAG
## 22                                  NA                  NA TTGCGAAG+AACACGCT
## 23                                  NA                  NA TGCTTCCA+CGATCGAT
## 24                                  NA                  NA TGAGCTAG+GAACGGTT
## 25                                  NA                  NA CTTAGGAC+ACTCCTAC
## 26                                  NA                  NA TGGTACAG+TCGAGAGT
## 27                                  NA                  NA ACCACGAT+GTCTGCAA
## 28                                  NA                  NA ACTGAGGT+GTCAACAG
## 29                                  NA                  NA ACGACTTG+AACAGCGA
## 30                                  NA                  NA TCAGGCTT+ATCATGCG
## 31                                  NA                  NA ATGCCTGT+AGATTGCG
## 32                                  NA                  NA CCGTAAGA+AGAGTCCA
## 33                                  NA                  NA TTCCAAGG+CTACAAGG
## 34                                  NA                  NA GTAGGAGT+GTCCTAAG
## 35                                  NA                  NA CTTCGACT+GATCTTGC
## 36                                  NA                  NA TTGGACGT+GAAGTGCT
## 37                                  NA                  NA TATCGGTC+TACCGGAT
## 38                                  NA                  NA TACGCCTT+GCTACTCT
## 39                                  NA                  NA CGTGTGTA+CCAACGAA
## 40                                  NA                  NA CCTTGTAG+CCTTGGAA
## 41                                  NA                  NA CGCAATCT+ACAGGCAT
## 42                                  NA                  NA AGTGGATC+TCGATGAC
## 43                                  NA                  NA CTGTTGAC+ACCTCAGT
## 44                                  NA                  NA AACCGTTC+CTAGCTCA
## 45                                  NA                  NA TAACCGGT+ATCGTCTC
## 46                                  NA                  NA TTGCAGAC+ATCGTGGT
## 47                                  NA                  NA GAGACGAT+ACCGGTTA
## 48                                  NA                  NA CTTGTCGA+CGATGTTC
## 49                                  NA                  NA TACGCTAC+CGTGTGAT
## 50                                  NA                  NA GAATCCGA+AGCTAGTG
## 51                                  NA                  NA GCACAACT+CTGAACGT
## 52                                  NA                  NA TGTGACTG+AGCCTATC
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    5,338,890           1.00              98.08                    1.92
## 2   14,968,459           3.00              97.82                    2.18
## 3    4,340,498           1.00              97.95                    2.05
## 4   16,944,152           3.00              97.98                    2.02
## 5    5,125,566           1.00              96.21                    3.79
## 6    5,317,767           1.00              97.33                    2.67
## 7    2,690,632           1.00              97.77                    2.23
## 8   12,134,750           2.00              96.94                    3.06
## 9    3,809,607           1.00              96.73                    3.27
## 10   9,606,720           2.00              97.52                    2.48
## 11   6,018,884           1.00              97.88                    2.12
## 12   6,861,544           1.00              97.76                    2.24
## 13   3,000,501           1.00              97.96                    2.04
## 14   5,927,942           1.00              97.40                    2.60
## 15   1,702,608           0.00              98.07                    1.93
## 16   7,628,257           2.00              98.34                    1.66
## 17  13,381,058           3.00              96.98                    3.02
## 18   8,041,818           1.73              96.32                    3.68
## 19   5,758,111           1.24              96.72                    3.28
## 20   5,774,637           1.24              96.76                    3.24
## 21     348,621           0.08              97.24                    2.76
## 22   6,376,997           1.37              97.60                    2.40
## 23   9,181,668           1.98              98.08                    1.92
## 24   3,740,878           0.81              97.15                    2.85
## 25  11,133,566           2.40              97.85                    2.15
## 26   7,887,375           1.70              97.57                    2.43
## 27   7,308,907           1.58              97.70                    2.30
## 28   2,984,930           0.64              97.59                    2.41
## 29          98           0.00              94.90                    5.10
## 30   4,879,629           1.05              97.38                    2.62
## 31   4,857,395           1.05              97.58                    2.42
## 32   1,074,345           0.23              97.56                    2.44
## 33  10,669,237           2.30              97.64                    2.36
## 34  10,603,179           2.29              97.34                    2.66
## 35   5,642,025           1.22              96.37                    3.63
## 36  10,821,895           2.33              96.02                    3.98
## 37   8,693,920           1.87              98.13                    1.87
## 38   3,422,010           0.74              97.72                    2.28
## 39   4,811,453           1.04              97.67                    2.33
## 40   5,913,586           1.27              97.05                    2.95
## 41   8,306,537           1.79              96.94                    3.06
## 42   3,528,471           0.76              97.24                    2.76
## 43          23           0.00             100.00                     NaN
## 44   7,247,793           1.56              97.63                    2.37
## 45   6,908,416           1.49              97.09                    2.91
## 46   4,475,461           0.96              95.05                    4.95
## 47  12,024,421           2.59              95.37                    4.63
## 48  10,751,797           2.32              97.49                    2.51
## 49  13,015,081           2.81              97.36                    2.64
## 50   3,336,983           0.72              97.10                    2.90
## 51   6,826,313           1.47              97.66                    2.34
## 52   4,566,180           0.98              97.68                    2.32
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,612           100     93.69        35.91  NA  NA  NA
## 2           4,520           100     93.68        35.91  NA  NA  NA
## 3           1,311           100     93.54        35.88  NA  NA  NA
## 4           5,117           100     93.05        35.78  NA  NA  NA
## 5           1,548           100     93.89        35.94  NA  NA  NA
## 6           1,606           100     93.24        35.83  NA  NA  NA
## 7             813           100     93.77        35.93  NA  NA  NA
## 8           3,665           100     93.34        35.84  NA  NA  NA
## 9           1,151           100     93.07        35.79  NA  NA  NA
## 10          2,901           100     93.25        35.83  NA  NA  NA
## 11          1,818           100     93.58        35.89  NA  NA  NA
## 12          2,072           100     93.49        35.87  NA  NA  NA
## 13            906           100     93.70        35.91  NA  NA  NA
## 14          1,790           100     93.86        35.94  NA  NA  NA
## 15            514           100     93.58        35.89  NA  NA  NA
## 16          2,304           100     93.62        35.89  NA  NA  NA
## 17          4,041           100     93.36        35.84  NA  NA  NA
## 18          2,429           100     92.18        35.63  NA  NA  NA
## 19          1,739           100     91.87        35.55  NA  NA  NA
## 20          1,744           100     91.56        35.50  NA  NA  NA
## 21            105           100     92.77        35.73  NA  NA  NA
## 22          1,926           100     92.44        35.67  NA  NA  NA
## 23          2,773           100     93.04        35.79  NA  NA  NA
## 24          1,130           100     93.03        35.79  NA  NA  NA
## 25          3,362           100     92.47        35.68  NA  NA  NA
## 26          2,382           100     93.15        35.81  NA  NA  NA
## 27          2,207           100     92.84        35.75  NA  NA  NA
## 28            901           100     92.49        35.69  NA  NA  NA
## 29              0           100     89.11        34.91  NA  NA  NA
## 30          1,474           100     92.63        35.71  NA  NA  NA
## 31          1,467           100     92.64        35.72  NA  NA  NA
## 32            324           100     92.66        35.72  NA  NA  NA
## 33          3,222           100     92.79        35.74  NA  NA  NA
## 34          3,202           100     92.01        35.58  NA  NA  NA
## 35          1,704           100     91.87        35.56  NA  NA  NA
## 36          3,268           100     92.72        35.73  NA  NA  NA
## 37          2,626           100     92.32        35.65  NA  NA  NA
## 38          1,033           100     92.94        35.76  NA  NA  NA
## 39          1,453           100     92.30        35.65  NA  NA  NA
## 40          1,786           100     92.92        35.77  NA  NA  NA
## 41          2,509           100     91.86        35.55  NA  NA  NA
## 42          1,066           100     93.08        35.79  NA  NA  NA
## 43              0           100     95.85        36.37  NA  NA  NA
## 44          2,189           100     92.28        35.63  NA  NA  NA
## 45          2,086           100     91.90        35.56  NA  NA  NA
## 46          1,352           100     91.42        35.46  NA  NA  NA
## 47          3,631           100     93.06        35.79  NA  NA  NA
## 48          3,247           100     92.77        35.74  NA  NA  NA
## 49          3,931           100     92.61        35.70  NA  NA  NA
## 50          1,008           100     93.09        35.79  NA  NA  NA
## 51          2,062           100     92.67        35.71  NA  NA  NA
## 52          1,379           100     92.13        35.61  NA  NA  NA
ssCapAg <- ssCapAg[ssCapAg$Sample %in% colnames(x),]

dim(ssCapAg)
## [1] 48 31
x1 <- x[,which(colnames(x) %in% ssCapAg$Sample)]
dim(x1)
## [1] 310  48
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 261  48
ssCapAg %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S2_B99008 6102468 NA Captive FAU F A Summer Monarto 3.7369863 8.12 NA NA NA NA NA GCTATCCT+AACAGGTG 5,338,890 1.00 98.08 1.92 1,612 100 93.69 35.91 NA NA NA
2 1 default S2_Bonney 6102469 NA Captive FAU F A Summer Healesville 2.5863014 5.4 NA NA NA NA NA ACGTTCAG+AGTTGTGC 14,968,459 3.00 97.82 2.18 4,520 100 93.68 35.91 NA NA NA
3 1 default S3_Jessie 6102476 NA Captive FAW F A Winter Monarto 2.1945205 12.95 NA NA NA NA NA CCGTAAGA+AGAGTCCA 4,340,498 1.00 97.95 2.05 1,311 100 93.54 35.88 NA NA NA
4 1 default S3_McCauley 6102477 NA Captive MAA M A Autumn Healesville 3.0328767 8.52 NA NA NA NA NA CAACACCT+AGCTACCA 16,944,152 3.00 97.98 2.02 5,117 100 93.05 35.78 NA NA NA
5 1 default S5_Fenton 6102484 NA Captive MAU M A Summer Monarto 3.0000000 N/A NA NA NA NA NA GATTACCG+TTGGACTG 5,125,566 1.00 96.21 3.79 1,548 100 93.89 35.94 NA NA NA
6 1 default S5_Bryan Adams 6102485 NA Captive MAW M A Winter Healesville 4.1616438 8.6 NA NA NA NA NA CACTAGCT+TCGGATTC 5,317,767 1.00 97.33 2.67 1,606 100 93.24 35.83 NA NA NA
7 1 default S7_Fredo 6102496 NA Captive MAA M A Autumn Healesville 2.9945205 8.8 NA NA NA NA NA AGTGGATC+TCGATGAC 2,690,632 1.00 97.77 2.23 813 100 93.77 35.93 NA NA NA
8 1 default S7_Piglet 6102497 NA Captive FSU F S Summer Healesville 1.5890411 4.76 NA NA NA NA NA ATCACACG+GTAGCGTA 12,134,750 2.00 96.94 3.06 3,665 100 93.34 35.84 NA NA NA
9 1 default S10_McMahon 6102514 NA Captive MSP M S Spring Healesville 1.6493151 8.06 NA NA NA NA NA AACGTCTG+AATGACGC 3,809,607 1.00 96.73 3.27 1,151 100 93.07 35.79 NA NA NA
10 1 default S10_Logan 6102515 NA Captive MAU M A Summer Healesville 5.6000000 9.02 NA NA NA NA NA GTGCCATA+CTCCTAGT 9,606,720 2.00 97.52 2.48 2,901 100 93.25 35.83 NA NA NA
11 1 default S11_Xuki 6102520 NA Captive MAA M A Autumn Monarto 2.0767123 7.95 NA NA NA NA NA ATCGCCAT+TGCGTAAC 6,018,884 1.00 97.88 2.12 1,818 100 93.58 35.89 NA NA NA
12 1 default S11_Kalamata 6102521 NA Captive MSW M S Winter Healesville 1.2849315 5.58 NA NA NA NA NA GAACATCG+TCGACAAG 6,861,544 1.00 97.76 2.24 2,072 100 93.49 35.87 NA NA NA
13 1 default S12_Wally 6102528 NA Captive MAA M A Autumn Monarto 2.1616438 N/A NA NA NA NA NA ACGACTTG+AACAGCGA 3,000,501 1.00 97.96 2.04 906 100 93.70 35.91 NA NA NA
14 1 default S12_Naz 6102529 NA Captive MAW M A Winter Monarto 4.4547945 N/A NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,927,942 1.00 97.40 2.60 1,790 100 93.86 35.94 NA NA NA
15 1 default S13_Humbug 6102530 NA Captive MAU M A Summer Monarto 2.5397260 7.94 NA NA NA NA NA GAGCAGTA+TGAGCTGT 1,702,608 0.00 98.07 1.93 514 100 93.58 35.89 NA NA NA
16 1 default S13_Xerxes 6102535 NA Captive MAA M A Autumn Monarto 2.0767123 N/A NA NA NA NA NA GATAGGCT+CAGTCACA 7,628,257 2.00 98.34 1.66 2,304 100 93.62 35.89 NA NA NA
17 1 default S14_Catani 6102538 NA Captive FAU F A Summer Healesville 2.8630137 6.46 NA NA NA NA NA TGAAGACG+ACATGCCA 13,381,058 3.00 96.98 3.02 4,041 100 93.36 35.84 NA NA NA
18 2 default S15_Amelia 6102541 NA Captive FAU F A Summer Healesville 4.7260274 5.85 NA NA NA NA NA AACGTCTG+AATGACGC 8,041,818 1.73 96.32 3.68 2,429 100 92.18 35.63 NA NA NA
19 2 default S15_London 6102542 NA Captive FAU F A Summer Healesville 3.7863014 4.8 NA NA NA NA NA GTCATCGA+GATCCACT 5,758,111 1.24 96.72 3.28 1,739 100 91.87 35.55 NA NA NA
20 2 default S15_Elyse 6102543 NA Captive FAP F A Spring Healesville 4.5232877 7.88 NA NA NA NA NA AGCGTGTT+CTTCGCAA 5,774,637 1.24 96.76 3.24 1,744 100 91.56 35.50 NA NA NA
22 2 default S16_Milla 6102548 NA Captive FAU F A Summer Healesville 2.7671233 5.82 NA NA NA NA NA TTGCGAAG+AACACGCT 6,376,997 1.37 97.60 2.40 1,926 100 92.44 35.67 NA NA NA
23 2 default S16_Maleficent 6102549 NA Captive FAU F A Summer Monarto 4.5589041 8.59 NA NA NA NA NA TGCTTCCA+CGATCGAT 9,181,668 1.98 98.08 1.92 2,773 100 93.04 35.79 NA NA NA
24 2 default S17_Anirak 6102553 NA Captive FSW F S Winter Healesville 1.3424658 5.42 NA NA NA NA NA TGAGCTAG+GAACGGTT 3,740,878 0.81 97.15 2.85 1,130 100 93.03 35.79 NA NA NA
25 2 default S17_Poly 6102554 NA Captive FSU F S Summer Monarto 1.7917808 6.67 NA NA NA NA NA CTTAGGAC+ACTCCTAC 11,133,566 2.40 97.85 2.15 3,362 100 92.47 35.68 NA NA NA
26 2 default S17_Methyl 6102556 NA Captive FSU F S Summer Healesville 0.7534247 2.72 NA NA NA NA NA TGGTACAG+TCGAGAGT 7,887,375 1.70 97.57 2.43 2,382 100 93.15 35.81 NA NA NA
27 2 default S18_Zara 6102558 NA Captive FSW F S Winter Monarto 1.5150685 4.6 NA NA NA NA NA ACCACGAT+GTCTGCAA 7,308,907 1.58 97.70 2.30 2,207 100 92.84 35.75 NA NA NA
28 2 default S18_Maze 6102559 NA Captive FSW F S Winter Healesville 1.4000000 5.82 NA NA NA NA NA ACTGAGGT+GTCAACAG 2,984,930 0.64 97.59 2.41 901 100 92.49 35.69 NA NA NA
30 2 default S19_Morocco 6102564 NA Captive MAU M A Summer Monarto 4.5917808 9.82 NA NA NA NA NA TCAGGCTT+ATCATGCG 4,879,629 1.05 97.38 2.62 1,474 100 92.63 35.71 NA NA NA
31 2 default S19_Pecorino 6102565 NA Captive FSW F S Winter Healesville 1.1123288 6.02 NA NA NA NA NA ATGCCTGT+AGATTGCG 4,857,395 1.05 97.58 2.42 1,467 100 92.64 35.72 NA NA NA
33 2 default S20_Muasy 6102569 NA Captive MSU M S Summer Healesville 1.4219178 6.62 NA NA NA NA NA TTCCAAGG+CTACAAGG 10,669,237 2.30 97.64 2.36 3,222 100 92.79 35.74 NA NA NA
34 2 default S20_Fuse 6102570 NA Captive MSU M S Summer Healesville 1.7315068 6.26 NA NA NA NA NA GTAGGAGT+GTCCTAAG 10,603,179 2.29 97.34 2.66 3,202 100 92.01 35.58 NA NA NA
35 2 default S20_Joseph 6102571 NA Captive MSU M S Summer Healesville 1.7479452 7.42 NA NA NA NA NA CTTCGACT+GATCTTGC 5,642,025 1.22 96.37 3.63 1,704 100 91.87 35.56 NA NA NA
36 2 default S21_Moama 6102576 NA Captive MAW M A Winter Monarto 1.6986301 8.75 NA NA NA NA NA TTGGACGT+GAAGTGCT 10,821,895 2.33 96.02 3.98 3,268 100 92.72 35.73 NA NA NA
37 2 default S21_Nauset 6102577 NA Captive MSW M S Winter Healesville 1.3041096 4.036 NA NA NA NA NA TATCGGTC+TACCGGAT 8,693,920 1.87 98.13 1.87 2,626 100 92.32 35.65 NA NA NA
38 2 default S21_Graham 6102578 NA Captive MSW M S Winter Healesville 1.3616438 6.4 NA NA NA NA NA TACGCCTT+GCTACTCT 3,422,010 0.74 97.72 2.28 1,033 100 92.94 35.76 NA NA NA
39 2 default S22_Yanni 6102581 NA Captive MSW M S Winter Monarto 1.5178082 8.15 NA NA NA NA NA CGTGTGTA+CCAACGAA 4,811,453 1.04 97.67 2.33 1,453 100 92.30 35.65 NA NA NA
40 2 default S22_Gherkin 6102582 NA Captive MSW M S Winter Healesville 1.2630137 6.32 NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,913,586 1.27 97.05 2.95 1,786 100 92.92 35.77 NA NA NA
41 2 default S22_Stilton 6102584 NA Captive MSW M S Winter Healesville 1.2986301 5.76 NA NA NA NA NA CGCAATCT+ACAGGCAT 8,306,537 1.79 96.94 3.06 2,509 100 91.86 35.55 NA NA NA
42 2 default S23_Osiris 6102588 NA Captive MSW M S Winter Healesville 1.1753425 5.34 NA NA NA NA NA AGTGGATC+TCGATGAC 3,528,471 0.76 97.24 2.76 1,066 100 93.08 35.79 NA NA NA
44 2 default S23_Quince 6102590 NA Captive MSW M S Winter Healesville 1.3835616 N/A NA NA NA NA NA AACCGTTC+CTAGCTCA 7,247,793 1.56 97.63 2.37 2,189 100 92.28 35.63 NA NA NA
45 2 default S24_Malfoy 6102595 NA Captive MAW M A Winter Healesville 5.1041096 8.02 NA NA NA NA NA TAACCGGT+ATCGTCTC 6,908,416 1.49 97.09 2.91 2,086 100 91.90 35.56 NA NA NA
46 2 default S24_Licorice 6102596 NA Captive FSA F S Autumn Healesville 1.8246575 5.94 NA NA NA NA NA TTGCAGAC+ATCGTGGT 4,475,461 0.96 95.05 4.95 1,352 100 91.42 35.46 NA NA NA
47 2 default S25_Tofu 6102599 NA Captive FAU F A Summer Healesville 2.7452055 N/A NA NA NA NA NA GAGACGAT+ACCGGTTA 12,024,421 2.59 95.37 4.63 3,631 100 93.06 35.79 NA NA NA
48 2 default S25_Colette 6102600 NA Captive FAP F A Spring Healesville 6.6273973 7.52 NA NA NA NA NA CTTGTCGA+CGATGTTC 10,751,797 2.32 97.49 2.51 3,247 100 92.77 35.74 NA NA NA
49 2 default S25_CannonBall 6102601 NA Captive MSW M S Winter Healesville 1.1479452 6.54 NA NA NA NA NA TACGCTAC+CGTGTGAT 13,015,081 2.81 97.36 2.64 3,931 100 92.61 35.70 NA NA NA
50 2 default S25_Cornelius 6102602 NA Captive MAU M A Summer Healesville 3.6904110 7.74 NA NA NA NA NA GAATCCGA+AGCTAGTG 3,336,983 0.72 97.10 2.90 1,008 100 93.09 35.79 NA NA NA
51 2 default S25_Mardook 6102603 NA Captive MAW M A Winter Healesville 4.3013699 9.16 NA NA NA NA NA GCACAACT+CTGAACGT 6,826,313 1.47 97.66 2.34 2,062 100 92.67 35.71 NA NA NA
52 2 default S25_Negroni 6102604 NA Captive FSP F S Spring Healesville 1.6767123 5.86 NA NA NA NA NA TGTGACTG+AGCCTATC 4,566,180 0.98 97.68 2.32 1,379 100 92.13 35.61 NA NA NA
col <- as.character(as.numeric(grepl("A",ssCapAg$Age)))
col <- gsub("0","orange",col)
col <- gsub("1","brown",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Comparison of Sub-Adult vs Adult Captive devils")
mtext("Sub-Adult=Orange, Adult=Brown")

ssCapAg$CapLoc <- grepl("Monarto",ssCapAg$Location)
ssCapAg$MvF <- factor(ssCapAg$Sex)
ssCapAg$SubAdvAd <- as.numeric(factor(ssCapAg$Age,levels=c("S","A"),ordered = TRUE))
ssCapAg$Season <- factor(ssCapAg$Season)
str(ssCapAg)
## 'data.frame':    48 obs. of  34 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S2_B99008" "S2_Bonney" "S3_Jessie" "S3_McCauley" ...
##  $ Sample                 : int  6102468 6102469 6102476 6102477 6102484 6102485 6102496 6102497 6102514 6102515 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "Captive" "Captive" "Captive" "Captive" ...
##  $ Sex.Age.Season         : chr  "FAU" "FAU" "FAW" "MAA" ...
##  $ Sex                    : chr  "F" "F" "F" "M" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 3 3 4 1 3 4 1 3 2 3 ...
##  $ Location               : chr  "Monarto" "Healesville" "Monarto" "Healesville" ...
##  $ Agebyyear              : num  3.74 2.59 2.19 3.03 3 ...
##  $ Weight                 : chr  "8.12" "5.4" "12.95" "8.52" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ Ulcerated              : logi  NA NA NA NA NA NA ...
##  $ UlcerationDepth        : chr  "" "" "" "" ...
##  $ Secondary.infection    : logi  NA NA NA NA NA NA ...
##  $ Total.tumour.volume    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Barcode.sequence       : chr  "GCTATCCT+AACAGGTG" "ACGTTCAG+AGTTGTGC" "CCGTAAGA+AGAGTCCA" "CAACACCT+AGCTACCA" ...
##  $ PF.Clusters            : chr  "5,338,890" "14,968,459" "4,340,498" "16,944,152" ...
##  $ X..of.the.lane         : num  1 3 1 3 1 1 1 2 1 2 ...
##  $ X..Perfect.barcode     : num  98.1 97.8 98 98 96.2 ...
##  $ X..One.mismatch.barcode: num  1.92 2.18 2.05 2.02 3.79 2.67 2.23 3.06 3.27 2.48 ...
##  $ Yield..Mbases.         : chr  "1,612" "4,520" "1,311" "5,117" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.7 93.7 93.5 93 93.9 ...
##  $ Mean.Quality           : num  35.9 35.9 35.9 35.8 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ CapLoc                 : logi  TRUE FALSE TRUE FALSE TRUE FALSE ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 2 2 2 2 1 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 1 1 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssCapAg, design = ~ Season + MvF + CapLoc + SubAdvAd)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 10 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeCapAg <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 14
maplot(dgeCapAg,"Sub-Adult vs Adult Captive devils")

make_volcano(dgeCapAg,"Sub-Adult vs Adult Captive devils")

col <- as.character(as.numeric(grepl("A",ssCapAg$Age)))
col <- gsub("0","orange",col)
col <- gsub("1","brown",col)
mtext("Sub-Adult=Orange, Adult=Brown")

sig[1:100,1:6] %>%
  kbl(caption="Comparison of Sub-Adult vs Adult Captive devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Sub-Adult vs Adult Captive devils
baseMean log2FoldChange lfcSE stat pvalue padj
FLT3 2665.40411 -1.2796830 0.2642011 -4.843594 0.0000013 0.0003264
IL5 660.81847 -3.4300117 0.7715965 -4.445344 0.0000088 0.0010884
GATA2 1727.77825 1.0974081 0.2514531 4.364266 0.0000128 0.0010884
CIITA 3093.73316 -0.7904557 0.1891149 -4.179765 0.0000292 0.0015356
Saha-UC 440247.70240 1.0594366 0.2548969 4.156334 0.0000323 0.0015356
IgA 31617.57508 0.9692246 0.2345756 4.131822 0.0000360 0.0015356
Saha-UD 766155.33670 1.5843532 0.3875401 4.088231 0.0000435 0.0015802
CCL24 1456.99179 1.0838345 0.2672030 4.056222 0.0000499 0.0015802
Saha-UA 295824.31182 0.9194355 0.2280948 4.030937 0.0000556 0.0015802
IRF8 3207.91842 -0.6195137 0.1618325 -3.828118 0.0001291 0.0031680
CD83 201.68746 -1.0292791 0.2697905 -3.815104 0.0001361 0.0031680
CCL25 24.47158 -3.1574774 0.8341792 -3.785131 0.0001536 0.0032774
IgM 151322.22005 -0.8119283 0.2162946 -3.753807 0.0001742 0.0033610
TLR7 1413.02239 -0.6398268 0.1710633 -3.740293 0.0001838 0.0033610
TLR3 1013.97122 -0.5247096 0.1434902 -3.656763 0.0002554 0.0043166
IRF5 6518.67692 -0.6716279 0.1843762 -3.642704 0.0002698 0.0043166
CD22 21934.33484 -0.7279433 0.2056778 -3.539241 0.0004013 0.0060208
STING1 1617.54127 -0.6813284 0.1932797 -3.525091 0.0004233 0.0060208
F10 170051.52401 1.2010900 0.3512393 3.419577 0.0006272 0.0084505
CD19 6708.07000 -0.7973806 0.2382073 -3.347423 0.0008157 0.0095777
B2M 265069.64285 1.0050865 0.3004285 3.345509 0.0008213 0.0095777
CCR1 527.97713 0.8076812 0.2414656 3.344912 0.0008231 0.0095777
PDCD1 2203.24533 -0.7944444 0.2390848 -3.322856 0.0008910 0.0099173
Rag1 46.82983 -2.2895610 0.6987534 -3.276637 0.0010505 0.0112055
Saha-UB 345632.06581 0.8722311 0.2731084 3.193717 0.0014045 0.0143825
CD40 5525.72470 -0.7288007 0.2308827 -3.156584 0.0015963 0.0155993
IL21R 7824.98893 -0.6433001 0.2046134 -3.143978 0.0016667 0.0155993
CCL20 33.90915 -3.1671242 1.0101290 -3.135366 0.0017164 0.0155993
Saha-DAA 140702.30852 -0.4803360 0.1536183 -3.126815 0.0017671 0.0155993
OAZ1 391338.51842 1.1332851 0.3678947 3.080460 0.0020668 0.0176368
FCMR 67644.98037 -0.8637685 0.2815813 -3.067563 0.0021581 0.0178219
C5 119.45516 -1.0963492 0.3656139 -2.998653 0.0027118 0.0216941
Saha-DAB2 18376.93729 -0.5553659 0.1894875 -2.930884 0.0033800 0.0258483
CD36 12970.68540 0.9212163 0.3148330 2.926048 0.0034330 0.0258483
FCER1A 351.01967 1.0182569 0.3519379 2.893286 0.0038123 0.0278845
IL24 40.34769 -1.8196785 0.6453297 -2.819766 0.0048059 0.0341751
EIF2AK2 855.79939 -0.5424791 0.1939458 -2.797066 0.0051569 0.0356802
MS4A1 15233.57533 -0.6784880 0.2440810 -2.779766 0.0054398 0.0366471
IL22 29.18288 -2.8152596 1.0359161 -2.717652 0.0065747 0.0431569
FGF2 127.33242 -0.6207586 0.2295239 -2.704549 0.0068397 0.0437742
IL10RA 22527.62924 -0.5408429 0.2007779 -2.693737 0.0070656 0.0441169
CD9 59462.73116 1.0485088 0.3929423 2.668353 0.0076224 0.0464604
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
NA.28 NA NA NA NA NA NA
NA.29 NA NA NA NA NA NA
NA.30 NA NA NA NA NA NA
NA.31 NA NA NA NA NA NA
NA.32 NA NA NA NA NA NA
NA.33 NA NA NA NA NA NA
NA.34 NA NA NA NA NA NA
NA.35 NA NA NA NA NA NA
NA.36 NA NA NA NA NA NA
NA.37 NA NA NA NA NA NA
NA.38 NA NA NA NA NA NA
NA.39 NA NA NA NA NA NA
NA.40 NA NA NA NA NA NA
NA.41 NA NA NA NA NA NA
NA.42 NA NA NA NA NA NA
NA.43 NA NA NA NA NA NA
NA.44 NA NA NA NA NA NA
NA.45 NA NA NA NA NA NA
NA.46 NA NA NA NA NA NA
NA.47 NA NA NA NA NA NA
NA.48 NA NA NA NA NA NA
NA.49 NA NA NA NA NA NA
NA.50 NA NA NA NA NA NA
NA.51 NA NA NA NA NA NA
NA.52 NA NA NA NA NA NA
NA.53 NA NA NA NA NA NA
NA.54 NA NA NA NA NA NA
NA.55 NA NA NA NA NA NA
NA.56 NA NA NA NA NA NA
NA.57 NA NA NA NA NA NA
write.table(dge,file="dgeCapAg.tsv",sep="\t")

mx <- sig[,7:ncol(sig)]
mx <- head(mx,30)
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(as.matrix(mx),trace="none",scale="row",
          col=colfunc(25),ColSideColors=col,mar=c(5,12)) 

ssH <- filter(ss, Category %in% c('Healthy','Healthy/Wild'))

ssHS <- ssH[which(grepl("M",ssH$Sex) + grepl("F",ssH$Sex)>0),]
ssHS
##    Lane Project     Client.ID  Sample  X     Category Sex.Age.Season Sex Age
## 1     1 default S1_LauraGrace 6102461 NA Healthy/Wild            FAP   F   A
## 2     1 default   S1_Turmeric 6102465 NA Healthy/Wild            FAU   F   A
## 3     1 default  S1_Singapore 6102466 NA      Healthy            FAA   F   A
## 4     1 default    S2_Belinda 6102467 NA Healthy/Wild            FAU   F   A
## 5     1 default      S2_Rosie 6102470 NA Healthy/Wild            FAU   F   A
## 6     1 default       S3_ST62 6102475 NA Healthy/Wild            FAW   F   A
## 7     1 default    S4_Kerchak 6102478 NA      Healthy            MAA   M   A
## 8     1 default    S4_Duffman 6102479 NA      Healthy            MAA   M   A
## 9     1 default      S4_Hogan 6102481 NA      Healthy            MAA   M   A
## 10    1 default      S5_Silky 6102486 NA Healthy/Wild            MAW   M   A
## 11    1 default    S5_Longley 6102487 NA Healthy/Wild            MAU   M   A
## 12    1 default    S6_Myanmar 6102490 NA      Healthy            FAP   F   A
## 13    1 default     S6_Pakana 6102491 NA      Healthy            MSP   M   S
## 14    1 default     S6_Hobbit 6102495 NA      Healthy            MSP   M   S
## 15    1 default      S7_Lieke 6102499 NA Healthy/Wild            FSU   F   S
## 16    1 default   S7_Smithers 6102501 NA Healthy/Wild            MAA   M   A
## 17    1 default     S8_Vinnie 6102503 NA Healthy/Wild            MAU   M   A
## 18    1 default  S8_Struggles 6102504 NA Healthy/Wild            MAW   M   A
## 19    1 default     S8_SusieQ 6102506 NA Healthy/Wild            FAU   F   A
## 20    1 default     S9_Majula 6102509 NA      Healthy            FAA   F   A
## 21    1 default     S9_Snoopy 6102510 NA Healthy/Wild            MSW   M   S
## 22    1 default     S9_Sarabi 6102513 NA Healthy/Wild            FSP   F   S
## 23    1 default     S11_Baloo 6102518 NA Healthy/Wild            MAA   M   A
## 24    1 default S11_DanRhodes 6102523 NA Healthy/Wild            MSW   M   S
## 25    1 default     S12_Robin 6102525 NA Healthy/Wild            MAA   M   A
## 26    1 default    S12_Eeyore 6102527 NA Healthy/Wild            MAW   M   A
## 27    1 default    S13_Pangea 6102533 NA Healthy/Wild            MAU   M   A
## 28    1 default    S13_Finbar 6102534 NA Healthy/Wild            MAA   M   A
## 29    2 default    S22_Ginger 6102586 NA Healthy/Wild            MSW   M   S
## 30    2 default       S24_Boy 6102593 NA Healthy/Wild            MAA   M   A
## 31    2 default    S24_Shazza 6102598 NA      Healthy            FAW   F   A
##    Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1  Spring  Channel 2.6219178    7.2  NA                NA        NA
## 2  Summer  Channel 1.9095890    7.8  NA                NA        NA
## 3  Autumn  Channel 5.0000000    8.6  NA                NA        NA
## 4  Summer  Channel 1.8657534    6.6  NA                NA        NA
## 5  Summer  Channel 1.8904110    7.4  NA                NA        NA
## 6  Winter  Channel 3.2712329   10.2  NA                NA        NA
## 7  Autumn  Channel 4.1863014   11.6  NA                NA        NA
## 8  Autumn  Channel 3.1123288   12.4  NA                NA        NA
## 9  Autumn  Channel 3.1616438   11.6  NA                NA        NA
## 10 Winter  Channel 2.2849315    9.5  NA                NA        NA
## 11 Summer  Channel 2.9315068    9.7  NA                NA        NA
## 12 Spring  Channel 5.5726027    7.6  NA                NA        NA
## 13 Spring  Channel 1.6712329    7.8  NA                NA        NA
## 14 Spring  Channel 1.6273973      9  NA                NA        NA
## 15 Summer  Channel 0.8657534    4.9  NA                NA        NA
## 16 Autumn  Channel 3.1013699    8.9  NA                NA        NA
## 17 Summer  Channel 2.9150685    8.8  NA                NA        NA
## 18 Winter  Channel 3.2821918   11.1  NA                NA        NA
## 19 Summer  Channel 1.8712329    7.1  NA                NA        NA
## 20 Autumn  Channel 3.1150685      6  NA                NA        NA
## 21 Winter  Channel 1.2794521    6.3  NA                NA        NA
## 22 Spring  Channel 1.6328767    5.8  NA                NA        NA
## 23 Autumn  Channel 3.1726027   11.5  NA                NA        NA
## 24 Winter  Channel 1.3917808    6.8  NA                NA        NA
## 25 Autumn  Channel 2.1972603    7.7  NA                NA        NA
## 26 Winter  Channel 3.2794521      9  NA                NA        NA
## 27 Summer  Channel 1.8794521    7.7  NA                NA        NA
## 28 Autumn  Channel 2.1150685    6.8  NA                NA        NA
## 29 Winter  Channel 1.2712329    7.6  NA                NA        NA
## 30 Autumn  Channel 3.1452055    8.3  NA                NA        NA
## 31 Winter  Channel 2.0273973    6.2  NA                NA        NA
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA                  NA AGAGTAGC+AAGGCGTA
## 2                                   NA                  NA GAAGGAAG+GACGTCAT
## 3                                   NA                  NA ACAGCTCA+TACTGCTC
## 4                                   NA                  NA GCAAGATC+AGTCGAAG
## 5                                   NA                  NA CGCATGAT+AAGCCTGA
## 6                                   NA                  NA TGAGCTAG+GAACGGTT
## 7                                   NA                  NA CGGCTAAT+CTCGTTCT
## 8                                   NA                  NA GACGATCT+TCGTGCAT
## 9                                   NA                  NA TACGCCTT+GCTACTCT
## 10                                  NA                  NA CTGTTGAC+ACCTCAGT
## 11                                  NA                  NA CGCAATCT+ACAGGCAT
## 12                                  NA                  NA GCACAACT+CTGAACGT
## 13                                  NA                  NA GTTACGCA+ATGGCGAT
## 14                                  NA                  NA ATATGCGC+ACGATCAG
## 15                                  NA                  NA TTCCAAGG+CTACAAGG
## 16                                  NA                  NA GCGTCATT+CAGACGTT
## 17                                  NA                  NA CGACGTTA+CTCTGGAT
## 18                                  NA                  NA ATCGATCG+TGGAAGCA
## 19                                  NA                  NA CAGTCCAA+CGGTAATC
## 20                                  NA                  NA ACTCTCGA+CTGTACCA
## 21                                  NA                  NA AACTGAGC+CAATCAGG
## 22                                  NA                  NA CTTAGGAC+ACTCCTAC
## 23                                  NA                  NA CTGATCGT+GCGCATAT
## 24                                  NA                  NA TCGCTGTT+CAAGTCGT
## 25                                  NA                  NA ATGACGTC+CTTCCTTC
## 26                                  NA                  NA TCAGGCTT+ATCATGCG
## 27                                  NA                  NA ACCACGAT+GTCTGCAA
## 28                                  NA                  NA GAGACGAT+ACCGGTTA
## 29                                  NA                  NA ACAGCTCA+TACTGCTC
## 30                                  NA                  NA CGACGTTA+CTCTGGAT
## 31                                  NA                  NA GAGCAGTA+TGAGCTGT
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    4,511,702           1.00              98.29                    1.71
## 2    6,479,047           1.00              97.28                    2.72
## 3    4,481,213           1.00              97.99                    2.01
## 4    3,296,547           1.00              97.40                    2.60
## 5    4,556,781           1.00              95.70                    4.30
## 6    4,579,681           1.00              96.67                    3.33
## 7    6,886,511           1.00              97.80                    2.20
## 8    8,301,336           2.00              97.75                    2.25
## 9    2,990,345           1.00              97.77                    2.23
## 10   5,617,260           1.00              97.81                    2.19
## 11   2,937,660           1.00              97.71                    2.29
## 12   9,604,175           2.00              98.14                    1.86
## 13   4,383,521           1.00              98.09                    1.91
## 14   7,342,414           2.00              97.00                    3.00
## 15   1,800,468           0.00              97.79                    2.21
## 16   6,731,177           1.00              98.04                    1.96
## 17   7,901,958           2.00              98.02                    1.98
## 18   5,257,820           1.00              95.13                    4.87
## 19     454,240           0.00              97.95                    2.05
## 20   8,490,270           2.00              97.99                    2.01
## 21   1,709,078           0.00              98.04                    1.96
## 22   3,945,235           1.00              98.11                    1.89
## 23  10,923,019           2.00              98.07                    1.93
## 24   5,076,673           1.00              97.41                    2.59
## 25   6,756,342           1.00              97.12                    2.88
## 26   3,071,283           1.00              97.28                    2.72
## 27   1,732,316           0.00              97.57                    2.43
## 28       1,152           0.00              96.70                    3.30
## 29   9,742,792           2.10              97.63                    2.37
## 30   1,476,427           0.32              97.63                    2.37
## 31   2,693,655           0.58              97.51                    2.49
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,363           100     93.82        35.92  NA  NA  NA
## 2           1,957           100     93.85        35.94  NA  NA  NA
## 3           1,353           100     93.95        35.96  NA  NA  NA
## 4             996           100     94.12        35.98  NA  NA  NA
## 5           1,376           100     93.94        35.94  NA  NA  NA
## 6           1,383           100     93.75        35.92  NA  NA  NA
## 7           2,080           100     93.61        35.89  NA  NA  NA
## 8           2,507           100     93.83        35.93  NA  NA  NA
## 9             903           100     93.71        35.90  NA  NA  NA
## 10          1,696           100     93.55        35.88  NA  NA  NA
## 11            887           100     93.75        35.91  NA  NA  NA
## 12          2,900           100     93.93        35.94  NA  NA  NA
## 13          1,324           100     93.90        35.95  NA  NA  NA
## 14          2,217           100     93.93        35.96  NA  NA  NA
## 15            544           100     93.58        35.88  NA  NA  NA
## 16          2,033           100     93.62        35.89  NA  NA  NA
## 17          2,386           100     94.09        35.98  NA  NA  NA
## 18          1,588           100     93.81        35.93  NA  NA  NA
## 19            137           100     92.97        35.76  NA  NA  NA
## 20          2,564           100     93.34        35.84  NA  NA  NA
## 21            516           100     93.06        35.78  NA  NA  NA
## 22          1,191           100     93.55        35.88  NA  NA  NA
## 23          3,299           100     93.51        35.87  NA  NA  NA
## 24          1,533           100     93.77        35.92  NA  NA  NA
## 25          2,040           100     92.53        35.68  NA  NA  NA
## 26            928           100     92.94        35.76  NA  NA  NA
## 27            523           100     93.82        35.92  NA  NA  NA
## 28              0           100     92.06        35.56  NA  NA  NA
## 29          2,942           100     93.00        35.78  NA  NA  NA
## 30            446           100     93.25        35.82  NA  NA  NA
## 31            813           100     93.01        35.79  NA  NA  NA
ssHS <- ssHS[ssHS$Sample %in% colnames(x),]

dim(ssHS)
## [1] 29 31
x1 <- x[,which(colnames(x) %in% ssHS$Sample)]
dim(x1)
## [1] 310  29
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 256  29
ssHS %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S1_LauraGrace 6102461 NA Healthy/Wild FAP F A Spring Channel 2.6219178 7.2 NA NA NA NA NA AGAGTAGC+AAGGCGTA 4,511,702 1.00 98.29 1.71 1,363 100 93.82 35.92 NA NA NA
2 1 default S1_Turmeric 6102465 NA Healthy/Wild FAU F A Summer Channel 1.9095890 7.8 NA NA NA NA NA GAAGGAAG+GACGTCAT 6,479,047 1.00 97.28 2.72 1,957 100 93.85 35.94 NA NA NA
3 1 default S1_Singapore 6102466 NA Healthy FAA F A Autumn Channel 5.0000000 8.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 4,481,213 1.00 97.99 2.01 1,353 100 93.95 35.96 NA NA NA
4 1 default S2_Belinda 6102467 NA Healthy/Wild FAU F A Summer Channel 1.8657534 6.6 NA NA NA NA NA GCAAGATC+AGTCGAAG 3,296,547 1.00 97.40 2.60 996 100 94.12 35.98 NA NA NA
5 1 default S2_Rosie 6102470 NA Healthy/Wild FAU F A Summer Channel 1.8904110 7.4 NA NA NA NA NA CGCATGAT+AAGCCTGA 4,556,781 1.00 95.70 4.30 1,376 100 93.94 35.94 NA NA NA
6 1 default S3_ST62 6102475 NA Healthy/Wild FAW F A Winter Channel 3.2712329 10.2 NA NA NA NA NA TGAGCTAG+GAACGGTT 4,579,681 1.00 96.67 3.33 1,383 100 93.75 35.92 NA NA NA
7 1 default S4_Kerchak 6102478 NA Healthy MAA M A Autumn Channel 4.1863014 11.6 NA NA NA NA NA CGGCTAAT+CTCGTTCT 6,886,511 1.00 97.80 2.20 2,080 100 93.61 35.89 NA NA NA
8 1 default S4_Duffman 6102479 NA Healthy MAA M A Autumn Channel 3.1123288 12.4 NA NA NA NA NA GACGATCT+TCGTGCAT 8,301,336 2.00 97.75 2.25 2,507 100 93.83 35.93 NA NA NA
9 1 default S4_Hogan 6102481 NA Healthy MAA M A Autumn Channel 3.1616438 11.6 NA NA NA NA NA TACGCCTT+GCTACTCT 2,990,345 1.00 97.77 2.23 903 100 93.71 35.90 NA NA NA
10 1 default S5_Silky 6102486 NA Healthy/Wild MAW M A Winter Channel 2.2849315 9.5 NA NA NA NA NA CTGTTGAC+ACCTCAGT 5,617,260 1.00 97.81 2.19 1,696 100 93.55 35.88 NA NA NA
11 1 default S5_Longley 6102487 NA Healthy/Wild MAU M A Summer Channel 2.9315068 9.7 NA NA NA NA NA CGCAATCT+ACAGGCAT 2,937,660 1.00 97.71 2.29 887 100 93.75 35.91 NA NA NA
12 1 default S6_Myanmar 6102490 NA Healthy FAP F A Spring Channel 5.5726027 7.6 NA NA NA NA NA GCACAACT+CTGAACGT 9,604,175 2.00 98.14 1.86 2,900 100 93.93 35.94 NA NA NA
13 1 default S6_Pakana 6102491 NA Healthy MSP M S Spring Channel 1.6712329 7.8 NA NA NA NA NA GTTACGCA+ATGGCGAT 4,383,521 1.00 98.09 1.91 1,324 100 93.90 35.95 NA NA NA
14 1 default S6_Hobbit 6102495 NA Healthy MSP M S Spring Channel 1.6273973 9 NA NA NA NA NA ATATGCGC+ACGATCAG 7,342,414 2.00 97.00 3.00 2,217 100 93.93 35.96 NA NA NA
15 1 default S7_Lieke 6102499 NA Healthy/Wild FSU F S Summer Channel 0.8657534 4.9 NA NA NA NA NA TTCCAAGG+CTACAAGG 1,800,468 0.00 97.79 2.21 544 100 93.58 35.88 NA NA NA
16 1 default S7_Smithers 6102501 NA Healthy/Wild MAA M A Autumn Channel 3.1013699 8.9 NA NA NA NA NA GCGTCATT+CAGACGTT 6,731,177 1.00 98.04 1.96 2,033 100 93.62 35.89 NA NA NA
17 1 default S8_Vinnie 6102503 NA Healthy/Wild MAU M A Summer Channel 2.9150685 8.8 NA NA NA NA NA CGACGTTA+CTCTGGAT 7,901,958 2.00 98.02 1.98 2,386 100 94.09 35.98 NA NA NA
18 1 default S8_Struggles 6102504 NA Healthy/Wild MAW M A Winter Channel 3.2821918 11.1 NA NA NA NA NA ATCGATCG+TGGAAGCA 5,257,820 1.00 95.13 4.87 1,588 100 93.81 35.93 NA NA NA
20 1 default S9_Majula 6102509 NA Healthy FAA F A Autumn Channel 3.1150685 6 NA NA NA NA NA ACTCTCGA+CTGTACCA 8,490,270 2.00 97.99 2.01 2,564 100 93.34 35.84 NA NA NA
21 1 default S9_Snoopy 6102510 NA Healthy/Wild MSW M S Winter Channel 1.2794521 6.3 NA NA NA NA NA AACTGAGC+CAATCAGG 1,709,078 0.00 98.04 1.96 516 100 93.06 35.78 NA NA NA
22 1 default S9_Sarabi 6102513 NA Healthy/Wild FSP F S Spring Channel 1.6328767 5.8 NA NA NA NA NA CTTAGGAC+ACTCCTAC 3,945,235 1.00 98.11 1.89 1,191 100 93.55 35.88 NA NA NA
23 1 default S11_Baloo 6102518 NA Healthy/Wild MAA M A Autumn Channel 3.1726027 11.5 NA NA NA NA NA CTGATCGT+GCGCATAT 10,923,019 2.00 98.07 1.93 3,299 100 93.51 35.87 NA NA NA
24 1 default S11_DanRhodes 6102523 NA Healthy/Wild MSW M S Winter Channel 1.3917808 6.8 NA NA NA NA NA TCGCTGTT+CAAGTCGT 5,076,673 1.00 97.41 2.59 1,533 100 93.77 35.92 NA NA NA
25 1 default S12_Robin 6102525 NA Healthy/Wild MAA M A Autumn Channel 2.1972603 7.7 NA NA NA NA NA ATGACGTC+CTTCCTTC 6,756,342 1.00 97.12 2.88 2,040 100 92.53 35.68 NA NA NA
26 1 default S12_Eeyore 6102527 NA Healthy/Wild MAW M A Winter Channel 3.2794521 9 NA NA NA NA NA TCAGGCTT+ATCATGCG 3,071,283 1.00 97.28 2.72 928 100 92.94 35.76 NA NA NA
27 1 default S13_Pangea 6102533 NA Healthy/Wild MAU M A Summer Channel 1.8794521 7.7 NA NA NA NA NA ACCACGAT+GTCTGCAA 1,732,316 0.00 97.57 2.43 523 100 93.82 35.92 NA NA NA
29 2 default S22_Ginger 6102586 NA Healthy/Wild MSW M S Winter Channel 1.2712329 7.6 NA NA NA NA NA ACAGCTCA+TACTGCTC 9,742,792 2.10 97.63 2.37 2,942 100 93.00 35.78 NA NA NA
30 2 default S24_Boy 6102593 NA Healthy/Wild MAA M A Autumn Channel 3.1452055 8.3 NA NA NA NA NA CGACGTTA+CTCTGGAT 1,476,427 0.32 97.63 2.37 446 100 93.25 35.82 NA NA NA
31 2 default S24_Shazza 6102598 NA Healthy FAW F A Winter Channel 2.0273973 6.2 NA NA NA NA NA GAGCAGTA+TGAGCTGT 2,693,655 0.58 97.51 2.49 813 100 93.01 35.79 NA NA NA
col <- as.character(as.numeric(grepl("F",ssHS$Sex)))
col <- gsub("0","grey",col)
col <- gsub("1","black",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Comparison of Male and Female Healthy devils")
mtext("Male=Grey, Female=Black")

ssHS$MvF <- factor(ssHS$Sex)
ssHS$SubAdvAd <- as.numeric(factor(ssHS$Age,levels=c("S","A"),ordered = TRUE))
ssHS$Season <- factor(ssHS$Season)
str(ssHS)
## 'data.frame':    29 obs. of  33 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S1_LauraGrace" "S1_Turmeric" "S1_Singapore" "S2_Belinda" ...
##  $ Sample                 : int  6102461 6102465 6102466 6102467 6102470 6102475 6102478 6102479 6102481 6102486 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "Healthy/Wild" "Healthy/Wild" "Healthy" "Healthy/Wild" ...
##  $ Sex.Age.Season         : chr  "FAP" "FAU" "FAA" "FAU" ...
##  $ Sex                    : chr  "F" "F" "F" "F" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 2 3 1 3 3 4 1 1 1 4 ...
##  $ Location               : chr  "Channel" "Channel" "Channel" "Channel" ...
##  $ Agebyyear              : num  2.62 1.91 5 1.87 1.89 ...
##  $ Weight                 : chr  "7.2" "7.8" "8.6" "6.6" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ Ulcerated              : logi  NA NA NA NA NA NA ...
##  $ UlcerationDepth        : chr  "" "" "" "" ...
##  $ Secondary.infection    : logi  NA NA NA NA NA NA ...
##  $ Total.tumour.volume    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Barcode.sequence       : chr  "AGAGTAGC+AAGGCGTA" "GAAGGAAG+GACGTCAT" "ACAGCTCA+TACTGCTC" "GCAAGATC+AGTCGAAG" ...
##  $ PF.Clusters            : chr  "4,511,702" "6,479,047" "4,481,213" "3,296,547" ...
##  $ X..of.the.lane         : num  1 1 1 1 1 1 1 2 1 1 ...
##  $ X..Perfect.barcode     : num  98.3 97.3 98 97.4 95.7 ...
##  $ X..One.mismatch.barcode: num  1.71 2.72 2.01 2.6 4.3 3.33 2.2 2.25 2.23 2.19 ...
##  $ Yield..Mbases.         : chr  "1,363" "1,957" "1,353" "996" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.8 93.8 94 94.1 93.9 ...
##  $ Mean.Quality           : num  35.9 35.9 36 36 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 1 1 1 2 2 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 2 2 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssHS, design = ~ Season +  SubAdvAd + MvF)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 10 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeHS <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 0
maplot(dgeHS,"Male vs Female Healthy devils")

make_volcano(dgeHS,"Male vs Female Healthy devils")

col <- as.character(as.numeric(grepl("F",ssHS$Sex)))
col <- gsub("0","grey",col)
col <- gsub("1","black",col)
mtext("Sub-Adult=Orange, Adult=Brown")

sig[1:100,1:6] %>%
  kbl(caption="Comparison of Male vs Female Healthy devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Male vs Female Healthy devils
baseMean log2FoldChange lfcSE stat pvalue padj
CXCLD2 23.75304 -4.970202 1.141820 -4.352876 1.34e-05 0.0034128
CCLD2 24.31172 -4.503590 1.108071 -4.064351 4.82e-05 0.0041248
CXCLD1 30.08543 -4.156034 1.023227 -4.061694 4.87e-05 0.0041248
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
NA.28 NA NA NA NA NA NA
NA.29 NA NA NA NA NA NA
NA.30 NA NA NA NA NA NA
NA.31 NA NA NA NA NA NA
NA.32 NA NA NA NA NA NA
NA.33 NA NA NA NA NA NA
NA.34 NA NA NA NA NA NA
NA.35 NA NA NA NA NA NA
NA.36 NA NA NA NA NA NA
NA.37 NA NA NA NA NA NA
NA.38 NA NA NA NA NA NA
NA.39 NA NA NA NA NA NA
NA.40 NA NA NA NA NA NA
NA.41 NA NA NA NA NA NA
NA.42 NA NA NA NA NA NA
NA.43 NA NA NA NA NA NA
NA.44 NA NA NA NA NA NA
NA.45 NA NA NA NA NA NA
NA.46 NA NA NA NA NA NA
NA.47 NA NA NA NA NA NA
NA.48 NA NA NA NA NA NA
NA.49 NA NA NA NA NA NA
NA.50 NA NA NA NA NA NA
NA.51 NA NA NA NA NA NA
NA.52 NA NA NA NA NA NA
NA.53 NA NA NA NA NA NA
NA.54 NA NA NA NA NA NA
NA.55 NA NA NA NA NA NA
NA.56 NA NA NA NA NA NA
NA.57 NA NA NA NA NA NA
NA.58 NA NA NA NA NA NA
NA.59 NA NA NA NA NA NA
NA.60 NA NA NA NA NA NA
NA.61 NA NA NA NA NA NA
NA.62 NA NA NA NA NA NA
NA.63 NA NA NA NA NA NA
NA.64 NA NA NA NA NA NA
NA.65 NA NA NA NA NA NA
NA.66 NA NA NA NA NA NA
NA.67 NA NA NA NA NA NA
NA.68 NA NA NA NA NA NA
NA.69 NA NA NA NA NA NA
NA.70 NA NA NA NA NA NA
NA.71 NA NA NA NA NA NA
NA.72 NA NA NA NA NA NA
NA.73 NA NA NA NA NA NA
NA.74 NA NA NA NA NA NA
NA.75 NA NA NA NA NA NA
NA.76 NA NA NA NA NA NA
NA.77 NA NA NA NA NA NA
NA.78 NA NA NA NA NA NA
NA.79 NA NA NA NA NA NA
NA.80 NA NA NA NA NA NA
NA.81 NA NA NA NA NA NA
NA.82 NA NA NA NA NA NA
NA.83 NA NA NA NA NA NA
NA.84 NA NA NA NA NA NA
NA.85 NA NA NA NA NA NA
NA.86 NA NA NA NA NA NA
NA.87 NA NA NA NA NA NA
NA.88 NA NA NA NA NA NA
NA.89 NA NA NA NA NA NA
NA.90 NA NA NA NA NA NA
NA.91 NA NA NA NA NA NA
NA.92 NA NA NA NA NA NA
NA.93 NA NA NA NA NA NA
NA.94 NA NA NA NA NA NA
NA.95 NA NA NA NA NA NA
NA.96 NA NA NA NA NA NA
write.table(dge,file="dgeHS.tsv",sep="\t")

mx <- sig[,7:ncol(sig)]
mx <- head(mx,30)
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(as.matrix(mx),trace="none",scale="row",
          col=colfunc(25),ColSideColors=col,mar=c(5,12))

ssDFT <- filter(ss, Category %in% c('DFT1','DFT2'))

ssDFTS <- ssDFT[which(grepl("M",ssDFT$Sex) + grepl("F",ssDFT$Sex)>0),]
ssDFTS
##    Lane Project              Client.ID  Sample  X Category Sex.Age.Season Sex
## 1     1 default            S1_Sarafina 6102463 NA     DFT1            FAP   F
## 2     1 default                S1_Lucy 6102464 NA     DFT1            FAU   F
## 3     1 default                S2_Hope 6102471 NA     DFT1            FAU   F
## 4     1 default               S2_Sally 6102472 NA     DFT1            FAU   F
## 5     1 default                 S3_Apu 6102473 NA     DFT1            MAA   M
## 6     1 default              S3_Simone 6102474 NA     DFT1            FAW   F
## 7     1 default              S4_Wiggum 6102480 NA     DFT1            MAA   M
## 8     1 default                S4_Pooh 6102482 NA     DFT1            MAA   M
## 9     1 default            S4_Milhouse 6102483 NA     DFT1            MAA   M
## 10    1 default               S5_Allen 6102488 NA     DFT1            MAU   M
## 11    1 default                S5_Cyan 6102489 NA     DFT1            MAW   M
## 12    1 default              S6_Shelob 6102492 NA     DFT2            FAP   F
## 13    1 default           S6_Stuttgart 6102493 NA     DFT1            MSP   M
## 14    1 default              S7_Violet 6102498 NA     DFT2            FSU   F
## 15    1 default              S7_Willie 6102500 NA     DFT2            MAA   M
## 16    1 default              S8_Orange 6102502 NA     DFT1            FAU   F
## 17    1 default                S8_ST67 6102505 NA     DFT2            MAW   M
## 18    1 default              S8_Yellow 6102507 NA     DFT2            MAU   M
## 19    1 default                S9_Jane 6102508 NA     DFT1            FAA   F
## 20    1 default        S9_Clytemnestra 6102511 NA     DFT1            FSP   F
## 21    1 default                S9_Zeus 6102512 NA     DFT2            MSW   M
## 22    1 default           S10_Laurasia 6102516 NA     DFT2            MSP   M
## 23    1 default          S10_Enchilada 6102517 NA     DFT2            MAP   M
## 24    1 default S11_Murdoch/Washington 6102519 NA     DFT2            MAA   M
## 25    1 default                S12_Abe 6102524 NA     DFT1            MAA   M
## 26    1 default              S12_Lilac 6102526 NA     DFT1            MAW   M
## 27    1 default              S13_Green 6102531 NA     DFT1            MAA   M
## 28    1 default               S13_Bump 6102532 NA     DFT1            MAU   M
## 29    1 default             S14_Purple 6102536 NA     DFT1            FAW   F
##    Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1    A Spring  Channel 2.6191781    6.4  NA                NA        NA
## 2    A Summer  Channel 2.9178082    7.1  NA                 3      TRUE
## 3    A Summer  Channel 2.9315068    6.4  NA                 4      TRUE
## 4    A Summer  Channel 2.9945205      7  NA                 1      TRUE
## 5    A Autumn  Channel 3.1150685    9.5  NA                 1     FALSE
## 6    A Winter  Channel 3.2739726   10.2  NA                 1      TRUE
## 7    A Autumn  Channel 3.1178082    8.3  NA                 2     FALSE
## 8    A Autumn  Channel 4.1863014   11.8  NA                 1     FALSE
## 9    A Autumn  Channel 4.1013699     11  NA                 1      TRUE
## 10   A Summer  Channel 1.9095890    6.7  NA                 1      TRUE
## 11   A Winter  Channel 3.3945205    9.1  NA                 5      TRUE
## 12   A Spring  Channel 4.6219178    7.2  NA                NA        NA
## 13   S Spring  Channel 0.5780822   12.7  NA                 1     FALSE
## 14   S Summer  Channel 0.8739726    4.6  NA                 1      TRUE
## 15   A Autumn  Channel 2.1150685    8.2  NA                 2      TRUE
## 16   A Summer  Channel 1.9150685    7.1  NA                 7      TRUE
## 17   A Winter  Channel 4.2794521   10.2  NA                 1      TRUE
## 18   A Summer  Channel 1.8657534   10.5  NA                 2      TRUE
## 19   A Autumn  Channel 3.1972603    6.1  NA                NA        NA
## 20   S Spring  Channel 1.6602740      6  NA                NA        NA
## 21   S Winter  Channel 1.3479452    7.3  NA                NA        NA
## 22   S Spring  Channel 1.6383562      8  NA                NA        NA
## 23   A Spring  Channel 3.6438356    9.3  NA                14     FALSE
## 24   A Autumn  Channel 1.4438356    8.9  NA                NA        NA
## 25   A Autumn  Channel 3.1150685    7.9  NA                 1      TRUE
## 26   A Winter  Channel 3.4109589    9.6  NA                 5      TRUE
## 27   A Autumn  Channel 3.1534247    7.5  NA                 2      TRUE
## 28   A Summer  Channel 3.9068493    9.3  NA                NA        NA
## 29   A Winter  Channel 2.3945205    6.8  NA                 1      TRUE
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA           95140.790 ATCCAGAG+TAACGTCG
## 2             deep                TRUE          700825.170 AAGCACTG+AGGTCAAC
## 3             deep                TRUE          103815.530 AGCACTTC+ACGTCCAA
## 4             deep               FALSE            1588.272 CGTTGCAA+ATAGAGCG
## 5      superficial                TRUE             200.000 CCTTGATC+GATGGAGT
## 6      superficial                TRUE            2670.678 CGGTTGTT+GTGGTATG
## 7                                FALSE            7272.309 GTGAAGTG+GAGCAATC
## 8                                FALSE            7577.856 CTTCGACT+GATCTTGC
## 9             deep                TRUE             480.000 AACCGTTC+CTAGCTCA
## 10            deep                TRUE           55959.750 TTGCAGAC+ATCGTGGT
## 11            deep                TRUE          206006.422 GTAGGAGT+GTCCTAAG
## 12                                  NA            7455.435 GTCATCGA+GATCCACT
## 13                                TRUE            3809.806 AGCGTGTT+CTTCGCAA
## 14     superficial                TRUE            5517.330 CTTGTCGA+CGATGTTC
## 15            deep                TRUE            1527.480 TGGACTCT+TCTTACGG
## 16     superficial                TRUE           43690.461 GTTGACCT+CAGTGCTT
## 17            deep                TRUE          102246.432 TTGGACGT+GAAGTGCT
## 18            deep                TRUE          139389.671 GAAGTTGG+CGAACAAC
## 19                                  NA           64646.036 GTTCTCGT+TGTTCCGT
## 20                                  NA           34738.080 CATGGCTA+CACACATC
## 21                                  NA             100.000 CGTGTGTA+CCAACGAA
## 22                                  NA            2697.152 TACGCTAC+CGTGTGAT
## 23                               FALSE          301301.905 GATTGCTC+CACTTCAC
## 24                                  NA          127176.305 ACTGAGGT+GTCAACAG
## 25            deep                TRUE           13125.000 GTTGTTCG+CCAACTTC
## 26     superficial                TRUE           37293.844 TATCGGTC+TACCGGAT
## 27     superficial                TRUE            7407.222 GTCGAAGA+CCACATTG
## 28                                  NA          629522.362 AGTTCGTC+ACTCGATC
## 29            deep                TRUE           24938.123 CGCTCTAT+TTGCAACG
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    6,491,488              1              74.07                   25.93
## 2    6,121,785              1              98.00                    2.00
## 3    1,971,776              0              97.96                    2.04
## 4    2,429,449              1              97.42                    2.58
## 5    4,939,580              1              96.94                    3.06
## 6    4,015,027              1              95.91                    4.09
## 7    4,201,355              1              97.17                    2.83
## 8    3,821,151              1              97.31                    2.69
## 9   10,492,900              2              98.13                    1.87
## 10   5,288,435              1              96.85                    3.15
## 11   4,138,600              1              98.03                    1.97
## 12   3,184,798              1              98.21                    1.79
## 13   3,056,475              1              97.50                    2.50
## 14   2,768,682              1              98.19                    1.81
## 15   4,539,036              1              98.30                    1.70
## 16   5,072,309              1              97.92                    2.08
## 17   5,476,735              1              95.44                    4.56
## 18   6,469,324              1              97.99                    2.01
## 19  12,489,105              3              97.92                    2.08
## 20   6,141,790              1              98.00                    2.00
## 21     699,953              0              97.64                    2.36
## 22   9,716,148              2              97.81                    2.19
## 23  11,967,844              2              97.82                    2.18
## 24   2,003,509              0              97.82                    2.18
## 25   6,446,467              1              97.60                    2.40
## 26   4,490,241              1              98.15                    1.85
## 27   2,623,695              1              97.38                    2.62
## 28   9,435,053              2              98.16                    1.84
## 29   5,432,182              1              97.81                    2.19
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,960           100     93.74        35.92  NA  NA  NA
## 2           1,849           100     93.84        35.93  NA  NA  NA
## 3             595           100     93.62        35.88  NA  NA  NA
## 4             734           100     93.78        35.93  NA  NA  NA
## 5           1,492           100     93.71        35.91  NA  NA  NA
## 6           1,213           100     93.42        35.86  NA  NA  NA
## 7           1,269           100     93.64        35.90  NA  NA  NA
## 8           1,154           100     93.60        35.89  NA  NA  NA
## 9           3,169           100     93.80        35.92  NA  NA  NA
## 10          1,597           100     93.42        35.86  NA  NA  NA
## 11          1,250           100     93.67        35.90  NA  NA  NA
## 12            962           100     93.90        35.94  NA  NA  NA
## 13            923           100     93.95        35.95  NA  NA  NA
## 14            836           100     93.85        35.93  NA  NA  NA
## 15          1,371           100     93.84        35.93  NA  NA  NA
## 16          1,532           100     93.36        35.84  NA  NA  NA
## 17          1,654           100     93.21        35.82  NA  NA  NA
## 18          1,954           100     94.00        35.97  NA  NA  NA
## 19          3,772           100     93.54        35.88  NA  NA  NA
## 20          1,855           100     93.42        35.85  NA  NA  NA
## 21            211           100     93.33        35.84  NA  NA  NA
## 22          2,934           100     93.97        35.95  NA  NA  NA
## 23          3,614           100     93.88        35.94  NA  NA  NA
## 24            605           100     93.39        35.85  NA  NA  NA
## 25          1,947           100     93.65        35.90  NA  NA  NA
## 26          1,356           100     93.42        35.85  NA  NA  NA
## 27            792           100     92.94        35.76  NA  NA  NA
## 28          2,849           100     93.64        35.89  NA  NA  NA
## 29          1,641           100     93.93        35.95  NA  NA  NA
ssDFTS <- ssDFTS[ssDFTS$Sample %in% colnames(x),]

dim(ssDFTS)
## [1] 28 31
x1 <- x[,which(colnames(x) %in% ssDFTS$Sample)]
dim(x1)
## [1] 310  28
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 258  28
ssDFTS %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S1_Sarafina 6102463 NA DFT1 FAP F A Spring Channel 2.6191781 6.4 NA NA NA NA 95140.790 ATCCAGAG+TAACGTCG 6,491,488 1 74.07 25.93 1,960 100 93.74 35.92 NA NA NA
2 1 default S1_Lucy 6102464 NA DFT1 FAU F A Summer Channel 2.9178082 7.1 NA 3 TRUE deep TRUE 700825.170 AAGCACTG+AGGTCAAC 6,121,785 1 98.00 2.00 1,849 100 93.84 35.93 NA NA NA
3 1 default S2_Hope 6102471 NA DFT1 FAU F A Summer Channel 2.9315068 6.4 NA 4 TRUE deep TRUE 103815.530 AGCACTTC+ACGTCCAA 1,971,776 0 97.96 2.04 595 100 93.62 35.88 NA NA NA
4 1 default S2_Sally 6102472 NA DFT1 FAU F A Summer Channel 2.9945205 7 NA 1 TRUE deep FALSE 1588.272 CGTTGCAA+ATAGAGCG 2,429,449 1 97.42 2.58 734 100 93.78 35.93 NA NA NA
5 1 default S3_Apu 6102473 NA DFT1 MAA M A Autumn Channel 3.1150685 9.5 NA 1 FALSE superficial TRUE 200.000 CCTTGATC+GATGGAGT 4,939,580 1 96.94 3.06 1,492 100 93.71 35.91 NA NA NA
6 1 default S3_Simone 6102474 NA DFT1 FAW F A Winter Channel 3.2739726 10.2 NA 1 TRUE superficial TRUE 2670.678 CGGTTGTT+GTGGTATG 4,015,027 1 95.91 4.09 1,213 100 93.42 35.86 NA NA NA
7 1 default S4_Wiggum 6102480 NA DFT1 MAA M A Autumn Channel 3.1178082 8.3 NA 2 FALSE FALSE 7272.309 GTGAAGTG+GAGCAATC 4,201,355 1 97.17 2.83 1,269 100 93.64 35.90 NA NA NA
8 1 default S4_Pooh 6102482 NA DFT1 MAA M A Autumn Channel 4.1863014 11.8 NA 1 FALSE FALSE 7577.856 CTTCGACT+GATCTTGC 3,821,151 1 97.31 2.69 1,154 100 93.60 35.89 NA NA NA
9 1 default S4_Milhouse 6102483 NA DFT1 MAA M A Autumn Channel 4.1013699 11 NA 1 TRUE deep TRUE 480.000 AACCGTTC+CTAGCTCA 10,492,900 2 98.13 1.87 3,169 100 93.80 35.92 NA NA NA
10 1 default S5_Allen 6102488 NA DFT1 MAU M A Summer Channel 1.9095890 6.7 NA 1 TRUE deep TRUE 55959.750 TTGCAGAC+ATCGTGGT 5,288,435 1 96.85 3.15 1,597 100 93.42 35.86 NA NA NA
11 1 default S5_Cyan 6102489 NA DFT1 MAW M A Winter Channel 3.3945205 9.1 NA 5 TRUE deep TRUE 206006.422 GTAGGAGT+GTCCTAAG 4,138,600 1 98.03 1.97 1,250 100 93.67 35.90 NA NA NA
12 1 default S6_Shelob 6102492 NA DFT2 FAP F A Spring Channel 4.6219178 7.2 NA NA NA NA 7455.435 GTCATCGA+GATCCACT 3,184,798 1 98.21 1.79 962 100 93.90 35.94 NA NA NA
13 1 default S6_Stuttgart 6102493 NA DFT1 MSP M S Spring Channel 0.5780822 12.7 NA 1 FALSE TRUE 3809.806 AGCGTGTT+CTTCGCAA 3,056,475 1 97.50 2.50 923 100 93.95 35.95 NA NA NA
14 1 default S7_Violet 6102498 NA DFT2 FSU F S Summer Channel 0.8739726 4.6 NA 1 TRUE superficial TRUE 5517.330 CTTGTCGA+CGATGTTC 2,768,682 1 98.19 1.81 836 100 93.85 35.93 NA NA NA
15 1 default S7_Willie 6102500 NA DFT2 MAA M A Autumn Channel 2.1150685 8.2 NA 2 TRUE deep TRUE 1527.480 TGGACTCT+TCTTACGG 4,539,036 1 98.30 1.70 1,371 100 93.84 35.93 NA NA NA
16 1 default S8_Orange 6102502 NA DFT1 FAU F A Summer Channel 1.9150685 7.1 NA 7 TRUE superficial TRUE 43690.461 GTTGACCT+CAGTGCTT 5,072,309 1 97.92 2.08 1,532 100 93.36 35.84 NA NA NA
17 1 default S8_ST67 6102505 NA DFT2 MAW M A Winter Channel 4.2794521 10.2 NA 1 TRUE deep TRUE 102246.432 TTGGACGT+GAAGTGCT 5,476,735 1 95.44 4.56 1,654 100 93.21 35.82 NA NA NA
18 1 default S8_Yellow 6102507 NA DFT2 MAU M A Summer Channel 1.8657534 10.5 NA 2 TRUE deep TRUE 139389.671 GAAGTTGG+CGAACAAC 6,469,324 1 97.99 2.01 1,954 100 94.00 35.97 NA NA NA
19 1 default S9_Jane 6102508 NA DFT1 FAA F A Autumn Channel 3.1972603 6.1 NA NA NA NA 64646.036 GTTCTCGT+TGTTCCGT 12,489,105 3 97.92 2.08 3,772 100 93.54 35.88 NA NA NA
20 1 default S9_Clytemnestra 6102511 NA DFT1 FSP F S Spring Channel 1.6602740 6 NA NA NA NA 34738.080 CATGGCTA+CACACATC 6,141,790 1 98.00 2.00 1,855 100 93.42 35.85 NA NA NA
22 1 default S10_Laurasia 6102516 NA DFT2 MSP M S Spring Channel 1.6383562 8 NA NA NA NA 2697.152 TACGCTAC+CGTGTGAT 9,716,148 2 97.81 2.19 2,934 100 93.97 35.95 NA NA NA
23 1 default S10_Enchilada 6102517 NA DFT2 MAP M A Spring Channel 3.6438356 9.3 NA 14 FALSE FALSE 301301.905 GATTGCTC+CACTTCAC 11,967,844 2 97.82 2.18 3,614 100 93.88 35.94 NA NA NA
24 1 default S11_Murdoch/Washington 6102519 NA DFT2 MAA M A Autumn Channel 1.4438356 8.9 NA NA NA NA 127176.305 ACTGAGGT+GTCAACAG 2,003,509 0 97.82 2.18 605 100 93.39 35.85 NA NA NA
25 1 default S12_Abe 6102524 NA DFT1 MAA M A Autumn Channel 3.1150685 7.9 NA 1 TRUE deep TRUE 13125.000 GTTGTTCG+CCAACTTC 6,446,467 1 97.60 2.40 1,947 100 93.65 35.90 NA NA NA
26 1 default S12_Lilac 6102526 NA DFT1 MAW M A Winter Channel 3.4109589 9.6 NA 5 TRUE superficial TRUE 37293.844 TATCGGTC+TACCGGAT 4,490,241 1 98.15 1.85 1,356 100 93.42 35.85 NA NA NA
27 1 default S13_Green 6102531 NA DFT1 MAA M A Autumn Channel 3.1534247 7.5 NA 2 TRUE superficial TRUE 7407.222 GTCGAAGA+CCACATTG 2,623,695 1 97.38 2.62 792 100 92.94 35.76 NA NA NA
28 1 default S13_Bump 6102532 NA DFT1 MAU M A Summer Channel 3.9068493 9.3 NA NA NA NA 629522.362 AGTTCGTC+ACTCGATC 9,435,053 2 98.16 1.84 2,849 100 93.64 35.89 NA NA NA
29 1 default S14_Purple 6102536 NA DFT1 FAW F A Winter Channel 2.3945205 6.8 NA 1 TRUE deep TRUE 24938.123 CGCTCTAT+TTGCAACG 5,432,182 1 97.81 2.19 1,641 100 93.93 35.95 NA NA NA
col <- as.character(as.numeric(grepl("F",ssHS$Sex)))
col <- gsub("0","grey",col)
col <- gsub("1","black",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Comparison of Male and Female DFTD infected devils")
mtext("Male=Grey, Female=Black")

ssDFTS$DFTDStat <- grepl("DFT2",ssDFTS$Category)
ssDFTS$MvF <- factor(ssDFTS$Sex)
ssDFTS$SubAdvAd <- as.numeric(factor(ssDFTS$Age,levels=c("S","A"),ordered = TRUE))
ssDFTS$Season <- factor(ssDFTS$Season)


dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssDFTS, design = ~ Season +  SubAdvAd + DFTDStat + MvF)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeDFTS <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 1
maplot(dgeDFTS,"Male vs Female DFTD infected devils")

make_volcano(dgeDFTS,"Male vs Female DFTD infected devils")

sig[1:100,1:6] %>%
  kbl(caption="Comparison of Male vs Female DFTD infected devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Male vs Female DFTD infected devils
baseMean log2FoldChange lfcSE stat pvalue padj
IL9R 22.190197 -4.778219 1.159975 -4.119242 0.0000380 0.0098071
CXCL10 6.852306 4.868341 1.356887 3.587875 0.0003334 0.0430066
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
NA.28 NA NA NA NA NA NA
NA.29 NA NA NA NA NA NA
NA.30 NA NA NA NA NA NA
NA.31 NA NA NA NA NA NA
NA.32 NA NA NA NA NA NA
NA.33 NA NA NA NA NA NA
NA.34 NA NA NA NA NA NA
NA.35 NA NA NA NA NA NA
NA.36 NA NA NA NA NA NA
NA.37 NA NA NA NA NA NA
NA.38 NA NA NA NA NA NA
NA.39 NA NA NA NA NA NA
NA.40 NA NA NA NA NA NA
NA.41 NA NA NA NA NA NA
NA.42 NA NA NA NA NA NA
NA.43 NA NA NA NA NA NA
NA.44 NA NA NA NA NA NA
NA.45 NA NA NA NA NA NA
NA.46 NA NA NA NA NA NA
NA.47 NA NA NA NA NA NA
NA.48 NA NA NA NA NA NA
NA.49 NA NA NA NA NA NA
NA.50 NA NA NA NA NA NA
NA.51 NA NA NA NA NA NA
NA.52 NA NA NA NA NA NA
NA.53 NA NA NA NA NA NA
NA.54 NA NA NA NA NA NA
NA.55 NA NA NA NA NA NA
NA.56 NA NA NA NA NA NA
NA.57 NA NA NA NA NA NA
NA.58 NA NA NA NA NA NA
NA.59 NA NA NA NA NA NA
NA.60 NA NA NA NA NA NA
NA.61 NA NA NA NA NA NA
NA.62 NA NA NA NA NA NA
NA.63 NA NA NA NA NA NA
NA.64 NA NA NA NA NA NA
NA.65 NA NA NA NA NA NA
NA.66 NA NA NA NA NA NA
NA.67 NA NA NA NA NA NA
NA.68 NA NA NA NA NA NA
NA.69 NA NA NA NA NA NA
NA.70 NA NA NA NA NA NA
NA.71 NA NA NA NA NA NA
NA.72 NA NA NA NA NA NA
NA.73 NA NA NA NA NA NA
NA.74 NA NA NA NA NA NA
NA.75 NA NA NA NA NA NA
NA.76 NA NA NA NA NA NA
NA.77 NA NA NA NA NA NA
NA.78 NA NA NA NA NA NA
NA.79 NA NA NA NA NA NA
NA.80 NA NA NA NA NA NA
NA.81 NA NA NA NA NA NA
NA.82 NA NA NA NA NA NA
NA.83 NA NA NA NA NA NA
NA.84 NA NA NA NA NA NA
NA.85 NA NA NA NA NA NA
NA.86 NA NA NA NA NA NA
NA.87 NA NA NA NA NA NA
NA.88 NA NA NA NA NA NA
NA.89 NA NA NA NA NA NA
NA.90 NA NA NA NA NA NA
NA.91 NA NA NA NA NA NA
NA.92 NA NA NA NA NA NA
NA.93 NA NA NA NA NA NA
NA.94 NA NA NA NA NA NA
NA.95 NA NA NA NA NA NA
NA.96 NA NA NA NA NA NA
NA.97 NA NA NA NA NA NA
write.table(dge,file="dgeDFTS.tsv",sep="\t")
ssCap <- filter(ss, Category %in% c('Captive'))

ssCapS <- ssCap[which(grepl("M",ssCap$Sex) + grepl("F",ssCap$Sex)>0),]
ssCapS
##    Lane Project      Client.ID  Sample  X Category Sex.Age.Season Sex Age
## 1     1 default      S2_B99008 6102468 NA  Captive            FAU   F   A
## 2     1 default      S2_Bonney 6102469 NA  Captive            FAU   F   A
## 3     1 default      S3_Jessie 6102476 NA  Captive            FAW   F   A
## 4     1 default    S3_McCauley 6102477 NA  Captive            MAA   M   A
## 5     1 default      S5_Fenton 6102484 NA  Captive            MAU   M   A
## 6     1 default S5_Bryan Adams 6102485 NA  Captive            MAW   M   A
## 7     1 default       S7_Fredo 6102496 NA  Captive            MAA   M   A
## 8     1 default      S7_Piglet 6102497 NA  Captive            FSU   F   S
## 9     1 default    S10_McMahon 6102514 NA  Captive            MSP   M   S
## 10    1 default      S10_Logan 6102515 NA  Captive            MAU   M   A
## 11    1 default       S11_Xuki 6102520 NA  Captive            MAA   M   A
## 12    1 default   S11_Kalamata 6102521 NA  Captive            MSW   M   S
## 13    1 default      S12_Wally 6102528 NA  Captive            MAA   M   A
## 14    1 default        S12_Naz 6102529 NA  Captive            MAW   M   A
## 15    1 default     S13_Humbug 6102530 NA  Captive            MAU   M   A
## 16    1 default     S13_Xerxes 6102535 NA  Captive            MAA   M   A
## 17    1 default     S14_Catani 6102538 NA  Captive            FAU   F   A
## 18    2 default     S15_Amelia 6102541 NA  Captive            FAU   F   A
## 19    2 default     S15_London 6102542 NA  Captive            FAU   F   A
## 20    2 default      S15_Elyse 6102543 NA  Captive            FAP   F   A
## 21    2 default     S16_Marley 6102547 NA  Captive            FAU   F   A
## 22    2 default      S16_Milla 6102548 NA  Captive            FAU   F   A
## 23    2 default S16_Maleficent 6102549 NA  Captive            FAU   F   A
## 24    2 default     S17_Anirak 6102553 NA  Captive            FSW   F   S
## 25    2 default       S17_Poly 6102554 NA  Captive            FSU   F   S
## 26    2 default     S17_Methyl 6102556 NA  Captive            FSU   F   S
## 27    2 default       S18_Zara 6102558 NA  Captive            FSW   F   S
## 28    2 default       S18_Maze 6102559 NA  Captive            FSW   F   S
## 29    2 default    S18_Delores 6102560 NA  Captive            FSW   F   S
## 30    2 default    S19_Morocco 6102564 NA  Captive            MAU   M   A
## 31    2 default   S19_Pecorino 6102565 NA  Captive            FSW   F   S
## 32    2 default      S19_Hooch 6102566 NA  Captive            MSA   M   S
## 33    2 default      S20_Muasy 6102569 NA  Captive            MSU   M   S
## 34    2 default       S20_Fuse 6102570 NA  Captive            MSU   M   S
## 35    2 default     S20_Joseph 6102571 NA  Captive            MSU   M   S
## 36    2 default      S21_Moama 6102576 NA  Captive            MAW   M   A
## 37    2 default     S21_Nauset 6102577 NA  Captive            MSW   M   S
## 38    2 default     S21_Graham 6102578 NA  Captive            MSW   M   S
## 39    2 default      S22_Yanni 6102581 NA  Captive            MSW   M   S
## 40    2 default    S22_Gherkin 6102582 NA  Captive            MSW   M   S
## 41    2 default    S22_Stilton 6102584 NA  Captive            MSW   M   S
## 42    2 default     S23_Osiris 6102588 NA  Captive            MSW   M   S
## 43    2 default     S23_X-boxx 6102589 NA  Captive            FSW   F   S
## 44    2 default     S23_Quince 6102590 NA  Captive            MSW   M   S
## 45    2 default     S24_Malfoy 6102595 NA  Captive            MAW   M   A
## 46    2 default   S24_Licorice 6102596 NA  Captive            FSA   F   S
## 47    2 default       S25_Tofu 6102599 NA  Captive            FAU   F   A
## 48    2 default    S25_Colette 6102600 NA  Captive            FAP   F   A
## 49    2 default S25_CannonBall 6102601 NA  Captive            MSW   M   S
## 50    2 default  S25_Cornelius 6102602 NA  Captive            MAU   M   A
## 51    2 default    S25_Mardook 6102603 NA  Captive            MAW   M   A
## 52    2 default    S25_Negroni 6102604 NA  Captive            FSP   F   S
##    Season    Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated
## 1  Summer     Monarto 3.7369863   8.12  NA                NA        NA
## 2  Summer Healesville 2.5863014    5.4  NA                NA        NA
## 3  Winter     Monarto 2.1945205  12.95  NA                NA        NA
## 4  Autumn Healesville 3.0328767   8.52  NA                NA        NA
## 5  Summer     Monarto 3.0000000    N/A  NA                NA        NA
## 6  Winter Healesville 4.1616438    8.6  NA                NA        NA
## 7  Autumn Healesville 2.9945205    8.8  NA                NA        NA
## 8  Summer Healesville 1.5890411   4.76  NA                NA        NA
## 9  Spring Healesville 1.6493151   8.06  NA                NA        NA
## 10 Summer Healesville 5.6000000   9.02  NA                NA        NA
## 11 Autumn     Monarto 2.0767123   7.95  NA                NA        NA
## 12 Winter Healesville 1.2849315   5.58  NA                NA        NA
## 13 Autumn     Monarto 2.1616438    N/A  NA                NA        NA
## 14 Winter     Monarto 4.4547945    N/A  NA                NA        NA
## 15 Summer     Monarto 2.5397260   7.94  NA                NA        NA
## 16 Autumn     Monarto 2.0767123    N/A  NA                NA        NA
## 17 Summer Healesville 2.8630137   6.46  NA                NA        NA
## 18 Summer Healesville 4.7260274   5.85  NA                NA        NA
## 19 Summer Healesville 3.7863014    4.8  NA                NA        NA
## 20 Spring Healesville 4.5232877   7.88  NA                NA        NA
## 21 Summer     Monarto 4.7726027   7.51  NA                NA        NA
## 22 Summer Healesville 2.7671233   5.82  NA                NA        NA
## 23 Summer     Monarto 4.5589041   8.59  NA                NA        NA
## 24 Winter Healesville 1.3424658   5.42  NA                NA        NA
## 25 Summer     Monarto 1.7917808   6.67  NA                NA        NA
## 26 Summer Healesville 0.7534247   2.72  NA                NA        NA
## 27 Winter     Monarto 1.5150685    4.6  NA                NA        NA
## 28 Winter Healesville 1.4000000   5.82  NA                NA        NA
## 29 Winter Healesville 1.2986301    5.1  NA                NA        NA
## 30 Summer     Monarto 4.5917808   9.82  NA                NA        NA
## 31 Winter Healesville 1.1123288   6.02  NA                NA        NA
## 32 Autumn Healesville 1.0164384    6.1  NA                NA        NA
## 33 Summer Healesville 1.4219178   6.62  NA                NA        NA
## 34 Summer Healesville 1.7315068   6.26  NA                NA        NA
## 35 Summer Healesville 1.7479452   7.42  NA                NA        NA
## 36 Winter     Monarto 1.6986301   8.75  NA                NA        NA
## 37 Winter Healesville 1.3041096  4.036  NA                NA        NA
## 38 Winter Healesville 1.3616438    6.4  NA                NA        NA
## 39 Winter     Monarto 1.5178082   8.15  NA                NA        NA
## 40 Winter Healesville 1.2630137   6.32  NA                NA        NA
## 41 Winter Healesville 1.2986301   5.76  NA                NA        NA
## 42 Winter Healesville 1.1753425   5.34  NA                NA        NA
## 43 Winter     Monarto 1.4657534   4.34  NA                NA        NA
## 44 Winter Healesville 1.3835616    N/A  NA                NA        NA
## 45 Winter Healesville 5.1041096   8.02  NA                NA        NA
## 46 Autumn Healesville 1.8246575   5.94  NA                NA        NA
## 47 Summer Healesville 2.7452055    N/A  NA                NA        NA
## 48 Spring Healesville 6.6273973   7.52  NA                NA        NA
## 49 Winter Healesville 1.1479452   6.54  NA                NA        NA
## 50 Summer Healesville 3.6904110   7.74  NA                NA        NA
## 51 Winter Healesville 4.3013699   9.16  NA                NA        NA
## 52 Spring Healesville 1.6767123   5.86  NA                NA        NA
##    UlcerationDepth Secondary.infection Total.tumour.volume  Barcode.sequence
## 1                                   NA                  NA GCTATCCT+AACAGGTG
## 2                                   NA                  NA ACGTTCAG+AGTTGTGC
## 3                                   NA                  NA CCGTAAGA+AGAGTCCA
## 4                                   NA                  NA CAACACCT+AGCTACCA
## 5                                   NA                  NA GATTACCG+TTGGACTG
## 6                                   NA                  NA CACTAGCT+TCGGATTC
## 7                                   NA                  NA AGTGGATC+TCGATGAC
## 8                                   NA                  NA ATCACACG+GTAGCGTA
## 9                                   NA                  NA AACGTCTG+AATGACGC
## 10                                  NA                  NA GTGCCATA+CTCCTAGT
## 11                                  NA                  NA ATCGCCAT+TGCGTAAC
## 12                                  NA                  NA GAACATCG+TCGACAAG
## 13                                  NA                  NA ACGACTTG+AACAGCGA
## 14                                  NA                  NA CCTTGTAG+CCTTGGAA
## 15                                  NA                  NA GAGCAGTA+TGAGCTGT
## 16                                  NA                  NA GATAGGCT+CAGTCACA
## 17                                  NA                  NA TGAAGACG+ACATGCCA
## 18                                  NA                  NA AACGTCTG+AATGACGC
## 19                                  NA                  NA GTCATCGA+GATCCACT
## 20                                  NA                  NA AGCGTGTT+CTTCGCAA
## 21                                  NA                  NA GCAAGATC+AGTCGAAG
## 22                                  NA                  NA TTGCGAAG+AACACGCT
## 23                                  NA                  NA TGCTTCCA+CGATCGAT
## 24                                  NA                  NA TGAGCTAG+GAACGGTT
## 25                                  NA                  NA CTTAGGAC+ACTCCTAC
## 26                                  NA                  NA TGGTACAG+TCGAGAGT
## 27                                  NA                  NA ACCACGAT+GTCTGCAA
## 28                                  NA                  NA ACTGAGGT+GTCAACAG
## 29                                  NA                  NA ACGACTTG+AACAGCGA
## 30                                  NA                  NA TCAGGCTT+ATCATGCG
## 31                                  NA                  NA ATGCCTGT+AGATTGCG
## 32                                  NA                  NA CCGTAAGA+AGAGTCCA
## 33                                  NA                  NA TTCCAAGG+CTACAAGG
## 34                                  NA                  NA GTAGGAGT+GTCCTAAG
## 35                                  NA                  NA CTTCGACT+GATCTTGC
## 36                                  NA                  NA TTGGACGT+GAAGTGCT
## 37                                  NA                  NA TATCGGTC+TACCGGAT
## 38                                  NA                  NA TACGCCTT+GCTACTCT
## 39                                  NA                  NA CGTGTGTA+CCAACGAA
## 40                                  NA                  NA CCTTGTAG+CCTTGGAA
## 41                                  NA                  NA CGCAATCT+ACAGGCAT
## 42                                  NA                  NA AGTGGATC+TCGATGAC
## 43                                  NA                  NA CTGTTGAC+ACCTCAGT
## 44                                  NA                  NA AACCGTTC+CTAGCTCA
## 45                                  NA                  NA TAACCGGT+ATCGTCTC
## 46                                  NA                  NA TTGCAGAC+ATCGTGGT
## 47                                  NA                  NA GAGACGAT+ACCGGTTA
## 48                                  NA                  NA CTTGTCGA+CGATGTTC
## 49                                  NA                  NA TACGCTAC+CGTGTGAT
## 50                                  NA                  NA GAATCCGA+AGCTAGTG
## 51                                  NA                  NA GCACAACT+CTGAACGT
## 52                                  NA                  NA TGTGACTG+AGCCTATC
##    PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode
## 1    5,338,890           1.00              98.08                    1.92
## 2   14,968,459           3.00              97.82                    2.18
## 3    4,340,498           1.00              97.95                    2.05
## 4   16,944,152           3.00              97.98                    2.02
## 5    5,125,566           1.00              96.21                    3.79
## 6    5,317,767           1.00              97.33                    2.67
## 7    2,690,632           1.00              97.77                    2.23
## 8   12,134,750           2.00              96.94                    3.06
## 9    3,809,607           1.00              96.73                    3.27
## 10   9,606,720           2.00              97.52                    2.48
## 11   6,018,884           1.00              97.88                    2.12
## 12   6,861,544           1.00              97.76                    2.24
## 13   3,000,501           1.00              97.96                    2.04
## 14   5,927,942           1.00              97.40                    2.60
## 15   1,702,608           0.00              98.07                    1.93
## 16   7,628,257           2.00              98.34                    1.66
## 17  13,381,058           3.00              96.98                    3.02
## 18   8,041,818           1.73              96.32                    3.68
## 19   5,758,111           1.24              96.72                    3.28
## 20   5,774,637           1.24              96.76                    3.24
## 21     348,621           0.08              97.24                    2.76
## 22   6,376,997           1.37              97.60                    2.40
## 23   9,181,668           1.98              98.08                    1.92
## 24   3,740,878           0.81              97.15                    2.85
## 25  11,133,566           2.40              97.85                    2.15
## 26   7,887,375           1.70              97.57                    2.43
## 27   7,308,907           1.58              97.70                    2.30
## 28   2,984,930           0.64              97.59                    2.41
## 29          98           0.00              94.90                    5.10
## 30   4,879,629           1.05              97.38                    2.62
## 31   4,857,395           1.05              97.58                    2.42
## 32   1,074,345           0.23              97.56                    2.44
## 33  10,669,237           2.30              97.64                    2.36
## 34  10,603,179           2.29              97.34                    2.66
## 35   5,642,025           1.22              96.37                    3.63
## 36  10,821,895           2.33              96.02                    3.98
## 37   8,693,920           1.87              98.13                    1.87
## 38   3,422,010           0.74              97.72                    2.28
## 39   4,811,453           1.04              97.67                    2.33
## 40   5,913,586           1.27              97.05                    2.95
## 41   8,306,537           1.79              96.94                    3.06
## 42   3,528,471           0.76              97.24                    2.76
## 43          23           0.00             100.00                     NaN
## 44   7,247,793           1.56              97.63                    2.37
## 45   6,908,416           1.49              97.09                    2.91
## 46   4,475,461           0.96              95.05                    4.95
## 47  12,024,421           2.59              95.37                    4.63
## 48  10,751,797           2.32              97.49                    2.51
## 49  13,015,081           2.81              97.36                    2.64
## 50   3,336,983           0.72              97.10                    2.90
## 51   6,826,313           1.47              97.66                    2.34
## 52   4,566,180           0.98              97.68                    2.32
##    Yield..Mbases. X..PF.Cluster X.....Q30 Mean.Quality X.2 X.3 X.4
## 1           1,612           100     93.69        35.91  NA  NA  NA
## 2           4,520           100     93.68        35.91  NA  NA  NA
## 3           1,311           100     93.54        35.88  NA  NA  NA
## 4           5,117           100     93.05        35.78  NA  NA  NA
## 5           1,548           100     93.89        35.94  NA  NA  NA
## 6           1,606           100     93.24        35.83  NA  NA  NA
## 7             813           100     93.77        35.93  NA  NA  NA
## 8           3,665           100     93.34        35.84  NA  NA  NA
## 9           1,151           100     93.07        35.79  NA  NA  NA
## 10          2,901           100     93.25        35.83  NA  NA  NA
## 11          1,818           100     93.58        35.89  NA  NA  NA
## 12          2,072           100     93.49        35.87  NA  NA  NA
## 13            906           100     93.70        35.91  NA  NA  NA
## 14          1,790           100     93.86        35.94  NA  NA  NA
## 15            514           100     93.58        35.89  NA  NA  NA
## 16          2,304           100     93.62        35.89  NA  NA  NA
## 17          4,041           100     93.36        35.84  NA  NA  NA
## 18          2,429           100     92.18        35.63  NA  NA  NA
## 19          1,739           100     91.87        35.55  NA  NA  NA
## 20          1,744           100     91.56        35.50  NA  NA  NA
## 21            105           100     92.77        35.73  NA  NA  NA
## 22          1,926           100     92.44        35.67  NA  NA  NA
## 23          2,773           100     93.04        35.79  NA  NA  NA
## 24          1,130           100     93.03        35.79  NA  NA  NA
## 25          3,362           100     92.47        35.68  NA  NA  NA
## 26          2,382           100     93.15        35.81  NA  NA  NA
## 27          2,207           100     92.84        35.75  NA  NA  NA
## 28            901           100     92.49        35.69  NA  NA  NA
## 29              0           100     89.11        34.91  NA  NA  NA
## 30          1,474           100     92.63        35.71  NA  NA  NA
## 31          1,467           100     92.64        35.72  NA  NA  NA
## 32            324           100     92.66        35.72  NA  NA  NA
## 33          3,222           100     92.79        35.74  NA  NA  NA
## 34          3,202           100     92.01        35.58  NA  NA  NA
## 35          1,704           100     91.87        35.56  NA  NA  NA
## 36          3,268           100     92.72        35.73  NA  NA  NA
## 37          2,626           100     92.32        35.65  NA  NA  NA
## 38          1,033           100     92.94        35.76  NA  NA  NA
## 39          1,453           100     92.30        35.65  NA  NA  NA
## 40          1,786           100     92.92        35.77  NA  NA  NA
## 41          2,509           100     91.86        35.55  NA  NA  NA
## 42          1,066           100     93.08        35.79  NA  NA  NA
## 43              0           100     95.85        36.37  NA  NA  NA
## 44          2,189           100     92.28        35.63  NA  NA  NA
## 45          2,086           100     91.90        35.56  NA  NA  NA
## 46          1,352           100     91.42        35.46  NA  NA  NA
## 47          3,631           100     93.06        35.79  NA  NA  NA
## 48          3,247           100     92.77        35.74  NA  NA  NA
## 49          3,931           100     92.61        35.70  NA  NA  NA
## 50          1,008           100     93.09        35.79  NA  NA  NA
## 51          2,062           100     92.67        35.71  NA  NA  NA
## 52          1,379           100     92.13        35.61  NA  NA  NA
ssCapS <- ssCapS[ssCapS$Sample %in% colnames(x),]

dim(ssCapS)
## [1] 48 31
x1 <- x[,which(colnames(x) %in% ssCapS$Sample)]
dim(x1)
## [1] 310  48
x1 <- x1[which(rowMeans(x1)>10),]
dim(x1)
## [1] 261  48
ssCapS %>%  kbl(caption="Sample sheet")%>% kable_styling("hover",full_width=FALSE) 
Sample sheet
Lane Project Client.ID Sample X Category Sex.Age.Season Sex Age Season Location Agebyyear Weight X.1 Number.of.Tumours Ulcerated UlcerationDepth Secondary.infection Total.tumour.volume Barcode.sequence PF.Clusters X..of.the.lane X..Perfect.barcode X..One.mismatch.barcode Yield..Mbases. X..PF.Cluster X…..Q30 Mean.Quality X.2 X.3 X.4
1 1 default S2_B99008 6102468 NA Captive FAU F A Summer Monarto 3.7369863 8.12 NA NA NA NA NA GCTATCCT+AACAGGTG 5,338,890 1.00 98.08 1.92 1,612 100 93.69 35.91 NA NA NA
2 1 default S2_Bonney 6102469 NA Captive FAU F A Summer Healesville 2.5863014 5.4 NA NA NA NA NA ACGTTCAG+AGTTGTGC 14,968,459 3.00 97.82 2.18 4,520 100 93.68 35.91 NA NA NA
3 1 default S3_Jessie 6102476 NA Captive FAW F A Winter Monarto 2.1945205 12.95 NA NA NA NA NA CCGTAAGA+AGAGTCCA 4,340,498 1.00 97.95 2.05 1,311 100 93.54 35.88 NA NA NA
4 1 default S3_McCauley 6102477 NA Captive MAA M A Autumn Healesville 3.0328767 8.52 NA NA NA NA NA CAACACCT+AGCTACCA 16,944,152 3.00 97.98 2.02 5,117 100 93.05 35.78 NA NA NA
5 1 default S5_Fenton 6102484 NA Captive MAU M A Summer Monarto 3.0000000 N/A NA NA NA NA NA GATTACCG+TTGGACTG 5,125,566 1.00 96.21 3.79 1,548 100 93.89 35.94 NA NA NA
6 1 default S5_Bryan Adams 6102485 NA Captive MAW M A Winter Healesville 4.1616438 8.6 NA NA NA NA NA CACTAGCT+TCGGATTC 5,317,767 1.00 97.33 2.67 1,606 100 93.24 35.83 NA NA NA
7 1 default S7_Fredo 6102496 NA Captive MAA M A Autumn Healesville 2.9945205 8.8 NA NA NA NA NA AGTGGATC+TCGATGAC 2,690,632 1.00 97.77 2.23 813 100 93.77 35.93 NA NA NA
8 1 default S7_Piglet 6102497 NA Captive FSU F S Summer Healesville 1.5890411 4.76 NA NA NA NA NA ATCACACG+GTAGCGTA 12,134,750 2.00 96.94 3.06 3,665 100 93.34 35.84 NA NA NA
9 1 default S10_McMahon 6102514 NA Captive MSP M S Spring Healesville 1.6493151 8.06 NA NA NA NA NA AACGTCTG+AATGACGC 3,809,607 1.00 96.73 3.27 1,151 100 93.07 35.79 NA NA NA
10 1 default S10_Logan 6102515 NA Captive MAU M A Summer Healesville 5.6000000 9.02 NA NA NA NA NA GTGCCATA+CTCCTAGT 9,606,720 2.00 97.52 2.48 2,901 100 93.25 35.83 NA NA NA
11 1 default S11_Xuki 6102520 NA Captive MAA M A Autumn Monarto 2.0767123 7.95 NA NA NA NA NA ATCGCCAT+TGCGTAAC 6,018,884 1.00 97.88 2.12 1,818 100 93.58 35.89 NA NA NA
12 1 default S11_Kalamata 6102521 NA Captive MSW M S Winter Healesville 1.2849315 5.58 NA NA NA NA NA GAACATCG+TCGACAAG 6,861,544 1.00 97.76 2.24 2,072 100 93.49 35.87 NA NA NA
13 1 default S12_Wally 6102528 NA Captive MAA M A Autumn Monarto 2.1616438 N/A NA NA NA NA NA ACGACTTG+AACAGCGA 3,000,501 1.00 97.96 2.04 906 100 93.70 35.91 NA NA NA
14 1 default S12_Naz 6102529 NA Captive MAW M A Winter Monarto 4.4547945 N/A NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,927,942 1.00 97.40 2.60 1,790 100 93.86 35.94 NA NA NA
15 1 default S13_Humbug 6102530 NA Captive MAU M A Summer Monarto 2.5397260 7.94 NA NA NA NA NA GAGCAGTA+TGAGCTGT 1,702,608 0.00 98.07 1.93 514 100 93.58 35.89 NA NA NA
16 1 default S13_Xerxes 6102535 NA Captive MAA M A Autumn Monarto 2.0767123 N/A NA NA NA NA NA GATAGGCT+CAGTCACA 7,628,257 2.00 98.34 1.66 2,304 100 93.62 35.89 NA NA NA
17 1 default S14_Catani 6102538 NA Captive FAU F A Summer Healesville 2.8630137 6.46 NA NA NA NA NA TGAAGACG+ACATGCCA 13,381,058 3.00 96.98 3.02 4,041 100 93.36 35.84 NA NA NA
18 2 default S15_Amelia 6102541 NA Captive FAU F A Summer Healesville 4.7260274 5.85 NA NA NA NA NA AACGTCTG+AATGACGC 8,041,818 1.73 96.32 3.68 2,429 100 92.18 35.63 NA NA NA
19 2 default S15_London 6102542 NA Captive FAU F A Summer Healesville 3.7863014 4.8 NA NA NA NA NA GTCATCGA+GATCCACT 5,758,111 1.24 96.72 3.28 1,739 100 91.87 35.55 NA NA NA
20 2 default S15_Elyse 6102543 NA Captive FAP F A Spring Healesville 4.5232877 7.88 NA NA NA NA NA AGCGTGTT+CTTCGCAA 5,774,637 1.24 96.76 3.24 1,744 100 91.56 35.50 NA NA NA
22 2 default S16_Milla 6102548 NA Captive FAU F A Summer Healesville 2.7671233 5.82 NA NA NA NA NA TTGCGAAG+AACACGCT 6,376,997 1.37 97.60 2.40 1,926 100 92.44 35.67 NA NA NA
23 2 default S16_Maleficent 6102549 NA Captive FAU F A Summer Monarto 4.5589041 8.59 NA NA NA NA NA TGCTTCCA+CGATCGAT 9,181,668 1.98 98.08 1.92 2,773 100 93.04 35.79 NA NA NA
24 2 default S17_Anirak 6102553 NA Captive FSW F S Winter Healesville 1.3424658 5.42 NA NA NA NA NA TGAGCTAG+GAACGGTT 3,740,878 0.81 97.15 2.85 1,130 100 93.03 35.79 NA NA NA
25 2 default S17_Poly 6102554 NA Captive FSU F S Summer Monarto 1.7917808 6.67 NA NA NA NA NA CTTAGGAC+ACTCCTAC 11,133,566 2.40 97.85 2.15 3,362 100 92.47 35.68 NA NA NA
26 2 default S17_Methyl 6102556 NA Captive FSU F S Summer Healesville 0.7534247 2.72 NA NA NA NA NA TGGTACAG+TCGAGAGT 7,887,375 1.70 97.57 2.43 2,382 100 93.15 35.81 NA NA NA
27 2 default S18_Zara 6102558 NA Captive FSW F S Winter Monarto 1.5150685 4.6 NA NA NA NA NA ACCACGAT+GTCTGCAA 7,308,907 1.58 97.70 2.30 2,207 100 92.84 35.75 NA NA NA
28 2 default S18_Maze 6102559 NA Captive FSW F S Winter Healesville 1.4000000 5.82 NA NA NA NA NA ACTGAGGT+GTCAACAG 2,984,930 0.64 97.59 2.41 901 100 92.49 35.69 NA NA NA
30 2 default S19_Morocco 6102564 NA Captive MAU M A Summer Monarto 4.5917808 9.82 NA NA NA NA NA TCAGGCTT+ATCATGCG 4,879,629 1.05 97.38 2.62 1,474 100 92.63 35.71 NA NA NA
31 2 default S19_Pecorino 6102565 NA Captive FSW F S Winter Healesville 1.1123288 6.02 NA NA NA NA NA ATGCCTGT+AGATTGCG 4,857,395 1.05 97.58 2.42 1,467 100 92.64 35.72 NA NA NA
33 2 default S20_Muasy 6102569 NA Captive MSU M S Summer Healesville 1.4219178 6.62 NA NA NA NA NA TTCCAAGG+CTACAAGG 10,669,237 2.30 97.64 2.36 3,222 100 92.79 35.74 NA NA NA
34 2 default S20_Fuse 6102570 NA Captive MSU M S Summer Healesville 1.7315068 6.26 NA NA NA NA NA GTAGGAGT+GTCCTAAG 10,603,179 2.29 97.34 2.66 3,202 100 92.01 35.58 NA NA NA
35 2 default S20_Joseph 6102571 NA Captive MSU M S Summer Healesville 1.7479452 7.42 NA NA NA NA NA CTTCGACT+GATCTTGC 5,642,025 1.22 96.37 3.63 1,704 100 91.87 35.56 NA NA NA
36 2 default S21_Moama 6102576 NA Captive MAW M A Winter Monarto 1.6986301 8.75 NA NA NA NA NA TTGGACGT+GAAGTGCT 10,821,895 2.33 96.02 3.98 3,268 100 92.72 35.73 NA NA NA
37 2 default S21_Nauset 6102577 NA Captive MSW M S Winter Healesville 1.3041096 4.036 NA NA NA NA NA TATCGGTC+TACCGGAT 8,693,920 1.87 98.13 1.87 2,626 100 92.32 35.65 NA NA NA
38 2 default S21_Graham 6102578 NA Captive MSW M S Winter Healesville 1.3616438 6.4 NA NA NA NA NA TACGCCTT+GCTACTCT 3,422,010 0.74 97.72 2.28 1,033 100 92.94 35.76 NA NA NA
39 2 default S22_Yanni 6102581 NA Captive MSW M S Winter Monarto 1.5178082 8.15 NA NA NA NA NA CGTGTGTA+CCAACGAA 4,811,453 1.04 97.67 2.33 1,453 100 92.30 35.65 NA NA NA
40 2 default S22_Gherkin 6102582 NA Captive MSW M S Winter Healesville 1.2630137 6.32 NA NA NA NA NA CCTTGTAG+CCTTGGAA 5,913,586 1.27 97.05 2.95 1,786 100 92.92 35.77 NA NA NA
41 2 default S22_Stilton 6102584 NA Captive MSW M S Winter Healesville 1.2986301 5.76 NA NA NA NA NA CGCAATCT+ACAGGCAT 8,306,537 1.79 96.94 3.06 2,509 100 91.86 35.55 NA NA NA
42 2 default S23_Osiris 6102588 NA Captive MSW M S Winter Healesville 1.1753425 5.34 NA NA NA NA NA AGTGGATC+TCGATGAC 3,528,471 0.76 97.24 2.76 1,066 100 93.08 35.79 NA NA NA
44 2 default S23_Quince 6102590 NA Captive MSW M S Winter Healesville 1.3835616 N/A NA NA NA NA NA AACCGTTC+CTAGCTCA 7,247,793 1.56 97.63 2.37 2,189 100 92.28 35.63 NA NA NA
45 2 default S24_Malfoy 6102595 NA Captive MAW M A Winter Healesville 5.1041096 8.02 NA NA NA NA NA TAACCGGT+ATCGTCTC 6,908,416 1.49 97.09 2.91 2,086 100 91.90 35.56 NA NA NA
46 2 default S24_Licorice 6102596 NA Captive FSA F S Autumn Healesville 1.8246575 5.94 NA NA NA NA NA TTGCAGAC+ATCGTGGT 4,475,461 0.96 95.05 4.95 1,352 100 91.42 35.46 NA NA NA
47 2 default S25_Tofu 6102599 NA Captive FAU F A Summer Healesville 2.7452055 N/A NA NA NA NA NA GAGACGAT+ACCGGTTA 12,024,421 2.59 95.37 4.63 3,631 100 93.06 35.79 NA NA NA
48 2 default S25_Colette 6102600 NA Captive FAP F A Spring Healesville 6.6273973 7.52 NA NA NA NA NA CTTGTCGA+CGATGTTC 10,751,797 2.32 97.49 2.51 3,247 100 92.77 35.74 NA NA NA
49 2 default S25_CannonBall 6102601 NA Captive MSW M S Winter Healesville 1.1479452 6.54 NA NA NA NA NA TACGCTAC+CGTGTGAT 13,015,081 2.81 97.36 2.64 3,931 100 92.61 35.70 NA NA NA
50 2 default S25_Cornelius 6102602 NA Captive MAU M A Summer Healesville 3.6904110 7.74 NA NA NA NA NA GAATCCGA+AGCTAGTG 3,336,983 0.72 97.10 2.90 1,008 100 93.09 35.79 NA NA NA
51 2 default S25_Mardook 6102603 NA Captive MAW M A Winter Healesville 4.3013699 9.16 NA NA NA NA NA GCACAACT+CTGAACGT 6,826,313 1.47 97.66 2.34 2,062 100 92.67 35.71 NA NA NA
52 2 default S25_Negroni 6102604 NA Captive FSP F S Spring Healesville 1.6767123 5.86 NA NA NA NA NA TGTGACTG+AGCCTATC 4,566,180 0.98 97.68 2.32 1,379 100 92.13 35.61 NA NA NA
col <- as.character(as.numeric(grepl("F",ssHS$Sex)))
col <- gsub("0","grey",col)
col <- gsub("1","black",col)

mds<-plotMDS(x1,pch=19,cex=3,col=col,main="MDS plot: Comparison of Male and Female Captive devils")
mtext("Male=Grey, Female=Black")

ssCapS$CapLoc <- grepl("Monarto",ssCapS$Location)
ssCapS$MvF <- factor(ssCapS$Sex)
ssCapS$SubAdvAd <- as.numeric(factor(ssCapS$Age,levels=c("S","A"),ordered = TRUE))
ssCapS$Season <- factor(ssCapS$Season)
str(ssCapS)
## 'data.frame':    48 obs. of  34 variables:
##  $ Lane                   : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Project                : chr  "default" "default" "default" "default" ...
##  $ Client.ID              : chr  "S2_B99008" "S2_Bonney" "S3_Jessie" "S3_McCauley" ...
##  $ Sample                 : int  6102468 6102469 6102476 6102477 6102484 6102485 6102496 6102497 6102514 6102515 ...
##  $ X                      : logi  NA NA NA NA NA NA ...
##  $ Category               : chr  "Captive" "Captive" "Captive" "Captive" ...
##  $ Sex.Age.Season         : chr  "FAU" "FAU" "FAW" "MAA" ...
##  $ Sex                    : chr  "F" "F" "F" "M" ...
##  $ Age                    : chr  "A" "A" "A" "A" ...
##  $ Season                 : Factor w/ 4 levels "Autumn","Spring",..: 3 3 4 1 3 4 1 3 2 3 ...
##  $ Location               : chr  "Monarto" "Healesville" "Monarto" "Healesville" ...
##  $ Agebyyear              : num  3.74 2.59 2.19 3.03 3 ...
##  $ Weight                 : chr  "8.12" "5.4" "12.95" "8.52" ...
##  $ X.1                    : logi  NA NA NA NA NA NA ...
##  $ Number.of.Tumours      : int  NA NA NA NA NA NA NA NA NA NA ...
##  $ Ulcerated              : logi  NA NA NA NA NA NA ...
##  $ UlcerationDepth        : chr  "" "" "" "" ...
##  $ Secondary.infection    : logi  NA NA NA NA NA NA ...
##  $ Total.tumour.volume    : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ Barcode.sequence       : chr  "GCTATCCT+AACAGGTG" "ACGTTCAG+AGTTGTGC" "CCGTAAGA+AGAGTCCA" "CAACACCT+AGCTACCA" ...
##  $ PF.Clusters            : chr  "5,338,890" "14,968,459" "4,340,498" "16,944,152" ...
##  $ X..of.the.lane         : num  1 3 1 3 1 1 1 2 1 2 ...
##  $ X..Perfect.barcode     : num  98.1 97.8 98 98 96.2 ...
##  $ X..One.mismatch.barcode: num  1.92 2.18 2.05 2.02 3.79 2.67 2.23 3.06 3.27 2.48 ...
##  $ Yield..Mbases.         : chr  "1,612" "4,520" "1,311" "5,117" ...
##  $ X..PF.Cluster          : int  100 100 100 100 100 100 100 100 100 100 ...
##  $ X.....Q30              : num  93.7 93.7 93.5 93 93.9 ...
##  $ Mean.Quality           : num  35.9 35.9 35.9 35.8 35.9 ...
##  $ X.2                    : logi  NA NA NA NA NA NA ...
##  $ X.3                    : logi  NA NA NA NA NA NA ...
##  $ X.4                    : logi  NA NA NA NA NA NA ...
##  $ CapLoc                 : logi  TRUE FALSE TRUE FALSE TRUE FALSE ...
##  $ MvF                    : Factor w/ 2 levels "F","M": 1 1 1 2 2 2 2 1 2 2 ...
##  $ SubAdvAd               : num  2 2 2 2 2 2 2 1 1 2 ...
dds <- DESeqDataSetFromMatrix(countData = x1 , colData = ssCapS, design = ~ Season +  SubAdvAd + CapLoc + MvF)
## converting counts to integer mode
##   the design formula contains one or more numeric variables with integer values,
##   specifying a model with increasing fold change for higher values.
##   did you mean for this to be a factor? if so, first convert
##   this variable to a factor using the factor() function
res <- DESeq(dds)
## estimating size factors
## estimating dispersions
## gene-wise dispersion estimates
## mean-dispersion relationship
## final dispersion estimates
## fitting model and testing
## -- replacing outliers and refitting for 10 genes
## -- DESeq argument 'minReplicatesForReplace' = 7 
## -- original counts are preserved in counts(dds)
## estimating dispersions
## fitting model and testing
z<- results(res)
vsd <- vst(dds, blind=FALSE,nsub=nrow(x1)-50)
zz<-cbind(as.data.frame(z),assay(vsd))
dge<-as.data.frame(zz[order(zz$pvalue),])
dgeCapS <- dge
sig <- subset(dge,padj<0.05)
sig1_up <- rownames(subset(sig,log2FoldChange>0))
sig1_dn <- rownames(subset(sig,log2FoldChange<0))
length(sig1_up)
## [1] 0
maplot(dgeCapS,"Male vs Female Captive devils")

make_volcano(dgeCapS,"Male vs Female Captive devils")

col <- as.character(as.numeric(grepl("F",ssCapS$Sex)))
col <- gsub("0","grey",col)
col <- gsub("1","black",col)
mtext("Sub-Adult=Orange, Adult=Brown")

sig[1:100,1:6] %>%
  kbl(caption="Comparison of Male vs Female Captive devils") %>%
  kable_paper("hover", full_width = F)
Comparison of Male vs Female Captive devils
baseMean log2FoldChange lfcSE stat pvalue padj
IDO1 5484.3259 -2.890992 0.6674776 -4.331220 0.0000148 0.0037961
SIRPA 215.9456 -1.339309 0.3773424 -3.549321 0.0003862 0.0446010
IL18 1718.3609 -1.258023 0.3626617 -3.468862 0.0005227 0.0446010
NA NA NA NA NA NA NA
NA.1 NA NA NA NA NA NA
NA.2 NA NA NA NA NA NA
NA.3 NA NA NA NA NA NA
NA.4 NA NA NA NA NA NA
NA.5 NA NA NA NA NA NA
NA.6 NA NA NA NA NA NA
NA.7 NA NA NA NA NA NA
NA.8 NA NA NA NA NA NA
NA.9 NA NA NA NA NA NA
NA.10 NA NA NA NA NA NA
NA.11 NA NA NA NA NA NA
NA.12 NA NA NA NA NA NA
NA.13 NA NA NA NA NA NA
NA.14 NA NA NA NA NA NA
NA.15 NA NA NA NA NA NA
NA.16 NA NA NA NA NA NA
NA.17 NA NA NA NA NA NA
NA.18 NA NA NA NA NA NA
NA.19 NA NA NA NA NA NA
NA.20 NA NA NA NA NA NA
NA.21 NA NA NA NA NA NA
NA.22 NA NA NA NA NA NA
NA.23 NA NA NA NA NA NA
NA.24 NA NA NA NA NA NA
NA.25 NA NA NA NA NA NA
NA.26 NA NA NA NA NA NA
NA.27 NA NA NA NA NA NA
NA.28 NA NA NA NA NA NA
NA.29 NA NA NA NA NA NA
NA.30 NA NA NA NA NA NA
NA.31 NA NA NA NA NA NA
NA.32 NA NA NA NA NA NA
NA.33 NA NA NA NA NA NA
NA.34 NA NA NA NA NA NA
NA.35 NA NA NA NA NA NA
NA.36 NA NA NA NA NA NA
NA.37 NA NA NA NA NA NA
NA.38 NA NA NA NA NA NA
NA.39 NA NA NA NA NA NA
NA.40 NA NA NA NA NA NA
NA.41 NA NA NA NA NA NA
NA.42 NA NA NA NA NA NA
NA.43 NA NA NA NA NA NA
NA.44 NA NA NA NA NA NA
NA.45 NA NA NA NA NA NA
NA.46 NA NA NA NA NA NA
NA.47 NA NA NA NA NA NA
NA.48 NA NA NA NA NA NA
NA.49 NA NA NA NA NA NA
NA.50 NA NA NA NA NA NA
NA.51 NA NA NA NA NA NA
NA.52 NA NA NA NA NA NA
NA.53 NA NA NA NA NA NA
NA.54 NA NA NA NA NA NA
NA.55 NA NA NA NA NA NA
NA.56 NA NA NA NA NA NA
NA.57 NA NA NA NA NA NA
NA.58 NA NA NA NA NA NA
NA.59 NA NA NA NA NA NA
NA.60 NA NA NA NA NA NA
NA.61 NA NA NA NA NA NA
NA.62 NA NA NA NA NA NA
NA.63 NA NA NA NA NA NA
NA.64 NA NA NA NA NA NA
NA.65 NA NA NA NA NA NA
NA.66 NA NA NA NA NA NA
NA.67 NA NA NA NA NA NA
NA.68 NA NA NA NA NA NA
NA.69 NA NA NA NA NA NA
NA.70 NA NA NA NA NA NA
NA.71 NA NA NA NA NA NA
NA.72 NA NA NA NA NA NA
NA.73 NA NA NA NA NA NA
NA.74 NA NA NA NA NA NA
NA.75 NA NA NA NA NA NA
NA.76 NA NA NA NA NA NA
NA.77 NA NA NA NA NA NA
NA.78 NA NA NA NA NA NA
NA.79 NA NA NA NA NA NA
NA.80 NA NA NA NA NA NA
NA.81 NA NA NA NA NA NA
NA.82 NA NA NA NA NA NA
NA.83 NA NA NA NA NA NA
NA.84 NA NA NA NA NA NA
NA.85 NA NA NA NA NA NA
NA.86 NA NA NA NA NA NA
NA.87 NA NA NA NA NA NA
NA.88 NA NA NA NA NA NA
NA.89 NA NA NA NA NA NA
NA.90 NA NA NA NA NA NA
NA.91 NA NA NA NA NA NA
NA.92 NA NA NA NA NA NA
NA.93 NA NA NA NA NA NA
NA.94 NA NA NA NA NA NA
NA.95 NA NA NA NA NA NA
NA.96 NA NA NA NA NA NA
write.table(dge,file="dgeCapS.tsv",sep="\t")

mx <- sig[,7:ncol(sig)]
mx <- head(mx,30)
colfunc <- colorRampPalette(c("blue", "white", "red"))
heatmap.2(as.matrix(mx),trace="none",scale="row",
          col=colfunc(25),ColSideColors=col,mar=c(5,12))