Skip to content

Commit

Permalink
Merge pull request #9 from briney/development
Browse files Browse the repository at this point in the history
fixed D-gene assignment bug
  • Loading branch information
briney committed Feb 20, 2016
2 parents b54e789 + a7b33a8 commit 201a6b1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion abstar/abstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,11 @@ def _run_jobs_singlethreaded(files, output_dir, args):
for i, f in enumerate(files):
try:
results.append(run_vdj(f, output_dir, args))
update_progress(i, len(files))
update_progress(i + 1, len(files))
except:
logger.debug('FILE-LEVEL EXCEPTION: {}'.format(f))
logging.debug(traceback.format_exc())
logger.info('')
return results


Expand Down
2 changes: 1 addition & 1 deletion abstar/utils/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def _imgt_summary_output(vdj, header=False):
('J-REGION score', vdj.j.top_score),
('J-REGION identity %', round(vdj.j.nt_mutations.germline_identity, 2)),
('J-REGION identity nt', _get_iden_nt(vdj.j)),
('D-GENE and allele', vdj.d.top_germline if vdj.d else ''),
('D-GENE and allele', vdj.d.top_germline if vdj.d is not None else ''),
('D-REGION reading frame', vdj.d.reading_frame if vdj.d else ''),
('CDR1-IMGT length', vdj.v.regions.aa_lengths['CDR1']),
('CDR2-IMGT length', vdj.v.regions.aa_lengths['CDR2']),
Expand Down
10 changes: 7 additions & 3 deletions abstar/utils/vdj.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,11 @@ def process_sequence_file(seq_file, args):
if v.chain == 'heavy':
junc_start = len(v.query_alignment) + v.query_start
junc_end = junc_start + j.query_start
junction = Sequence(seq.id, seq.sequence[junc_start:junc_end])
junction = Sequence(seq.sequence[junc_start:junc_end], id=seq.id)
if junction:
d = assign_d(junction, args.species)
logger.debug('ASSIGNED D-GENE: {}, {}'.format(seq.id, d.top_germline))
if d is not None:
logger.debug('ASSIGNED D-GENE: {}, {}'.format(seq.id, d.top_germline))
vdjs.append(VDJ(seq, args, v, j, d))
continue
vdjs.append(VDJ(seq, args, v, j))
Expand Down Expand Up @@ -466,4 +467,7 @@ def assign_d(seq, species):
alignments = local_alignment(seq, targets=germs,
gap_open_penalty=20, gap_extend_penalty=2)
alignments.sort(key=lambda x: x.score, reverse=True)
return blast.DiversityResult(seq, alignments[:5])
try:
return blast.DiversityResult(seq, alignments[:5])
except IndexError:
return None

0 comments on commit 201a6b1

Please sign in to comment.