Skip to content

Commit

Permalink
fixes mutation lists for rrna models
Browse files Browse the repository at this point in the history
  • Loading branch information
raphenya committed Oct 13, 2023
1 parent 60fdfc2 commit 52cb4c6
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions app/Database.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,19 +182,21 @@ def write_fasta_from_json_rna(self):
if "23S" in j[i]['ARO_name']:
if s not in snpList_23s:
snpList_23s.append(s)
if snpList:
for seq in j[i]['model_sequences']['sequence']:
if j[i]['model_sequences']['sequence'][seq]['dna_sequence']['strand'] == "-":
basecomplement = self.complementary_strand(j[i]['model_sequences']['sequence'][seq]['dna_sequence']['sequence'])

for seq in j[i]['model_sequences']['sequence']:
if j[i]['model_sequences']['sequence'][seq]['dna_sequence']['strand'] == "-":
basecomplement = self.complementary_strand(j[i]['model_sequences']['sequence'][seq]['dna_sequence']['sequence'])

fout.write('>%s_%s | model_type_id: 40295 | pass_bit_score: %s | SNP: %s | %s\n' \
% (i, seq, pass_bit_score, ','.join(snpList), j[i]['ARO_name']))
fout.write('%s\n' % (basecomplement))
fout.write('>%s_%s | model_type_id: 40295 | pass_bit_score: %s | SNP: %s | %s\n' \
% (i, seq, pass_bit_score, ','.join(snpList), j[i]['ARO_name']))
fout.write('%s\n' % (basecomplement))

else:
fout.write('>%s_%s | model_type_id: 40295 | pass_bit_score: %s | SNP: %s | %s\n' \
% (i, seq, pass_bit_score, ','.join(snpList), j[i]['ARO_name']))
fout.write('%s\n' % (j[i]['model_sequences']['sequence'][seq]['dna_sequence']['sequence']))
else:
fout.write('>%s_%s | model_type_id: 40295 | pass_bit_score: %s | SNP: %s | %s\n' \
% (i, seq, pass_bit_score, ','.join(snpList), j[i]['ARO_name']))
fout.write('%s\n' % (j[i]['model_sequences']['sequence'][seq]['dna_sequence']['sequence']))
# reset mutations list
snpList = []

# write snps to file
with open(os.path.join(self.db,"16s_rRNA.txt"), 'w') as f16s:
Expand Down

0 comments on commit 52cb4c6

Please sign in to comment.