The fields of DenisovaMat, DenisovaMat, and AncestMat:

 [1] "allCount1"          "allCount"           "ibdC"              
 [4] "posAll"             "#SNPs"              "#Nea"              
 [7] "#Ref"               "#Alt"               "#New"              
[10] "NeaR"               "RefR"               "AltR"              
[13] "NewR"               "xAltCon"            "xRefCon"           
[16] "mAltCon"            "mRefCon"            "NeaPosC"           
[19] "AltPosC"            "RefPosC"            "IBDlength"         
[22] "IBDlengthCorrected" "#samples"           "AFR"               
[25] "AMR"                "ASN"                "EUR"               
[28] "AFRr"               "AMRr"               "ASNr"              
[31] "EURr"               "IBDlengthNew"       "ancientLengthSNVs" 
[34] "ancientLength"      "ancientRatio"   

"allCount1"  		  Non redundant IBD segment count        
"allCount"           	  count with redundant IBD segments removed
"ibdC"              	  Number of IBD segments in this interval
"posAll"             	  Number of the current interval               
"#SNPs"              	  Number of tagSNVs 
"#Nea"              	  Number of SNVs called in archaic genome (of tagSNVs)
"#Ref"               	  Number of SNVs matching human reference
"#Alt"               	  Number of SNVs matching human alternative (minor human)
"#New"              	  Number of SNVs that are different from human (major, minor)
"NeaR"               	  Ratio of SNVs called in archaic genome                    
"RefR"               	  Ratio of SNVs matching human reference                    
"AltR"              	  Ratio of SNVs matchin human alternative (minor)           
"NewR"               	  Ratio of SNVs that are different from human (major, minor)
"xAltCon"            	  median distance between matched (archaic-human) positions (minor human)         
"xRefCon"           	  median distance of reference positions (major human)              
"mAltCon"           	  mean distance between matched positions (minor human)            
"mRefCon"            	  mean distance between reference positions (major human)                
"NeaPosC"           	  median physical distance between tagSNV positions            
"AltPosC"            	  median physical distance between matched positions (minor human) 
"RefPosC"            	  median physical distance between reference positions (major human)     
"IBDlength"         	  length of IBD segment (maximum)
"IBDlengthCorrected" 	  length of IBD segment corrected (3/4 of chromosomes match)
"#samples"           	  number of samples with this IBD segment
"AFR"               	  number of Africans
"AMR"                	  number of admixed Americans
"ASN"                	  number of Asians
"EUR"               	  number of Europeans          
"AFRr"               	  ratio of Africans          
"AMRr"               	  ratio of admixed Americans 
"ASNr"              	  ratio of Asians            
"EURr"               	  ratio of Europeans         
"IBDlengthNew"            length of IBD (same as IBDlength)
"ancientLengthSNVs" 	  number of tagSNVs in archaic part - 1 (note the -1 !)
"ancientLength"      	  length of archaic part
"ancientRatio"   	  ratio of matching tagSNVs in archaic part 


NOTE: archaic or ancient refers always to the genome that is
indicated by the filename


###########


The fields of PopulationMat:

[1] "allCount1" "allCount"  "ibdC"      "posAll"    "#Samples"  "AFR"      
[7] "AMR"       "ASN"       "EUR"      

"allCount1"               Non redundant IBD segment count             
"allCount"                count with redundant IBD segments removed   
"ibdC"                    Number of IBD segments in this interval     
"posAll"                  Number of the current interval              
"#Samples"                Number of samples 
"AFR"                     ratio of Africans
"AMR"                     ratio of admixed Americans
"ASN"                     ratio of Asians
"EUR"                     ratio of Europeans


###############################################


LLL <- DenisovaMat[,22]
LLLZ <- which(LLL>10)
LLL <- LLL[LLLZ]


de <- intersect(de1,de2)
DE <- intersect(DE1,DE2)
ne <- intersect(ne1,ne2)
NE <- intersect(NE1,NE2)

dene <- intersect(de,ne)
de <- setdiff(de,dene)
ne <- setdiff(ne,dene)

DENE <- intersect(DE,NE)
DE <- setdiff(DE,DENE)
NE <- setdiff(NE,DENE)


AFR <- which(PopulationMat[,6]>0.2) #147574
ASN <- which(PopulationMat[,8]>0.2) #7472
EUR <- which(PopulationMat[,9]>0.2) #10688


AFRd <- which(PopulationMat[,6]>0.5) #141262
ASNd <- which(PopulationMat[,8]>0.5) #5161
EURd <- which(PopulationMat[,9]>0.5) #5915


LLLAFR <- DenisovaMat[AFR,22]
LLLASN <- DenisovaMat[ASN,22]
LLLEUR <- DenisovaMat[EUR,22]

LLLAFRd <- DenisovaMat[AFRd,22]
LLLASNd <- DenisovaMat[ASNd,22]
LLLEURd <- DenisovaMat[EURd,22]

neL <- NeanderMat[ne,34]
deL <- DenisovaMat[de,34]
deneL <- DenisovaMat[dene,34]


NEL <- NeanderMat[NE,34]
DEL <- DenisovaMat[DE,34]
DENEL <- DenisovaMat[dene,34]






> summary(DenisovaMat[,21])
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
      56    20120    25380    26970    30550 21250000 

> summary(DenisovaMat[,22])
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
       0    17610    23250    23950    28410 21250000 

Corrected:
> summary(LLL)
    Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
      34    17860    23360    24220    28480 21250000 


> summary(deL)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    252    7340   12830   15570   20700  291900 


> summary(neL)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    509   13600   20150   21220   26860  331300 

> summary(deneL)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    435   10740   18250   19560   26090  314100 




> summary(DenisovaMat[,34])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0       0       0    1102       0  314100 


> summary(NeanderMat[,34])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0       0       0    1963       0  331300 


> shorT <- which(DenisovaMat[,5]==9)
> shorTL <- DenisovaMat[shorT,22]
> summary(shorTL)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
     56   15820   21260   21700   26260  595000 




de1 <- which(DenisovaMat[,12]>0.15)
de2 <- which(DenisovaMat[,35]>0.3)
de <- intersect(de1,de2)

DE1 <- which(DenisovaMat[,12]>0.3)
DE2 <- which(DenisovaMat[,35]>0.6)
DE <- intersect(DE1,DE2)

ne1 <- which(NeanderMat[,12]>0.15)
ne2 <- which(NeanderMat[,35]>0.3)
ne <- intersect(ne1,ne2)

NE1 <- which(NeanderMat[,12]>0.3)
NE2 <- which(NeanderMat[,35]>0.6)
NE <- intersect(NE1,NE2)



dene <- intersect(de,ne)

de <- setdiff(de,dene)
ne <- setdiff(ne,dene)

DENE <- intersect(DE,NE)

DE <- setdiff(DE,DENE)
NE <- setdiff(NE,DENE)


> length(ne)
[1] 8173
> length(de)
[1] 4005
>  length(dene)
[1] 5606




summary(DenisovaMat[de,5])
summary(DenisovaMat[de,23])
summary(DenisovaMat[de,22])
summary(DenisovaMat[de,33])
summary(DenisovaMat[de,34])
summary(DenisovaMat[de,35])

> summary(DenisovaMat[de,5])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   9.00   14.00   25.00   32.06   41.00  164.00 
> summary(DenisovaMat[de,23])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   2.00    7.00   18.00   28.21   41.00  163.00 
> summary(DenisovaMat[de,22])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0   13050   21520   21740   28710  337800 
> summary(DenisovaMat[de,33])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   6.00    8.00   10.00   17.06   17.00  161.00 
> summary(DenisovaMat[de,34])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    252    7340   12830   15570   20700  291900 
> summary(DenisovaMat[de,35])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.3051  0.5000  0.5625  0.5925  0.6667  1.0000 


summary(NeanderMat[ne,5])
summary(NeanderMat[ne,23])
summary(NeanderMat[ne,22])
summary(NeanderMat[ne,33])
summary(NeanderMat[ne,34])
summary(NeanderMat[ne,35])



> summary(NeanderMat[ne,5])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   9.00   11.00   16.00   21.53   25.00  254.00 
> summary(NeanderMat[ne,23])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   2.00    5.00   16.00   24.84   36.00  151.00 
> summary(NeanderMat[ne,22])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0   16570   23260   23340   29200  410100 
> summary(NeanderMat[ne,33])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   6.00    8.00   10.00   15.22   15.00  251.00 
> summary(NeanderMat[ne,34])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    509   13600   20150   21220   26860  331300 
> summary(NeanderMat[ne,35])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.3462  0.6667  0.7284  0.7350  0.8000  1.0000 
>

summary(DenisovaMat[dene,5])
summary(DenisovaMat[dene,23])
summary(DenisovaMat[dene,22])
summary(NeanderMat[dene,33])
summary(DenisovaMat[dene,33])
summary(NeanderMat[dene,34])
summary(DenisovaMat[dene,34])
summary(NeanderMat[dene,35])
summary(DenisovaMat[dene,35])


> summary(DenisovaMat[dene,5])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   9.00   15.00   25.00   32.95   42.00  266.00 
> summary(DenisovaMat[dene,23])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    2.0    10.0    26.0    34.4    51.0   176.0 
> summary(DenisovaMat[dene,22])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
      0   14060   23100   22840   30120  318600 
> summary(NeanderMat[dene,33])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   6.00   10.00   15.00   23.82   30.00  264.00 
> summary(DenisovaMat[dene,33])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
   6.00    9.00   13.00   21.17   25.00  263.00 
> summary(NeanderMat[dene,34])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    666   14430   22190   23240   29730  310300 
> summary(DenisovaMat[dene,34])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    435   10740   18250   19560   26090  314100 
> summary(NeanderMat[dene,35])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.3846  0.6667  0.7449  0.7414  0.8182  1.0000 
> summary(DenisovaMat[dene,35])
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.3023  0.5263  0.6222  0.6387  0.7500  1.0000 



summary(DenisovaMat[de,24:31])
summary(NeanderMat[ne,24:31])
summary(DenisovaMat[dene,24:31])


> summary(DenisovaMat[de,24:31])
      AFR              AMR              ASN              EUR       
 Min.   :  0.00   Min.   : 0.000   Min.   : 0.000   Min.   : 0.00  
 1st Qu.:  4.00   1st Qu.: 0.000   1st Qu.: 0.000   1st Qu.: 0.00  
 Median : 13.00   Median : 1.000   Median : 0.000   Median : 0.00  
 Mean   : 21.52   Mean   : 2.158   Mean   : 2.321   Mean   : 2.21  
 3rd Qu.: 31.00   3rd Qu.: 3.000   3rd Qu.: 0.000   3rd Qu.: 0.00  
 Max.   :149.00   Max.   :37.000   Max.   :83.000   Max.   :79.00  
      AFRr             AMRr              ASNr              EURr        
 Min.   :0.0000   Min.   :0.00000   Min.   :0.00000   Min.   :0.00000  
 1st Qu.:0.8000   1st Qu.:0.00000   1st Qu.:0.00000   1st Qu.:0.00000  
 Median :0.9286   Median :0.04225   Median :0.00000   Median :0.00000  
 Mean   :0.7797   Mean   :0.06653   Mean   :0.09793   Mean   :0.05586  
 3rd Qu.:1.0000   3rd Qu.:0.09091   3rd Qu.:0.00000   3rd Qu.:0.00000  
 Max.   :1.0000   Max.   :1.00000   Max.   :1.00000   Max.   :1.00000  


> summary(NeanderMat[ne,24:31])
      AFR               AMR              ASN              EUR         
 Min.   :  0.000   Min.   : 0.000   Min.   : 0.000   Min.   :  0.000  
 1st Qu.:  0.000   1st Qu.: 0.000   1st Qu.: 0.000   1st Qu.:  0.000  
 Median :  3.000   Median : 1.000   Median : 0.000   Median :  0.000  
 Mean   :  9.681   Mean   : 3.114   Mean   : 5.879   Mean   :  6.166  
 3rd Qu.: 12.000   3rd Qu.: 4.000   3rd Qu.: 5.000   3rd Qu.:  5.000  
 Max.   :131.000   Max.   :49.000   Max.   :96.000   Max.   :119.000  
      AFRr             AMRr              ASNr             EURr       
 Min.   :0.0000   Min.   :0.00000   Min.   :0.0000   Min.   :0.0000  
 1st Qu.:0.0000   1st Qu.:0.00000   1st Qu.:0.0000   1st Qu.:0.0000  
 Median :0.5000   Median :0.04444   Median :0.0000   Median :0.0000  
 Mean   :0.4891   Mean   :0.10672   Mean   :0.2113   Mean   :0.1929  
 3rd Qu.:1.0000   3rd Qu.:0.15789   3rd Qu.:0.2941   3rd Qu.:0.3438  
 Max.   :1.0000   Max.   :1.00000   Max.   :1.0000   Max.   :1.0000  


> summary(DenisovaMat[dene,24:31])
      AFR              AMR              ASN               EUR         
 Min.   :  0.00   Min.   : 0.000   Min.   :  0.000   Min.   :  0.000  
 1st Qu.:  2.00   1st Qu.: 0.000   1st Qu.:  0.000   1st Qu.:  0.000  
 Median : 10.00   Median : 1.000   Median :  0.000   Median :  0.000  
 Mean   : 19.66   Mean   : 3.521   Mean   :  5.788   Mean   :  5.433  
 3rd Qu.: 30.00   3rd Qu.: 4.000   3rd Qu.:  3.000   3rd Qu.:  3.000  
 Max.   :157.00   Max.   :49.000   Max.   :101.000   Max.   :110.000  
      AFRr             AMRr              ASNr             EURr       
 Min.   :0.0000   Min.   :0.00000   Min.   :0.0000   Min.   :0.0000  
 1st Qu.:0.1231   1st Qu.:0.00000   1st Qu.:0.0000   1st Qu.:0.0000  
 Median :0.8889   Median :0.05195   Median :0.0000   Median :0.0000  
 Mean   :0.6381   Mean   :0.08716   Mean   :0.1529   Mean   :0.1218  
 3rd Qu.:0.9750   3rd Qu.:0.11628   3rd Qu.:0.1250   3rd Qu.:0.1000  
 Max.   :1.0000   Max.   :1.00000   Max.   :1.0000   Max.   :1.0000  
> 

colnames(DenisovaMat)[24]
length(which(DenisovaMat[de,24]>0))
colnames(DenisovaMat)[25]
length(which(DenisovaMat[de,25]>0))
colnames(DenisovaMat)[26]
length(which(DenisovaMat[de,26]>0))
colnames(DenisovaMat)[27]
length(which(DenisovaMat[de,27]>0))

colnames(NeanderMat)[24]
length(which(NeanderMat[ne,24]>0))
colnames(NeanderMat)[25]
length(which(NeanderMat[ne,25]>0))
colnames(NeanderMat)[26]
length(which(NeanderMat[ne,26]>0))
colnames(NeanderMat)[27]
length(which(NeanderMat[ne,27]>0))

colnames(DenisovaMat)[24]
length(which(DenisovaMat[dene,24]>0))
colnames(DenisovaMat)[25]
length(which(DenisovaMat[dene,25]>0))
colnames(DenisovaMat)[26]
length(which(DenisovaMat[dene,26]>0))
colnames(DenisovaMat)[27]
length(which(DenisovaMat[dene,27]>0))

> colnames(DenisovaMat)[24]
[1] "AFR"
> length(which(DenisovaMat[de,24]>0))
[1] 3590
> colnames(DenisovaMat)[25]
[1] "AMR"
> length(which(DenisovaMat[de,25]>0))
[1] 2390
> colnames(DenisovaMat)[26]
[1] "ASN"
> length(which(DenisovaMat[de,26]>0))
[1] 681
> colnames(DenisovaMat)[27]
[1] "EUR"
> length(which(DenisovaMat[de,27]>0))
[1] 872

c(length(which(DenisovaMat[de,24]>0)),length(which(DenisovaMat[de,25]>0)),length(which(DenisovaMat[de,26]>0)),length(which(DenisovaMat[de,27]>0)))/length(which(DenisovaMat[de,24]>0))
> c(length(which(DenisovaMat[de,24]>0)),length(which(DenisovaMat[de,25]>0)),length(which(DenisovaMat[de,26]>0)),length(which(DenisovaMat[de,27]>0)))/length(which(DenisovaMat[de,24]>0))
[1] 1.0000000 0.6657382 0.1896936 0.2428969



> colnames(NeanderMat)[24]
[1] "AFR"
> length(which(NeanderMat[ne,24]>0))
[1] 5691
> colnames(NeanderMat)[25]
[1] "AMR"
> length(which(NeanderMat[ne,25]>0))
[1] 4641
> colnames(NeanderMat)[26]
[1] "ASN"
> length(which(NeanderMat[ne,26]>0))
[1] 2867
> colnames(NeanderMat)[27]
[1] "EUR"
> length(which(NeanderMat[ne,27]>0))
[1] 3384
> 
c(length(which(NeanderMat[ne,24]>0)),length(which(NeanderMat[ne,25]>0)),length(which(NeanderMat[ne,26]>0)),length(which(NeanderMat[ne,27]>0)))/length(which(NeanderMat[ne,24]>0))
> c(length(which(NeanderMat[ne,24]>0)),length(which(NeanderMat[ne,25]>0)),length(which(NeanderMat[ne,26]>0)),length(which(NeanderMat[ne,27]>0)))/length(which(NeanderMat[ne,24]>0))
[1] 1.0000000 0.8154982 0.5037779 0.5946231



> colnames(DenisovaMat)[24]
[1] "AFR"
> length(which(DenisovaMat[dene,24]>0))
[1] 4825
> colnames(DenisovaMat)[25]
[1] "AMR"
> length(which(DenisovaMat[dene,25]>0))
[1] 3677
> colnames(DenisovaMat)[26]
[1] "ASN"
> length(which(DenisovaMat[dene,26]>0))
[1] 1768
> colnames(DenisovaMat)[27]
[1] "EUR"
> length(which(DenisovaMat[dene,27]>0))
[1] 2097

c(length(which(DenisovaMat[dene,24]>0)),length(which(DenisovaMat[dene,25]>0)),length(which(DenisovaMat[dene,26]>0)),length(which(DenisovaMat[dene,27]>0)))/length(which(DenisovaMat[dene,24]>0))

> c(length(which(DenisovaMat[dene,24]>0)),length(which(DenisovaMat[dene,25]>0)),length(which(DenisovaMat[dene,26]>0)),length(which(DenisovaMat[dene,27]>0)))/length(which(DenisovaMat[dene,24]>0))
[1] 1.0000000 0.7620725 0.3664249 0.4346114



c(length(which(DenisovaMat[de,24]>0)),length(which(DenisovaMat[de,25]>0)),length(which(DenisovaMat[de,26]>0)),length(which(DenisovaMat[de,27]>0)))/length(which(DenisovaMat[de,24]>0))
c(length(which(NeanderMat[ne,24]>0)),length(which(NeanderMat[ne,25]>0)),length(which(NeanderMat[ne,26]>0)),length(which(NeanderMat[ne,27]>0)))/length(which(NeanderMat[ne,24]>0))
c(length(which(DenisovaMat[dene,24]>0)),length(which(DenisovaMat[dene,25]>0)),length(which(DenisovaMat[dene,26]>0)),length(which(DenisovaMat[dene,27]>0)))/length(which(DenisovaMat[dene,24]>0))