3 import jalview.bin.Jalview;
4 import jalview.datamodel.AlignmentI;
5 import jalview.datamodel.ResidueCount;
6 import jalview.datamodel.SequenceI;
7 import jalview.gui.AlignmentPanel;
8 import jalview.gui.Desktop;
9 import jalview.gui.JvOptionPane;
10 import jalview.util.MessageManager;
13 import java.io.IOException;
14 import java.net.MalformedURLException;
16 import javax.swing.JFileChooser;
18 public class CountReader
20 public static ResidueCount getBackgroundFrequencies(AlignmentPanel ap, SequenceI seq) throws MalformedURLException, IOException
22 JFileChooser bkgdFreqChooser = new JFileChooser();
24 bkgdFreqChooser.showOpenDialog(ap);
26 File file = bkgdFreqChooser.getSelectedFile();
32 IdentifyFile identifier = new IdentifyFile();
33 FileFormatI format = null;
36 format = identifier.identify(file.getPath(), DataSourceType.FILE);
44 if (!Jalview.isHeadlessMode())
46 JvOptionPane.showInternalMessageDialog(Desktop.desktop,
47 MessageManager.getString("label.couldnt_read_data") + " in "
49 + AppletFormatAdapter.getSupportedFormats(),
50 MessageManager.getString("label.couldnt_read_data"),
51 JvOptionPane.WARNING_MESSAGE);
55 FileParse parser = new FileParse(file.getPath(), DataSourceType.FILE);
56 AlignmentI al = new FormatAdapter().readFromFile(parser, format);
59 ResidueCount counts = new ResidueCount(al.getSequences());