Clover icon

Coverage Report

  1. Project Clover database Thu Dec 4 2025 14:43:25 GMT
  2. Package jalview.io

File CountReader.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
60% of files have more coverage

Code metrics

6
17
1
1
63
51
5
0.29
17
1
5

Classes

Class Line # Actions
CountReader 18 17 5
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package jalview.io;
2   
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;
11   
12    import java.io.File;
13    import java.io.IOException;
14    import java.net.MalformedURLException;
15   
16    import javax.swing.JFileChooser;
17   
 
18    public class CountReader
19    {
 
20  0 toggle public static ResidueCount getBackgroundFrequencies(AlignmentPanel ap, SequenceI seq) throws MalformedURLException, IOException
21    {
22  0 JFileChooser bkgdFreqChooser = new JFileChooser();
23   
24  0 bkgdFreqChooser.showOpenDialog(ap);
25   
26  0 File file = bkgdFreqChooser.getSelectedFile();
27  0 if (file == null)
28    {
29  0 return null;
30    }
31   
32  0 IdentifyFile identifier = new IdentifyFile();
33  0 FileFormatI format = null;
34  0 try
35    {
36  0 format = identifier.identify(file.getPath(), DataSourceType.FILE);
37    } catch (Exception e)
38    {
39   
40    }
41   
42  0 if (format == null)
43    {
44  0 if (!Jalview.isHeadlessMode())
45    {
46  0 JvOptionPane.showInternalMessageDialog(Desktop.getInstance(),
47    MessageManager.getString("label.couldnt_read_data") + " in "
48    + file + "\n"
49    + AppletFormatAdapter.getSupportedFormats(),
50    MessageManager.getString("label.couldnt_read_data"),
51    JvOptionPane.WARNING_MESSAGE);
52    }
53    }
54   
55  0 FileParse parser = new FileParse(file.getPath(), DataSourceType.FILE);
56  0 AlignmentI al = new FormatAdapter().readFromFile(parser, format);
57  0 parser.close();
58   
59  0 ResidueCount counts = new ResidueCount(al.getSequences());
60   
61  0 return counts;
62    }
63    }