bcgsc / AMPlify

Attentive deep learning model for antimicrobial peptide prediction
Other
38 stars 9 forks source link

Implement calculation of length and charge #12

Closed dy-lin closed 2 years ago

dy-lin commented 2 years ago

L213-214: created lists for length and charge

    y_length = []
    y_charge = []

L232-236: added length and charge calculation (valid sequences)

            # calculate charge
            y_charge.append(peptide[ix].count('K') + peptide[ix].count('R') - peptide[ix].count('D') - peptide[ix].count('E'))
            # calculate length
            y_length.append(len(peptide[ix]))

L244-245: Length and charge for invalid sequences

            y_charge.append('NA')
            y_length.append('NA')

L250: Add length and charge to output txt

        temp_txt = 'Sequence ID: '+seq_id[i]+'\n'+'Sequence: '+peptide[i]+'\n' \
        + 'Length: ' + str(y_length[i]) + '\n' + 'Charge: ' + str(y_charge[i]) + '\n' \
        +'Probability_score: '+str(y_score[i])+'\n'+'AMPlify_log_scaled_score: ' \
        +str(y_log_score[i])+'\n'+'Prediction: '+y_class[i]+'\n'

L280-281, L289-290 : Add length and charge to output tsv/xlsx

                if args.attention == 'on':
                    out = pd.DataFrame({'Sequence_ID':seq_id,
                                        'Sequence': peptide,
                                        'Length': y_length,
                                        'Charge': y_charge,
                                        'Probability_score': y_score,
                                        'AMPlify_log_scaled_score': y_log_score,
                                        'Prediction': y_class,
                                        'Attention': attention})
                else:
                    out = pd.DataFrame({'Sequence_ID':seq_id,
                                        'Sequence': peptide,
                                        'Length': y_length,
                                        'Charge': y_charge,
                                        'Probability_score': y_score,
                                        'AMPlify_log_scaled_score': y_log_score,
                                        'Prediction': y_class})

Other edits appear to be my text editor adding some eol characters?