Skip to content

Commit 7e84f5e

Browse files
committed
bug for single mutation. reduce warning of refseq
fix bug for chromosome with only one mutations
1 parent 37601e3 commit 7e84f5e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/perChrom.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ def get_df_transcript2(file_gtf, file_protein, file_genome, cpu_counts, datatype
348348
print('chromosome', chromosome, list(tdf_special.index), 'not translated from the CDS sequences in the genome. do not change')
349349
for transcript_id in tdf_special.index:
350350
df_transcript2.at[transcript_id, 'mutations'] = []
351+
df_transcript2 = df_transcript2[~df_transcript2.index.isin(set(tdf_special.index))]
351352

352353
# split df_transcript2 to with mutations and no_mutations
353354
df_transcript_noMut = df_transcript2[df_transcript2['mutations'].apply(lambda x:len(x)==0)]

src/perChromSqlite.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def run_perChrom(self, save_results = True):
122122

123123
# get df_transcript2 based on dc_transcript2mutations
124124
protein_ids = tuple(dc_transcript2mutations.keys())
125+
if len(protein_ids) == 1:
126+
protein_ids = '("{}")'.format(protein_ids[0])
125127
query = f"SELECT * FROM protein_description WHERE protein_id IN {protein_ids}"
126128
df_transcript2 = pd.read_sql_query(query, self.con) # assign mutations to each transcript.
127129
if df_transcript2.shape[0] == 0:
@@ -145,6 +147,7 @@ def run_perChrom(self, save_results = True):
145147
print('chromosome', chromosome, list(tdf_special.index), 'not translated from the CDS sequences in the genome. do not change')
146148
for transcript_id in tdf_special.index:
147149
df_transcript2.at[transcript_id, 'mutations'] = []
150+
df_transcript2 = df_transcript2[~df_transcript2.index.isin(set(tdf_special.index))]
148151

149152
df_transcript3 = df_transcript2
150153

0 commit comments

Comments
 (0)