Skip to content

train code has some errors #8

@hearthewind

Description

@hearthewind

It works fine when denovo from the provided model, (model.h5). When training our own model, there is an error

Train mode runs successfully, however, if we used the trained model to do denovo, the following exception.

File "denovo.py", line 228, in
peps, ppeps, scores, pscores, ppms, _ = denovo(model, spectra, args.batch_size)
File "denovo.py", line 181, in denovo
pep, pos, positional_score = post_correction(rst, ms, c)
File "denovo.py", line 73, in post_correction
pep = topep(seq)
File "/home/m/git/PepNet/utils.py", line 172, in topep
raise(e)
File "/home/m/git/PepNet/utils.py", line 170, in topep
return ''.join(map(lambda n: id2amino[n], seq)).strip("[]")
File "/home/m/git/PepNet/utils.py", line 170, in
return ''.join(map(lambda n: id2amino[n], seq)).strip("
[]")
KeyError: 24

The root of the problem is the output shape of the model

` for rst, sp in zip(predictions, spectra):
ms, c = sp['mass'], sp['charge']

    print('rst', rst.shape)

    # run post correction
    try:
        pep, pos, positional_score = post_correction(rst, ms, c)
    except KeyError as e:
        print('rst', rst.shape)
        raise(e)

    predict_peps.append(pep)
    positional_scores.append(positional_score)
    scores.append(np.prod(positional_score))`

In denovo.py, the code section above, if we use the provided model, rst has shape (32,23), which is correct.
However, if we use our own trained model, the shape of rst is (10000, 32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions