Skip to content

Implement calculation of length and charge#12

Merged
mark0428 merged 1 commit intoBirolLab:masterfrom
dy-lin:master
Jan 29, 2022
Merged

Implement calculation of length and charge#12
mark0428 merged 1 commit intoBirolLab:masterfrom
dy-lin:master

Conversation

@dy-lin
Copy link
Copy Markdown
Contributor

@dy-lin dy-lin commented Jan 29, 2022

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?

@mark0428 mark0428 merged commit 78ccf3f into BirolLab:master Jan 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants