Skip to content

Commit

Permalink
Add info to log files
Browse files Browse the repository at this point in the history
  • Loading branch information
rafelafrance committed Jan 19, 2018
1 parent 2d2b33c commit b9ee180
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion atram.py
Expand Up @@ -41,7 +41,7 @@ def assemble(args):
assembler.write_final_output(blast_db, query)
except (TimeoutError, RuntimeError):
pass
except Exception as err:
except Exception as err: # pylint: disable=broad-except
log.error('Exception: ' + err)

db.aux_detach(db_conn)
Expand Down
22 changes: 12 additions & 10 deletions atram_preprocessor.py
Expand Up @@ -184,12 +184,8 @@ def parse_command_line(temp_dir_default):
formatter_class=argparse.RawDescriptionHelpFormatter,
description=textwrap.dedent(description))

parser.add_argument('--mixed-ends', '-m', metavar='FASTA_or_FASTQ', nargs='+',
help='''Sequence read archive files that have a mix of
both end 1 and end 2 sequences (or single ends).
The files are in fasta or fastq format. You may
enter more than one file or you may use wildcards.
''')
parser.add_argument('--version', action='version',
version='%(prog)s {}'.format(db.ATRAM_VERSION))

parser.add_argument('--end-1', '-1', metavar='FASTA_or_FASTQ', nargs='+',
help='''Sequence read archive files that have only
Expand All @@ -207,16 +203,22 @@ def parse_command_line(temp_dir_default):
enter more than one file or you may use wildcards.
''')

parser.add_argument('--single-ends', '-0', metavar='FASTA_or_FASTQ', nargs='+',
parser.add_argument('--mixed-ends', '-m', metavar='FASTA_or_FASTQ',
nargs='+',
help='''Sequence read archive files that have a mix of
both end 1 and end 2 sequences (or single ends).
The files are in fasta or fastq format. You may
enter more than one file or you may use wildcards.
''')

parser.add_argument('--single-ends', '-0', metavar='FASTA_or_FASTQ',
nargs='+',
help='''Sequence read archive files that have only
unpaired sequences. Any sequence suffix will be
ignored. The files are in fasta or fastq format.
You may enter more than one file or you may use
wildcards.''')

parser.add_argument('--version', action='version',
version='%(prog)s {}'.format(db.ATRAM_VERSION))

group = parser.add_argument_group('preprocessor arguments')

blast_db = os.path.join('.', 'atram_' + date.today().isoformat())
Expand Down
2 changes: 1 addition & 1 deletion lib/assemblers/base.py
Expand Up @@ -118,7 +118,7 @@ def assembled_contigs_count(self, high_score):

if not count:
log.info('No contigs had a bit score greater than {} and are at '
'least {} long in iteration {}. The highest score for '
'least {} bp long in iteration {}. The highest score for '
'this iteration is {}'.format(
self.args['bit_score'],
self.args['contig_length'],
Expand Down
2 changes: 1 addition & 1 deletion lib/db.py
Expand Up @@ -6,7 +6,7 @@
from os.path import basename, join, exists


ATRAM_VERSION = '2.0'
ATRAM_VERSION = '2.0.alpha.5'
DB_VERSION = '2.0'

BATCH_SIZE = 1e6 # How many sequence records to insert at a time
Expand Down
4 changes: 3 additions & 1 deletion lib/log.py
Expand Up @@ -5,6 +5,7 @@
import logging
import tempfile
import subprocess
import lib.db as db

LOGGER = None # Global logger so we can switch between queries & blast DBs
FORMATTER = logging.Formatter('%(asctime)s %(levelname)s: %(message)s',
Expand Down Expand Up @@ -32,7 +33,8 @@ def setup(log_file, blast_db, query_file=''):
LOGGER.addHandler(handler)
LOGGER.addHandler(stream)

info(" ".join(sys.argv[:]))
info('aTRAM version: {}'.format(db.ATRAM_VERSION))
info(' '.join(sys.argv[:]))


def file_name(log_file, blast_db, query_file=''):
Expand Down
2 changes: 1 addition & 1 deletion tests/lib/assemblers/test_base.py
Expand Up @@ -275,7 +275,7 @@ def test_assembled_contigs_count_0(self, assembled_contigs_count, info):
assembler.args['contig_length'])

expect = ('No contigs had a bit score greater than {} and are at '
'least {} long in iteration {}. The highest score for '
'least {} bp long in iteration {}. The highest score for '
'this iteration is {}').format(
assembler.args['bit_score'],
assembler.args['contig_length'],
Expand Down

0 comments on commit b9ee180

Please sign in to comment.