Each Tumor Type separated!!

folderNames <- c("BLCA_PRS_20211011",
                 "BRCA_PRS_20211011",
                 "CESC_PRS_20211011",
                 "CHOL_PRS_20211011",
                 "ESCA_PRS_20211011",
                 "GBM_PRS_20211011",
                 "HNSC_PRS_20211011",
                 "KICH_PRS_20211011",
                 "KIRC_PRS_20211011",
                 "KIRP_PRS_20211011",
                 "LIHC_PRS_20211011",
                 "LUAD_PRS_20211011",
                 "LUSC_PRS_20211011",
                 "PAAD_PRS_20211011",
                 "PRAD_PRS_20211011",
                 "SARC_PRS_20211011",
                 "SKCM_PRS_20211011",
                 "TGCT_PRS_20211011",
                 "UCEC_PRS_20211011",
                 "UCS_PRS_20211011"
                 
)



for (i in 1:length(folderNames)){
  #dir(file.path(getwd(),folderNames[i]), pattern = "20211011", full.names=F)
  #df <- data.frame(gene=c(), trait=c(), p_value=c())
  final<-data.frame()
  tumorName <- folderNames[i]
  fileNames <- dir(file.path(getwd(),folderNames[i]),pattern = "res.txt", full.names = F) #This will create a vector that contains the list of file names ending with "res.txt". 
  
  for (j in 1:length(fileNames)){
    traitName<- fileNames[j]
    print(traitName)
    
    data <- read.table(file.path(getwd(),tumorName,traitName), comment="", header = TRUE)
    #write.table(data, file = paste(traitName,".txt",sep=""), sep = "\t", quote = FALSE)
    
    
    
    demodf<-data.frame(c(1),c(1))
    
    for (k in 1:nrow(data)){
      if (is.na(data[k,1])){
        data[k,1] <- 1
      }
      if(is.na(data[k,2])){
        data[k,1] <- 1
      }
      if (data[k,1] > data[k,2]){
        demodf[k,] <- c(row.names(data[k,]),data[k,2])
      } else{ demodf[k,] <- c(row.names(data[k,]), data[k,1])}
    }
    

    
    demodf<-demodf[order(demodf[,2]),]
    
    demodf<- demodf[1:20,]
   
    
    
    c<- rep(traitName,20)
    
    df<-data.frame( gene =demodf[,1], trait = c, pval = demodf[,2])
    
    
    final<- rbind(final, df)
  }
  

  final<-final[order(final[,1]),]
  colnames(final)<- c("gene", "trait", "p_value")
  write.table(final, file = paste(tumorName, "top20pval.txt", sep=""), sep = "\t", quote = FALSE, row.names=FALSE)
  
  data <- read.table( paste(tumorName, "top20pval.txt", sep=""), comment="", header = TRUE)
  data<- data[order(data$p_value),]
  data<- data[1:20,]
  write.table(data, file = paste(tumorName, "top20pval.txt", sep=""), sep = "\t", quote = FALSE, row.names=FALSE)
  
  
}
## [1] NA
## Warning in file(file, "rt"): cannot open file '/Users/jihyun/Desktop/PRS_histo/
## top20/BLCA_PRS_20211011/NA': No such file or directory
## Error in file(file, "rt"): cannot open the connection

Check the files that I created above.

fileNames <- dir(file.path(getwd()),pattern = "pval.txt", full.names = F)
for (i in 1:length(fileNames)){
  data <- read.table(fileNames[i], comment="", header = TRUE)
  print(i)
  print(fileNames[i])
  print(data)
}
## [1] 1
## [1] "BLCA_PRS_20211011top20pval.txt"
##        gene                                trait      p_value
## 1      FTH1                     Vitiligo_res.txt 0.0002769139
## 2    RNF111             T2D_DIAGRAM_2017_res.txt 0.0003455066
## 3      TP53             SmokingCessation_res.txt 0.0007401188
## 4  TRAF3IP2           PD_GWAS_2017_N300k_res.txt 0.0007739485
## 5    RNF111                  ukbEUR_DIA2_res.txt 0.0008347651
## 6    CREBBP                   UC_NG_2015_res.txt 0.0008594374
## 7    CREBBP                SCZ_Cell_2018_res.txt 0.0010783204
## 8      FMN2                     Vitiligo_res.txt 0.0011396484
## 9  HIST1H1E                DrinksPerWeek_res.txt 0.0011632889
## 10     ACTB  Prostate_cancer_2017_common_res.txt 0.0013771109
## 11     PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 12      SF1               ukbEUR_TI_cojo_res.txt 0.0019107998
## 13     PHF3             T2D_DIAGRAM_2017_res.txt 0.0021262579
## 14     ACTB                     Vitiligo_res.txt 0.0023826722
## 15   PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 16    MKI67             SmokingCessation_res.txt 0.0026282406
## 17 KIAA1522           PD_GWAS_2017_N300k_res.txt 0.0028537287
## 18   PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 19   PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 20   RNF111           ukbEUR_HEMORRHOIDS_res.txt 0.0028709435
## [1] 2
## [1] "BRCA_PRS_20211011top20pval.txt"
##      gene                                trait      p_value
## 1    TP53             SmokingCessation_res.txt 0.0007401188
## 2    CBFB             T2D_DIAGRAM_2017_res.txt 0.0010473054
## 3    PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 4    CDH1                ukbEUR_OSTIOP_res.txt 0.0018216125
## 5  PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 6  PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 7  PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 8    TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 9    PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 10 MAP2K4                ukbEUR_CANCER_res.txt 0.0037016650
## 11  FOXA1                DrinksPerWeek_res.txt 0.0053961927
## 12  MUC17              ukbEUR_DYSLIPID_res.txt 0.0055750835
## 13  SF3B1                 ukbEUR_HYPER_res.txt 0.0068509853
## 14  RUNX1           PD_GWAS_2017_N300k_res.txt 0.0075980048
## 15  FBXW7               RA_NG2010.hap3_res.txt 0.0083137975
## 16  FBXW7                  ukbEUR_DIA2_res.txt 0.0083876929
## 17  FBXW7               ukbEUR_CI_cojo_res.txt 0.0100089845
## 18   TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 19   PTEN                ukbEUR_CANCER_res.txt 0.0115651547
## 20 MAP3K1                   UC_NG_2015_res.txt 0.0133613821
## [1] 3
## [1] "CESC_PRS_20211011top20pval.txt"
##      gene                                trait      p_value
## 1  ABCA12             T2D_DIAGRAM_2017_res.txt 0.0002164297
## 2    TP53             SmokingCessation_res.txt 0.0007401188
## 3     FLG                ukbEUR_Height_res.txt 0.0007812806
## 4    PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 5     FLG                  ukbEUR_CARD_res.txt 0.0023720818
## 6  PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 7  PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 8  PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 9    TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 10   PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 11   BAP1           ukbEUR_PSYCHIATRIC_res.txt 0.0034998197
## 12    FLG                ukbEUR_ASTHMA_res.txt 0.0069526651
## 13  MAPK1  Prostate_cancer_2017_common_res.txt 0.0075311878
## 14  FBXW7               RA_NG2010.hap3_res.txt 0.0083137975
## 15  FBXW7                  ukbEUR_DIA2_res.txt 0.0083876929
## 16    FLG                     Vitiligo_res.txt 0.0091563574
## 17  CASP8             CigarettesPerDay_res.txt 0.0092958334
## 18  CASP8              ukbEUR_DYSLIPID_res.txt 0.0099648285
## 19  FBXW7               ukbEUR_CI_cojo_res.txt 0.0100089845
## 20   TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## [1] 4
## [1] "CHOL_PRS_20211011top20pval.txt"
##       gene                      trait      p_value
## 1    DNAH5           Vitiligo_res.txt 0.0004671867
## 2    DNAH5     RA_NG2010.hap3_res.txt 0.0020602637
## 3     BAP1 ukbEUR_PSYCHIATRIC_res.txt 0.0034998197
## 4    DNAH5      SCZ_Cell_2018_res.txt 0.0047871641
## 5  ATG16L1      SCZ_Cell_2018_res.txt 0.0075287986
## 6    PBRM1         IQ_NG_2018_res.txt 0.0124424884
## 7    PBRM1       IQ_NG_2018.1_res.txt 0.0124424884
## 8    DNAH5         ukbEUR_PVD_res.txt 0.0139269786
## 9     BAP1         ukbEUR_PVD_res.txt 0.0171746991
## 10   PBRM1           Vitiligo_res.txt 0.0190849627
## 11 ATG16L1         ukbEUR_PVD_res.txt 0.0235689577
## 12    BAP1        ukbEUR_DIA2_res.txt 0.0291117006
## 13    BAP1     ukbEUR_OBESITY_res.txt 0.0297163470
## 14   DNAH5   T2D_DIAGRAM_2017_res.txt 0.0326469621
## 15   PBRM1        ukbEUR_CARD_res.txt 0.0330733089
## 16   PBRM1     RA_NG2010.hap3_res.txt 0.0335045213
## 17   DNAH5      ukbEUR_CANCER_res.txt 0.0403196180
## 18 ATG16L1      ukbEUR_OSTIOP_res.txt 0.0436618870
## 19    BAP1 ukbEUR_HEMORRHOIDS_res.txt 0.0480660320
## 20 ATG16L1   T2D_DIAGRAM_2017_res.txt 0.0539340733
## [1] 5
## [1] "ESCA_PRS_20211011top20pval.txt"
##       gene                                trait      p_value
## 1     TP53             SmokingCessation_res.txt 0.0007401188
## 2   PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 3   PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 4   PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 5     TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 6    SMAD4                   IQ_NG_2018_res.txt 0.0051795004
## 7    SMAD4                 IQ_NG_2018.1_res.txt 0.0051795004
## 8     TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 9  SLC17A6                ukbEUR_OSTIOA_res.txt 0.0117283395
## 10 SMARCA4           ukbEUR_HEMORRHOIDS_res.txt 0.0127122366
## 11    TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 12 SLC17A6               ukbEUR_CI_cojo_res.txt 0.0198172523
## 13   NAA16              IBD_NG2017.hap3_res.txt 0.0213335650
## 14    TP53                   IQ_NG_2018_res.txt 0.0214374008
## 15    TP53                 IQ_NG_2018.1_res.txt 0.0214374008
## 16  PIK3CA EA_NG_2018_excluding_23andMe_res.txt 0.0230011023
## 17  NFE2L2                  ukbEUR_DIA2_res.txt 0.0232001439
## 18 SLC17A6               ukbEUR_OBESITY_res.txt 0.0233680500
## 19   NAA16                   UC_NG_2015_res.txt 0.0309229050
## 20   SMAD4              ukbEUR_DYSLIPID_res.txt 0.0320156095
## [1] 6
## [1] "GBM_PRS_20211011top20pval.txt"
##       gene                                trait      p_value
## 1     EGFR EA_NG_2018_excluding_23andMe_res.txt 0.0004740343
## 2    LZTR1           ukbEUR_PSYCHIATRIC_res.txt 0.0005327073
## 3     EGFR                   IQ_NG_2018_res.txt 0.0006591103
## 4     EGFR                 IQ_NG_2018.1_res.txt 0.0006591103
## 5     TP53             SmokingCessation_res.txt 0.0007401188
## 6     PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 7    LZTR1           PD_GWAS_2017_N300k_res.txt 0.0021066294
## 8   PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 9   PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 10  PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 11    TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 12    PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 13  GABRA6                SCZ_Cell_2018_res.txt 0.0044397037
## 14   LZTR1             T2D_DIAGRAM_2017_res.txt 0.0060306718
## 15 IL18RAP                  MDD_NG_2018_res.txt 0.0069643579
## 16  PIK3R1               ukbEUR_TI_cojo_res.txt 0.0090167500
## 17     LUM                ukbEUR_Height_res.txt 0.0091905028
## 18  PIK3R1                SCZ_Cell_2018_res.txt 0.0100184373
## 19    TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 20    RPL5              ukbEUR_DYSLIPID_res.txt 0.0105361097
## [1] 7
## [1] "HNSC_PRS_20211011top20pval.txt"
##       gene                                trait      p_value
## 1    HLA-A               ukbEUR_CI_cojo_res.txt 0.0002212435
## 2     TP53             SmokingCessation_res.txt 0.0007401188
## 3     NSD1                   ukbEUR_PVD_res.txt 0.0011092138
## 4   THSD7A             CigarettesPerDay_res.txt 0.0012157936
## 5     PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 6    KEAP1           PD_GWAS_2017_N300k_res.txt 0.0021675894
## 7  GPATCH8                ukbEUR_OSTIOP_res.txt 0.0023927649
## 8   PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 9  GPATCH8               RA_NG2010.hap3_res.txt 0.0026242661
## 10   HLA-A                   ukbEUR_BMI_res.txt 0.0028476582
## 11  PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 12  PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 13    TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 14    PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 15    NSD1         ukbEUR_PEPTIC_ULCERS_res.txt 0.0048931031
## 16    RARG                   IQ_NG_2018_res.txt 0.0051681766
## 17    RARG                 IQ_NG_2018.1_res.txt 0.0051681766
## 18   SMAD4                   IQ_NG_2018_res.txt 0.0051795004
## 19   SMAD4                 IQ_NG_2018.1_res.txt 0.0051795004
## 20    NSD1             CigarettesPerDay_res.txt 0.0066747184
## [1] 8
## [1] "KICH_PRS_20211011top20pval.txt"
##    gene                                trait      p_value
## 1  TP53             SmokingCessation_res.txt 0.0007401188
## 2  FRG1              ukbEUR_DYSLIPID_res.txt 0.0033358421
## 3  TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 4  TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 5  TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 6  TP53                   IQ_NG_2018_res.txt 0.0214374008
## 7  TP53                 IQ_NG_2018.1_res.txt 0.0214374008
## 8  FRG1                  ukbEUR_CARD_res.txt 0.0293939313
## 9  TP53               ukbEUR_TI_cojo_res.txt 0.0389900734
## 10 TP53                ukbEUR_OSTIOA_res.txt 0.0595673904
## 11 FRG1             SmokingCessation_res.txt 0.0623154913
## 12 TP53             CigarettesPerDay_res.txt 0.0673896380
## 13 TP53                  SWB_NG_2015_res.txt 0.0791582883
## 14 FRG1               ukbEUR_CI_cojo_res.txt 0.1150304458
## 15 TP53                  MDD_NG_2018_res.txt 0.1160794638
## 16 FRG1              IBD_NG2017.hap3_res.txt 0.1346881465
## 17 TP53                ukbEUR_Height_res.txt 0.1394949103
## 18 FRG1        ukbEUR_VARICOSE_VEINS_res.txt 0.1690146090
## 19 TP53                DrinksPerWeek_res.txt 0.1963375151
## 20 FRG1                  SWB_NG_2015_res.txt 0.1972382558
## [1] 9
## [1] "KIRC_PRS_20211011top20pval.txt"
##     gene                                trait      p_value
## 1   NOS1               ukbEUR_OBESITY_res.txt 0.0006276049
## 2   TP53             SmokingCessation_res.txt 0.0007401188
## 3   PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 4    VHL               ukbEUR_OBESITY_res.txt 0.0023679925
## 5   TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 6   PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 7   BAP1           ukbEUR_PSYCHIATRIC_res.txt 0.0034998197
## 8    VHL               RA_NG2010.hap3_res.txt 0.0058610353
## 9    VHL                   ukbEUR_BMI_res.txt 0.0070159046
## 10  TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 11  PTEN                ukbEUR_CANCER_res.txt 0.0115651547
## 12 SETD2                     Vitiligo_res.txt 0.0123358166
## 13 PBRM1                   IQ_NG_2018_res.txt 0.0124424884
## 14 PBRM1                 IQ_NG_2018.1_res.txt 0.0124424884
## 15  NOS1                     Vitiligo_res.txt 0.0146257972
## 16  BAP1                   ukbEUR_PVD_res.txt 0.0171746991
## 17  TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 18  NOS1                ukbEUR_OSTIOA_res.txt 0.0185103733
## 19 PBRM1                     Vitiligo_res.txt 0.0190849627
## 20   ATM                ukbEUR_ASTHMA_res.txt 0.0191745135
## [1] 10
## [1] "KIRP_PRS_20211011top20pval.txt"
##       gene                                trait    p_value
## 1  SMARCA4           ukbEUR_HEMORRHOIDS_res.txt 0.01271224
## 2     CUL3  Prostate_cancer_2017_common_res.txt 0.01342059
## 3     CUL3 ukbEUR_HERNIA_ABDOMINOPELVIC_res.txt 0.01936885
## 4      MET             SmokingCessation_res.txt 0.02628956
## 5      MET EA_NG_2018_excluding_23andMe_res.txt 0.03599149
## 6     KRAS                  ukbEUR_CARD_res.txt 0.04568369
## 7      MET                ukbEUR_ASTHMA_res.txt 0.04607232
## 8  SMARCA4  Prostate_cancer_2017_common_res.txt 0.04847619
## 9  SMARCA4                   ukbEUR_PVD_res.txt 0.04948129
## 10     MET                ukbEUR_Height_res.txt 0.06689932
## 11     MET                   IQ_NG_2018_res.txt 0.06713455
## 12     MET                 IQ_NG_2018.1_res.txt 0.06713455
## 13    CUL3                   ukbEUR_PVD_res.txt 0.07415749
## 14     MET     ukbEUR_ALLERGIC_RHINITIS_res.txt 0.08035187
## 15     MET               ukbEUR_CI_cojo_res.txt 0.09090835
## 16 SMARCA4                 ukbEUR_HYPER_res.txt 0.09879460
## 17 SMARCA4             CigarettesPerDay_res.txt 0.09991760
## 18     MET             T2D_DIAGRAM_2017_res.txt 0.10295348
## 19     MET           PD_GWAS_2017_N300k_res.txt 0.10401327
## 20     MET                   ukbEUR_BMI_res.txt 0.11077365
## [1] 11
## [1] "LIHC_PRS_20211011top20pval.txt"
##       gene                                trait      p_value
## 1     TP53             SmokingCessation_res.txt 0.0007401188
## 2    KEAP1           PD_GWAS_2017_N300k_res.txt 0.0021675894
## 3  PCDHB16                ukbEUR_CANCER_res.txt 0.0021761148
## 4     TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 5     BAP1           ukbEUR_PSYCHIATRIC_res.txt 0.0034998197
## 6  COL11A1 EA_NG_2018_excluding_23andMe_res.txt 0.0050359535
## 7    ARID2                     Vitiligo_res.txt 0.0062926817
## 8    HNF1A                 ukbEUR_CASES_res.txt 0.0077910223
## 9   CTNNB1                     Vitiligo_res.txt 0.0089100472
## 10 COL11A1             SmokingCessation_res.txt 0.0095347877
## 11    TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 12   AXIN1       ukbEUR_IRON_DEFICIENCY_res.txt 0.0110449047
## 13   HNF1A                  ukbEUR_CARD_res.txt 0.0123147715
## 14     RB1              IBD_NG2017.hap3_res.txt 0.0143402527
## 15    BAP1                   ukbEUR_PVD_res.txt 0.0171746991
## 16    TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 17   HNF1A               RA_NG2010.hap3_res.txt 0.0192544089
## 18 PCDHB16                     Vitiligo_res.txt 0.0201713061
## 19    TP53                   IQ_NG_2018_res.txt 0.0214374008
## 20    TP53                 IQ_NG_2018.1_res.txt 0.0214374008
## [1] 12
## [1] "LUAD_PRS_20211011top20pval.txt"
##       gene                                trait      p_value
## 1     EGFR EA_NG_2018_excluding_23andMe_res.txt 0.0004740343
## 2     EGFR                   IQ_NG_2018_res.txt 0.0006591103
## 3     EGFR                 IQ_NG_2018.1_res.txt 0.0006591103
## 4     TP53             SmokingCessation_res.txt 0.0007401188
## 5    KEAP1           PD_GWAS_2017_N300k_res.txt 0.0021675894
## 6     TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 7     BRAF                     Vitiligo_res.txt 0.0046410362
## 8   DZIP1L                 ukbEUR_HYPER_res.txt 0.0053861918
## 9    ARID2                     Vitiligo_res.txt 0.0062926817
## 10    TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 11    BRAF                ukbEUR_OSTIOP_res.txt 0.0109926260
## 12   LCE1F           ukbEUR_HEMORRHOIDS_res.txt 0.0117301686
## 13   SETD2                     Vitiligo_res.txt 0.0123358166
## 14 SMARCA4           ukbEUR_HEMORRHOIDS_res.txt 0.0127122366
## 15    EGFR                  ukbEUR_DIA2_res.txt 0.0132844394
## 16    BRAF             T2D_DIAGRAM_2017_res.txt 0.0134928488
## 17  DZIP1L           ukbEUR_PSYCHIATRIC_res.txt 0.0139728711
## 18   KCNQ2                DrinksPerWeek_res.txt 0.0142328375
## 19     RB1              IBD_NG2017.hap3_res.txt 0.0143402527
## 20  DZIP1L                 ukbEUR_CASES_res.txt 0.0146838692
## [1] 13
## [1] "LUSC_PRS_20211011top20pval.txt"
##        gene                                trait      p_value
## 1      TP53             SmokingCessation_res.txt 0.0007401188
## 2      PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 3     KEAP1           PD_GWAS_2017_N300k_res.txt 0.0021675894
## 4    PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 5    PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 6    PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 7      TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 8      PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 9      TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 10     PTEN                ukbEUR_CANCER_res.txt 0.0115651547
## 11 ADAMTS12                ukbEUR_CANCER_res.txt 0.0121119974
## 12      RB1              IBD_NG2017.hap3_res.txt 0.0143402527
## 13    ELTD1                   IQ_NG_2018_res.txt 0.0166844865
## 14    ELTD1                 IQ_NG_2018.1_res.txt 0.0166844865
## 15     TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 16     PTEN              ukbEUR_DYSLIPID_res.txt 0.0209265850
## 17     TP53                   IQ_NG_2018_res.txt 0.0214374008
## 18     TP53                 IQ_NG_2018.1_res.txt 0.0214374008
## 19    DPPA4                ukbEUR_OSTIOA_res.txt 0.0223135875
## 20 ADAMTS12                  SWB_NG_2015_res.txt 0.0225604157
## [1] 14
## [1] "PAAD_PRS_20211011top20pval.txt"
##      gene                                trait      p_value
## 1    TP53             SmokingCessation_res.txt 0.0007401188
## 2   RNF43                     Vitiligo_res.txt 0.0022529261
## 3    TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 4   SMAD4                   IQ_NG_2018_res.txt 0.0051795004
## 5   SMAD4                 IQ_NG_2018.1_res.txt 0.0051795004
## 6   RNF43            SmokingInitiation_res.txt 0.0054623390
## 7   RNF43           ukbEUR_HEMORRHOIDS_res.txt 0.0089476290
## 8    TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 9   RNF43                 ukbEUR_CASES_res.txt 0.0161825409
## 10   TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 11  RNF43         ukbEUR_PEPTIC_ULCERS_res.txt 0.0208808450
## 12   TP53                   IQ_NG_2018_res.txt 0.0214374008
## 13   TP53                 IQ_NG_2018.1_res.txt 0.0214374008
## 14  SMAD4              ukbEUR_DYSLIPID_res.txt 0.0320156095
## 15  COTL1                ukbEUR_Height_res.txt 0.0333056868
## 16  SMAD4                 ukbEUR_CASES_res.txt 0.0348276787
## 17 ARID1A                     Vitiligo_res.txt 0.0386561376
## 18 TGFBR2  Prostate_cancer_2017_common_res.txt 0.0386676118
## 19   TP53               ukbEUR_TI_cojo_res.txt 0.0389900734
## 20  RNF43                   ukbEUR_PVD_res.txt 0.0406247770
## [1] 15
## [1] "PRAD_PRS_20211011top20pval.txt"
##       gene                                trait      p_value
## 1     TP53             SmokingCessation_res.txt 0.0007401188
## 2     PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 3   PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 4   PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 5   PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 6     TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 7     PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 8     ETV3                ukbEUR_CANCER_res.txt 0.0038410392
## 9  COL11A1 EA_NG_2018_excluding_23andMe_res.txt 0.0050359535
## 10   FOXA1                DrinksPerWeek_res.txt 0.0053961927
## 11   CSMD3             CigarettesPerDay_res.txt 0.0066818934
## 12   CSMD3                     Vitiligo_res.txt 0.0082218430
## 13  CTNNB1                     Vitiligo_res.txt 0.0089100472
## 14     APC             SmokingCessation_res.txt 0.0091074202
## 15 COL11A1             SmokingCessation_res.txt 0.0095347877
## 16   CDK12                ukbEUR_Height_res.txt 0.0098727412
## 17    TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 18    PTEN                ukbEUR_CANCER_res.txt 0.0115651547
## 19    HRAS     ukbEUR_ALLERGIC_RHINITIS_res.txt 0.0129706910
## 20    TP53                 ukbEUR_CASES_res.txt 0.0176094196
## [1] 16
## [1] "SARC_PRS_20211011top20pval.txt"
##    gene                                trait      p_value
## 1  TP53             SmokingCessation_res.txt 0.0007401188
## 2  PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 3  TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 4  PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 5  TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 6  PTEN                ukbEUR_CANCER_res.txt 0.0115651547
## 7   RB1              IBD_NG2017.hap3_res.txt 0.0143402527
## 8  TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 9  PTEN              ukbEUR_DYSLIPID_res.txt 0.0209265850
## 10 TP53                   IQ_NG_2018_res.txt 0.0214374008
## 11 TP53                 IQ_NG_2018.1_res.txt 0.0214374008
## 12 TP53               ukbEUR_TI_cojo_res.txt 0.0389900734
## 13 PTEN                 ukbEUR_HYPER_res.txt 0.0561274529
## 14 TP53                ukbEUR_OSTIOA_res.txt 0.0595673904
## 15 PTEN                   IQ_NG_2018_res.txt 0.0631094823
## 16 PTEN                 IQ_NG_2018.1_res.txt 0.0631094823
## 17 TP53             CigarettesPerDay_res.txt 0.0673896380
## 18 PTEN                   ukbEUR_BMI_res.txt 0.0705249109
## 19 TP53                  SWB_NG_2015_res.txt 0.0791582883
## 20  RB1                ukbEUR_ASTHMA_res.txt 0.0847995682
## [1] 17
## [1] "SKCM_PRS_20211011top20pval.txt"
##      gene                                trait      p_value
## 1    TP53             SmokingCessation_res.txt 0.0007401188
## 2    PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 3    TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 4    PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 5    BRAF                     Vitiligo_res.txt 0.0046410362
## 6   TACR3                  SWB_NG_2015_res.txt 0.0054176895
## 7   TACR3                  ukbEUR_CARD_res.txt 0.0060376556
## 8   ARID2                     Vitiligo_res.txt 0.0062926817
## 9   PPP6C                   IQ_NG_2018_res.txt 0.0068315121
## 10  PPP6C                 IQ_NG_2018.1_res.txt 0.0068315121
## 11 PCDHB8                ukbEUR_CANCER_res.txt 0.0068877067
## 12  RGS22 EA_NG_2018_excluding_23andMe_res.txt 0.0069086006
## 13  PDE1A                     Vitiligo_res.txt 0.0091564573
## 14   TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 15   BRAF                ukbEUR_OSTIOP_res.txt 0.0109926260
## 16   PTEN                ukbEUR_CANCER_res.txt 0.0115651547
## 17  HNF4G                DrinksPerWeek_res.txt 0.0119596151
## 18  PDE1A ukbEUR_HERNIA_ABDOMINOPELVIC_res.txt 0.0119630749
## 19  TACR3               ukbEUR_CI_cojo_res.txt 0.0132622991
## 20 MAP2K1                     Vitiligo_res.txt 0.0133605335
## [1] 18
## [1] "TGCT_PRS_20211011top20pval.txt"
##    gene                                trait    p_value
## 1  NRAS                     Vitiligo_res.txt 0.01471168
## 2  NRAS                ukbEUR_CANCER_res.txt 0.01890556
## 3  NRAS           PD_GWAS_2017_N300k_res.txt 0.02760321
## 4  NRAS                   UC_NG_2015_res.txt 0.03117181
## 5   KIT                 ukbEUR_HYPER_res.txt 0.03510323
## 6  NRAS                  ukbEUR_CARD_res.txt 0.04059930
## 7  KRAS                  ukbEUR_CARD_res.txt 0.04568369
## 8  NRAS               ukbEUR_CI_cojo_res.txt 0.04648172
## 9  NRAS                SCZ_Cell_2018_res.txt 0.05467952
## 10  KIT               RA_NG2010.hap3_res.txt 0.05963490
## 11 NRAS               RA_NG2010.hap3_res.txt 0.07749342
## 12 NRAS              IBD_NG2017.hap3_res.txt 0.08849419
## 13  KIT                DrinksPerWeek_res.txt 0.09761553
## 14  KIT                ukbEUR_CANCER_res.txt 0.10379842
## 15 NRAS     ukbEUR_ALLERGIC_RHINITIS_res.txt 0.10654215
## 16 NRAS                   ukbEUR_BMI_res.txt 0.10813569
## 17 KRAS  Prostate_cancer_2017_common_res.txt 0.13788269
## 18 KRAS               ukbEUR_CI_cojo_res.txt 0.13851455
## 19 KRAS ukbEUR_HERNIA_ABDOMINOPELVIC_res.txt 0.14602245
## 20 KRAS             SmokingCessation_res.txt 0.15801640
## [1] 19
## [1] "UCEC_PRS_20211011top20pval.txt"
##        gene                                trait      p_value
## 1     LZTR1           ukbEUR_PSYCHIATRIC_res.txt 0.0005327073
## 2      TP53             SmokingCessation_res.txt 0.0007401188
## 3      PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 4  RAB3GAP1                ukbEUR_OSTIOA_res.txt 0.0020103956
## 5     LZTR1           PD_GWAS_2017_N300k_res.txt 0.0021066294
## 6    PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 7    PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 8    PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 9      TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 10     PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 11    SIN3A                  SWB_NG_2015_res.txt 0.0046834651
## 12  DEPDC1B             CigarettesPerDay_res.txt 0.0053695489
## 13    LZTR1             T2D_DIAGRAM_2017_res.txt 0.0060306718
## 14    CCND1                DrinksPerWeek_res.txt 0.0074740545
## 15   DICER1               ukbEUR_CI_cojo_res.txt 0.0078437661
## 16    FBXW7               RA_NG2010.hap3_res.txt 0.0083137975
## 17    FBXW7                  ukbEUR_DIA2_res.txt 0.0083876929
## 18   CTNNB1                     Vitiligo_res.txt 0.0089100472
## 19   PIK3R1               ukbEUR_TI_cojo_res.txt 0.0090167500
## 20  DEPDC1B               ukbEUR_TI_cojo_res.txt 0.0091919665
## [1] 20
## [1] "UCS_PRS_20211011top20pval.txt"
##      gene                                trait      p_value
## 1    TP53             SmokingCessation_res.txt 0.0007401188
## 2    PTEN EA_NG_2018_excluding_23andMe_res.txt 0.0014878141
## 3  PIK3CA                   ukbEUR_PVD_res.txt 0.0024078293
## 4  PIK3CA                   IQ_NG_2018_res.txt 0.0028632984
## 5  PIK3CA                 IQ_NG_2018.1_res.txt 0.0028632984
## 6   FOXA2                   IQ_NG_2018_res.txt 0.0031145590
## 7   FOXA2                 IQ_NG_2018.1_res.txt 0.0031145590
## 8    TP53 EA_NG_2018_excluding_23andMe_res.txt 0.0034598303
## 9    PTEN                ukbEUR_OSTIOP_res.txt 0.0034648313
## 10  FBXW7               RA_NG2010.hap3_res.txt 0.0083137975
## 11  ERBB3        ukbEUR_VARICOSE_VEINS_res.txt 0.0083334877
## 12  FBXW7                  ukbEUR_DIA2_res.txt 0.0083876929
## 13  FBXW7               ukbEUR_CI_cojo_res.txt 0.0100089845
## 14   TP53  Prostate_cancer_2017_common_res.txt 0.0100880635
## 15   PTEN                ukbEUR_CANCER_res.txt 0.0115651547
## 16  FBXW7        ukbEUR_VARICOSE_VEINS_res.txt 0.0140152547
## 17    RB1              IBD_NG2017.hap3_res.txt 0.0143402527
## 18   CHD4                  ukbEUR_DIA2_res.txt 0.0144040172
## 19   TP53                 ukbEUR_CASES_res.txt 0.0176094196
## 20 ZBTB7B               RA_NG2010.hap3_res.txt 0.0201046007