Skip to content

Commit 8000297

Browse files
committed
fix a bug when no mutated protein identified
1 parent e9c3323 commit 8000297

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/perChrom.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,9 @@ def save_mutation_and_proteins(df_transcript3, outprefix):
686686
# save mutation annotation
687687
columns_keep = ['protein_id_fasta', 'seqname', 'strand','frameChange','stopGain', 'AA_stopGain', 'stopLoss', 'stopLoss_pos', 'nonStandardStopCodon', 'n_variant_AA', 'n_deletion_AA', 'n_insertion_AA', 'variant_AA', 'insertion_AA', 'deletion_AA', 'len_ref_AA', 'len_alt_AA']
688688
columns_keep = [e for e in columns_keep if e in df_transcript3.columns]
689+
if df_transcript3.shape[0] == 0:
690+
print('no protein with AA change')
691+
return None
689692
df_sum_mutations = df_transcript3[(df_transcript3['AA_seq'] != df_transcript3['new_AA']) & (pd.notnull(df_transcript3['new_AA']))][columns_keep]
690693

691694
outfilename = outprefix +'.aa_mutations.csv'

0 commit comments

Comments
 (0)