Skip to content

Commit

Permalink
adds code to create config file and add badge
Browse files Browse the repository at this point in the history
  • Loading branch information
raphenya committed Sep 21, 2023
1 parent b5fc064 commit 7e6b730
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
:scale: 100%
:target: https://travis-ci.org/arpcard/rgi

.. |build-status| image:: https://github.com/arpcard/rgi/actions/workflows/build.yml/badge.svg?branch=master
:alt: Workflow status badge
:scale: 100%
:target: https://github.com/arpcard/rgi/actions/workflows/build.yml

.. |docs| image:: https://img.shields.io/badge/install%20with-bioconda-brightgreen.svg?style=flat
:alt: Documentation
:scale: 100%
Expand Down
19 changes: 13 additions & 6 deletions app/Database.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,20 @@ def __repr__(self):
def build_databases(self):
"""Build BLAST and DIAMOND databases."""
self.write_fasta_from_json()
self.create_blast_config()
self.make_blast_database()
self.make_diamond_database()
self.write_fasta_from_json_rna()

def create_blast_config(self):
"""
This function stops NCBI application from sending usage report (which it does by default).
For more information see https://www.ncbi.nlm.nih.gov/books/NBK569851
"""
config_file="{path}".format(path=os.path.join(self.db,".ncbirc"))
logger.info("config_file: {}".format(config_file))
os.system("echo 'export BLAST_USAGE_REPORT=false' >> {config_file}".format(config_file=config_file))

def make_blast_database(self):
"""Build BLAST database from a FASTA file."""
if os.path.isfile(os.path.join(self.db,"proteindb.fsa")) == True and os.path.exists(os.path.join(self.db,"proteindb.fsa")) == True \
Expand Down Expand Up @@ -176,7 +186,7 @@ def write_fasta_from_json_rna(self):
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))
Expand All @@ -202,11 +212,8 @@ def complementary_strand(self, strand):
"R":"Y", "Y":"R", "S":"S", "W":"W", "B":"V", "V":"B", "H":"D", "D":"H"}
complement = []

for base in strand:
for base in strand:
complement.append(self.trans[base])

complement_seq = ''.join(complement)
return complement_seq



0 comments on commit 7e6b730

Please sign in to comment.