Exemple #1
0
def test_date32_sort(seed):
    random.seed(seed)
    n = int(10 + random.expovariate(0.01))
    src = [int(random.random() * 100000) for i in range(n)]
    DT = dt.Frame(src, stype='date32')
    RES = DT[:, :, dt.sort(f[0])]
    assert_equals(RES, dt.Frame(sorted(src), stype='date32'))
# ~ 2a ~
# Create rd3_<release>_subject
# Not much is needed. Most of the data comes from the PED and PHENOPACKET files
subjects = release[:, {
    'id': f.subjectID,
    'subjectID': f.samples_subject,
    'organisation': f.subject_organisation,
    'ERN': f.subject_ERN,
    'solved': f.subject_solved,
    # 'date_solved': f.subject_date_solved, # optional: if available
    'matchMakerPermission': f.subject_matchMakerPermission,
    'recontact': f.subject_recontact,
    'patch': f.patch
},
                   dt.sort('id')][:, dt.first(f[1:]),
                                  dt.by(f.id)]

# reocde solved status
subjects['solved'] = dt.Frame([
    recodeValue(mappings=solvedStatusMappings, value=d, label='Solved status')
    for d in subjects['solved'].to_list()[0]
])

# ~ b ~
# Create rd3_<release>_subjectinfo
# There isn't much to add at this point as most of the data in this
# table comes from other sources or has never been collected. Add more column
# names here if required.

subjectInfo = subjects[:, (f.id, f.patch)]
Exemple #3
0
def test_date32_sort_with_NAs():
    src = [d(2001, 12, 1), None, d(3000, 3, 30), None, d(1, 1, 1)]
    RES = dt.Frame(src)[:, :, dt.sort(f[0])]
    assert_equals(RES,
        dt.Frame([None, None, d(1, 1, 1), d(2001, 12, 1), d(3000, 3, 30)]))
Exemple #4
0
def test_sort_void_multi2():
    DT = dt.Frame(A=[None] * 5, B=[3, 8, 1, 0, 2])
    RES = DT[:, :, dt.sort(f.A, f.B)]
    EXP = dt.Frame(A=[None] * 5, B=[0, 1, 2, 3, 8])
    assert_equals(RES, EXP)
Exemple #5
0
def test_sort_void_simple2():
    DT = dt.Frame([None] * 2345)
    assert_equals(DT[:, :, dt.sort(f[0])], DT)