Clover icon

Coverage Report

  1. Project Clover database Thu Aug 13 2020 12:04:21 BST
  2. Package jalview.ws

File SequenceFetcher.java

 

Coverage histogram

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

Code metrics

6
20
2
1
93
51
5
0.25
10
2
2.5

Classes

Class Line # Actions
SequenceFetcher 42 20 5
1.0100%
 

Contributing tests

This file is covered by 97 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.ws.dbsources.EmblCdsSource;
25    import jalview.ws.dbsources.EmblSource;
26    import jalview.ws.dbsources.Pdb;
27    import jalview.ws.dbsources.PfamFull;
28    import jalview.ws.dbsources.PfamSeed;
29    import jalview.ws.dbsources.RfamSeed;
30    import jalview.ws.dbsources.Uniprot;
31    import jalview.ws.seqfetcher.ASequenceFetcher;
32    import jalview.ws.seqfetcher.DbSourceProxy;
33   
34    import java.util.ArrayList;
35    import java.util.Collections;
36    import java.util.List;
37   
38    /**
39    * This implements the run-time discovery of sequence database clients.
40    *
41    */
 
42    public class SequenceFetcher extends ASequenceFetcher
43    {
44    /**
45    * Thread safe construction of database proxies TODO: extend to a configurable
46    * database plugin mechanism where classes are instantiated by reflection and
47    * queried for their DbRefSource and version association.
48    *
49    */
 
50  8 toggle public SequenceFetcher()
51    {
52  8 addDBRefSourceImpl(EnsemblGene.class);
53    // addDBRefSourceImpl(EnsemblGenomes.class);
54  8 addDBRefSourceImpl(EmblSource.class);
55  8 addDBRefSourceImpl(EmblCdsSource.class);
56  8 addDBRefSourceImpl(Uniprot.class);
57  8 addDBRefSourceImpl(Pdb.class);
58  8 addDBRefSourceImpl(PfamFull.class);
59  8 addDBRefSourceImpl(PfamSeed.class);
60  8 addDBRefSourceImpl(RfamSeed.class);
61    }
62   
63    /**
64    * return an ordered list of database sources excluding alignment only databases
65    */
 
66  1747 toggle public String[] getNonAlignmentSources()
67    {
68  1747 String[] srcs = this.getSupportedDb();
69  1747 List<String> src = new ArrayList<>();
70   
71  15723 for (int i = 0; i < srcs.length; i++)
72    {
73  13976 boolean accept = true;
74  13976 for (DbSourceProxy dbs : getSourceProxy(srcs[i]))
75    {
76    // Skip the alignment databases for the moment - they're not useful for
77    // verifying a single sequence against its reference source
78  13976 if (dbs.isAlignmentSource())
79    {
80  5241 accept = false;
81  5241 break;
82    }
83    }
84  13976 if (accept)
85    {
86  8735 src.add(srcs[i]);
87    }
88    }
89   
90  1747 Collections.sort(src, String.CASE_INSENSITIVE_ORDER);
91  1747 return src.toArray(new String[src.size()]);
92    }
93    }