Mercurial > repos > davidvanzessen > imgt_loader_igg
comparison imgtconvert.py @ 1:4405849aa053 draft
Uploaded
author | davidvanzessen |
---|---|
date | Thu, 06 Mar 2014 09:34:10 -0500 |
parents | f8ba6ab5514b |
children | 477cab9c32d1 |
comparison
equal
deleted
inserted
replaced
0:f8ba6ab5514b | 1:4405849aa053 |
---|---|
1 import pandas as pd | 1 import pandas as pd |
2 pd.options.mode.chained_assignment = None # default='warn' | |
2 import re | 3 import re |
3 import argparse | 4 import argparse |
4 import os | 5 import os |
5 | 6 |
6 def stop_err( msg, ret=1 ): | 7 def stop_err( msg, ret=1 ): |
106 | 107 |
107 outFrame = outFrame.append(tmp) | 108 outFrame = outFrame.append(tmp) |
108 | 109 |
109 outFrame.columns = [u'ID', u'VDJ Frame', u'Top V Gene', u'Top D Gene', u'Top J Gene', u'CDR1 Seq', u'CDR1 Length', u'CDR2 Seq', u'CDR2 Length', u'CDR3 Seq', u'CDR3 Length', u'CDR3 Seq DNA', u'CDR3 Length DNA', u'Strand', u'CDR3 Found How', u'Functionality', 'V-REGION identity %', 'V-REGION identity nt', 'D-REGION reading frame', 'AA JUNCTION', 'Functionality comment', 'Sequence', 'FR1-IMGT', 'FR2-IMGT', 'FR3-IMGT', 'CDR3-IMGT', 'JUNCTION', 'J-REGION', 'FR4-IMGT', 'P3V-nt nb', 'N1-REGION-nt nb', 'P5D-nt nb', 'P3D-nt nb', 'N2-REGION-nt nb', 'P5J-nt nb', '3V-REGION trimmed-nt nb', '5D-REGION trimmed-nt nb', '3D-REGION trimmed-nt nb', '5J-REGION trimmed-nt nb'] | 110 outFrame.columns = [u'ID', u'VDJ Frame', u'Top V Gene', u'Top D Gene', u'Top J Gene', u'CDR1 Seq', u'CDR1 Length', u'CDR2 Seq', u'CDR2 Length', u'CDR3 Seq', u'CDR3 Length', u'CDR3 Seq DNA', u'CDR3 Length DNA', u'Strand', u'CDR3 Found How', u'Functionality', 'V-REGION identity %', 'V-REGION identity nt', 'D-REGION reading frame', 'AA JUNCTION', 'Functionality comment', 'Sequence', 'FR1-IMGT', 'FR2-IMGT', 'FR3-IMGT', 'CDR3-IMGT', 'JUNCTION', 'J-REGION', 'FR4-IMGT', 'P3V-nt nb', 'N1-REGION-nt nb', 'P5D-nt nb', 'P3D-nt nb', 'N2-REGION-nt nb', 'P5J-nt nb', '3V-REGION trimmed-nt nb', '5D-REGION trimmed-nt nb', '3D-REGION trimmed-nt nb', '5J-REGION trimmed-nt nb'] |
110 | 111 |
111 vPattern = re.compile(r"IGHV[1-9]-[0-9ab]+-?[1-9]?") | 112 #vPattern = re.compile(r"|TRBV[0-9]{1,2}-?[0-9]?") #mouse |
112 dPattern = re.compile(r"IGHD[1-9]-[0-9ab]+") | 113 #vPattern = re.compile(r"IGHV[1-9]-[0-9ab]+-?[1-9]?") #human |
113 jPattern = re.compile(r"IGHJ[1-9]") | 114 vPattern = re.compile(r"IGHV[1-9]-[0-9ab]+-?[1-9]?|TRBV[0-9]{1,2}-?[0-9]?") #mouse and human |
115 | |
116 #dPattern = re.compile(r"TRBD1|TRBD2") #mouse | |
117 #dPattern = re.compile(r"IGHD[1-9]-[0-9ab]+") #human | |
118 dPattern = re.compile(r"IGHD[1-9]-[0-9ab]+|TRBD1|TRBD2") #mouse and human | |
119 | |
120 | |
121 #jPattern = re.compile(r"TRBJ[12]-[1-7]") #mouse | |
122 #jPattern = re.compile(r"IGHJ[1-6]") #human | |
123 jPattern = re.compile(r"IGHJ[1-6]|TRBJ[12]-[1-7]") #mouse and human | |
114 | 124 |
115 def filterGenes(s, pattern): | 125 def filterGenes(s, pattern): |
116 if type(s) is not str: | 126 if type(s) is not str: |
117 return "NA" | 127 return "NA" |
118 res = pattern.search(s) | 128 res = pattern.search(s) |