Categories
Development

Add sequence lengths to headers in a fasta file

I have a multifasta file and would like to add the sequence lengths to the headers by keeping the sequences. >Seq1 MADKLTRIAIVNHDKCKPKKCRQECKKSCPVVRMGKLCIEVTPQSKIAWISETLCIGCGI KILAGKQKPNLGKYDDPPDWQEILTYFRGSELQNYFTKILEDDLKAIIKPQYVDQIPKAA KGTVGSILDRKDETKTQAIVCQQLDLTHLKERNVEDLSGGELQRFACAVVCIQK >Seq2 MADKLTRIAIVNHDKCKPKKCRQECKKSCPVVRMGKLCIEVTSQSKIAWISETLCIGCGI CIKKCPFGALSIVNLPSNLEKETTHRYCANAFKLHRLPIPRPGEVLGLVGTNGIGKSTAL KGTVGSILDRKDETKTQTVVCQQLDLTHLKERNVEDLSGGELQRFACAVVCIQKADIFMF DEPSSYLDVKQRLKAAITIRSLINPDRYIIV My desired output >Seq1_174 MADKLTRIAIVNHDKCKPKKCRQECKKSCPVVRMGKLCIEVTPQSKIAWISETLCIGCGI KILAGKQKPNLGKYDDPPDWQEILTYFRGSELQNYFTKILEDDLKAIIKPQYVDQIPKAA KGTVGSILDRKDETKTQAIVCQQLDLTHLKERNVEDLSGGELQRFACAVVCIQK >Seq2_211 MADKLTRIAIVNHDKCKPKKCRQECKKSCPVVRMGKLCIEVTSQSKIAWISETLCIGCGI CIKKCPFGALSIVNLPSNLEKETTHRYCANAFKLHRLPIPRPGEVLGLVGTNGIGKSTAL KGTVGSILDRKDETKTQTVVCQQLDLTHLKERNVEDLSGGELQRFACAVVCIQKADIFMF DEPSSYLDVKQRLKAAITIRSLINPDRYIIV I tried to use this command awk ‘/^>/{if (l!=””) print l; print; l=0; next}{l+=length($0)}END{print […]

Categories
Development

How to expand only leaf nodes with property red_color = true of jtree

I have a jtree with green leaf nodes and reds leaf nodes by implementing a custom CellRenderer. i am doing this to expand the entire jtree: expAll.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { for (int i = 0; i < jTree1.getRowCount(); i++) { jTree1.expandRow(i); } } }); but How to create a action […]

Categories
Development

error with returning a value from a method in java

hello in the code below I am sorting (sort method) a small array to find the largest number. I then print the answer in the (display method). But to extend my knowledge I want to mass the max value back to them main in a return statement and then print from there….simply to learn how […]