java – Calculating physico-chemical properties of amino acids in Biojava

I need to calculate the number and percentages of polar/non-polar, aliphatic/aromatic/heterocyclic amino acids in this protein sequence that I got from UNIPROT, using BioJava.

I have found in the BioJava tutorial how to read the Fasta files and implemented this code. But I have no ideas how to solve this problem.

If you have some ideas please help me.

Maybe there are some sources where I can check it.

This is the code.

package biojava.biojava_project;

import java.net.URL;

import org.biojava.nbio.core.sequence.ProteinSequence;
import org.biojava.nbio.core.sequence.io.FastaReaderHelper;

public class BioSeq {
    // Inserting the sequence from UNIPROT
    public static ProteinSequence getSequenceForId(String uniProtId) throws Exception {
        URL uniprotFasta = new URL(String.format("https://rest.uniprot.org/uniprotkb/P31574.fasta", uniProtId));
        ProteinSequence seq = FastaReaderHelper.readFastaProteinSequence(uniprotFasta.openStream()).get(uniProtId);
        System.out.printf("id : P31574", uniProtId, seq, System.getProperty("line.separator"), seq.getOriginalHeader());
        System.out.println();
        return seq;
    }
    public static void main(String[] args) {
        try {
            System.out.println(getSequenceForId("P31574"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Read more here: Source link