コード例 #1
0
def make_parser():
    """Create the argument parser, derived from the general scripts parser."""
    parser = get_parser(
        __doc__,
        ('A file containing a list of files/file paths to be read. These '
         'should be nxml or txt files.'))
    parser.add_argument(
        dest='output_name',
        help=('Results will be pickled in files '
              '<output_name>_stmts.pkl and <output_name>_readings.pkl.'))
    return parser
コード例 #2
0
ファイル: read_files.py プロジェクト: johnbachman/indra
def make_parser():
    """Create the argument parser, derived from the general scripts parser."""
    parser = get_parser(
        __doc__,
        ('A file containing a list of files/file paths to be read. These '
         'should be nxml or txt files.')
    )
    parser.add_argument(
        dest='output_name',
        help=('Results will be pickled in files '
              '<output_name>_stmts.pkl and <output_name>_readings.pkl.')
    )
    return parser
コード例 #3
0
"""Read a list of files located in your local directory."""
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str

import logging
import pickle
import random

logger = logging.getLogger('file_reader')

from indra.tools.reading.util.script_tools import get_parser, make_statements

if __name__ == '__main__':
    parser = get_parser(
        __doc__,
        ('A file containing a list of files/file paths to be read. These '
         'should be nxml or txt files.'))
    parser.add_argument(
        dest='output_name',
        help=('Results will be pickled in files '
              '<output_name>_stmts.pkl and <output_name>_readings.pkl.'))
    args = parser.parse_args()
    if args.debug and not args.quiet:
        logger.setLevel(logging.DEBUG)

from indra.tools.reading.readers import _get_dir, get_readers, Content


def read_files(files, readers, **kwargs):
    """Read the files in `files` with the reader objects in `readers`.
コード例 #4
0
ファイル: read_db.py プロジェクト: yunguan-wang/indra_db
from __future__ import absolute_import, print_function, unicode_literals
from builtins import dict, str
import logging
import random
import pickle
from math import log10, floor, ceil
from datetime import datetime
from indra.tools.reading.util.script_tools import get_parser, make_statements,\
                                             StatementData

logger = logging.getLogger('make_db_readings')
if __name__ == '__main__':
    parser = get_parser(
        'A tool to read and process content from the database.',
        ('A file containing a list of ids of the form <id_type>:<id>. '
         'Note that besided the obvious id types (pmid, pmcid, doi, etc.), '
         'you may use trid and tcid to indicate text ref and text content '
         'ids, respectively. Note that these are specific to the database, '
         'and should thus be used with care.'))
    parser.add_argument(
        '-m',
        '--reading_mode',
        choices=['all', 'unread', 'none'],
        default='unread',
        help=("Set the reading mode. If 'all', read everything, if "
              "'unread', only read content that does not have pre-existing "
              "readings of the same reader and version, if 'none', only "
              "use pre-existing readings. Default is 'unread'."))
    parser.add_argument(
        '-S',
        '--stmt_mode',