<commit_before>from indra.util import _require_python3
import indra.tools.assemble_corpus as ac
from indra.tools.reading.submit_reading_pipeline_aws import \
    submit_run_reach, submit_combine, wait_for_complete
import assemble_pysb
import process_data
from util import *


def run_reading(pmid_fname):
    """Run reading on Amazon to produce a pickle of INDRA Statements

    This needs to be done only once, after that the resulting pickle file
    can be loaded.
    """
    # Submit reading
    job_list = submit_run_reach(basen, pmid_fname)
    # Wait for reading to complete
    reading_res = wait_for_complete(job_list)
    # Submit pickle combine job
    combine_res = submit_combine(basen, job_list)
    # Download the file and save


def get_stmt_sif(stmts, fname):
    with open(fname, 'wt') as fh:
        for stmt in stmts:
            agents = [a for a in stmt.agent_list() if a is not None]
            if len(agents) != 2:
                continue
            fh.write('%s,%s,%s\n' %
                     (agents[0].name, stmt.uuid, agents[1].name))


if __name__ == '__main__':
    # Load the data and get the gene names
    data = process_data.read_rppa_data()<commit_msg>Use CSV writing to assemble statements SIF<commit_after>from indra.util import _require_python3, write_unicode_csv
import indra.tools.assemble_corpus as ac
#from indra.tools.reading.submit_reading_pipeline_aws import \
#    submit_run_reach, submit_combine, wait_for_complete
import assemble_pysb
import process_data
from util import *


def run_reading(pmid_fname):
    """Run reading on Amazon to produce a pickle of INDRA Statements

    This needs to be done only once, after that the resulting pickle file
    can be loaded.
    """
    # Submit reading
    job_list = submit_run_reach(basen, pmid_fname)
    # Wait for reading to complete
    reading_res = wait_for_complete(job_list)
    # Submit pickle combine job
    combine_res = submit_combine(basen, job_list)
    # Download the file and save


def get_stmt_sif(stmts, fname):
    rows = []
    for stmt in stmts:
        agent_names = [a.name for a in stmt.agent_list() if a is not None]
        if len(agent_names) != 2:
            continue
        rows.append((agent_names[0], stmt.uuid, agent_names[1]))
    write_unicode_csv(fname, rows)


if __name__ == '__main__':
    # Load the data and get the gene names
    data = process_data.read_rppa_data()
{'fraction_non_alphanumeric': 0.07507258399004563, 'fraction_numerical': 0.0033181252592285357, 'mean_word_length': 3.3148479427549193, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5921990', 'n_tokens_mistral': 803, 'n_tokens_neox': 775, 'n_words': 239}