for (int i = 0; i < pdb.getChains().size(); i++)
{
- mappingDetails.append("\n\nPDB Sequence is :\nSequence = "
- + pdb.getChains().elementAt(i).sequence.getSequenceAsString());
+ mappingDetails
+ .append("\n\nPDB Sequence is :\nSequence = "
+ + pdb.getChains().elementAt(i).sequence
+ .getSequenceAsString());
mappingDetails.append("\nNo of residues = "
+ pdb.getChains().elementAt(i).residues.size() + "\n\n");
// Align the sequence to the pdb
// TODO: DNa/Pep switch
AlignSeq as = new AlignSeq(sequence,
- pdb.getChains().elementAt(i).sequence,
- pdb.getChains().elementAt(i).isNa ? AlignSeq.DNA : AlignSeq.PEP);
+ pdb.getChains().elementAt(i).sequence, pdb.getChains()
+ .elementAt(i).isNa ? AlignSeq.DNA : AlignSeq.PEP);
as.calcScoreMatrix();
as.traceAlignment();
PrintStream ps = new PrintStream(System.out)
}
return false;
}
+
public Atom(float x, float y, float z)
{
this.x = x;
for (int i = 0; i < pdb.getChains().size(); i++)
{
- mappingDetails.append("\n\nPDB Sequence is :\nSequence = "
- + pdb.getChains().elementAt(i).sequence.getSequenceAsString());
+ mappingDetails
+ .append("\n\nPDB Sequence is :\nSequence = "
+ + pdb.getChains().elementAt(i).sequence
+ .getSequenceAsString());
mappingDetails.append("\nNo of residues = "
+ pdb.getChains().elementAt(i).residues.size() + "\n\n");
else
{
- // Make a new Residue object with the new atoms vector
- residues.addElement(new Residue(resAtoms, resNumber - 1, count));
+ // Make a new Residue object with the new atoms vector
+ residues.addElement(new Residue(resAtoms, resNumber - 1, count));
- Residue tmpres = residues.lastElement();
- Atom tmpat = tmpres.atoms.get(0);
- // Make A new SequenceFeature for the current residue numbering
+ Residue tmpres = residues.lastElement();
+ Atom tmpat = tmpres.atoms.get(0);
+ // Make A new SequenceFeature for the current residue numbering
SequenceFeature sf = new SequenceFeature("RESNUM", tmpat.resName
- + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset
- + count, offset + count, pdbid);
- resFeatures.addElement(sf);
- resAnnotation.addElement(new Annotation(tmpat.tfactor));
- // Keep totting up the sequence
+ + ":" + tmpat.resNumIns + " " + pdbid + id, "", offset
+ + count, offset + count, pdbid);
+ resFeatures.addElement(sf);
+ resAnnotation.addElement(new Annotation(tmpat.tfactor));
+ // Keep totting up the sequence
- if ((symbol = ResidueProperties.getAA3Hash().get(tmpat.resName)) == null)
- {
- String nucname = tmpat.resName.trim();
- // use the aaIndex rather than call 'toLower' - which would take a bit
- // more time.
- deoxyn = nucname.length() == 2
- && ResidueProperties.aaIndex[nucname.charAt(0)] == ResidueProperties.aaIndex['D'];
- if (tmpat.name.equalsIgnoreCase("CA")
- || ResidueProperties.nucleotideIndex[nucname
- .charAt((deoxyn ? 1 : 0))] == -1)
+ if ((symbol = ResidueProperties.getAA3Hash().get(tmpat.resName)) == null)
{
+ String nucname = tmpat.resName.trim();
+ // use the aaIndex rather than call 'toLower' - which would take a bit
+ // more time.
+ deoxyn = nucname.length() == 2
+ && ResidueProperties.aaIndex[nucname.charAt(0)] == ResidueProperties.aaIndex['D'];
+ if (tmpat.name.equalsIgnoreCase("CA")
+ || ResidueProperties.nucleotideIndex[nucname
+ .charAt((deoxyn ? 1 : 0))] == -1)
+ {
char r = ResidueProperties
.getSingleCharacterCode(ResidueProperties
.getCanonicalAminoAcid(tmpat.resName));
seq.append(r == '0' ? 'X' : r);
// System.err.println("PDBReader:Null aa3Hash for " +
// tmpat.resName);
+ }
+ else
+ {
+ // nucleotide flag
+ nucleotide = true;
+ seq.append(nucname.charAt((deoxyn ? 1 : 0)));
+ }
}
else
{
- // nucleotide flag
- nucleotide = true;
- seq.append(nucname.charAt((deoxyn ? 1 : 0)));
- }
- }
- else
- {
- if (nucleotide)
- {
- System.err
- .println("Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!");
+ if (nucleotide)
+ {
+ System.err
+ .println("Warning: mixed nucleotide and amino acid chain.. its gonna do bad things to you!");
+ }
+ seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]);
}
- seq.append(ResidueProperties.aa[((Integer) symbol).intValue()]);
- }
count++;
}
}
if (StructureImportSettings.isShowSeqFeatures())
{
- for (i = 0, iSize = resFeatures.size(); i < iSize; i++)
- {
- sequence.addSequenceFeature(resFeatures.elementAt(i));
- resFeatures.setElementAt(null, i);
- }
+ for (i = 0, iSize = resFeatures.size(); i < iSize; i++)
+ {
+ sequence.addSequenceFeature(resFeatures.elementAt(i));
+ resFeatures.setElementAt(null, i);
+ }
}
if (visibleChainAnnotation)
{
radioItem.removeActionListener(radioItem.getActionListeners()[0]);
int option = JOptionPane.showInternalConfirmDialog(
- jalview.gui.Desktop.desktop,
- MessageManager
+ jalview.gui.Desktop.desktop, MessageManager
.getString("label.remove_from_default_list"),
MessageManager
.getString("label.remove_user_defined_colour"),
}
public PDBfile(boolean addAlignmentAnnotations, boolean predictSecStr,
- boolean externalSecStr,
- FileParse source) throws IOException
+ boolean externalSecStr, FileParse source) throws IOException
{
super(false, source);
addSettings(addAlignmentAnnotations, predictSecStr, externalSecStr);
Atom tmpatom = new Atom(line);
try
{
- tmpchain = findChain(tmpatom.chain);
+ tmpchain = findChain(tmpatom.chain);
if (tmpatom.resNumIns.trim().equals(lastID))
{
// phosphorylated protein - seen both CA and P..
markCalcIds();
}
-
-
/**
* Process a parsed chain to construct and return a Sequence, and add it to
* the list of sequences parsed.
}
pid = pid / (aseq1.length - count) * 100;
- output = output.append(new Format("Percentage ID = %2.2f\n")
- .form(pid));
+ output = output.append(new Format("Percentage ID = %2.2f\n").form(pid));
try
{
os.print(output.toString());
public static void sortByFeature(String featureLabel, String groupLabel,
int start, int stop, AlignmentI alignment, String method)
{
- sortByFeature(featureLabel == null ? null
+ sortByFeature(
+ featureLabel == null ? null
: Arrays.asList(new String[] { featureLabel }),
- groupLabel == null ? null
- : Arrays.asList(new String[]{ groupLabel }), start, stop, alignment, method);
+ groupLabel == null ? null : Arrays
+ .asList(new String[] { groupLabel }), start, stop,
+ alignment, method);
}
private static boolean containsIgnoreCase(final String lab,
}
public static void sortByFeature(List<String> featureLabels,
- List<String> groupLabels, int start, int stop, AlignmentI alignment,
- String method)
+ List<String> groupLabels, int start, int stop,
+ AlignmentI alignment, String method)
{
if (method != FEATURE_SCORE && method != FEATURE_LABEL
&& method != FEATURE_DENSITY)
{
private static final int CODON_LENGTH = 3;
+
private static final String SEQUENCE_VARIANT = "sequence_variant:";
+
private static final String ID = "ID";
/**
*/
if (cdnaLength != mappedLength && cdnaLength > 2)
{
- String lastCodon = String.valueOf(cdnaSeqChars, cdnaLength - CODON_LENGTH, CODON_LENGTH)
- .toUpperCase();
+ String lastCodon = String.valueOf(cdnaSeqChars,
+ cdnaLength - CODON_LENGTH, CODON_LENGTH).toUpperCase();
for (String stop : ResidueProperties.STOP)
{
if (lastCodon.equals(stop))
int aaPos = 0;
int dnaPos = cdnaStart;
- for (; dnaPos < cdnaSeqChars.length - 2
- && aaPos < aaSeqChars.length; dnaPos += CODON_LENGTH, aaPos++)
+ for (; dnaPos < cdnaSeqChars.length - 2 && aaPos < aaSeqChars.length; dnaPos += CODON_LENGTH, aaPos++)
{
String codon = String.valueOf(cdnaSeqChars, dnaPos, CODON_LENGTH);
final String translated = ResidueProperties.codonTranslate(codon);
.println("alignCdsSequenceAsProtein needs aligned sequence!");
return false;
}
-
+
List<AlignedCodonFrame> dnaMappings = MappingUtils
.findMappingsForSequence(cdsSeq, mappings);
for (AlignedCodonFrame mapping : dnaMappings)
.getFromRanges());
int mappedToLength = MappingUtils
.getLength(mapList.getToRanges());
- boolean addStopCodon = (cdsLength == mappedFromLength * CODON_LENGTH + CODON_LENGTH)
+ boolean addStopCodon = (cdsLength == mappedFromLength
+ * CODON_LENGTH + CODON_LENGTH)
|| (peptide.getDatasetSequence().getLength() == mappedFromLength - 1);
if (cdsLength != mappedToLength && !addStopCodon)
{
// TODO resolve JAL-2022 so this fudge can be removed
int mappedSequenceCount = protein.getHeight() - unmappedProtein.size();
addUnmappedPeptideStarts(alignedCodons, mappedSequenceCount);
-
+
return alignedCodons;
}
*/
List<int[]> cdsRange = Collections.singletonList(new int[] { 1,
cdsSeq.getLength() });
- MapList cdsToProteinMap = new MapList(cdsRange, mapList.getToRanges(),
- mapList.getFromRatio(), mapList.getToRatio());
+ MapList cdsToProteinMap = new MapList(cdsRange,
+ mapList.getToRanges(), mapList.getFromRatio(),
+ mapList.getToRatio());
AlignedCodonFrame cdsToProteinMapping = new AlignedCodonFrame();
cdsToProteinMapping.addMap(cdsSeqDss, proteinProduct,
cdsToProteinMap);
* same source and accession, so need a different accession for
* the CDS from the dna sequence
*/
-
+
// specific use case:
// Genomic contig ENSCHR:1, contains coding regions for ENSG01,
// ENSG02, ENSG03, with transcripts and products similarly named.
// cannot add distinct dbrefs mapping location on ENSCHR:1 to ENSG01
-
+
// JBPNote: ?? can't actually create an example that demonstrates we
// need to
// synthesize an xref.
-
+
for (DBRefEntry primRef : dnaDss.getPrimaryDBRefs())
{
// creates a complementary cross-reference to the source sequence's
int mappedFromLength = MappingUtils.getLength(aMapping.getMap()
.getFromRanges());
int dnaLength = seqDss.getLength();
- if (mappedFromLength == dnaLength || mappedFromLength == dnaLength - CODON_LENGTH)
+ if (mappedFromLength == dnaLength
+ || mappedFromLength == dnaLength - CODON_LENGTH)
{
return seqDss;
}
for (SequenceToSequenceMapping map : acf.getMappings())
{
Mapping mapping = map.getMapping();
- if (mapping != aMapping && mapping.getMap().getFromRatio() == CODON_LENGTH
+ if (mapping != aMapping
+ && mapping.getMap().getFromRatio() == CODON_LENGTH
&& proteinProduct == mapping.getTo()
&& seqDss != map.getFromSeq())
{
}
}
}
-
+
/*
* assign 'from id' held in the mapping if set (e.g. EMBL protein_id),
* else generate a sequence name
StringBuilder link = new StringBuilder(32);
try
{
- link.append(desc).append(" ").append(id)
+ link.append(desc)
+ .append(" ")
+ .append(id)
.append("|http://www.ensembl.org/Homo_sapiens/Variation/Summary?v=")
.append(URLEncoder.encode(id, "UTF-8"));
sf.addLink(link.toString());
// as if
}
}
- String clinSig = (String) var.variant
- .getValue(CLINICAL_SIGNIFICANCE);
+ String clinSig = (String) var.variant.getValue(CLINICAL_SIGNIFICANCE);
if (clinSig != null)
{
sf.setValue(CLINICAL_SIGNIFICANCE, clinSig);
}
newCol++;
}
-
+
/*
* trim trailing gaps
*/
{
tot = 0;
xx = new double[24];
- seqNum = (j < lengths[k]) ? seqNums.elementAt(k)[j + 1]
- : 23; // Sequence, or gap at the end
+ seqNum = (j < lengths[k]) ? seqNums.elementAt(k)[j + 1] : 23; // Sequence,
+ // or gap
+ // at the
+ // end
// This is a loop over r
for (i = 0; i < 23; i++)
Conservation cons = new Conservation(name, threshold, seqs, start, end);
cons.calculate();
cons.verdict(posOrNeg, consPercGaps);
-
+
if (calcQuality)
{
cons.findQuality();
}
-
+
return cons;
}
}
rseqs = new ArrayList<SequenceI>();
AlignedCodonFrame cf = new AlignedCodonFrame();
- matcher = new SequenceIdMatcher(
- dataset.getSequences());
+ matcher = new SequenceIdMatcher(dataset.getSequences());
for (SequenceI seq : fromSeqs)
{
* attribute in equality test; this avoids creating many
* otherwise duplicate exon features on genomic sequence
*/
- SequenceFeature newFeature = new SequenceFeature(
- feat)
+ SequenceFeature newFeature = new SequenceFeature(feat)
{
@Override
public boolean equals(Object o)
}
return imported;
}
+
/**
* Sets the inverse sequence mapping in the corresponding dbref of the mapped
* to sequence (if any). This is used after fetching a cross-referenced
MapList mapping = null;
SequenceI dsmapFrom = mapFrom.getDatasetSequence() == null ? mapFrom
: mapFrom.getDatasetSequence();
- SequenceI dsmapTo = mapTo.getDatasetSequence() == null ? mapTo
- : mapTo.getDatasetSequence();
+ SequenceI dsmapTo = mapTo.getDatasetSequence() == null ? mapTo : mapTo
+ .getDatasetSequence();
/*
* look for a reverse mapping, if found make its inverse.
* Note - we do this on dataset sequences only.
public static char getComplement(char c)
{
char result = c;
- switch (c) {
+ switch (c)
+ {
case '-':
case '.':
case ' ':
if ((nd.left() == null) && (nd.right() == null))
{
- System.out
- .println("Leaf = " + ((SequenceI) nd.element()).getName());
+ System.out.println("Leaf = " + ((SequenceI) nd.element()).getName());
System.out.println("Dist " + nd.dist);
System.out.println("Boot " + nd.getBootstrap());
}
}
else
{
- System.out.println(" name = "
- + ((SequenceI) nd.element()).getName());
+ System.out.println(" name = " + ((SequenceI) nd.element()).getName());
}
System.out.println(" dist = " + nd.dist + " " + nd.count + " "
public void applyToNodes(NodeTransformI nodeTransformI)
{
for (Enumeration<SequenceNode> nodes = node.elements(); nodes
- .hasMoreElements(); nodeTransformI
- .transform(nodes.nextElement()))
+ .hasMoreElements(); nodeTransformI.transform(nodes
+ .nextElement()))
{
;
}
{
second -= 32;
}
-
+
switch (first)
{
case 'A':
{
sqinfo.put("SeqFeatures", sfeat);
sqinfo.put("PdbId",
- (seq.getAllPDBEntries() != null) ? seq.getAllPDBEntries()
- : new Vector<PDBEntry>());
+ (seq.getAllPDBEntries() != null) ? seq.getAllPDBEntries()
+ : new Vector<PDBEntry>());
}
else
{
sqinfo.put("datasetSequence",
- (seq.getDatasetSequence() != null) ? seq.getDatasetSequence()
- : new Sequence("THISISAPLACEHOLDER", ""));
+ (seq.getDatasetSequence() != null) ? seq.getDatasetSequence()
+ : new Sequence("THISISAPLACEHOLDER", ""));
}
return sqinfo;
}
&& !(seqds.getName().equals("THISISAPLACEHOLDER") && seqds
.getLength() == 0))
{
- if (sfeatures!=null)
+ if (sfeatures != null)
{
System.err
.println("Implementation error: setting dataset sequence for a sequence which has sequence features.\n\tDataset sequence features will not be visible.");
if (canonicalOrWobblePairCount >= otherPairCount)
{
maxResidue = (canonicalOrWobblePairCount - canonical) < canonical ? "("
- : "[";
+ : "[";
}
else
{
* @return String[]
*/
String[] getViewAsString(boolean selectedRegionOnly);
-
+
/**
* This method returns the visible alignment as text, as seen on the GUI, ie
* if columns are hidden they will not be returned in the result. Use this for
*
* @return String[]
*/
- String[] getViewAsString(boolean selectedRegionOnly, boolean isExportHiddenSeqs);
+ String[] getViewAsString(boolean selectedRegionOnly,
+ boolean isExportHiddenSeqs);
void setSelectionGroup(SequenceGroup sg);
*/
void setFollowHighlight(boolean b);
-
public void applyFeaturesStyle(FeatureSettingsModelI featureSettings);
/**
*/
public String getDbCoordSys();
-
/**
* Get DB Source for the SIFTs Entry
*
*/
public StructureMapping getSiftsStructureMapping(SequenceI seq,
String pdbFile, String chain) throws SiftsException;
-
+
/**
* Get residue by residue mapping for a given Sequence and SIFTs entity
*
* @throws Exception
*/
public HashMap<Integer, int[]> getGreedyMapping(String entityId,
- SequenceI seq,
- java.io.PrintStream os) throws SiftsException;
+ SequenceI seq, java.io.PrintStream os) throws SiftsException;
}
\ No newline at end of file
if (alignPanel.getAlignment().getAlignmentAnnotation() != null)
{
for (AlignmentAnnotation aa : alignPanel.getAlignment()
- .getAlignmentAnnotation())
- {
- boolean visible = (aa.sequenceRef == null ? showForAlignment
- : showForSequences);
- aa.visible = visible;
+ .getAlignmentAnnotation())
+ {
+ boolean visible = (aa.sequenceRef == null ? showForAlignment
+ : showForSequences);
+ aa.visible = visible;
}
}
alignPanel.validateAnnotationDimensions(true);
FeaturesFile formatter = new FeaturesFile();
if (format.equalsIgnoreCase("Jalview"))
{
- features = formatter.printJalviewFormat(viewport
- .getAlignment().getSequencesArray(),
- getDisplayedFeatureCols());
+ features = formatter.printJalviewFormat(viewport.getAlignment()
+ .getSequencesArray(), getDisplayedFeatureCols());
}
else
{
}
protected void popupSort(final MyCheckbox check,
- final Map<String, float[][]> minmax,
- int x, int y)
+ final Map<String, float[][]> minmax, int x, int y)
{
final String type = check.type;
final FeatureColourI typeCol = fr.getFeatureStyle(type);
* @param type
* @param columnsContaining
*/
- void hideFeatureColumns(final String type,
- boolean columnsContaining)
+ void hideFeatureColumns(final String type, boolean columnsContaining)
{
- if (ap.alignFrame.avc.markColumnsContainingFeatures(
- columnsContaining, false, false, type))
+ if (ap.alignFrame.avc.markColumnsContainingFeatures(columnsContaining,
+ false, false, type))
{
if (ap.alignFrame.avc.markColumnsContainingFeatures(
!columnsContaining, false, false, type))
if ((av.getSelectionGroup() == null)
|| ((!jalview.util.Platform.isControlDown(e) && !e
- .isShiftDown()) && av
- .getSelectionGroup() != null))
+ .isShiftDown()) && av.getSelectionGroup() != null))
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().setStartRes(0);
PopupMenu pop = new PopupMenu();
if (reveal != null)
{
- MenuItem item = new MenuItem(
- MessageManager.getString("label.reveal"));
+ MenuItem item = new MenuItem(MessageManager.getString("label.reveal"));
item.addActionListener(new ActionListener()
{
@Override
{
av.hideColumns(res, res);
if (av.getSelectionGroup() != null
- && av.getSelectionGroup().getSize() == av
- .getAlignment().getHeight())
+ && av.getSelectionGroup().getSize() == av.getAlignment()
+ .getHeight())
{
av.setSelectionGroup(null);
}
gg.fillPolygon(new int[] {
-1 + res * avCharWidth - avcharHeight / 4,
-1 + res * avCharWidth + avcharHeight / 4,
- -1 + res * avCharWidth },
- new int[] { y, y, y + 2 * yOf }, 3);
+ -1 + res * avCharWidth }, new int[] { y, y, y + 2 * yOf }, 3);
}
}
}
}
g.drawLine((mpos * avcharWidth) + (avcharWidth / 2), (ypos + 2)
- (avcharHeight / 2), (mpos * avcharWidth)
- + (avcharWidth / 2),
- ypos - 2);
+ + (avcharWidth / 2), ypos - 2);
}
}
}
}
PaintRefresher.Refresh(ap, av.getSequenceSetId());
ap.paintAlignment(needOverviewUpdate);
- needOverviewUpdate =false;
+ needOverviewUpdate = false;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
pid = (SliderPanel) PIDSlider.getComponent(0);
pid.cs = cs;
}
- PIDSlider.setTitle(MessageManager
- .formatMessage("label.percentage_identity_threshold",
+ PIDSlider
+ .setTitle(MessageManager.formatMessage(
+ "label.percentage_identity_threshold",
new String[] { source }));
if (ap.av.getAlignment().getGroups() != null)
for (int i = 0; i < leaves.size(); i++)
{
- SequenceI seq = (SequenceI) leaves.elementAt(i)
- .element();
+ SequenceI seq = (SequenceI) leaves.elementAt(i).element();
treeSelectionChanged(seq);
}
}
(int) (Math.random() * 255), (int) (Math.random() * 255));
setColor(tree.getGroups().elementAt(i), col.brighter());
- Vector<SequenceNode> l = tree.findLeaves(tree
- .getGroups().elementAt(i));
+ Vector<SequenceNode> l = tree.findLeaves(tree.getGroups()
+ .elementAt(i));
Vector<SequenceI> sequences = new Vector<SequenceI>();
for (int j = 0; j < l.size(); j++)
{
- SequenceI s1 = (SequenceI) l.elementAt(j)
- .element();
+ SequenceI s1 = (SequenceI) l.elementAt(j).element();
if (!sequences.contains(s1))
{
sequences.addElement(s1);
private final static String DEFAULT_CACHE_THRESHOLD_IN_DAYS = "2";
private final static String DEFAULT_FAIL_SAFE_PID_THRESHOLD = "30";
-
+
/**
* Allowed values are PDB or mmCIF
*/
{
setProperty(property, jalview.util.Format.getHexString(colour));
}
-
+
/**
* Stores a formatted date in a jalview property, using a fixed locale.
*
setEdit(new Edit(Action.CUT, seqs, column + 1, width, al));
}
-
performEdit(0, null);
}
return (this.fromSeq == that.fromSeq || (this.fromSeq != null
&& that.fromSeq != null
&& this.fromSeq.getDatasetSequence() != null && this.fromSeq
- .getDatasetSequence() == that.fromSeq
- .getDatasetSequence())) && this.mapping.equals(that.mapping);
+ .getDatasetSequence() == that.fromSeq.getDatasetSequence()))
+ && this.mapping.equals(that.mapping);
}
public SequenceI getFromSeq()
}
/**
- * Returns the first mapping found that is between 'fromSeq' and 'toSeq', or null
- * if none found
+ * Returns the first mapping found that is between 'fromSeq' and 'toSeq', or
+ * null if none found
*
* @param fromSeq
* aligned or dataset sequence
* already
*/
public void remap(SequenceI newref, HashMap<Integer, int[]> mapping,
- int from, int to,
- int idxoffset)
+ int from, int to, int idxoffset)
{
if (mapping != null)
{
*/
public int[] locateVisibleBoundsOfSequence(SequenceI seq)
{
- int fpos=seq.getStart(),lpos= seq.getEnd();
+ int fpos = seq.getStart(), lpos = seq.getEnd();
int start = 0;
-
+
if (hiddenColumns == null || hiddenColumns.size() == 0)
{
int ifpos = seq.findIndex(fpos) - 1, ilpos = seq.findIndex(lpos) - 1;
* makes a copy of the alignment with hidden sequences included. Using the
* copy for anything other than simple output is not recommended. Note - this
* method DOES NOT USE THE AlignmentI COPY CONSTRUCTOR!
+ *
* @return
*/
public AlignmentI getFullAlignment()
{
char[] oseq = seq.getSequence();
initSeqAndName(seq.getName(), Arrays.copyOf(oseq, oseq.length),
- seq.getStart(),
- seq.getEnd());
+ seq.getStart(), seq.getEnd());
}
description = seq.getDescription();
if (seq != datasetSequence)
}
}
-
@Override
public void setSequenceFeatures(SequenceFeature[] features)
{
@Override
public synchronized void addSequenceFeature(SequenceFeature sf)
{
- if (sequenceFeatures==null && datasetSequence != null)
+ if (sequenceFeatures == null && datasetSequence != null)
{
datasetSequence.addSequenceFeature(sf);
return;
{
if (sequenceFeatures == null)
{
- if (datasetSequence!=null) {
- datasetSequence.deleteFeature(sf);
+ if (datasetSequence != null)
+ {
+ datasetSequence.deleteFeature(sf);
}
return;
}
@Override
public SequenceI deriveSequence()
{
- Sequence seq=null;
+ Sequence seq = null;
if (datasetSequence == null)
{
if (isValidDatasetSequence())
else
{
// Create a new, valid dataset sequence
- createDatasetSequence();
+ createDatasetSequence();
}
}
return new Sequence(this);
dsseq.setDescription(description);
// move features and database references onto dataset sequence
dsseq.sequenceFeatures = sequenceFeatures;
- sequenceFeatures=null;
+ sequenceFeatures = null;
dsseq.dbrefs = dbrefs;
- dbrefs=null;
+ dbrefs = null;
// TODO: search and replace any references to this sequence with
// references to the dataset sequence in Mappings on dbref
dsseq.pdbIds = pdbIds;
return null;
}
-
@Override
public List<DBRefEntry> getPrimaryDBRefs()
{
- if (datasetSequence!=null)
+ if (datasetSequence != null)
{
return datasetSequence.getPrimaryDBRefs();
}
- if (dbrefs==null || dbrefs.length==0)
+ if (dbrefs == null || dbrefs.length == 0)
{
return Collections.emptyList();
}
*/
public PDBEntry getPDBEntry(String pdbId);
-
/**
* Get all primary database/accessions for this sequence's data. These
* DBRefEntry are expected to resolve to a valid record in the associated
* Data model for one entry returned from an EMBL query, as marshalled by a
* Castor binding file
*
- * For example:
- * http://www.ebi.ac.uk/ena/data/view/J03321&display=xml
+ * For example: http://www.ebi.ac.uk/ena/data/view/J03321&display=xml
*
* @see embl_mapping.xml
*/
retrievedref.setMap(new Mapping(null, new int[] { 1, dna.getLength() },
new int[] { 1, dna.getLength() }, 1, 1));
-
/*
* transform EMBL Database refs to canonical form
*/
if (qname.equals("translation"))
{
// remove all spaces (precompiled String.replaceAll(" ", ""))
- translation = SPACE_PATTERN.matcher(q.getValues()[0]).replaceAll("");
+ translation = SPACE_PATTERN.matcher(q.getValues()[0]).replaceAll(
+ "");
}
else if (qname.equals("protein_id"))
{
*/
String source = DBRefUtils.getCanonicalName(ref.getSource());
ref.setSource(source);
- DBRefEntry proteinDbRef = new DBRefEntry(ref.getSource(), ref.getVersion(), ref
- .getAccessionId());
+ DBRefEntry proteinDbRef = new DBRefEntry(ref.getSource(),
+ ref.getVersion(), ref.getAccessionId());
if (source.equals(DBRefSource.UNIPROT))
{
String proteinSeqName = DBRefSource.UNIPROT + "|"
+ ref.getAccessionId();
- if (dnaToProteinMapping != null && dnaToProteinMapping.getTo() != null)
+ if (dnaToProteinMapping != null
+ && dnaToProteinMapping.getTo() != null)
{
if (mappingUsed)
{
*/
private static final Regex ACCESSION_REGEX = new Regex(
"(ENS([A-Z]{3}|)[TG][0-9]{11}$)" + "|" + "(CCDS[0-9.]{3,}$)");
-
+
/*
* fetch exon features on genomic sequence (to identify the cdna regions)
* and cds and variation features (to retain)
protected URL getUrl(List<String> ids) throws MalformedURLException
{
StringBuffer urlstring = new StringBuffer(128);
- urlstring.append(getDomain()).append("/overlap/id/")
- .append(ids.get(0));
+ urlstring.append(getDomain()).append("/overlap/id/").append(ids.get(0));
// @see https://github.com/Ensembl/ensembl-rest/wiki/Output-formats
urlstring.append("?content-type=text/x-gff3");
}
}
gene.setSequenceFeatures(filtered
- .toArray(new SequenceFeature[filtered
- .size()]));
+ .toArray(new SequenceFeature[filtered.size()]));
}
}
return new FeatureSettingsAdapter()
{
SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+
@Override
public boolean isFeatureDisplayed(String type)
{
package jalview.ext.ensembl;
-
/**
* A class to behave much like EnsemblGene but referencing the ensemblgenomes
* domain and data
public String getParent(String identifier)
{
List<String> ids = Arrays.asList(new String[] { identifier });
-
+
BufferedReader br = null;
try
{
private final static long VERSION_RETEST_INTERVAL = 1000L * 3600; // 1 hr
private static final Regex TRANSCRIPT_REGEX = new Regex(
- "(ENS)([A-Z]{3}|)T[0-9]{11}$");
+ "(ENS)([A-Z]{3}|)T[0-9]{11}$");
private static final Regex GENE_REGEX = new Regex(
- "(ENS)([A-Z]{3}|)G[0-9]{11}$");
+ "(ENS)([A-Z]{3}|)G[0-9]{11}$");
static
{
throws IOException
{
URL url = getUrl(ids);
-
+
BufferedReader reader = getHttpResponse(url, ids);
if (reader == null)
{
{
// long now = System.currentTimeMillis();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
-
+
/*
* POST method allows multiple queries in one request; it is supported for
* sequence queries, but not for overlap
{
writePostBody(connection, ids);
}
-
+
int responseCode = connection.getResponseCode();
-
+
if (responseCode != 200)
{
/*
// + (System.currentTimeMillis() - now) + "ms to fetch");
checkRateLimits(connection);
-
+
BufferedReader reader = null;
reader = new BufferedReader(new InputStreamReader(response, "UTF-8"));
return reader;
// remaining, limit, reset));
}
}
-
+
/**
* Rechecks if Ensembl is responding, unless the last check was successful and
* the retest interval has not yet elapsed. Returns true if Ensembl is up,
proteinSeq.createDatasetSequence();
querySeq.createDatasetSequence();
- MapList mapList = AlignmentUtils.mapCdsToProtein(querySeq, proteinSeq);
+ MapList mapList = AlignmentUtils
+ .mapCdsToProtein(querySeq, proteinSeq);
if (mapList != null)
{
// clunky: ensure Uniprot xref if we have one is on mapped sequence
for (DBRefEntry up : uprots)
{
// locate local uniprot ref and map
- List<DBRefEntry> upx = DBRefUtils.searchRefs(upxrefs, up.getAccessionId());
+ List<DBRefEntry> upx = DBRefUtils.searchRefs(upxrefs,
+ up.getAccessionId());
DBRefEntry upxref;
if (upx.size() != 0)
{
else
{
upxref = new DBRefEntry(DBRefSource.UNIPROT,
- getEnsemblDataVersion(), up.getAccessionId());
+ getEnsemblDataVersion(), up.getAccessionId());
}
Mapping newMap = new Mapping(ds, mapList);
// add the new uniprot ref
querySeq.getDatasetSequence().addDBRef(upxref);
}
-
+
}
}
-
+
/*
* copy exon features to protein, compute peptide variants from dna
* variants and add as features on the protein sequence ta-da
*/
- AlignmentUtils.computeProteinFeatures(querySeq, proteinSeq, mapList);
+ AlignmentUtils
+ .computeProteinFeatures(querySeq, proteinSeq, mapList);
}
} catch (Exception e)
{
if (fr.getSeqs().size() > 0)
{
- AlignmentI seqal = new Alignment(
- fr.getSeqsAsArray());
- for (SequenceI sq:seqal.getSequences())
+ AlignmentI seqal = new Alignment(fr.getSeqsAsArray());
+ for (SequenceI sq : seqal.getSequences())
{
if (sq.getDescription() == null)
{
int mappedLength = 0;
int direction = 1; // forward
boolean directionSet = false;
-
+
for (SequenceFeature sf : sfs)
{
/*
// abort - mix of forward and backward
System.err.println("Error: forward and backward strand for "
+ accId);
- return null;
- }
- direction = strand;
- directionSet = true;
-
- /*
- * add to CDS ranges, semi-sorted forwards/backwards
- */
- if (strand < 0)
- {
- regions.add(0, new int[] { sf.getEnd(), sf.getBegin() });
- }
- else
- {
+ return null;
+ }
+ direction = strand;
+ directionSet = true;
+
+ /*
+ * add to CDS ranges, semi-sorted forwards/backwards
+ */
+ if (strand < 0)
+ {
+ regions.add(0, new int[] { sf.getEnd(), sf.getBegin() });
+ }
+ else
+ {
regions.add(new int[] { sf.getBegin(), sf.getEnd() });
}
mappedLength += Math.abs(sf.getEnd() - sf.getBegin() + 1);
}
}
}
-
+
if (regions.isEmpty())
{
System.out.println("Failed to identify target sequence for " + accId
* (havana / ensembl_havana)
*/
Collections.sort(regions, new RangeSorter(direction == 1));
-
+
List<int[]> to = Arrays.asList(new int[] { start,
start + mappedLength - 1 });
-
+
return new MapList(regions, to, 1, 1);
}
int start = sf.getBegin();
int end = sf.getEnd();
int[] mappedRange = mapping.locateInTo(start, end);
-
+
if (mappedRange != null)
{
SequenceFeature copy = new SequenceFeature(sf);
// long start = System.currentTimeMillis();
SequenceFeature[] sfs = sourceSequence.getSequenceFeatures();
- MapList mapping = getGenomicRangesFromFeatures(sourceSequence, accessionId,
- targetSequence.getStart());
+ MapList mapping = getGenomicRangesFromFeatures(sourceSequence,
+ accessionId, targetSequence.getStart());
if (mapping == null)
{
return false;
String type, String parentId)
{
List<SequenceFeature> result = new ArrayList<SequenceFeature>();
-
+
SequenceFeature[] sfs = sequence.getSequenceFeatures();
- if (sfs != null) {
+ if (sfs != null)
+ {
SequenceOntologyI so = SequenceOntologyFactory.getInstance();
- for (SequenceFeature sf :sfs) {
+ for (SequenceFeature sf : sfs)
+ {
if (so.isA(sf.getType(), type))
{
String parent = (String) sf.getValue(PARENT);
protected URL getUrl(String id, Species species)
{
String url = getDomain() + "/xrefs/symbol/" + species.toString() + "/"
- + id
- + "?content-type=application/json";
+ + id + "?content-type=application/json";
try
{
return new URL(url);
List<String> result = new ArrayList<String>();
List<String> ids = new ArrayList<String>();
ids.add(identifier);
-
+
String[] queries = identifier.split(getAccessionSeparator());
BufferedReader br = null;
try
super(d);
dbName = dbSource;
xrefVersion = dbSource + ":" + version;
-
+
}
@Override
}
-
SAMSequenceDictionary rrefDict = null;
- private ReferenceSequenceFile initSequenceDictionaryFor(File dbLocation2) throws Exception
+
+ private ReferenceSequenceFile initSequenceDictionaryFor(File dbLocation2)
+ throws Exception
{
rrefDict = getDictionary(dbLocation2, true);
if (rrefDict != null)
{
- ReferenceSequenceFile rrefFile = ReferenceSequenceFileFactory.getReferenceSequenceFile(dbLocation2, true);
+ ReferenceSequenceFile rrefFile = ReferenceSequenceFileFactory
+ .getReferenceSequenceFile(dbLocation2, true);
return rrefFile;
}
return null;
}
+
/**
* code below hacked out from picard ----
*
* broadinstitute/picard/commit/270580d3e28123496576f0b91b3433179bb5d876
*/
-
/*
* The MIT License
*
{
// remove listeners for all structures in viewer
getSsm().removeStructureViewerListener(this, this.getPdbFile());
- viewer.dispose();
+ viewer.dispose();
lastCommand = null;
viewer = null;
releaseUIResources();
{
Viewer viewer = null;
- public JmolParser(String inFile, String type)
- throws IOException
+ public JmolParser(String inFile, String type) throws IOException
{
super(inFile, type);
}
{
try
{
- asecstr[p] = new Annotation(String.valueOf(secstr[p]), null,
- secstrcode[p], Float.NaN);
- ssFound = true;
+ asecstr[p] = new Annotation(String.valueOf(secstr[p]), null,
+ secstrcode[p], Float.NaN);
+ ssFound = true;
} catch (Exception e)
{
// e.printStackTrace();
}
else
{
- System.err.println("Warning: " + term.getName()
- + " has replaced " + replaced.getName()
- + " for lookup of '" + description + "'");
+ System.err.println("Warning: " + term.getName()
+ + " has replaced " + replaced.getName()
+ + " for lookup of '" + description + "'");
}
}
termsByDescription.put(description, term);
{
try
{
- if (Boolean.TRUE.equals(ann.getProperty("is_obsolete")))
- {
+ if (Boolean.TRUE.equals(ann.getProperty("is_obsolete")))
+ {
return true;
}
} catch (NoSuchElementException e)
public FTSDataColumnI getDataColumnByNameOrCode(String nameOrCode)
throws Exception;
-
/**
* Convert collection of FTSDataColumnI objects to a comma delimited string of
* the 'code' values
public String getDataColumnsFieldsAsCommaDelimitedString(
Collection<FTSDataColumnI> wantedFields);
-
/**
* Fetch index of the primary key column for the dynamic table
*
public int getPrimaryKeyColumIndex(
Collection<FTSDataColumnI> wantedFields, boolean hasRefSeq)
throws Exception;
-
+
/**
* Fetch the primary key data column object
*
*/
public int getDefaultResponsePageSize();
}
-
import javax.swing.table.TableModel;
import javax.swing.table.TableRowSorter;
-
@SuppressWarnings("serial")
public class FTSDataColumnPreferences extends JScrollPane
{
if (source.equals(PreferenceSource.STRUCTURE_CHOOSER)
|| source.equals(PreferenceSource.PREFERENCES))
{
- structSummaryColumns = ((PDBFTSRestClient) ftsRestClient)
+ structSummaryColumns = ((PDBFTSRestClient) ftsRestClient)
.getAllDefaultDisplayedStructureDataColumns();
}
allFTSDataColumns.addAll(ftsRestClient.getAllFTSDataColumns());
{
case SEARCH_SUMMARY:
data[x++] = new Object[] {
- ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
- .contains(field),
- field.getName(), field.getGroup() };
+ ftsRestClient.getAllDefaultDisplayedFTSDataColumns().contains(
+ field), field.getName(), field.getGroup() };
break;
case STRUCTURE_CHOOSER:
data[x++] = new Object[] { structSummaryColumns.contains(field),
field.getName(), field.getGroup() };
break;
case PREFERENCES:
- data[x++] = new Object[] { field.getName(),
- ftsRestClient.getAllDefaultDisplayedFTSDataColumns()
- .contains(field),
- structSummaryColumns.contains(field) };
+ data[x++] = new Object[] {
+ field.getName(),
+ ftsRestClient.getAllDefaultDisplayedFTSDataColumns().contains(
+ field), structSummaryColumns.contains(field) };
break;
default:
break;
map.put(field.getName(), field);
}
- FTSDataColumnPrefsTableModel model = new FTSDataColumnPrefsTableModel(columnNames, data);
+ FTSDataColumnPrefsTableModel model = new FTSDataColumnPrefsTableModel(
+ columnNames, data);
tbl_FTSDataColumnPrefs.setModel(model);
switch (source)
tbl_FTSDataColumnPrefs.getColumnModel().getColumn(1).setMinWidth(150);
tbl_FTSDataColumnPrefs.getColumnModel().getColumn(2)
.setPreferredWidth(150);
- tbl_FTSDataColumnPrefs.getColumnModel().getColumn(2)
-.setMinWidth(150);
+ tbl_FTSDataColumnPrefs.getColumnModel().getColumn(2).setMinWidth(150);
TableRowSorter<TableModel> sorter = new TableRowSorter<>(
tbl_FTSDataColumnPrefs.getModel());
sortKeys.add(new RowSorter.SortKey(columnIndexToSort,
SortOrder.ASCENDING));
sorter.setSortKeys(sortKeys);
- sorter.setComparator(
- columnIndexToSort,
+ sorter.setComparator(columnIndexToSort,
new Comparator<FTSDataColumnGroupI>()
{
@Override
class FTSDataColumnPrefsTableModel extends AbstractTableModel
{
- public FTSDataColumnPrefsTableModel(String[] columnNames, Object[][] data)
+ public FTSDataColumnPrefsTableModel(String[] columnNames,
+ Object[][] data)
{
this.data = data;
this.columnNames = columnNames;
if (currentSource == PreferenceSource.SEARCH_SUMMARY)
{
- updatePrefs(ftsRestClient
- .getAllDefaultDisplayedFTSDataColumns(), ftsDataColumn,
- selected);
+ updatePrefs(ftsRestClient.getAllDefaultDisplayedFTSDataColumns(),
+ ftsDataColumn, selected);
}
else if (currentSource == PreferenceSource.STRUCTURE_CHOOSER)
{
{
if (col == 1)
{
- updatePrefs(ftsRestClient
- .getAllDefaultDisplayedFTSDataColumns(), ftsDataColumn,
- selected);
+ updatePrefs(ftsRestClient.getAllDefaultDisplayedFTSDataColumns(),
+ ftsDataColumn, selected);
}
else if (col == 2)
{
}
}
- private void updatePrefs(
- Collection<FTSDataColumnI> prefConfig,
+ private void updatePrefs(Collection<FTSDataColumnI> prefConfig,
FTSDataColumnI dataColumn, boolean selected)
{
if (prefConfig.contains(dataColumn) && !selected)
public void parseDataColumnsConfigFile()
{
String fileName = getColumnDataConfigFileName();
-
- InputStream in = getClass().getResourceAsStream(fileName);
-
+
+ InputStream in = getClass().getResourceAsStream(fileName);
+
try (BufferedReader br = new BufferedReader(new InputStreamReader(in)))
{
String line;
this.getGroup());
}
-
@Override
public boolean equals(Object otherObject)
{
&& this.getGroup().equals(that.getGroup());
}
-
};
dataColumns.add(dataCol);
return result;
}
-
@Override
public Collection<FTSDataColumnI> getAllFTSDataColumns()
{
switch (code)
{
case 400:
- message = MessageManager
- .getString("exception.bad_request");
+ message = MessageManager.getString("exception.bad_request");
break;
-
+
case 410:
message = MessageManager.formatMessage(
"exception.fts_rest_service_no_longer_available", service);
return wantedFields;
}
- public void setWantedFields(
- Collection<FTSDataColumnI> wantedFields)
+ public void setWantedFields(Collection<FTSDataColumnI> wantedFields)
{
this.wantedFields = wantedFields;
}
public static DefaultTableModel getTableModel(FTSRestRequest request,
Collection<FTSData> summariesList)
{
- final FTSDataColumnI[] cols = request.getWantedFields()
- .toArray(new FTSDataColumnI[0]);
+ final FTSDataColumnI[] cols = request.getWantedFields().toArray(
+ new FTSDataColumnI[0]);
final int colOffset = request.getAssociatedSequence() == null ? 0 : 1;
DefaultTableModel tableModel = new DefaultTableModel()
{
tableModel.addColumn("Ref Sequence"); // Create sequence column header if
// exists in the request
}
- for (FTSDataColumnI field : request
- .getWantedFields())
+ for (FTSDataColumnI field : request.getWantedFields())
{
tableModel.addColumn(field.getName()); // Create sequence column header if
// exists in the request
}
}
-
}
protected static final DecimalFormat totalNumberformatter = new DecimalFormat(
"###,###");
+
private JTable tbl_summary = new JTable()
{
private boolean inLayout;
return toolTipText;
}
};
+
protected JScrollPane scrl_searchResult = new JScrollPane(tbl_summary);
public GFTSPanel()
});
final DeferredTextInputListener listener = new DeferredTextInputListener(
- 1500,
- new ActionListener()
+ 1500, new ActionListener()
{
@Override
public void actionPerformed(ActionEvent e)
@Override
public void focusLost(FocusEvent e)
{
-// listener.stop();
+ // listener.stop();
}
});
txt_search.setEnabled(false);
cmb_searchTarget.setEnabled(false);
previousWantedFields = getFTSRestClient()
- .getAllDefaultDisplayedFTSDataColumns()
- .toArray(new Object[0]);
+ .getAllDefaultDisplayedFTSDataColumns().toArray(
+ new Object[0]);
}
if (sourceTabbedPane.getTitleAt(index).equals(searchTabTitle))
{
getTempUserPrefs().put("FTSPanel.y", mainFrame.getY());
mainFrame.dispose();
}
+
public class DeferredTextInputListener implements DocumentListener
{
private final Timer swingTimer;
}
return Arrays.equals(getFTSRestClient()
- .getAllDefaultDisplayedFTSDataColumns()
- .toArray(new Object[0]), previousWantedFields) ? false
- : true;
+ .getAllDefaultDisplayedFTSDataColumns().toArray(new Object[0]),
+ previousWantedFields) ? false : true;
}
}
}
-
public void transferToSequenceFetcher(String ids)
{
// mainFrame.dispose();
int[] selectedRows = resultTable.getSelectedRows();
for (int summaryRow : selectedRows)
{
- String idStr = resultTable.getValueAt(summaryRow,
- primaryKeyColIndex).toString();
+ String idStr = resultTable.getValueAt(summaryRow, primaryKeyColIndex)
+ .toString();
paginatorCart.add(idStr);
}
// System.out.println("Paginator shopping cart size : "
}
validateSelection();
}
+
public void refreshPaginatorState()
{
// System.out.println("resultSet count : " + resultSetCount);
setPrevPageButtonEnabled(true);
}
}
+
public void referesh()
{
mainFrame.setTitle(getFTSFrameTitle());
.getProgressIndicator();
}
-
@Override
public void searchAction(boolean isFreshSearch)
{
{
getResultTable().setModel(
FTSRestResponse.getTableModel(request,
- resultList.getSearchSummary()));
+ resultList.getSearchSummary()));
FTSRestResponse.configureTableColumn(getResultTable(),
wantedFields, tempUserPrefs);
getResultTable().setVisible(true);
String result = (resultSetCount > 0) ? MessageManager
.getString("label.results") : MessageManager
.getString("label.result");
-
+
if (isPaginationEnabled() && resultSetCount > 0)
{
- updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result
+ updateSearchFrameTitle(defaultFTSFrameTitle
+ + " - "
+ + result
+ " "
+ totalNumberformatter.format((Number) (offSet + 1))
+ " to "
.format((Number) (offSet + resultSetCount))
+ " of "
+ totalNumberformatter
- .format((Number) totalResultSetCount)
- + " " + " (" + (endTime - startTime) + " milli secs)");
+ .format((Number) totalResultSetCount) + " "
+ + " (" + (endTime - startTime) + " milli secs)");
}
else
{
+ resultSetCount + " " + result + " ("
+ (endTime - startTime) + " milli secs)");
}
-
+
setSearchInProgress(false);
refreshPaginatorState();
updateSummaryTableSelections();
try
{
primaryKeyColIndex = getFTSRestClient().getPrimaryKeyColumIndex(
- wantedFields,
- false);
+ wantedFields, false);
} catch (Exception e)
{
e.printStackTrace();
for (int summaryRow : selectedRows)
{
String idStr = getResultTable().getValueAt(summaryRow,
- primaryKeyColIndex)
- .toString();
+ primaryKeyColIndex).toString();
selectedIdsSet.add(getPDBIdwithSpecifiedChain(idStr, searchTerm));
}
delayAndEnableActionButtons();
}
-
public static String getPDBIdwithSpecifiedChain(String pdbId,
String searchTerm)
{
.queryParam("wt", "json").queryParam("fl", wantedFields)
.queryParam("rows", String.valueOf(responseSize))
.queryParam("start", String.valueOf(offSet))
- .queryParam("q", query)
- .queryParam("sort", sortParam);
+ .queryParam("q", query).queryParam("sort", sortParam);
}
// Execute the REST request
ClientResponse clientResponse = webResource.accept(
}
else
{
- errorMessage = getMessageByHTTPStatusCode(clientResponse
-.getStatus(), "PDB");
+ errorMessage = getMessageByHTTPStatusCode(
+ clientResponse.getStatus(), "PDB");
throw new Exception(errorMessage);
}
}
}
}
-
/**
* Process error response from PDB server if/when one occurs.
*
{
summaryRowData[colCounter++] = (field.getDataType()
.getDataTypeClass() == Integer.class) ? Integer
- .valueOf(fieldData)
- : (field.getDataType()
+ .valueOf(fieldData) : (field.getDataType()
.getDataTypeClass() == Double.class) ? Double
- .valueOf(fieldData)
- : sanitiseData(fieldData);
+ .valueOf(fieldData) : sanitiseData(fieldData);
} catch (Exception e)
{
e.printStackTrace();
- System.out.println("offending value:" + fieldData);
+ System.out.println("offending value:" + fieldData);
}
}
}
return "/fts/pdb_data_columns.txt";
}
-
public static FTSRestClientI getInstance()
{
if (instance == null)
summaryRowData[colCounter++] = (field.getDataType()
.getDataTypeClass() == Integer.class) ? Integer
.valueOf(fieldData.replace(",", ""))
- : (field.getDataType()
- .getDataTypeClass() == Double.class) ? Double
+ : (field.getDataType().getDataTypeClass() == Double.class) ? Double
.valueOf(fieldData) : fieldData;
} catch (Exception e)
{
e.printStackTrace();
- System.out.println("offending value:" + fieldData);
+ System.out.println("offending value:" + fieldData);
}
}
} catch (Exception e)
};
}
-
public static FTSRestClientI getInstance()
{
if (instance == null)
offSet = 0;
}
new Thread()
- {
+ {
@Override
public void run()
{
.getString("label.result");
if (isPaginationEnabled() && resultSetCount > 0)
{
- updateSearchFrameTitle(defaultFTSFrameTitle + " - " + result
+ updateSearchFrameTitle(defaultFTSFrameTitle
+ + " - "
+ + result
+ " "
+ totalNumberformatter.format((Number) (offSet + 1))
+ " to "
.format((Number) (offSet + resultSetCount))
+ " of "
+ totalNumberformatter
- .format((Number) totalResultSetCount)
- + " " + " (" + (endTime - startTime) + " milli secs)");
+ .format((Number) totalResultSetCount) + " "
+ + " (" + (endTime - startTime) + " milli secs)");
}
else
{
return foundSearchTerms;
}
-
@Override
public boolean isPaginationEnabled()
{
radioItem.removeActionListener(radioItem.getActionListeners()[0]);
int option = JOptionPane.showInternalConfirmDialog(
- jalview.gui.Desktop.desktop,
- MessageManager
+ jalview.gui.Desktop.desktop, MessageManager
.getString("label.remove_from_default_list"),
MessageManager
.getString("label.remove_user_defined_colour"),
List<SequenceI> choosenSeqs = new ArrayList<SequenceI>();
for (SequenceI sq : alignment.getSequences())
{
- Vector<PDBEntry> pdbRefEntries = sq.getDatasetSequence().getAllPDBEntries();
+ Vector<PDBEntry> pdbRefEntries = sq.getDatasetSequence()
+ .getAllPDBEntries();
if (pdbRefEntries == null)
{
continue;
}
}
}
- seqvectors.add(choosenSeqs.toArray(new SequenceI[choosenSeqs.size()]));
+ seqvectors
+ .add(choosenSeqs.toArray(new SequenceI[choosenSeqs.size()]));
}
return seqvectors.toArray(new SequenceI[seqvectors.size()][]);
}
if (file != null)
{
alignFrame.setProgressBar(MessageManager.formatMessage(
- "status.saving_file", new Object[] { type.getLabel() }),
+ "status.saving_file", new Object[] { type.getLabel() }),
pSessionId);
}
}
im = new jalview.util.ImageMaker(this, type, imageAction,
aDimension.getWidth(), aDimension.getHeight()
- + boarderBottomOffset, file,
- imageTitle, alignFrame, pSessionId, headless);
+ + boarderBottomOffset, file, imageTitle,
+ alignFrame, pSessionId, headless);
if (av.getWrapAlignment())
{
if (im.getGraphics() != null)
else
{
text = new FeaturesFile().printJalviewFormat(ap.av.getAlignment()
- .getDataset().getSequencesArray(), displayedFeatureColours, true, ap.av.isShowNPFeats()); // ap.av.featuresDisplayed);
+ .getDataset().getSequencesArray(), displayedFeatureColours,
+ true, ap.av.isShowNPFeats()); // ap.av.featuresDisplayed);
text = formatter.printJalviewFormat(sequences, featureColours,
true, includeNonPositional);
}
String tlabel = null;
if (anots[index] != null)
{ // LML added stem code
- if (type.equals(HELIX) || type.equals(SHEET)
- || type.equals(STEM) || type.equals(LABEL))
+ if (type.equals(HELIX) || type.equals(SHEET) || type.equals(STEM)
+ || type.equals(LABEL))
{
tlabel = anots[index].description;
if (tlabel == null || tlabel.length() < 1)
{
text.append(", ")
.append(MessageManager.getString("label.sequence"))
- .append(" ")
- .append(seqIndex + 1);
+ .append(" ").append(seqIndex + 1);
char residue = seqref.getCharAt(column);
if (!Comparison.isGap(residue))
{
}
}
- protected boolean colorAlignmContaining(
- AlignmentAnnotation currentAnn, int selectedThresholdOption)
+ protected boolean colorAlignmContaining(AlignmentAnnotation currentAnn,
+ int selectedThresholdOption)
{
AnnotationColourGradient acg = null;
}
acg.setSeqAssociated(seqAssociated.isSelected());
- if (currentAnn.graphMin == 0f
- && currentAnn.graphMax == 0f)
+ if (currentAnn.graphMin == 0f && currentAnn.graphMax == 0f)
{
acg.setPredefinedColours(true);
}
StringBuilder fileList = new StringBuilder();
for (String s : files)
{
- fileList.append(SPACE).append(BACKSLASH).append(Platform.escapeString(s))
- .append(BACKSLASH);
+ fileList.append(SPACE).append(BACKSLASH)
+ .append(Platform.escapeString(s)).append(BACKSLASH);
}
String filesString = fileList.toString();
jmb.evalStateCommand(command);
} catch (OutOfMemoryError oomerror)
{
- new OOMWarning(
- "When trying to add structures to the Jmol viewer!",
+ new OOMWarning("When trying to add structures to the Jmol viewer!",
oomerror);
Cache.log.debug("File locations are " + filesString);
} catch (Exception ex)
{
getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(
KeyStroke.getKeyStroke(KeyEvent.VK_Q, Toolkit
- .getDefaultToolkit().getMenuShortcutKeyMask()),
- "Quit");
+ .getDefaultToolkit().getMenuShortcutKeyMask()), "Quit");
getRootPane().getActionMap().put("Quit", new AbstractAction()
{
@Override
for (Object file : (List) t
.getTransferData(DataFlavor.javaFileListFlavor))
{
- files.add(((File)file).toString());
+ files.add(((File) file).toString());
protocols.add(FormatAdapter.FILE);
}
}
}
else
{
- Color color = new Color(
- Integer.parseInt(jucs.getColour(i).getRGB(), 16));
+ Color color = new Color(Integer.parseInt(jucs.getColour(i)
+ .getRGB(), 16));
fr.setColour(name = jucs.getColour(i).getName(),
new FeatureColour(color));
}
void save()
{
JalviewFileChooser chooser = new JalviewFileChooser(
- Cache.getProperty("LAST_DIRECTORY"),
- new String[] { "fc" },
+ Cache.getProperty("LAST_DIRECTORY"), new String[] { "fc" },
new String[] { "Sequence Feature Colours" },
"Sequence Feature Colours");
chooser.setFileView(new jalview.io.JalviewFileView());
{
public enum HelpId
{
- Home("home"), SequenceFeatureSettings("seqfeatures.settings"), StructureViewer(
- "viewingpdbs");
+ Home("home"), SequenceFeatureSettings("seqfeatures.settings"),
+ StructureViewer("viewingpdbs");
private String id;
}
if ((av.getSelectionGroup() == null)
- || (!jalview.util.Platform.isControlDown(e)
- && !e.isShiftDown() && av.getSelectionGroup() != null))
+ || (!jalview.util.Platform.isControlDown(e) && !e.isShiftDown() && av
+ .getSelectionGroup() != null))
{
av.setSelectionGroup(new SequenceGroup());
av.getSelectionGroup().setStartRes(0);
Sequence sq = (Sequence) av.getAlignment().getSequenceAt(seq2);
// build a new links menu based on the current links + any non-positional
// features
- Vector<String> nlinks = new Vector<String>(
- Preferences.sequenceURLLinks);
+ Vector<String> nlinks = new Vector<String>(Preferences.sequenceURLLinks);
SequenceFeature sfs[] = sq == null ? null : sq.getSequenceFeatures();
if (sfs != null)
{
}
return sq;
}
+
/**
* @return true if the forward reference was fully resolved
*/
public void resolveFrefedSequences()
{
- Iterator<SeqFref> nextFref=frefedSequence.iterator();
- int toresolve=frefedSequence.size();
- int unresolved=0,failedtoresolve=0;
- while (nextFref.hasNext()) {
+ Iterator<SeqFref> nextFref = frefedSequence.iterator();
+ int toresolve = frefedSequence.size();
+ int unresolved = 0, failedtoresolve = 0;
+ while (nextFref.hasNext())
+ {
SeqFref ref = nextFref.next();
if (ref.isResolvable())
{
- try {
+ try
+ {
if (ref.resolve())
{
nextFref.remove();
- } else {
+ }
+ else
+ {
failedtoresolve++;
}
- } catch (Exception x) {
- System.err.println("IMPLEMENTATION ERROR: Failed to resolve forward reference for sequence "+ref.getSref());
+ } catch (Exception x)
+ {
+ System.err
+ .println("IMPLEMENTATION ERROR: Failed to resolve forward reference for sequence "
+ + ref.getSref());
x.printStackTrace();
failedtoresolve++;
- }
- } else {
+ }
+ }
+ else
+ {
unresolved++;
}
}
- if (unresolved>0)
+ if (unresolved > 0)
{
System.err.println("Jalview Project Import: There were " + unresolved
+ " forward references left unresolved on the stack.");
}
- if (failedtoresolve>0)
+ if (failedtoresolve > 0)
{
System.err.println("SERIOUS! " + failedtoresolve
+ " resolvable forward references failed to resolve.");
JSeq jseq;
Set<String> calcIdSet = new HashSet<String>();
// record the set of vamsas sequence XML POJO we create.
- HashMap<String,Sequence> vamsasSetIds = new HashMap<String,Sequence>();
+ HashMap<String, Sequence> vamsasSetIds = new HashMap<String, Sequence>();
// SAVE SEQUENCES
for (final SequenceI jds : rjal.getSequences())
{
if (av.isHiddenRepSequence(jds))
{
jalview.datamodel.SequenceI[] reps = av
- .getRepresentedSequences(jds)
- .getSequencesInOrder(rjal);
+ .getRepresentedSequences(jds).getSequencesInOrder(rjal);
for (int h = 0; h < reps.length; h++)
{
for (String featureType : renderOrder)
{
FeatureColourI fcol = ap.getSeqPanel().seqCanvas
- .getFeatureRenderer()
- .getFeatureStyle(featureType);
+ .getFeatureRenderer().getFeatureStyle(featureType);
Setting setting = new Setting();
setting.setType(featureType);
if (!fcol.isSimpleColour())
setting.setAutoScale(fcol.isAutoScaled());
setting.setThreshold(fcol.getThreshold());
// -1 = No threshold, 0 = Below, 1 = Above
- setting.setThreshstate(fcol.isAboveThreshold() ? 1
- : (fcol.isBelowThreshold() ? 0 : -1));
+ setting.setThreshstate(fcol.isAboveThreshold() ? 1 : (fcol
+ .isBelowThreshold() ? 0 : -1));
}
else
{
// is groups actually supposed to be a map here ?
Iterator<String> en = ap.getSeqPanel().seqCanvas
- .getFeatureRenderer()
- .getFeatureGroups().iterator();
+ .getFeatureRenderer().getFeatureGroups().iterator();
Vector<String> groupsAdded = new Vector<String>();
while (en.hasNext())
{
List<SequenceI> hiddenSeqs = null;
-
List<SequenceI> tmpseqs = new ArrayList<SequenceI>();
boolean multipleView = false;
if (!incompleteSeqs.containsKey(seqId))
{
// may not need this check, but keep it for at least 2.9,1 release
- if (tmpSeq.getStart()!=jseqs[i].getStart() || tmpSeq.getEnd()!=jseqs[i].getEnd())
- {
+ if (tmpSeq.getStart() != jseqs[i].getStart()
+ || tmpSeq.getEnd() != jseqs[i].getEnd())
+ {
System.err
.println("Warning JAL-2154 regression: updating start/end for sequence "
+ tmpSeq.toString() + " to " + jseqs[i]);
}
- } else {
+ }
+ else
+ {
incompleteSeqs.remove(seqId);
}
if (vamsasSeq.length > vi && vamsasSeq[vi].getId().equals(seqId))
// filename
// translation differently.
StructureData filedat = oldFiles.get(new File(oldfilenam));
- if (filedat == null)
- {
- String reformatedOldFilename = oldfilenam.replaceAll("/",
- "\\\\");
- filedat = oldFiles.get(new File(reformatedOldFilename));
+ if (filedat == null)
+ {
+ String reformatedOldFilename = oldfilenam.replaceAll("/", "\\\\");
+ filedat = oldFiles.get(new File(reformatedOldFilename));
}
newFileLoc.append(Platform.escapeString(filedat.getFilePath()));
pdbfilenames.add(filedat.getFilePath());
if (!adjusting)
{
valueField.setText(""
- + ((integ) ? ("" + slider.getValue())
- : ("" + slider.getValue() / 1000f)));
+ + ((integ) ? ("" + slider.getValue()) : ("" + slider
+ .getValue() / 1000f)));
checkIfModified();
}
}
private BufferedImage lastMiniMe = null;
+
/**
* DOCUMENT ME!
*
urlLink = new GroupUrlLink(link);
} catch (Exception foo)
{
- Cache.log.error("Exception for GroupURLLink '" + link
- + "'", foo);
+ Cache.log.error("Exception for GroupURLLink '" + link + "'", foo);
continue;
}
;
/*
* Save Output settings
*/
- Cache.applicationProperties.setProperty("EPS_RENDERING",
- ((OptionsParam) epsRendering.getSelectedItem()).getCode());
+ Cache.applicationProperties.setProperty("EPS_RENDERING",
+ ((OptionsParam) epsRendering.getSelectedItem()).getCode());
/*
* Save Connections settings
}
@Override
- public int hashCode(){
+ public int hashCode()
+ {
return name.hashCode() + code.hashCode();
}
}
}
PaintRefresher.Refresh(this, av.getSequenceSetId());
ap.paintAlignment(needOverviewUpdate);
- needOverviewUpdate =false;
+ needOverviewUpdate = false;
changeEndRes = false;
changeStartRes = false;
stretchGroup = null;
{
if (av.getAlignment() == null)
{
- Cache.log.warn("alignviewport av SeqSetId="
- + av.getSequenceSetId() + " ViewId=" + av.getViewId()
+ Cache.log.warn("alignviewport av SeqSetId=" + av.getSequenceSetId()
+ + " ViewId=" + av.getViewId()
+ " 's alignment is NULL! returning immediately.");
return;
}
if (sfetch == null
|| dasRegistry != Cache.getDasSourceRegistry()
|| lastDasSourceRegistry != (Cache.getDasSourceRegistry()
- .getDasRegistryURL() + Cache
- .getDasSourceRegistry().getLocalSourceString())
- .hashCode())
+ .getDasRegistryURL() + Cache.getDasSourceRegistry()
+ .getLocalSourceString()).hashCode())
{
_initingFetcher = true;
initingThread = Thread.currentThread();
public SequenceFetcher(IProgressIndicator guiIndic,
final String selectedDb, final String queryString)
{
- this._isConstructing=true;
+ this._isConstructing = true;
this.progressIndicator = guiIndic;
final SequenceFetcher us = this;
// launch initialiser thread
if (getSequenceFetcherSingleton(progressIndicator) != null)
{
us.initGui(progressIndicator, selectedDb, queryString);
- us._isConstructing=false;
+ us._isConstructing = false;
}
else
{
});
sf.start();
}
+
/**
- * blocking call which creates a new sequence fetcher panel, configures it and presses the OK button with the given database and query.
+ * blocking call which creates a new sequence fetcher panel, configures it and
+ * presses the OK button with the given database and query.
+ *
* @param database
* @param query
*/
public static List<AlignFrame> fetchAndShow(String database, String query)
{
- final SequenceFetcher sf = new SequenceFetcher(Desktop.instance, database, query);
+ final SequenceFetcher sf = new SequenceFetcher(Desktop.instance,
+ database, query);
while (sf._isConstructing)
{
- try { Thread.sleep(50);
+ try
+ {
+ Thread.sleep(50);
} catch (Exception q)
{
return Collections.emptyList();
{
};
-
+
/**
* initialise the database and query for this fetcher panel
*
new UniprotFTSPanel(this);
frame.dispose();
}
+
private void otherSourceAction()
{
try
} catch (Exception e)
{
Cache.log.info(
- "Error retrieving " + accession
- + " from " + proxy.getDbName(), e);
+ "Error retrieving " + accession + " from "
+ + proxy.getDbName(), e);
}
return success;
}
try
{
- af.setMaximum(Cache.getDefault("SHOW_FULLSCREEN",
- false));
+ af.setMaximum(Cache.getDefault("SHOW_FULLSCREEN", false));
} catch (Exception ex)
{
}
pid.cs = cs;
}
- PIDSlider.setTitle(MessageManager
- .formatMessage("label.percentage_identity_threshold",
+ PIDSlider
+ .setTitle(MessageManager.formatMessage(
+ "label.percentage_identity_threshold",
new String[] { source }));
if (ap.av.getAlignment().getGroups() != null)
private static final int WINDOWS_INSETS_HEIGHT = 50; // tbc
private static final int MAC_INSETS_HEIGHT = 50;
+
private static final int DESKTOP_DECORATORS_HEIGHT = 65;
+
private static final long serialVersionUID = 1L;
public SplitFrame(GAlignFrame top, GAlignFrame bottom)
return Arrays.asList(new AlignFrame[] { (AlignFrame) getTopFrame(),
(AlignFrame) getBottomFrame() });
}
+
/**
* Replace Cmd-F Find action with our version. This is necessary because the
* 'default' Finder searches in the first AlignFrame it finds. We need it to
{
getResultTable().setModel(
FTSRestResponse.getTableModel(lastPdbRequest,
- discoveredStructuresSet));
+ discoveredStructuresSet));
noOfStructuresFound = discoveredStructuresSet.size();
mainFrame.setTitle(MessageManager.formatMessage(
"label.structure_chooser_no_of_structures",
if (isValidSeqName(entry.getId()))
{
queryBuilder.append("pdb_id:")
- .append(entry.getId().toLowerCase())
- .append(" OR ");
+ .append(entry.getId().toLowerCase()).append(" OR ");
isPDBRefsFound = true;
// seqRefs.add(entry.getId());
}
if (dbRef.getSource().equalsIgnoreCase(DBRefSource.UNIPROT))
{
queryBuilder.append("uniprot_accession:")
- .append(getDBRefId(dbRef))
- .append(" OR ");
+ .append(getDBRefId(dbRef)).append(" OR ");
queryBuilder.append("uniprot_id:").append(getDBRefId(dbRef))
.append(" OR ");
isUniProtRefsFound = true;
{
queryBuilder.append("pdb_id:")
- .append(getDBRefId(dbRef).toLowerCase())
- .append(" OR ");
+ .append(getDBRefId(dbRef).toLowerCase()).append(" OR ");
isPDBRefsFound = true;
}
else
.replaceAll("[^\\dA-Za-z|_]", "").replaceAll("\\s+", "+");
}
-
/**
* Ensures sequence ref names are not less than 3 characters and does not
* contain a database name
reorderedStructuresSet.addAll(filteredResponse);
reorderedStructuresSet.addAll(discoveredStructuresSet);
getResultTable().setModel(
- FTSRestResponse.getTableModel(
- lastPdbRequest, reorderedStructuresSet));
+ FTSRestResponse.getTableModel(lastPdbRequest,
+ reorderedStructuresSet));
FTSRestResponse.configureTableColumn(getResultTable(),
wantedFields, tempUserPrefs);
}
if (seq.getPrimaryDBRefs().size() == 0)
{
- seqsWithoutSourceDBRef.add(seq);
- continue;
- }
+ seqsWithoutSourceDBRef.add(seq);
+ continue;
+ }
}
if (!seqsWithoutSourceDBRef.isEmpty())
{
pdbRequest.setResponseSize(1);
pdbRequest.setFieldToSearchBy("(pdb_id:");
pdbRequest.setWantedFields(wantedFields);
- pdbRequest
-.setSearchTerm(searchTerm + ")");
+ pdbRequest.setSearchTerm(searchTerm + ")");
pdbRequest.setAssociatedSequence(selectedSequence);
pdbRestCleint = PDBFTSRestClient.getInstance();
wantedFields.add(pdbRestCleint.getPrimaryKeyColumn());
for (int i = 0; i < leaves.size(); i++)
{
- SequenceI seq = (SequenceI) leaves.elementAt(i)
- .element();
+ SequenceI seq = (SequenceI) leaves.elementAt(i).element();
treeSelectionChanged(seq);
}
av.sendSelection();
(int) (Math.random() * 255), (int) (Math.random() * 255));
setColor(tree.getGroups().elementAt(i), col.brighter());
- Vector<SequenceNode> l = tree.findLeaves(tree
- .getGroups().elementAt(i));
+ Vector<SequenceNode> l = tree.findLeaves(tree.getGroups()
+ .elementAt(i));
Vector<SequenceI> sequences = new Vector<SequenceI>();
for (int j = 0; j < l.size(); j++)
{
- SequenceI s1 = (SequenceI) l.elementAt(j)
- .element();
+ SequenceI s1 = (SequenceI) l.elementAt(j).element();
if (!sequences.contains(s1))
{
addProperties(al);
for (int i = 0; i < annotations.size(); i++)
{
- AlignmentAnnotation aa = annotations
- .elementAt(i);
+ AlignmentAnnotation aa = annotations.elementAt(i);
aa.setPadGaps(true, al.getGapCharacter());
al.addAnnotation(aa);
}
* @return true if features were added
*/
public boolean parse(AlignmentI align,
- Map<String, FeatureColourI> colours,
- boolean removeHTML)
+ Map<String, FeatureColourI> colours, boolean removeHTML)
{
return parse(align, colours, removeHTML, false);
}
* @return true if features were added
*/
public boolean parse(AlignmentI align,
- Map<String, FeatureColourI> colours,
- boolean removeHTML, boolean relaxedIdmatching)
+ Map<String, FeatureColourI> colours, boolean removeHTML,
+ boolean relaxedIdmatching)
{
Map<String, String> gffProps = new HashMap<String, String>();
/*
{
for (SequenceFeature sequenceFeature : features)
{
- isnonpos = sequenceFeature.begin == 0 && sequenceFeature.end == 0;
+ isnonpos = sequenceFeature.begin == 0
+ && sequenceFeature.end == 0;
if ((!nonpos && isnonpos)
|| (!isnonpos && visOnly && !visible
.containsKey(sequenceFeature.type)))
private boolean headless;
-
public HtmlSvgOutput(File file, AlignmentPanel ap)
{
this.av = ap.av;
try
{
setProgressMessage(null);
- setProgressMessage(MessageManager
-.formatMessage(
+ setProgressMessage(MessageManager.formatMessage(
"status.exporting_alignment_as_x_file", "HTML"));
AlignmentDimension aDimension = ap.getAlignmentDimension();
SVGGraphics2D g1 = new SVGGraphics2D(aDimension.getWidth(),
}
int lessThan = data.indexOf("<");
if ((lessThan > -1)) // possible Markup Language data i.e HTML,
- // RNAML, XML
+ // RNAML, XML
{
String upper = data.toUpperCase();
if (upper.substring(lessThan).startsWith("<HTML"))
}
/**
- * Returns true if the data has at least 6 tab-delimited fields _and_
- * fields 4 and 5 are integer (start/end)
+ * Returns true if the data has at least 6 tab-delimited fields _and_ fields 4
+ * and 5 are integer (start/end)
+ *
* @param data
* @return
*/
return false;
}
String[] columns = data.split("\t");
- if (columns.length < 6) {
+ if (columns.length < 6)
+ {
return false;
}
for (int col = 3; col < 5; col++)
{
- try {
+ try
+ {
Integer.parseInt(columns[col]);
- } catch (NumberFormatException e) {
+ } catch (NumberFormatException e)
+ {
return false;
}
}
* modify to MSF format: uses '.' for internal gaps,
* and '~' for leading or trailing gaps
*/
- String seqString = sqs[i].getSequenceAsString()
- .replace('-', '.');
+ String seqString = sqs[i].getSequenceAsString().replace('-', '.');
StringBuilder sb = new StringBuilder(seqString);
{
if (seqhash.get(headers.get(i)) != null)
{
- if (maxLength < seqhash.get(headers.get(i)).toString()
- .length())
+ if (maxLength < seqhash.get(headers.get(i)).toString().length())
{
maxLength = seqhash.get(headers.get(i)).toString().length();
}
}
else
{
- if (tmpString.indexOf("<") > -1
- || tmpString.indexOf(">") > -1)
+ if (tmpString.indexOf("<") > -1 || tmpString.indexOf(">") > -1)
{
// The description does not specify html is to
// be used, so we must remove < > symbols
.getType());
if (rng != null && rng[0] != null && rng[0][0] != rng[0][1])
{
- sb.append(" Score=").append(
- String.valueOf(feature.getScore()));
+ sb.append(" Score=").append(String.valueOf(feature.getScore()));
}
}
String status = (String) feature.getValue("status");
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
- result.add(new String[] { target, label, urls[u],
- urls[u + 1] });
+ result.add(new String[] { target, label, urls[u], urls[u + 1] });
uniques.add(unq);
}
}
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
- result.add(new String[] { target, label, urls[u],
- urls[u + 1] });
+ result.add(new String[] { target, label, urls[u], urls[u + 1] });
uniques.add(unq);
}
}
String unq = urls[u] + "|" + urls[u + 1];
if (!uniques.contains(unq))
{
- result.add(new String[] { target, label, urls[u],
- urls[u + 1] });
+ result.add(new String[] { target, label, urls[u], urls[u + 1] });
uniques.add(unq);
}
}
{
if (DETECT_BRACKETS.search(pos))
{
- ann.secondaryStructure = Rna.getRNASecStrucState(
- pos).charAt(0);
+ ann.secondaryStructure = Rna.getRNASecStrucState(pos).charAt(0);
}
else
{
}
- public StructureFile(boolean parseImmediately, String dataObject, String type)
- throws IOException
+ public StructureFile(boolean parseImmediately, String dataObject,
+ String type) throws IOException
{
super(parseImmediately, dataObject, type);
}
try
{
- processGffSimilarity(set, seq, gffColumns,
- align, newseqs, relaxedIdMatching);
+ processGffSimilarity(set, seq, gffColumns, align, newseqs,
+ relaxedIdMatching);
} catch (IOException ivfe)
{
System.err.println(ivfe);
* if true allow fuzzy search for a matching target sequence
* @throws IOException
*/
- protected void processGffSimilarity(
- Map<String, List<String>> set,
+ protected void processGffSimilarity(Map<String, List<String>> set,
SequenceI seq, String[] gff, AlignmentI align,
List<SequenceI> newseqs, boolean relaxedIdMatching)
throws IOException
int alignFromStart;
int alignToStart;
int alignCount;
- try {
+ try
+ {
alignFromStart = Integer.parseInt(tokens[0]);
alignToStart = Integer.parseInt(tokens[1]);
alignCount = Integer.parseInt(tokens[2]);
- } catch (NumberFormatException nfe) {
+ } catch (NumberFormatException nfe)
+ {
System.err.println(nfe.toString());
return null;
}
-
+
int fromStart;
int fromEnd;
int toStart;
{
result = MappingType.PeptideToNucleotide;
}
- else if (model.contains(CODING2CODING)
- || model.contains(CODING2GENOME)
- || model.contains(CDNA2GENOME)
- || model.contains(GENOME2GENOME))
+ else if (model.contains(CODING2CODING) || model.contains(CODING2GENOME)
+ || model.contains(CDNA2GENOME) || model.contains(GENOME2GENOME))
{
result = MappingType.NucleotideToNucleotide;
}
{
String mdl = model.toLowerCase();
if (mdl.contains(PROTEIN2DNA) || mdl.contains(PROTEIN2GENOME)
- || mdl.contains(CODING2CODING)
- || mdl.contains(CODING2GENOME)
- || mdl.contains(CDNA2GENOME)
- || mdl.contains(GENOME2GENOME))
+ || mdl.contains(CODING2CODING) || mdl.contains(CODING2GENOME)
+ || mdl.contains(CDNA2GENOME) || mdl.contains(GENOME2GENOME))
{
return true;
}
}
else if (so.isA(soTerm, SequenceOntologyI.NUCLEOTIDE_MATCH))
{
- sf = processNucleotideMatch(attributes, seq, gff, align,
- newseqs, relaxedIdMatching);
+ sf = processNucleotideMatch(attributes, seq, gff, align, newseqs,
+ relaxedIdMatching);
}
else
{
*/
sf = buildSequenceFeature(gff, null);
}
-
+
return sf;
}
protected SequenceFeature processNucleotideMatch(
Map<String, List<String>> attributes, SequenceI seq,
String[] gffColumns, AlignmentI align, List<SequenceI> newseqs,
- boolean relaxedIdMatching)
- throws IOException
+ boolean relaxedIdMatching) throws IOException
{
String strand = gffColumns[STRAND_COL];
* (new or existing) virtual sequence in the newseqs list
*/
String targetId = findTargetId(tokens[0], attributes);
- SequenceI mappedSequence1 = findSequence(targetId, align,
- newseqs, relaxedIdMatching);
+ SequenceI mappedSequence1 = findSequence(targetId, align, newseqs,
+ relaxedIdMatching);
SequenceI mappedSequence = mappedSequence1;
if (mappedSequence == null)
{
int fromStart = Integer.parseInt(gffColumns[START_COL]);
int fromEnd = Integer.parseInt(gffColumns[END_COL]);
MapList mapping = constructMappingFromAlign(fromStart, fromEnd,
- toStart, toEnd,
- MappingType.NucleotideToNucleotide);
+ toStart, toEnd, MappingType.NucleotideToNucleotide);
if (mapping != null)
{
for (String target : targets)
{
- SequenceI mappedSequence1 = findSequence(findTargetId(target, set), align,
- newseqs, relaxedIdMatching);
+ SequenceI mappedSequence1 = findSequence(findTargetId(target, set),
+ align, newseqs, relaxedIdMatching);
SequenceI mappedSequence = mappedSequence1;
if (mappedSequence == null)
{
/*
* Ensembl returns dna variants as 'alleles'
*/
- desc = StringUtils.listToDelimitedString(
- attributes.get("alleles"), ",");
+ desc = StringUtils.listToDelimitedString(attributes.get("alleles"),
+ ",");
}
/*
* @param toSeq
* @return
*/
- protected AlignedCodonFrame getMapping(AlignmentI align, SequenceI fromSeq, SequenceI toSeq)
+ protected AlignedCodonFrame getMapping(AlignmentI align,
+ SequenceI fromSeq, SequenceI toSeq)
{
AlignedCodonFrame acf = align.getMapping(fromSeq, toSeq);
if (acf == null)
package jalview.io.gff;
-
/**
* A factory to serve instances of GFF helper classes
*/
* @throws IOException
*/
SequenceFeature processGff(SequenceI seq, String[] gffColumns,
- AlignmentI align,
- List<SequenceI> newseqs, boolean relaxedIdMatching)
- throws IOException;
+ AlignmentI align, List<SequenceI> newseqs,
+ boolean relaxedIdMatching) throws IOException;
// java 8 will allow static methods in interfaces:
// static boolean recognises(String [] columns);
package jalview.io.gff;
-
/**
* 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
private void loadStaticData()
{
parents = new HashMap<String, List<String>>();
- for (String [] pair : TERMS) {
+ for (String[] pair : TERMS)
+ {
List<String> p = parents.get(pair[0]);
if (p == null)
{
* @param parentAlignment
*/
public JalviewDataset(AlignmentI aldataset,
- Map<String, FeatureColourI> fc,
- Hashtable seqDets)
+ Map<String, FeatureColourI> fc, Hashtable seqDets)
{
// TODO not used - remove?
this(aldataset, fc, seqDets, null);
* with.
*/
public JalviewDataset(AlignmentI aldataset,
- Map<String, FeatureColourI> fc,
- Hashtable seqDets, AlignmentI parentAlignment)
+ Map<String, FeatureColourI> fc, Hashtable seqDets,
+ AlignmentI parentAlignment)
{
this();
parentDataset = aldataset;
radioItem.removeActionListener(radioItem.getActionListeners()[0]);
int option = JOptionPane.showInternalConfirmDialog(
- jalview.gui.Desktop.desktop,
- MessageManager
+ jalview.gui.Desktop.desktop, MessageManager
.getString("label.remove_from_default_list"),
MessageManager
.getString("label.remove_user_defined_colour"),
showProducts.setText(MessageManager.getString("label.get_cross_refs"));
runGroovy.setText(MessageManager.getString("label.run_groovy"));
- runGroovy.setToolTipText(MessageManager.getString("label.run_groovy_tip"));
+ runGroovy.setToolTipText(MessageManager
+ .getString("label.run_groovy_tip"));
runGroovy.addActionListener(new ActionListener()
{
@Override
{
}
+
/**
* Adds the given action listener and key accelerator to the given menu item.
* Also saves in a lookup table to support lookup of action by key stroke.
{
return true;
}
-
+
FTSDataColumnI[] currentWantedFields = pdbDocFieldPrefs
- .getStructureSummaryFields()
- .toArray(new FTSDataColumnI[0]);
+ .getStructureSummaryFields().toArray(new FTSDataColumnI[0]);
return Arrays.equals(currentWantedFields, previousWantedFields) ? false
: true;
{
return tbl_summary;
}
+
public JComboBox<FilterOption> getCmbFilterOption()
{
return cmb_filterOption;
annotationPanel = null;
}
- void drawStemAnnot(Graphics g, Annotation[] row_annotations,
- int lastSSX, int x, int y, int iconOffset, int startRes,
- int column, boolean validRes, boolean validEnd)
+ void drawStemAnnot(Graphics g, Annotation[] row_annotations, int lastSSX,
+ int x, int y, int iconOffset, int startRes, int column,
+ boolean validRes, boolean validEnd)
{
g.setColor(STEM_COLOUR);
int sCol = (lastSSX / charWidth) + startRes;
private Color sdNOTCANONICAL_COLOUR;
- void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX,
- int x, int y, int iconOffset, int startRes, int column,
+ void drawGlyphLine(Graphics g, Annotation[] row, int lastSSX, int x,
+ int y, int iconOffset, int startRes, int column,
boolean validRes, boolean validEnd)
{
g.setColor(GLYPHLINE_COLOR);
}
- void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX,
- int x, int y, int iconOffset, int startRes, int column,
+ void drawHelixAnnot(Graphics g, Annotation[] row, int lastSSX, int x,
+ int y, int iconOffset, int startRes, int column,
boolean validRes, boolean validEnd)
{
g.setColor(HELIX_COLOUR);
* marker position in alignment column coords, a String to be rendered
* at the position (or null)
*/
- public List<ScaleMark> calculateMarks(AlignViewportI av,
- int startx, int endx)
+ public List<ScaleMark> calculateMarks(AlignViewportI av, int startx,
+ int endx)
{
int scalestartx = (startx / 10) * 10;
setAutoScaled(fc.isAutoScaled());
setColourByLabel(fc.isColourByLabel());
}
-
+
/**
* Copy constructor with new min/max ranges
+ *
* @param fc
* @param min
* @param max
setGraduatedColour(false);
}
}
+
@Override
public boolean isBelowThreshold()
{
{
scl = 1f;
}
- return new Color(minRed + scl * deltaRed, minGreen + scl * deltaGreen, minBlue + scl * deltaBlue);
+ return new Color(minRed + scl * deltaRed, minGreen + scl * deltaGreen,
+ minBlue + scl * deltaBlue);
}
/**
charged.put("D", Integer.valueOf(1));
charged.put("N", Integer.valueOf(0)); // Asparagine is polar but not
// charged.
- // Alternative would be charged and
- // negative (in basic form)?
+ // Alternative would be charged and
+ // negative (in basic form)?
charged.put("S", Integer.valueOf(0));
charged.put("T", Integer.valueOf(0));
charged.put("P", Integer.valueOf(0));
JMOL_PARSER, JALVIEW_PARSER
}
-
/**
* Determines the default file format for structure files to be downloaded
* from the PDB sequence fetcher. Possible options include: PDB|mmCIF
* are : JMolParser|JalveiwParser
*/
private static StructureParser defaultPDBFileParser = StructureParser.JMOL_PARSER;
+
public static void addSettings(boolean addAlignmentAnnotations,
boolean processSecStr, boolean externalSecStr)
{
return setMapping(true, sequence, targetChains, pdbFile, protocol);
}
-
/**
* create sequence structure mappings between each sequence and the given
* pdbFile (retrieved via the given protocol).
*/
synchronized public StructureFile setMapping(boolean forStructureView,
SequenceI[] sequenceArray, String[] targetChainIds,
- String pdbFile,
- String protocol)
+ String pdbFile, String protocol)
{
/*
* There will be better ways of doing this in the future, for now we'll use
try
{
StructureMapping siftsMapping = getStructureMapping(seq,
- pdbFile,
- chain.id, pdb, chain, sqmpping, maxAlignseq);
+ pdbFile, chain.id, pdb, chain, sqmpping, maxAlignseq);
foundSiftsMappings.add(siftsMapping);
} catch (SiftsException e)
{
PDBChain maxChain, jalview.datamodel.Mapping sqmpping,
AlignSeq maxAlignseq) throws SiftsException
{
- StructureMapping curChainMapping = siftsClient
- .getSiftsStructureMapping(seq, pdbFile, targetChainId);
- try
- {
+ StructureMapping curChainMapping = siftsClient
+ .getSiftsStructureMapping(seq, pdbFile, targetChainId);
+ try
+ {
PDBChain chain = pdb.findChain(targetChainId);
if (chain != null)
{
chain.transferResidueAnnotation(curChainMapping, sqmpping);
}
- } catch (Exception e)
- {
- e.printStackTrace();
- }
- return curChainMapping;
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return curChainMapping;
}
- private StructureMapping getNWMappings(SequenceI seq,
- String pdbFile,
+ private StructureMapping getNWMappings(SequenceI seq, String pdbFile,
String maxChainId, PDBChain maxChain, StructureFile pdb,
AlignSeq maxAlignseq)
{
public enum TYPE
{
- EPS("EPS", MessageManager.getString("label.eps_file"), getEPSChooser()), PNG(
- "PNG", MessageManager.getString("label.png_image"),
- getPNGChooser()), SVG("SVG", "SVG", getSVGChooser());
+ EPS("EPS", MessageManager.getString("label.eps_file"), getEPSChooser()),
+ PNG("PNG", MessageManager.getString("label.png_image"), getPNGChooser()),
+ SVG("SVG", "SVG", getSVGChooser());
private JalviewFileChooser chooser;
*/
public static List<int[]> coalesceRanges(final List<int[]> ranges)
{
- if (ranges == null || ranges.size() < 2) {
+ if (ranges == null || ranges.size() < 2)
+ {
return ranges;
}
lastRange = new int[] { lastRange[0], lastRange[1] };
merged.add(lastRange);
boolean first = true;
-
+
for (final int[] range : ranges)
{
if (first)
* if next range is in the same direction as last and contiguous,
* just update the end position of the last range
*/
- boolean sameDirection = range[1] == range[0] || direction == lastDirection;
+ boolean sameDirection = range[1] == range[0]
+ || direction == lastDirection;
boolean extending = range[0] == lastRange[1] + lastDirection;
boolean overlapping = (lastDirection == 1 && range[0] >= lastRange[0] && range[0] <= lastRange[1])
|| (lastDirection == -1 && range[0] <= lastRange[0] && range[0] >= lastRange[1]);
lastDirection = (range[1] == range[0]) ? lastDirection : direction;
}
}
-
+
return changed ? merged : ranges;
}
/*
* Found a sequence mapping. Locate the start/end mapped residues.
*/
- List<AlignedCodonFrame> mapping = Arrays.asList(new AlignedCodonFrame[] { acf });
+ List<AlignedCodonFrame> mapping = Arrays
+ .asList(new AlignedCodonFrame[] { acf });
SearchResults sr = buildSearchResults(selected,
startResiduePos, mapping);
for (Match m : sr.getResults())
* @param fromGapChar
*/
protected static void mapHiddenColumns(int[] hidden,
- List<AlignedCodonFrame> mappings,
- ColumnSelection mappedColumns, List<SequenceI> fromSequences,
- List<SequenceI> toSequences, char fromGapChar)
+ List<AlignedCodonFrame> mappings, ColumnSelection mappedColumns,
+ List<SequenceI> fromSequences, List<SequenceI> toSequences,
+ char fromGapChar)
{
for (int col = hidden[0]; col <= hidden[1]; col++)
{
* @param fromGapChar
*/
protected static void mapColumn(int col,
- List<AlignedCodonFrame> mappings,
- ColumnSelection mappedColumns, List<SequenceI> fromSequences,
- List<SequenceI> toSequences, char fromGapChar)
+ List<AlignedCodonFrame> mappings, ColumnSelection mappedColumns,
+ List<SequenceI> fromSequences, List<SequenceI> toSequences,
+ char fromGapChar)
{
int[] mappedTo = findMappedColumns(col, mappings, fromSequences,
toSequences, fromGapChar);
* Get the residue position and find the mapped position.
*/
int residuePos = fromSeq.findPosition(col);
- SearchResults sr = buildSearchResults(fromSeq, residuePos,
- mappings);
+ SearchResults sr = buildSearchResults(fromSeq, residuePos, mappings);
for (Match m : sr.getResults())
{
int mappedStartResidue = m.getStart();
{
return ranges;
}
-
+
int[] copy = Arrays.copyOf(ranges, ranges.length);
int sxpos = -1;
int cdspos = 0;
break;
}
}
-
+
if (sxpos > 0)
{
/*
final int length = arr.length;
Integer[] indices = makeIndexArray(length);
Arrays.sort(indices, new IntComparator(arr, ascending));
-
+
/*
* Copy the array values as per the sorted indices
*/
sortedInts[i] = arr[indices[i]];
sortedObjects[i] = s[indices[i]];
}
-
+
/*
* And copy the sorted values back into the arrays
*/
final int length = arr.length;
Integer[] indices = makeIndexArray(length);
Arrays.sort(indices, new ExternalComparator(arr, ascending));
-
+
/*
* Copy the array values as per the sorted indices
*/
sortedStrings[i] = arr[indices[i]];
sortedObjects[i] = s[indices[i]];
}
-
+
/*
* And copy the sorted values back into the arrays
*/
final int length = arr.length;
Integer[] indices = makeIndexArray(length);
Arrays.sort(indices, new DoubleComparator(arr, ascending));
-
+
/*
* Copy the array values as per the sorted indices
*/
sortedDoubles[i] = arr[indices[i]];
sortedObjects[i] = s[indices[i]];
}
-
+
/*
* And copy the sorted values back into the arrays
*/
}
return "" + separator;
}
-
+
/**
* Converts a list to a string with a delimiter before each term except the
* first. Returns an empty string given a null or zero-length argument. This
public boolean isHiddenRepSequence(SequenceI seq)
{
return (hiddenRepSequences != null && hiddenRepSequences
- .containsKey(seq));
+ .containsKey(seq));
}
/**
public void expandColSelection(SequenceGroup sg, boolean wholewidth)
{
int sgs, sge;
- if (sg != null
- && (sgs = sg.getStartRes()) >= 0
+ if (sg != null && (sgs = sg.getStartRes()) >= 0
&& sg.getStartRes() <= (sge = sg.getEndRes())
&& !this.hasSelectedColumns())
{
@Override
public void setColour(String featureType, FeatureColourI col)
{
- featureColours.put(featureType, col);
+ featureColours.put(featureType, col);
}
public void setTransparency(float value)
ourAnnots.clear();
}
}
+
// TODO: allow GUI to query workers associated with annotation to add items to
// annotation label panel popup menu
float max = Float.MIN_VALUE;
float min = Float.MAX_VALUE;
boolean set = false;
- for (Annotation a : anns) {
- if (a != null) {
+ for (Annotation a : anns)
+ {
+ if (a != null)
+ {
set = true;
float val = a.value;
max = Math.max(max, val);
{
// TODO need an interface for AlignFrame by which to access
// its AlignViewportI and AlignmentViewPanel
- AlignFrame currentAlignFrame = Jalview.getCurrentAlignFrame() ;
+ AlignFrame currentAlignFrame = Jalview.getCurrentAlignFrame();
if (currentAlignFrame != null)
{
newCalculator(currentAlignFrame.getViewport(), currentAlignFrame
* provider of AlignmentAnnotation for the alignment
*/
public static void newCalculator(AlignViewportI viewport,
- AlignmentViewPanel panel,
- AnnotationProviderI calculator)
+ AlignmentViewPanel panel, AnnotationProviderI calculator)
{
new AnnotationWorker(viewport, panel, calculator);
}
*/
AlignmentAnnotation ann = alignViewport.getAlignment()
.findOrCreateAnnotation(counter.getName(),
- counter.getDescription(), false, null,
- null);
+ counter.getDescription(), false, null, null);
ann.description = counter.getDescription();
ann.showAllColLabels = true;
ann.scaleColLabel = true;
*/
public DBRefFetcher(SequenceI[] seqs,
IProgressIndicator progressIndicatorFrame,
- DbSourceProxy[] sources, FeatureSettings featureSettings, boolean isNucleotide)
+ DbSourceProxy[] sources, FeatureSettings featureSettings,
+ boolean isNucleotide)
{
listeners = new ArrayList<FetchFinishedListenerI>();
this.progressWindow = progressIndicatorFrame;
{
progressWindow.setProgressBar(
MessageManager.getString("status.fetching_db_refs"),
- startTime);
+ startTime);
}
try
{
// Still queries to make for current seqIndex
StringBuffer queryString = new StringBuffer("");
int numq = 0;
- int nqSize = (maxqlen > queries.size()) ? queries
- .size() : maxqlen;
+ int nqSize = (maxqlen > queries.size()) ? queries.size()
+ : maxqlen;
while (queries.size() > 0 && numq < nqSize)
{
output.setText(sb.toString());
Desktop.addInternalFrame(output,
- MessageManager.getString("label.sequences_updated"),
- 600, 300);
+ MessageManager.getString("label.sequences_updated"), 600, 300);
// The above is the dataset, we must now find out the index
// of the viewed sequence
* @param warningMessages
* a list of messages to add to
*/
- boolean transferReferences(Vector<SequenceI> sdataset,
- String dbSource,
+ boolean transferReferences(Vector<SequenceI> sdataset, String dbSource,
AlignmentI retrievedAl, boolean trimDatasetSeqs,
List<String> warningMessages)
{
// taking into account all accessionIds and names in the file
Vector<SequenceI> sequenceMatches = new Vector<SequenceI>();
// look for corresponding accession ids
- DBRefEntry[] entryRefs = DBRefUtils.selectRefs(retrievedSeq.getDBRefs(),
- new String[] { dbSource });
+ DBRefEntry[] entryRefs = DBRefUtils.selectRefs(
+ retrievedSeq.getDBRefs(), new String[] { dbSource });
if (entryRefs == null)
{
System.err
*/
mp = new Mapping(null, new int[] { sequenceStart + absStart,
sequenceStart + absStart + entrySeq.length() - 1 }, new int[]
- { retrievedSeq.getStart(), retrievedSeq.getStart() + entrySeq.length() - 1 },
- 1, 1);
+ { retrievedSeq.getStart(),
+ retrievedSeq.getStart() + entrySeq.length() - 1 }, 1, 1);
updateRefFrame = false;
}
else
}
System.out.println("Adding dbrefs to " + sequence.getName()
- + " from " + dbSource + " sequence : " + retrievedSeq.getName());
+ + " from " + dbSource + " sequence : "
+ + retrievedSeq.getName());
sequence.transferAnnotation(retrievedSeq, mp);
absStart += retrievedSeq.getStart();
public void run()
{
running = true;
- boolean isNucleotide = af.getViewport().getAlignment()
- .isNucleotide();
+ boolean isNucleotide = af.getViewport().getAlignment().isNucleotide();
new DBRefFetcher(sequences, af, null, af.featureSettings,
isNucleotide).fetchDBRefs(true);
{
jalviewSourceI[] sources = sourceRegistry.getSources().toArray(
new jalviewSourceI[0]);
- String active = Cache.getDefault("DAS_ACTIVE_SOURCE",
- "uniprot");
+ String active = Cache.getDefault("DAS_ACTIVE_SOURCE", "uniprot");
StringTokenizer st = new StringTokenizer(active, "\t");
selectedSources = new Vector();
String token;
{
return null;
}
- DBRefEntry[] uprefs = DBRefUtils.selectRefs(
- seq.getDBRefs(), new String[] {
+ DBRefEntry[] uprefs = DBRefUtils.selectRefs(seq.getDBRefs(),
+ new String[] {
// jalview.datamodel.DBRefSource.PDB,
DBRefSource.UNIPROT,
// jalview.datamodel.DBRefSource.EMBL - not tested on any EMBL coord
for (COORDINATES csys : dasSource.getVersion().getCOORDINATES())
{
- if (DBRefUtils.isDasCoordinateSystem(
- csys.getAuthority(), uprefs[j]))
+ if (DBRefUtils.isDasCoordinateSystem(csys.getAuthority(),
+ uprefs[j]))
{
debug("Launched fetcher for coordinate system "
+ csys.getAuthority());
-
/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
public class Pdb extends EbiFileRetrievedProxy
{
private static final String SEPARATOR = "|";
+
private static final String COLON = ":";
- private static final int PDB_ID_LENGTH = 4;
+ private static final int PDB_ID_LENGTH = 4;
public Pdb()
{
String ext = StructureImportSettings.getDefaultStructureFileFormat()
.equalsIgnoreCase(Type.MMCIF.toString()) ? ".cif" : ".xml";
EBIFetchClient ebi = new EBIFetchClient();
- file = ebi.fetchDataAsFile("pdb:" + id,
- StructureImportSettings.getDefaultStructureFileFormat().toLowerCase(),
- ext)
- .getAbsolutePath();
+ file = ebi.fetchDataAsFile(
+ "pdb:" + id,
+ StructureImportSettings.getDefaultStructureFileFormat()
+ .toLowerCase(), ext).getAbsolutePath();
stopQuery();
if (file == null)
{
{
// FIXME seems to result in 'PDB|1QIP|1qip|A' - 1QIP is redundant.
// TODO: suggest simplify naming to 1qip|A as default name defined
- pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR + id
- + SEPARATOR + pdbcs.getName());
+ pdbcs.setName(jalview.datamodel.DBRefSource.PDB + SEPARATOR
+ + id + SEPARATOR + pdbcs.getName());
// Might need to add more metadata to the PDBEntry object
// like below
/*
return 0;
}
-
/**
* Returns a descriptor for suitable feature display settings with
* <ul>
"STH");
for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)
{
- rcds.getSequenceAt(s).addDBRef(
-new DBRefEntry(DBRefSource.PFAM,
- // getDbSource(),
- getDbVersion(), queries.trim().toUpperCase()));
+ rcds.getSequenceAt(s).addDBRef(new DBRefEntry(DBRefSource.PFAM,
+ // getDbSource(),
+ getDbVersion(), queries.trim().toUpperCase()));
if (!getDbSource().equals(DBRefSource.PFAM))
{ // add the specific ref too
rcds.getSequenceAt(s).addDBRef(
*/
package jalview.ws.dbsources;
-
/**
* flyweight class specifying retrieval of Full family alignments from PFAM
*
*/
package jalview.ws.dbsources;
-
/**
* flyweight class specifying retrieval of Seed alignments from PFAM
*
*/
package jalview.ws.dbsources;
-
/**
* Flyweight class specifying retrieval of Full family alignments from RFAM
*
*/
package jalview.ws.dbsources;
-
/**
* Flyweight class specifying retrieval of Seed family alignments from RFAM
*
{
return "/alignment";
}
+
/*
* (non-Javadoc)
*
* UniprotEntry
* @return SequenceI instance created from the UniprotEntry instance
*/
- public SequenceI uniprotEntryToSequenceI(UniprotEntry entry){
+ public SequenceI uniprotEntryToSequenceI(UniprotEntry entry)
+ {
String id = getUniprotEntryId(entry);
SequenceI sequence = new Sequence(id, entry.getUniprotSequence()
.getContent());
// TODO: trap HTTP 404 exceptions and return null
AlignmentI rcds = new FormatAdapter().readFile(getXFAMURL()
+ queries.trim().toUpperCase() + getXFAMURLSUFFIX(),
- jalview.io.FormatAdapter.URL,
- "STH");
+ jalview.io.FormatAdapter.URL, "STH");
for (int s = 0, sNum = rcds.getHeight(); s < sNum; s++)
{
rcds.getSequenceAt(s).addDBRef(new DBRefEntry(getXfamSource(),
}
/*
- *
- */
+ *
+ */
@Override
public jalviewSourceI createLocalSource(String url, String name,
}
// note: outFile is currently always specified, so return value is null
- String[] rslt = fetchBatch(querystring.toString(), database, format, outFile);
+ String[] rslt = fetchBatch(querystring.toString(), database, format,
+ outFile);
return (rslt != null && rslt.length > 0 ? rslt : null);
}
return null;
}
System.err.println("Unexpected exception when retrieving from "
- + database
- + "\nQuery was : '" + ids + "'");
+ + database + "\nQuery was : '" + ids + "'");
ex.printStackTrace(System.err);
return null;
} finally
while (j < l)
{
- if (((AlignmentOrder) alorders.get(i))
- .equals((alorders.get(j))))
+ if (((AlignmentOrder) alorders.get(i)).equals((alorders
+ .get(j))))
{
alorders.remove(j);
l--;
try
{
- this.server = loc.getSeqSearchService(new java.net.URL(
- WsURL));
+ this.server = loc.getSeqSearchService(new java.net.URL(WsURL));
((SeqSearchServiceSoapBindingStub) this.server).setTimeout(60000); // One
// minute
// timeout
}
});
- String tooltip = JvSwingUtils.wrapTooltip(
- true,
+ String tooltip = JvSwingUtils
+ .wrapTooltip(
+ true,
"<strong>"
- + (preset.isModifiable() ? MessageManager
- .getString("label.user_preset")
- : MessageManager
- .getString("label.service_preset"))
+ + (preset.isModifiable() ? MessageManager
+ .getString("label.user_preset")
+ : MessageManager
+ .getString("label.service_preset"))
+ "</strong><br/>"
+ preset.getDescription());
methodR.setToolTipText(tooltip);
return true;
}
}
- Cache.log.warn("isFetchable doesn't know about '" + source
- + "'");
+ Cache.log.warn("isFetchable doesn't know about '" + source + "'");
return false;
}
siftsEntry = parseSIFTs(siftsFile);
}
-
/**
* Parse the given SIFTs File and return a JAXB POJO of parsed data
*
{
siftsDownloadDir.mkdirs();
}
- // System.out.println(">> Download ftp url : " + siftsFileFTPURL);
- URL url = new URL(siftsFileFTPURL);
- URLConnection conn = url.openConnection();
- InputStream inputStream = conn.getInputStream();
- FileOutputStream outputStream = new FileOutputStream(
- downloadedSiftsFile);
- byte[] buffer = new byte[BUFFER_SIZE];
- int bytesRead = -1;
- while ((bytesRead = inputStream.read(buffer)) != -1)
- {
- outputStream.write(buffer, 0, bytesRead);
- }
- outputStream.close();
- inputStream.close();
- // System.out.println(">>> File downloaded : " + downloadedSiftsFile);
+ // System.out.println(">> Download ftp url : " + siftsFileFTPURL);
+ URL url = new URL(siftsFileFTPURL);
+ URLConnection conn = url.openConnection();
+ InputStream inputStream = conn.getInputStream();
+ FileOutputStream outputStream = new FileOutputStream(
+ downloadedSiftsFile);
+ byte[] buffer = new byte[BUFFER_SIZE];
+ int bytesRead = -1;
+ while ((bytesRead = inputStream.read(buffer)) != -1)
+ {
+ outputStream.write(buffer, 0, bytesRead);
+ }
+ outputStream.close();
+ inputStream.close();
+ // System.out.println(">>> File downloaded : " + downloadedSiftsFile);
return new File(downloadedSiftsFile);
}
}
}
}
+
/**
*
* @param chainId
}
}
-
-
@Override
public Entity getEntityById(String id) throws SiftsException
{