Clover icon

Coverage Report

  1. Project Clover database Thu Nov 28 2024 18:06:40 GMT
  2. Package jalview.io

File PContactPredictionFile.java

 

Coverage histogram

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

Code metrics

6
27
8
1
164
85
12
0.44
3.38
8
1.5

Classes

Class Line # Actions
PContactPredictionFile 46 27 12
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3    * Copyright (C) $$Year-Rel$$ The Jalview Authors
4    *
5    * This file is part of Jalview.
6    *
7    * Jalview is free software: you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation, either version 3
10    * of the License, or (at your option) any later version.
11    *
12    * Jalview is distributed in the hope that it will be useful, but
13    * WITHOUT ANY WARRANTY; without even the implied warranty
14    * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15    * PURPOSE. See the GNU General Public License for more details.
16    *
17    * You should have received a copy of the GNU General Public License
18    * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19    * The Jalview Authors are detailed in the 'AUTHORS' file.
20    */
21    package jalview.io;
22   
23    import jalview.datamodel.ContactMatrix;
24    import jalview.datamodel.SequenceI;
25   
26    import java.io.IOException;
27    import java.util.ArrayList;
28    import java.util.BitSet;
29    import java.util.HashMap;
30    import java.util.List;
31    import java.util.Map;
32   
33    /**
34    * A file parser for contact prediction files.
35    *
36    * An example file is the following
37    *
38    * <pre>
39    *
40    * </pre>
41    *
42    *
43    * @author jim procter
44    *
45    */
 
46    public class PContactPredictionFile extends AlignFile
47    {
48    protected static final String CONTACT_PREDICTION = "CONTACT_PREDICTION";
49   
 
50  0 toggle public PContactPredictionFile(String inFile,
51    DataSourceType fileSourceType) throws IOException
52    {
53  0 super(inFile, fileSourceType);
54   
55    }
56   
 
57  0 toggle public PContactPredictionFile(FileParse source) throws IOException
58    {
59  0 super(source);
60    }
61   
62    Integer fWidth;
63   
64    List<ContactMatrix> models = new ArrayList<ContactMatrix>();
65   
 
66  0 toggle public List<ContactMatrix> getContactMatrices()
67    {
68  0 return models;
69    }
70   
71    /*
72    * RaptorX pattern:
73    * for a contact prediction
74    * Target sequence
75    * alignment for target sequence
76    * contact matrix for sequence
77    * models generated that fit matrix
78    */
79   
80    /*
81    * TODO: create annotation rows from contact matrices.
82    * (non-Javadoc)
83    * @see jalview.io.AlignFile#parse()
84    */
 
85  0 toggle @Override
86    public void parse() throws IOException
87    {
88  0 String line;
89    /*
90    * stash any header lines if we've been given a CASP-RR file
91    */
92  0 Map<String, String> header = new HashMap<String, String>();
93  0 ContactMatrix cm = null;
94   
95  0 while ((line = nextLine()) != null)
96    {
97  0 int left, right;
98  0 double strength = Float.NaN;
99  0 String parts[] = line.split("\\s+");
100   
101    // check for header tokens in parts[0]
102   
103    // others - stash details
104    // MODEL - start a new matrix
105    // skip comments ?
106   
107  0 if (parts.length == 3) // and all are integers
108    {
109   
110  0 if (cm == null)
111    {
112  0 cm = new ContactMatrix(true)
113    {
 
114  0 toggle @Override
115    public String getType()
116    {
117  0 return CONTACT_PREDICTION;
118    }
119   
 
120  0 toggle @Override
121    public int getHeight()
122    {
123    // TODO Auto-generated method stub
124    // return maximum contact height
125  0 return 0;
126    }
127   
 
128  0 toggle @Override
129    public int getWidth()
130    {
131    // TODO Auto-generated method stub
132    // return total number of residues with contacts
133  0 return 0;
134    }
135    };
136  0 models.add(cm);
137    }
138   
139  0 try
140    {
141  0 left = Integer.parseInt(parts[0]);
142  0 right = Integer.parseInt(parts[1]);
143  0 strength = Double.parseDouble(parts[2]);
144    } catch (Exception x)
145    {
146  0 error = true;
147  0 errormessage = "Couldn't process line: " + x.getLocalizedMessage()
148    + "\n" + line;
149  0 return;
150    }
151  0 cm.addContact(left, right, (float) strength);
152    }
153    }
154    // TODO COMPLETE
155  0 throw (new Error("Not Implemented yet."));
156    }
157   
 
158  0 toggle @Override
159    public String print(SequenceI[] sqs, boolean jvsuffix)
160    {
161    // TODO Auto-generated method stub
162  0 return "Not valid.";
163    }
164    }