Clover icon

jalviewX

  1. Project Clover database Wed Oct 31 2018 15:13:58 GMT
  2. Package jalview.ws

File SequenceFetcher.java

 

Coverage histogram

../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

10
27
2
1
105
64
7
0.26
13.5
2
3.5

Classes

Class Line # Actions
SequenceFetcher 41 27 7 0
1.0100%
 

Contributing tests

This file is covered by 79 tests. .

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.ws;
22   
23    import jalview.ext.ensembl.EnsemblGene;
24    import jalview.ext.ensembl.EnsemblGenomes;
25    import jalview.ws.dbsources.EmblCdsSource;
26    import jalview.ws.dbsources.EmblSource;
27    import jalview.ws.dbsources.Pdb;
28    import jalview.ws.dbsources.PfamFull;
29    import jalview.ws.dbsources.PfamSeed;
30    import jalview.ws.dbsources.RfamSeed;
31    import jalview.ws.dbsources.Uniprot;
32    import jalview.ws.seqfetcher.ASequenceFetcher;
33    import jalview.ws.seqfetcher.DbSourceProxy;
34   
35    import java.util.ArrayList;
36   
37    /**
38    * This implements the run-time discovery of sequence database clients.
39    *
40    */
 
41    public class SequenceFetcher extends ASequenceFetcher
42    {
43    /**
44    * Thread safe construction of database proxies TODO: extend to a configurable
45    * database plugin mechanism where classes are instantiated by reflection and
46    * queried for their DbRefSource and version association.
47    *
48    */
 
49  6 toggle public SequenceFetcher()
50    {
51  6 addDBRefSourceImpl(EnsemblGene.class);
52  6 addDBRefSourceImpl(EnsemblGenomes.class);
53  6 addDBRefSourceImpl(EmblSource.class);
54  6 addDBRefSourceImpl(EmblCdsSource.class);
55  6 addDBRefSourceImpl(Uniprot.class);
56  6 addDBRefSourceImpl(Pdb.class);
57  6 addDBRefSourceImpl(PfamFull.class);
58  6 addDBRefSourceImpl(PfamSeed.class);
59  6 addDBRefSourceImpl(RfamSeed.class);
60    }
61   
62    /**
63    * return an ordered list of database sources excluding alignment only databases
64    */
 
65  1102 toggle public String[] getOrderedSupportedSources()
66    {
67  1102 String[] srcs = this.getSupportedDb();
68  1102 ArrayList<String> src = new ArrayList<>();
69   
70  11020 for (int i = 0; i < srcs.length; i++)
71    {
72  9918 boolean skip = false;
73  9918 for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
74    {
75    // Skip the alignment databases for the moment - they're not useful for
76    // verifying a single sequence against its reference source
77  9918 if (dbs.isAlignmentSource())
78    {
79  3306 skip = true;
80    }
81    }
82  9918 if (skip)
83    {
84  3306 continue;
85    }
86    {
87  6612 src.add(srcs[i]);
88    }
89    }
90  1102 String[] tosort = src.toArray(new String[0]),
91    sorted = src.toArray(new String[0]);
92  7714 for (int j = 0, jSize = sorted.length; j < jSize; j++)
93    {
94  6612 tosort[j] = tosort[j].toLowerCase();
95    }
96  1102 jalview.util.QuickSort.sort(tosort, sorted);
97    // construct array with all sources listed
98  1102 int i = 0;
99  7714 for (int j = sorted.length - 1; j >= 0; j--, i++)
100    {
101  6612 srcs[i] = sorted[j];
102    }
103  1102 return srcs;
104    }
105    }