boolean soDefault = !Platform.isJS();
if (Cache.getDefault("USE_FULL_SO", soDefault))
{
- SequenceOntologyFactory.setInstance(new SequenceOntology());
+ SequenceOntologyFactory.setSequenceOntology(new SequenceOntology());
}
if (!headless)
{
return true;
}
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
for (String term : soTerm)
{
if (type.equals(term) || so.isA(type, term))
@Override
protected boolean retainFeature(SequenceFeature sf, String accessionId)
{
- if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
+ if (SequenceOntologyFactory.getSequenceOntology().isA(sf.getType(),
SequenceOntologyI.CDS))
{
return false;
@Override
protected boolean retainFeature(SequenceFeature sf, String accessionId)
{
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
String type = sf.getType();
if (so.isA(type, SequenceOntologyI.GENE))
{
{
return new FeatureSettingsAdapter()
{
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
@Override
public boolean isFeatureDisplayed(String type)
* for sequence_variant on reverse strand, have to convert the allele
* values to their complements
*/
- if (!forwardStrand && SequenceOntologyFactory.getInstance()
+ if (!forwardStrand && SequenceOntologyFactory.getSequenceOntology()
.isA(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT))
{
reverseComplementAlleles(copy);
public static boolean isTranscript(String featureType)
{
return SequenceOntologyI.NMD_TRANSCRIPT_VARIANT.equals(featureType)
- || SequenceOntologyFactory.getInstance().isA(featureType,
+ || SequenceOntologyFactory.getSequenceOntology().isA(featureType,
SequenceOntologyI.TRANSCRIPT);
}
}
*/
package jalview.httpserver;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.rest.RestHandler;
import java.net.BindException;
* @author gmcarstairs
* @see http://eclipse.org/jetty/documentation/current/embedding-jetty.html
*/
-public class HttpServer
+public class HttpServer implements ApplicationSingletonI
{
+ /**
+ * Returns the singleton instance of this class.
+ *
+ * @return
+ * @throws BindException
+ */
+ public static HttpServer getInstance() throws BindException
+ {
+ synchronized (HttpServer.class)
+ {
+ return (HttpServer) ApplicationSingletonProvider.getInstance(HttpServer.class);
+ }
+ }
/*
* 'context root' - actually just prefixed to the path for each handler for
* now - see registerHandler
private static final String JALVIEW_PATH = "jalview";
/*
- * Singleton instance of this server
- */
- private static HttpServer instance;
-
- /*
* The Http server
*/
private Server server;
*/
private URI contextRoot;
- /**
- * Returns the singleton instance of this class.
- *
- * @return
- * @throws BindException
- */
- public static HttpServer getInstance() throws BindException
- {
- synchronized (HttpServer.class)
- {
- if (instance == null)
- {
- instance = new HttpServer();
- }
- return instance;
- }
- }
/**
* Private constructor to enforce use of singleton
import java.util.Map;
import java.util.Set;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
+
/**
* A singleton registry of alignment file formats known to Jalview. On startup,
* the 'built-in' formats are added (from the FileFormat enum). Additional
* @author gmcarstairs
*
*/
-public class FileFormats
+public class FileFormats implements ApplicationSingletonI
{
- private static FileFormats instance = new FileFormats();
+ public static FileFormats getInstance()
+ {
+ return (FileFormats) ApplicationSingletonProvider.getInstance(FileFormats.class);
+ }
+
/*
* A lookup map of file formats by upper-cased name
*/
- private static Map<String, FileFormatI> formats;
+ private Map<String, FileFormatI> formats;
/*
* Formats in this set are capable of being identified by IdentifyFile
*/
- private static Set<FileFormatI> identifiable;
-
- public static FileFormats getInstance()
- {
- return instance;
- }
+ private Set<FileFormatI> identifiable;
/**
* Private constructor registers Jalview's built-in file formats
*/
package jalview.io.cache;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.bin.Cache;
import java.util.Hashtable;
* @author tcnofoegbu
*
*/
-public class AppCache
+public class AppCache implements ApplicationSingletonI
{
+
+ public static AppCache getInstance()
+ {
+ return (AppCache) ApplicationSingletonProvider.getInstance(AppCache.class);
+ }
+
public static final String DEFAULT_LIMIT = "99";
public static final String CACHE_DELIMITER = ";";
- private static AppCache instance = null;
-
private static final String DEFAULT_LIMIT_KEY = ".DEFAULT_LIMIT";
private Hashtable<String, LinkedHashSet<String>> cacheItems;
}
/**
- * Returns a singleton instance of AppCache
- *
- * @return
- */
- public static AppCache getInstance()
- {
- if (instance == null)
- {
- instance = new AppCache();
- }
- return instance;
- }
-
- /**
* Method for persisting cache items for a given cache key
*
* @param cacheKey
String atts = gff[ATTRIBUTES_COL];
Map<String, List<String>> attributes = parseNameValuePairs(atts);
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
if (so.isA(soTerm, SequenceOntologyI.PROTEIN_MATCH))
{
sf = processProteinMatch(attributes, seq, gff, align, newseqs,
desc = target.split(" ")[0];
}
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
String type = sf.getType();
if (so.isA(type, SequenceOntologyI.SEQUENCE_VARIANT))
{
*/
public static boolean recognises(String[] columns)
{
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
String type = columns[TYPE_COL];
if (so.isA(type, SequenceOntologyI.PROTEIN_MATCH)
|| (".".equals(columns[SOURCE_COL])
*/
package jalview.io.gff;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
+
/**
* A factory class that returns a model of the Sequence Ontology. By default a
* hard-coded subset is used (for the applet, or testing), or setInstance() can
* @author gmcarstairs
*
*/
-public class SequenceOntologyFactory
+public class SequenceOntologyFactory implements ApplicationSingletonI
{
- private static SequenceOntologyI instance;
+ /**
+ * Answers an instance of this class for the current application context. Note
+ * that this supports running two JS 'applets' on the same page, one with the
+ * full Sequence Ontology (USE_FULL_SO = true) and one with a hard-coded
+ * subset (USE_FULL_SO = false). If this is overkill, could change this method
+ * to just return a common static instance.
+ *
+ * @return
+ */
+ private static synchronized SequenceOntologyFactory getInstance()
+ {
+ return (SequenceOntologyFactory) ApplicationSingletonProvider
+ .getInstance(SequenceOntologyFactory.class);
+ }
- public static synchronized SequenceOntologyI getInstance()
+ /**
+ * Answers the configured model of the Sequence Ontology.
+ *
+ * @return
+ */
+ public static synchronized SequenceOntologyI getSequenceOntology()
{
- if (instance == null)
- {
- instance = new SequenceOntologyLite();
- }
- return instance;
+ SequenceOntologyFactory f = getInstance();
+ return (f.sequenceOntology == null
+ ? f.sequenceOntology = new SequenceOntologyLite()
+ : f.sequenceOntology);
}
- public static void setInstance(SequenceOntologyI so)
+ /**
+ * For testng only
+ *
+ * @param so
+ */
+ public static void setSequenceOntology(SequenceOntologyI so)
{
- instance = so;
+ getInstance().sequenceOntology = so;
}
+
+
+ private SequenceOntologyI sequenceOntology;
+
+ private SequenceOntologyFactory()
+ {
+ // private singleton
+ }
+
}
*/
package jalview.rest;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.httpserver.AbstractRequestHandler;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
/**
- * A simple handler to process (or delegate) HTTP requests on /jalview/rest
+ * A simple handler to process (or delegate) HTTP requests on /jalview/rest.
*/
public class RestHandler extends AbstractRequestHandler
+ implements ApplicationSingletonI
{
private static final String MY_PATH = "rest";
private static final String MY_NAME = "Rest";
/**
- * Singleton instance of this class
- */
- private static RestHandler instance = null;
-
- /**
* Returns the singleton instance of this class
*
* @return
{
synchronized (RestHandler.class)
{
- if (instance == null)
- {
- instance = new RestHandler();
- }
+ return (RestHandler) ApplicationSingletonProvider.getInstance(RestHandler.class);
}
- return instance;
}
/**
package jalview.schemes;
import jalview.api.AlignViewportI;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.datamodel.AnnotatedCollectionI;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceI;
+import jalview.util.ColorUtils;
+import java.awt.Color;
import java.util.LinkedHashMap;
import java.util.Map;
-public class ColourSchemes
+public class ColourSchemes implements ApplicationSingletonI
{
- /*
- * singleton instance of this class
- */
- private static ColourSchemes instance = new ColourSchemes();
-
- /*
- * a map from scheme name (lower-cased) to an instance of it
- */
- private Map<String, ColourSchemeI> schemes;
/**
* Returns the singleton instance of this class
*/
public static ColourSchemes getInstance()
{
- return instance;
+ return (ColourSchemes) ApplicationSingletonProvider
+ .getInstance(ColourSchemes.class);
}
private ColourSchemes()
}
/**
+ * ColourSchemeProperty "static"
+ */
+ public Color[] rnaHelices = null;
+
+ /**
+ * delete the existing cached RNA helices colours
+ */
+ public static void resetRnaHelicesShading()
+ {
+ getInstance().rnaHelices = null;
+ }
+
+ public static void initRnaHelicesShading(int n)
+ {
+ int i = 0;
+ ColourSchemes j = getInstance();
+
+ if (j.rnaHelices == null)
+ {
+ j.rnaHelices = new Color[n + 1];
+ }
+ else if (j.rnaHelices != null && j.rnaHelices.length <= n)
+ {
+ Color[] t = new Color[n + 1];
+ System.arraycopy(j.rnaHelices, 0, t, 0, j.rnaHelices.length);
+ i = j.rnaHelices.length;
+ j.rnaHelices = t;
+ }
+ else
+ {
+ return;
+ }
+ // Generate random colors and store
+ for (; i <= n; i++)
+ {
+ j.rnaHelices[i] = ColorUtils.generateRandomColor(Color.white);
+ }
+ }
+
+ /**
+ * a map from scheme name (lower-cased) to an instance of it
+ */
+ private Map<String, ColourSchemeI> schemes;
+
+ /**
* Loads an instance of each standard or user-defined colour scheme
*
* @return
*/
package jalview.structure;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.PDBEntry.Type;
* @author tcofoegbu
*
*/
-public class StructureImportSettings
+public class StructureImportSettings implements ApplicationSingletonI
{
+
+ private StructureImportSettings()
+ {
+ // private singleton
+ }
+
+ private static StructureImportSettings getInstance()
+ {
+ return (StructureImportSettings) ApplicationSingletonProvider
+ .getInstance(StructureImportSettings.class);
+ }
+
/**
* set to true to add derived sequence annotations (temp factor read from
* file, or computed secondary structure) to the alignment
*/
- private static boolean visibleChainAnnotation = false;
+ private boolean visibleChainAnnotation = false;
/**
* Set true to predict secondary structure (using JMol for protein, Annotate3D
* for RNA)
*/
- private static boolean processSecStr = false;
+ private boolean processSecStr = false;
/**
* Set true (with predictSecondaryStructure=true) to predict secondary
* structure using an external service (currently Annotate3D for RNA only)
*/
- private static boolean externalSecondaryStructure = false;
+ private boolean externalSecondaryStructure = false;
- private static boolean showSeqFeatures = true;
+ private boolean showSeqFeatures = true;
public enum StructureParser
{
* Determines the default file format for structure files to be downloaded
* from the PDB sequence fetcher. Possible options include: PDB|mmCIF
*/
- private static PDBEntry.Type defaultStructureFileFormat = Type.PDB;
+ private PDBEntry.Type defaultStructureFileFormat = Type.PDB;
/**
* Determines the parser used for parsing PDB format file. Possible options
* are : JMolParser|JalveiwParser
*/
- private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
+ private StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
public static void addSettings(boolean addAlignmentAnnotations,
boolean processSecStr, boolean externalSecStr)
{
- StructureImportSettings.visibleChainAnnotation = addAlignmentAnnotations;
- StructureImportSettings.processSecStr = processSecStr;
- StructureImportSettings.externalSecondaryStructure = externalSecStr;
- StructureImportSettings.showSeqFeatures = true;
+ StructureImportSettings s = getInstance();
+ s.visibleChainAnnotation = addAlignmentAnnotations;
+ s.processSecStr = processSecStr;
+ s.externalSecondaryStructure = externalSecStr;
+ s.showSeqFeatures = true;
}
public static boolean isVisibleChainAnnotation()
{
- return visibleChainAnnotation;
+ return getInstance().visibleChainAnnotation;
}
public static void setVisibleChainAnnotation(
boolean visibleChainAnnotation)
{
- StructureImportSettings.visibleChainAnnotation = visibleChainAnnotation;
+ getInstance().visibleChainAnnotation = visibleChainAnnotation;
}
public static boolean isProcessSecondaryStructure()
{
- return processSecStr;
+ return getInstance().processSecStr;
}
public static void setProcessSecondaryStructure(
boolean processSecondaryStructure)
{
- StructureImportSettings.processSecStr = processSecondaryStructure;
+ getInstance().processSecStr = processSecondaryStructure;
}
public static boolean isExternalSecondaryStructure()
{
- return externalSecondaryStructure;
+ return getInstance().externalSecondaryStructure;
}
public static void setExternalSecondaryStructure(
boolean externalSecondaryStructure)
{
- StructureImportSettings.externalSecondaryStructure = externalSecondaryStructure;
+ getInstance().externalSecondaryStructure = externalSecondaryStructure;
}
public static boolean isShowSeqFeatures()
{
- return showSeqFeatures;
+ return getInstance().showSeqFeatures;
}
public static void setShowSeqFeatures(boolean showSeqFeatures)
{
- StructureImportSettings.showSeqFeatures = showSeqFeatures;
+ getInstance().showSeqFeatures = showSeqFeatures;
}
public static PDBEntry.Type getDefaultStructureFileFormat()
{
- return defaultStructureFileFormat;
+ return getInstance().defaultStructureFileFormat;
}
public static void setDefaultStructureFileFormat(
String defaultStructureFileFormat)
{
- StructureImportSettings.defaultStructureFileFormat = PDBEntry.Type
+ getInstance().defaultStructureFileFormat = PDBEntry.Type
.valueOf(defaultStructureFileFormat.toUpperCase());
}
public static String getDefaultPDBFileParser()
{
- return defaultPDBFileParser.toString();
+ return getInstance().defaultPDBFileParser.toString();
}
public static void setDefaultPDBFileParser(
StructureParser defaultPDBFileParser)
{
- StructureImportSettings.defaultPDBFileParser = defaultPDBFileParser;
+ getInstance().defaultPDBFileParser = defaultPDBFileParser;
}
public static void setDefaultPDBFileParser(String defaultPDBFileParser)
{
- StructureImportSettings.defaultPDBFileParser = StructureParser
+ getInstance().defaultPDBFileParser = StructureParser
.valueOf(defaultPDBFileParser.toUpperCase());
}
*/
package jalview.structure;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
import jalview.analysis.AlignSeq;
import jalview.api.StructureSelectionManagerProvider;
+import jalview.bin.ApplicationSingletonProvider;
+import jalview.bin.ApplicationSingletonProvider.ApplicationSingletonI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.ws.sifts.SiftsClient;
import jalview.ws.sifts.SiftsException;
import jalview.ws.sifts.SiftsSettings;
+
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
import mc_view.Atom;
import mc_view.PDBChain;
import mc_view.PDBfile;
-public class StructureSelectionManager
+public class StructureSelectionManager implements ApplicationSingletonI
{
public final static String NEWLINE = System.lineSeparator();
- static IdentityHashMap<StructureSelectionManagerProvider, StructureSelectionManager> instances;
-
private List<StructureMapping> mappings = new ArrayList<>();
private boolean processSecondaryStructure = false;
private List<SelectionListener> sel_listeners = new ArrayList<>();
+ /*
+ * instances of this class scoped by some context class
+ */
+ private IdentityHashMap<StructureSelectionManagerProvider, StructureSelectionManager> selectionManagers;
+
+ /**
+ * Answers an instance of this class for the current application (Java or JS
+ * 'applet') scope
+ *
+ * @return
+ */
+ private static StructureSelectionManager getInstance()
+ {
+ return (StructureSelectionManager) ApplicationSingletonProvider
+ .getInstance(StructureSelectionManager.class);
+ }
+
+ /**
+ * Answers an instance of this class for the current application (Java or JS
+ * 'applet') scope, and scoped to the specified context
+ *
+ * @param context
+ * @return
+ */
+ public static StructureSelectionManager getStructureSelectionManager(
+ StructureSelectionManagerProvider context)
+ {
+ return getInstance().getInstanceForContext(context);
+ }
+
+ /**
+ * Answers an instance of this class scoped to the given context. The instance
+ * is created on the first request for the context, thereafter the same
+ * instance is returned. Note that the context may be null (this is the case
+ * when running headless without a Desktop).
+ *
+ * @param context
+ * @return
+ */
+ StructureSelectionManager getInstanceForContext(
+ StructureSelectionManagerProvider context)
+ {
+ StructureSelectionManager instance = selectionManagers.get(context);
+ if (instance == null)
+ {
+ instance = new StructureSelectionManager();
+ selectionManagers.put(context, instance);
+ }
+ return instance;
+ }
+
+ /**
+ * Private constructor as all 'singleton' instances are managed here or by
+ * ApplicationSingletonProvider
+ */
+ private StructureSelectionManager()
+ {
+ selectionManagers = new IdentityHashMap<>();
+ }
+
/**
* @return true if will try to use external services for processing secondary
* structure
|| pdbIdFileName.containsKey(idOrFile);
}
- private static StructureSelectionManager nullProvider = null;
-
- public static StructureSelectionManager getStructureSelectionManager(
- StructureSelectionManagerProvider context)
- {
- if (context == null)
- {
- if (nullProvider == null)
- {
- if (instances != null)
- {
- throw new Error(MessageManager.getString(
- "error.implementation_error_structure_selection_manager_null"),
- new NullPointerException(MessageManager
- .getString("exception.ssm_context_is_null")));
- }
- else
- {
- nullProvider = new StructureSelectionManager();
- }
- return nullProvider;
- }
- }
- if (instances == null)
- {
- instances = new java.util.IdentityHashMap<>();
- }
- StructureSelectionManager instance = instances.get(context);
- if (instance == null)
- {
- if (nullProvider != null)
- {
- instance = nullProvider;
- }
- else
- {
- instance = new StructureSelectionManager();
- }
- instances.put(context, instance);
- }
- return instance;
- }
-
/**
* flag controlling whether SeqMappings are relayed from received sequence
* mouse over events to other sequences
return relaySeqMappings;
}
- Vector listeners = new Vector();
+ Vector<Object> listeners = new Vector<>();
/**
* register a listener for alignment sequence mouseover events
* Import structure data and register a structure mapping for broadcasting
* colouring, mouseovers and selection events (convenience wrapper).
*
+ * This is the standard entry point.
+ *
* @param sequence
* - one or more sequences to be mapped to pdbFile
* @param targetChains
* broadcasting colouring, mouseovers and selection events (convenience
* wrapper).
*
+ *
+ *
* @param forStructureView
- * when true, record the mapping for use in mouseOvers
+ * when true (testng only), record the mapping for use in mouseOvers
+ * (testng only)
* @param sequence
* - one or more sequences to be mapped to pdbFile
* @param targetChains
* mapping operation
* @return null or the structure data parsed as a pdb file
*/
- synchronized public StructureFile computeMapping(
+ synchronized private StructureFile computeMapping(
boolean forStructureView, SequenceI[] sequenceArray,
String[] targetChainIds, String pdbFile, DataSourceType sourceType,
IProgressIndicator progress)
{
ds = ds.getDatasetSequence();
}
- ;
if (ds.getAnnotation() != null)
{
for (AlignmentAnnotation ala : ds.getAnnotation())
if (s != null)
{
result = s;
- }
}
}
+ }
return result;
}
}
/**
- * Resets this object to its initial state by removing all registered
- * listeners, codon mappings, PDB file mappings
+ * Reset this object to its initial state by removing all registered
+ * listeners, codon mappings, PDB file mappings.
+ *
+ * Called only by Desktop and testng.
+ *
*/
public void resetAll()
{
if (mappings != null)
{
- mappings.clear();
+ mappings.clear();
}
if (seqmappings != null)
{
- seqmappings.clear();
+ seqmappings.clear();
}
if (sel_listeners != null)
{
- sel_listeners.clear();
+ sel_listeners.clear();
}
if (listeners != null)
{
- listeners.clear();
+ listeners.clear();
}
if (commandListeners != null)
{
- commandListeners.clear();
+ commandListeners.clear();
}
if (view_listeners != null)
{
- view_listeners.clear();
+ view_listeners.clear();
}
if (pdbFileNameId != null)
{
- pdbFileNameId.clear();
+ pdbFileNameId.clear();
}
if (pdbIdFileName != null)
{
- pdbIdFileName.clear();
+ pdbIdFileName.clear();
}
}
{
slis.viewPosition(startRes, endRes, startSeq, endSeq, source);
}
- ;
+
}
}
}
+
/**
- * release all references associated with this manager provider
+ * Removes the instance associated with this provider
*
- * @param jalviewLite
+ * @param provider
*/
- public static void release(StructureSelectionManagerProvider jalviewLite)
+
+ public static void release(StructureSelectionManagerProvider provider)
{
- // synchronized (instances)
- {
- if (instances == null)
- {
- return;
- }
- StructureSelectionManager mnger = (instances.get(jalviewLite));
- if (mnger != null)
- {
- instances.remove(jalviewLite);
- try
- {
- /* bsoares 2019-03-20 finalize deprecated, no apparent external
- * resources to close
- */
- // mnger.finalize();
- } catch (Throwable x)
- {
- }
- }
- }
+ getInstance().selectionManagers.remove(provider);
}
-
+
public void registerPDBEntry(PDBEntry pdbentry)
{
if (pdbentry.getFile() != null
@BeforeClass(alwaysRun = true)
public void setUp()
{
- SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
+ SequenceOntologyFactory.setSequenceOntology(new SequenceOntologyLite());
}
@AfterClass(alwaysRun = true)
public void tearDown()
{
- SequenceOntologyFactory.setInstance(null);
+ SequenceOntologyFactory.setSequenceOntology(null);
}
/**
@BeforeClass(alwaysRun = true)
public void setUp()
{
- SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
+ SequenceOntologyFactory.setSequenceOntology(new SequenceOntologyLite());
}
@AfterClass(alwaysRun = true)
public void tearDown()
{
- SequenceOntologyFactory.setInstance(null);
+ SequenceOntologyFactory.setSequenceOntology(null);
}
/**
public void setUp()
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
+ SequenceOntologyFactory.setSequenceOntology(new SequenceOntologyLite());
}
@AfterClass(alwaysRun = true)
public void tearDown()
{
- SequenceOntologyFactory.setInstance(null);
+ SequenceOntologyFactory.setSequenceOntology(null);
}
/**
@BeforeClass(alwaysRun = true)
public void setUp()
{
- SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
+ SequenceOntologyFactory.setSequenceOntology(new SequenceOntologyLite());
}
@AfterClass(alwaysRun = true)
public void tearDown()
{
- SequenceOntologyFactory.setInstance(null);
+ SequenceOntologyFactory.setSequenceOntology(null);
}
/**
@BeforeClass(alwaysRun = true)
public void setUp()
{
- SequenceOntologyFactory.setInstance(new SequenceOntologyLite());
+ SequenceOntologyFactory.setSequenceOntology(new SequenceOntologyLite());
}
@AfterClass(alwaysRun = true)
public void tearDown()
{
- SequenceOntologyFactory.setInstance(null);
+ SequenceOntologyFactory.setSequenceOntology(null);
}
@DataProvider(name = "ens_seqs")
SequenceRenderer sr = new SequenceRenderer(af.getViewport());
SequenceI[][] seqs = new SequenceI[][] { { seq1 }, { seq2 } };
String[] files = new String[] { "seq1.pdb", "seq2.pdb" };
- StructureSelectionManager ssm = new StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager.getStructureSelectionManager(null);
// need some mappings!
SequenceRenderer sr = new SequenceRenderer(af.getViewport());
SequenceI[][] seqs = new SequenceI[][] { { seq1 }, { seq2 } };
String[] files = new String[] { "seq1.pdb", "seq2.pdb" };
- StructureSelectionManager ssm = new StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager.getStructureSelectionManager(null);
/*
* map residues 1-10 to residues 21-30 (atoms 105-150) in structures
SequenceRenderer sr = new SequenceRenderer(af.getViewport());
SequenceI[][] seqs = new SequenceI[][] { { seq1 }, { seq2 } };
String[] files = new String[] { "seq1.pdb", "seq2.pdb" };
- StructureSelectionManager ssm = new StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager.getStructureSelectionManager(null);
/*
* map residues 1-10 to residues 21-30 (atoms 105-150) in structures
int coils[] = { 266, 275, 278, 287, 289, 298, 302, 316 }, helices[] = new int[]
{ 303, 315 }, sheets[] = new int[] { 267, 268, 269, 270 };
- StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(null);
StructureFile pmap = ssm.setMapping(true, new SequenceI[] { uprot },
new String[] { "A" }, "test/jalview/ext/jmol/1QCF.pdb",
DataSourceType.FILE);
"EIVKGVCSNFLCDLQPGDNVQITGPVGKEMLMPKDPNATIIMLATGTGIAPFRSFLWKMFFEKHDDYKFNGLGWLFLGVPTSSSLLYKEEFGKM");
Sequence sq1 = new Sequence(sq);
String inFile;
- StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(null);
// Associate the 1GAQ pdb file with the subsequence 'imported' from another
// source
StructureFile pde = ssm.setMapping(true, new SequenceI[] { sq },
">FER1_MAIZE/1-150 Ferredoxin-1, chloroplast precursor\nMATVLGSPRAPAFFFSSSSLRAAPAPTAVALPAAKVGIMGRSASSRRRLRAQATYNVKLITPEGEVELQVPD\nDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDVVIETHKE\nEELTGA",
DataSourceType.PASTE, FileFormat.Fasta);
SequenceI newseq = seqf.getViewport().getAlignment().getSequenceAt(0);
- StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(null);
StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
new String[] { null }, "examples/3W5V.pdb",
DataSourceType.FILE);
// make it harder by shifting the copy vs the reference
newseq.setStart(refseq.getStart() + 25);
newseq.setEnd(refseq.getLength() + 25 + refseq.getStart());
- StructureSelectionManager ssm = new jalview.structure.StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager
+ .getStructureSelectionManager(null);
ssm.setProcessSecondaryStructure(true);
ssm.setAddTempFacAnnot(true);
StructureFile pmap = ssm.setMapping(true, new SequenceI[] { newseq },
public void setUp()
{
StructureImportSettings.setShowSeqFeatures(true);
- ssm = new StructureSelectionManager();
+ ssm = StructureSelectionManager.getStructureSelectionManager(null);
}
@Test(groups = { "Functional" })
SequenceI seq = new Sequence(
"1GAQ|B",
"ATYNVKLITPEGEVELQVPDDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDVVIETHKEEELTGA");
- StructureSelectionManager sm = new StructureSelectionManager();
+ StructureSelectionManager sm = StructureSelectionManager.getStructureSelectionManager(null);
sm.setProcessSecondaryStructure(true);
sm.setAddTempFacAnnot(true);
StructureFile pmap = sm.setMapping(true, new SequenceI[] { seq },
SequenceI seq = new Sequence("4IM2|A",
"LDFCIRNIEKTVMGEISDIHTKLLRLSSSQGTIE");
String P4IM2_MISSING = "examples/testdata/4IM2_missing.pdb";
- StructureSelectionManager sm = new StructureSelectionManager();
+ StructureSelectionManager sm = StructureSelectionManager.getStructureSelectionManager(null);
sm.setProcessSecondaryStructure(true);
sm.setAddTempFacAnnot(true);
StructureFile pmap = sm.setMapping(true, new SequenceI[] { seq },
PDBEntry importedPDB = new PDBEntry("3A6S", "", Type.PDB,
"Paste");
AAStructureBindingModel binder = new AAStructureBindingModel(
- new StructureSelectionManager(), new PDBEntry[]
+ StructureSelectionManager.getStructureSelectionManager(null), new PDBEntry[]
{ importedPDB },
new SequenceI[][]
{ importedAl.getSequencesArray() }, null)
seqs[0] = new SequenceI[] { seq1a, seq1b };
seqs[1] = new SequenceI[] { seq2 };
seqs[2] = new SequenceI[] { seq3 };
- StructureSelectionManager ssm = new StructureSelectionManager();
+ StructureSelectionManager ssm = StructureSelectionManager.getStructureSelectionManager(null);
ssm.setMapping(new SequenceI[] { seq1a, seq1b }, null, PDB_1,
DataSourceType.PASTE, null);