@author: hhuang2 """ # import glob import sqlite3 as sql # from utils import phase_block_check as ps from utils import IMGTdbIO, CompareSeq import os import re locus = 'DQB1' #pkl_fp = '../Output/SG39_DRpairs/SG39_HLA_'+ locus +'_paired.pkl' pkl_fp = '../Output/SG39/2018/SG39_DRpairs/SG39_HLA_' + locus + '_paired.pkl' DRpair_seqInfo = IMGTdbIO.load_pickle2dict(pkl_fp) case_count = len(DRpair_seqInfo) print('Locus ' + locus + ' has ' + str(case_count) + ' paired cases.') DB_fp = "../Output/SG39/2018/SG39_DRpairs/SG39_HLA_" + locus + "_paired.db" conn = sql.connect(DB_fp) cursor = conn.cursor() cursor.execute('''CREATE TABLE IF NOT EXISTS DR_pair_comparison (BMT_caseID text, QC text, PS1_HLATyping text, PS1_GLstringM text, PS1_SeqM text, PS2_HLATyping text, PS2_GLstringM text, PS2_SeqM text, Audit text, Active text, Comment text)''')
""" Created on Tue Oct 3 14:42:06 2017 @author: hhuang2 """ import glob import sqlite3 as sql # from utils import phase_block_check as ps from utils import IMGTdbIO, CompareSeq import os import re fname = '../Output/SG41_52/2018/IMGTv3310/SG41_52_DRpair_Stats/SG41_52_pairedCases_Stats.pkl' Matching_cases_stats = IMGTdbIO.load_pickle2dict(fname) ## 'All_paired' groupType = 'fiveLoci_paired' # groupType = 'ClassI_paired' # groupType = 'All_paired' group_caseIDs = Matching_cases_stats[groupType] All_loci = ['A', 'B', 'C', 'DRB1', 'DQB1']#, 'DPB1'] ClassI_loci = ['A', 'B', 'C'] ClassII_loci = ['DRB1', 'DQB1'] CaseStats = {} LocusStats = {} #MatchStats = {} for caseID in group_caseIDs: # for locus in ClassI_loci: ARSregion = ['Exon2', 'Exon3']
import glob import csv from utils import IMGTdbIO, CompareSeq groupType = 'fiveLoci_paired' # groupType = 'ClassI_paired' # groupType = 'All_paired' ; 'fiveLoci_paired' All_loci = ['A', 'B', 'C', 'DRB1', 'DQB1', 'DPB1'] Five_loci = ['A', 'B', 'C', 'DRB1', 'DQB1'] ClassI_loci = ['A', 'B', 'C'] ClassII_loci = ['DRB1', 'DQB1', 'DPB1'] Group_fname = '../Output/SG41_52/2018/IMGTv3310/SG41_52_DRpair_Stats/fiveLoci_paired_Stats_0125_' + groupType + '.pkl' Stats_Dict = IMGTdbIO.load_pickle2dict(Group_fname) CaseStats = Stats_Dict['CaseStats'] LocusStats = Stats_Dict['LocusStats'] db_fp= '../Database/' #key = '83687' #CaseStats[key] #key in group_caseIDs ## : paired cases HLA typing stats fname = '../Output/SG41_52/2018/IMGTv3310/SG41_52_DRpair_Stats/SG41_52_pairedCases_Stats.pkl' Matching_cases_stats = IMGTdbIO.load_pickle2dict(fname) group_caseIDs = Matching_cases_stats[groupType] CaseMatchTable = {}
""" import glob import csv from utils import IMGTdbIO, CompareSeq groupType = 'fiveLoci_paired' # groupType = 'ClassI_paired' # groupType = 'All_paired' ; 'fiveLoci_paired' All_loci = ['A', 'B', 'C', 'DRB1', 'DQB1', 'DPB1'] Five_loci = ['A', 'B', 'C', 'DRB1', 'DQB1'] ClassI_loci = ['A', 'B', 'C'] ClassII_loci = ['DRB1', 'DQB1', 'DPB1'] Group_fname = '../Output/SG39/2018/SG39_Stats/fiveLoci_paired_Stats_0125_' + groupType + '.pkl' Stats_Dict = IMGTdbIO.load_pickle2dict(Group_fname) CaseStats = Stats_Dict['CaseStats'] LocusStats = Stats_Dict['LocusStats'] db_fp = '../Database/' #key = '84571' #CaseStats[key] #key in group_caseIDs ## : paired cases HLA typing stats fname = '../Output/SG39/2018/SG39_DRpairs/SG39_pairedCases_Stats.pkl' Matching_cases_stats = IMGTdbIO.load_pickle2dict(fname) CaseMatchTable = {} for locus in All_loci:
@author: hhuang2 """ from utils import IMGTdbIO #, CompareSeq from collections import Counter groupType = 'All_paired' # groupType = 'ClassI_paired' # groupType = 'All_paired' All_loci = ['A', 'B', 'C', 'DRB1', 'DQB1', 'DPB1'] Five_loci = ['A', 'B', 'C', 'DRB1', 'DQB1'] ClassI_loci = ['A', 'B', 'C'] ClassII_loci = ['DRB1', 'DQB1', 'DPB1'] Group_fname = '../Output/Stats/ClassI_Stats_1003_' + groupType + '.pkl' Stats_Dict = IMGTdbIO.load_pickle2dict(Group_fname) CaseStats = Stats_Dict['CaseStats'] LocusStats = Stats_Dict['LocusStats'] ## TODO1: paired cases HLA typing stats fname = '../Output/SG39_DRpairs/SG39_pairedCases_Stats.pkl' Matching_cases_stats = IMGTdbIO.load_pickle2dict(fname) AlleleStats = {} for locus in All_loci: AlleleStats[locus] = {} DRpaired_file = '../Output/SG39_DRpairs/SG39_HLA_' + locus + '_paired.pkl' DRpaired_table = IMGTdbIO.load_pickle2dict(DRpaired_file) num_total = len(DRpaired_table)