text stringlengths 1 93.6k |
|---|
# Read the input file
|
with open(in_file, 'r') as f:
|
for line in f:
|
identifier, go_id, score = line.strip().split()
|
data[identifier].append((go_id, float(score)))
|
# Open the output file
|
with open(out_file, 'w') as w:
|
for identifier, go_terms in data.items():
|
go_set = set([x[0] for x in go_terms])
|
scores = {x[0]: x[1] for x in go_terms}
|
# Filter out ancestors
|
for go_id in list(go_set):
|
ancestors = go.get_ancestors(go_id)
|
ancestors.discard(go_id)
|
go_set -= ancestors
|
# Write to the output file
|
for go_id in go_set:
|
w.write(f"{identifier}\t{go_id}\t{scores[go_id]:.3f}\n")
|
if __name__ == '__main__':
|
main()
|
# <FILESEP>
|
import sys
|
try:
|
from django.conf import settings
|
settings.configure(
|
DEBUG=True,
|
LANGUAGE_CODE='en-us',
|
USE_TZ=True,
|
DATABASES={
|
'default': {
|
'ENGINE': 'django.db.backends.sqlite3',
|
'NAME': 'djangocms_forms',
|
}
|
},
|
ROOT_URLCONF='djangocms_forms.urls',
|
INSTALLED_APPS=[
|
'django.contrib.auth',
|
'django.contrib.contenttypes',
|
'django.contrib.sites',
|
'djangocms_forms',
|
],
|
SITE_ID=1,
|
NOSE_ARGS=['-s'],
|
)
|
try:
|
import django
|
setup = django.setup
|
except AttributeError:
|
pass
|
else:
|
setup()
|
from django_nose import NoseTestSuiteRunner
|
except ImportError:
|
import traceback
|
traceback.print_exc()
|
raise ImportError('To fix this error, run: pip install -r requirements-test.txt')
|
def run_tests(*test_args):
|
if not test_args:
|
test_args = ['tests']
|
# Run tests
|
test_runner = NoseTestSuiteRunner(verbosity=1)
|
failures = test_runner.run_tests(test_args)
|
if failures:
|
sys.exit(failures)
|
if __name__ == '__main__':
|
run_tests(*sys.argv[1:])
|
# <FILESEP>
|
from math import ceil, log2
|
from taglexicon import hash32trans, hash64trans
|
from fasthash import hash32, hash64
|
from form import Lookup
|
class WCLexicon:
|
def __init__(self, name, items, config):
|
config.wclexicons.append(self)
|
self.items = items
|
self.lower = False
|
self.name = name
|
self.config = config
|
self.c_size = '%s_size' % name
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.