From: gmungoc Date: Fri, 10 Jul 2015 05:12:10 +0000 (+0100) Subject: JAL-1807 explicit imports (jalview.analysis) X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=7d6575e94bed92bc06043d432576e3a39e8a8e75;p=jalview.git JAL-1807 explicit imports (jalview.analysis) --- diff --git a/src/jalview/analysis/AlignSeq.java b/src/jalview/analysis/AlignSeq.java index f76e801..ed44d4a 100755 --- a/src/jalview/analysis/AlignSeq.java +++ b/src/jalview/analysis/AlignSeq.java @@ -20,13 +20,6 @@ */ package jalview.analysis; -import java.awt.Color; -import java.awt.Graphics; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.StringTokenizer; - import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Mapping; @@ -39,6 +32,13 @@ import jalview.util.Format; import jalview.util.MapList; import jalview.util.MessageManager; +import java.awt.Color; +import java.awt.Graphics; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.StringTokenizer; + /** * * @@ -365,8 +365,8 @@ public class AlignSeq */ private void SeqInit(String string1, String string2) { - s1str = extractGaps(jalview.util.Comparison.GapChars, string1); - s2str = extractGaps(jalview.util.Comparison.GapChars, string2); + s1str = extractGaps(Comparison.GapChars, string1); + s2str = extractGaps(Comparison.GapChars, string2); if (s1str.length() == 0 || s2str.length() == 0) { @@ -621,7 +621,7 @@ public class AlignSeq if ((i + (j * len)) < astr1.length()) { if (astr1.charAt(i + (j * len)) == astr2.charAt(i + (j * len)) - && !jalview.util.Comparison.isGap(astr1.charAt(i + && !Comparison.isGap(astr1.charAt(i + (j * len)))) { pid++; @@ -1010,7 +1010,7 @@ public class AlignSeq * * @return mapping from positions in S1 to corresponding positions in S2 */ - public jalview.datamodel.Mapping getMappingFromS1(boolean allowmismatch) + public Mapping getMappingFromS1(boolean allowmismatch) { ArrayList as1 = new ArrayList(), as2 = new ArrayList(); int pdbpos = s2.getStart() + getSeq2Start() - 2; @@ -1077,7 +1077,7 @@ public class AlignSeq } MapList map = new MapList(mapseq1, mapseq2, 1, 1); - jalview.datamodel.Mapping mapping = new Mapping(map); + Mapping mapping = new Mapping(map); mapping.setTo(s2); return mapping; } diff --git a/src/jalview/analysis/AlignmentSorter.java b/src/jalview/analysis/AlignmentSorter.java index 4f7f2e2..e960e63 100755 --- a/src/jalview/analysis/AlignmentSorter.java +++ b/src/jalview/analysis/AlignmentSorter.java @@ -607,7 +607,7 @@ public class AlignmentSorter .floatValue(); } - jalview.util.QuickSort.sortFloat(ids, alignment); + QuickSort.sortFloat(ids, alignment); } /** @@ -674,7 +674,7 @@ public class AlignmentSorter } } - jalview.util.QuickSort.sortDouble(scores, seqs); + QuickSort.sortDouble(scores, seqs); if (lastSortByScore != scoreLabel) { lastSortByScore = scoreLabel; @@ -854,7 +854,7 @@ public class AlignmentSorter labs[l] = (fs[l].getDescription() != null ? fs[l] .getDescription() : fs[l].getType()); } - jalview.util.QuickSort.sort(labs, ((Object[]) feats[i])); + QuickSort.sort(labs, ((Object[]) feats[i])); } } if (hasScore[i]) @@ -905,7 +905,7 @@ public class AlignmentSorter } } - jalview.util.QuickSort.sortDouble(scores, seqs); + QuickSort.sortDouble(scores, seqs); } else if (method == FEATURE_DENSITY) { @@ -922,7 +922,7 @@ public class AlignmentSorter // System.err.println("Sorting on Density: seq "+seqs[i].getName()+ // " Feats: "+nf+" Score : "+scores[i]); } - jalview.util.QuickSort.sortDouble(scores, seqs); + QuickSort.sortDouble(scores, seqs); } else { diff --git a/src/jalview/analysis/AlignmentUtils.java b/src/jalview/analysis/AlignmentUtils.java index e6d3e83..a331fd0 100644 --- a/src/jalview/analysis/AlignmentUtils.java +++ b/src/jalview/analysis/AlignmentUtils.java @@ -20,20 +20,6 @@ */ package jalview.analysis; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeMap; - import jalview.datamodel.AlignedCodon; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; @@ -52,6 +38,20 @@ import jalview.util.DBRefUtils; import jalview.util.MapList; import jalview.util.MappingUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; + /** * grab bag of useful alignment manipulation operations Expect these to be * refactored elsewhere at some point. @@ -149,8 +149,7 @@ public class AlignmentUtils s.setStart(s.getStart() - ustream_ds); s.setEnd(s_end + downstream.length); } - AlignmentI newAl = new jalview.datamodel.Alignment( - sq.toArray(new SequenceI[0])); + AlignmentI newAl = new Alignment(sq.toArray(new SequenceI[0])); for (SequenceI s : sq) { if (s.getAnnotation() != null) @@ -195,7 +194,7 @@ public class AlignmentUtils * name. For use in mapping between different alignment views of the same * sequences. * - * @see jalview.datamodel.AlignmentI#getSequencesByName() + * @see AlignmentI#getSequencesByName() */ public static Map> getSequencesByName( AlignmentI al) diff --git a/src/jalview/analysis/Conservation.java b/src/jalview/analysis/Conservation.java index 1aa29e0..2155b31 100755 --- a/src/jalview/analysis/Conservation.java +++ b/src/jalview/analysis/Conservation.java @@ -20,10 +20,18 @@ */ package jalview.analysis; -import java.awt.Color; -import java.util.*; +import jalview.datamodel.AlignmentAnnotation; +import jalview.datamodel.Annotation; +import jalview.datamodel.Sequence; +import jalview.datamodel.SequenceI; +import jalview.schemes.ResidueProperties; +import jalview.util.Comparison; -import jalview.datamodel.*; +import java.awt.Color; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; /** * Calculates conservation values for a given set of sequences @@ -108,7 +116,7 @@ public class Conservation { for (s = 0; s < sSize; s++) { - sarray[s] = (SequenceI) sequences.get(s); + sarray[s] = sequences.get(s); if (sarray[s].getLength() > maxLength) { maxLength = sarray[s].getLength(); @@ -163,7 +171,7 @@ public class Conservation for (j = 1; j <= len; j++) { - sqnum[j] = jalview.schemes.ResidueProperties.aaIndex[sq + sqnum[j] = ResidueProperties.aaIndex[sq .charAt(j - 1)]; } @@ -208,7 +216,7 @@ public class Conservation if (canonicaliseAa) { // lookup the base aa code symbol - c = (char) jalview.schemes.ResidueProperties.aaIndex[sequences[j] + c = (char) ResidueProperties.aaIndex[sequences[j] .getCharAt(i)]; if (c > 20) { @@ -217,7 +225,7 @@ public class Conservation else { // recover canonical aa symbol - c = jalview.schemes.ResidueProperties.aa[c].charAt(0); + c = ResidueProperties.aa[c].charAt(0); } } else @@ -274,7 +282,7 @@ public class Conservation resultHash.put(type, ht.get("-")); } } - else if (((Integer) resultHash.get(type)).equals((Integer) ht + else if (((Integer) resultHash.get(type)).equals(ht .get(res)) == false) { resultHash.put(type, new Integer(-1)); @@ -315,7 +323,7 @@ public class Conservation c = sequences[i].getCharAt(j); // gaps do not have upper/lower case - if (jalview.util.Comparison.isGap((c))) + if (Comparison.isGap((c))) { count++; } @@ -373,7 +381,7 @@ public class Conservation { gapcons = countConsNGaps(i); totGaps = gapcons[1]; - pgaps = ((float) totGaps * 100) / (float) sequences.length; + pgaps = ((float) totGaps * 100) / sequences.length; consSymbs[i-start]=new String(); if (percentageGaps > pgaps) @@ -519,7 +527,7 @@ public class Conservation quality = new Vector(); double max = -10000; - int[][] BLOSUM62 = jalview.schemes.ResidueProperties.getBLOSUM62(); + int[][] BLOSUM62 = ResidueProperties.getBLOSUM62(); // Loop over columns // JBPNote Profiling info // long ts = System.currentTimeMillis(); @@ -679,7 +687,7 @@ public class Conservation if (Character.isDigit(c)) { - value = (int) (c - '0'); + value = c - '0'; } else if (c == '*') { diff --git a/src/jalview/analysis/CrossRef.java b/src/jalview/analysis/CrossRef.java index 7238239..a3cd23d 100644 --- a/src/jalview/analysis/CrossRef.java +++ b/src/jalview/analysis/CrossRef.java @@ -20,21 +20,23 @@ */ package jalview.analysis; -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; - import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; +import jalview.datamodel.Mapping; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; +import jalview.util.Comparison; import jalview.util.DBRefUtils; import jalview.ws.SequenceFetcher; import jalview.ws.seqfetcher.ASequenceFetcher; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; + /** * Functions for cross-referencing sequence databases. user must first specify * if cross-referencing from protein or dna (set dna==true) @@ -329,7 +331,7 @@ public class CrossRef for (int rs = 0; rs < retrieved.length; rs++) { // TODO: examine each sequence for 'redundancy' - jalview.datamodel.DBRefEntry[] dbr = retrieved[rs] + DBRefEntry[] dbr = retrieved[rs] .getDBRef(); if (dbr != null && dbr.length > 0) { @@ -337,7 +339,7 @@ public class CrossRef { // find any entry where we should put in the sequence being // cross-referenced into the map - jalview.datamodel.Mapping map = dbr[di].getMap(); + Mapping map = dbr[di].getMap(); if (map != null) { if (map.getTo() != null && map.getMap() != null) @@ -492,7 +494,7 @@ public class CrossRef // check if this is the correct sequence type { typer[0] = nxt; - boolean isDna = jalview.util.Comparison.isNucleotide(typer); + boolean isDna = Comparison.isNucleotide(typer); if ((direct && isDna == dna) || (!direct && isDna != dna)) { // skip this sequence because it is same molecule type @@ -504,12 +506,12 @@ public class CrossRef DBRefEntry[] poss = nxt.getDBRef(), cands = null; if (direct) { - cands = jalview.util.DBRefUtils.searchRefs(poss, xrf); + cands = DBRefUtils.searchRefs(poss, xrf); } else { poss = CrossRef.findXDbRefs(dna, poss); // - cands = jalview.util.DBRefUtils.searchRefs(poss, xrf); + cands = DBRefUtils.searchRefs(poss, xrf); } if (cands != null) { diff --git a/src/jalview/analysis/Dna.java b/src/jalview/analysis/Dna.java index 1d5f996..f13a5bf 100644 --- a/src/jalview/analysis/Dna.java +++ b/src/jalview/analysis/Dna.java @@ -20,12 +20,6 @@ */ package jalview.analysis; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.Map; - import jalview.api.AlignViewportI; import jalview.datamodel.AlignedCodon; import jalview.datamodel.AlignedCodonFrame; @@ -47,6 +41,12 @@ import jalview.util.DBRefUtils; import jalview.util.MapList; import jalview.util.ShiftList; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.Map; + public class Dna { private static final String STOP_X = "X"; @@ -208,9 +208,8 @@ public class Dna for (int gd = 0; gd < selection.length; gd++) { SequenceI dna = selection[gd]; - DBRefEntry[] dnarefs = DBRefUtils - .selectRefs(dna.getDBRef(), - jalview.datamodel.DBRefSource.DNACODINGDBS); + DBRefEntry[] dnarefs = DBRefUtils.selectRefs(dna.getDBRef(), + DBRefSource.DNACODINGDBS); if (dnarefs != null) { // intersect with pep diff --git a/src/jalview/analysis/Finder.java b/src/jalview/analysis/Finder.java index 875322b..3c72598 100644 --- a/src/jalview/analysis/Finder.java +++ b/src/jalview/analysis/Finder.java @@ -24,9 +24,12 @@ import jalview.datamodel.AlignmentI; import jalview.datamodel.SearchResults; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceGroup; +import jalview.util.Comparison; import java.util.Vector; +import com.stevesoft.pat.Regex; + public class Finder { /** @@ -36,7 +39,7 @@ public class Finder AlignmentI alignment; - jalview.datamodel.SequenceGroup selection = null; + SequenceGroup selection = null; Vector idMatch = null; @@ -46,7 +49,7 @@ public class Finder boolean findAll = false; - com.stevesoft.pat.Regex regex = null; + Regex regex = null; /** * hold's last-searched position between calles to find(false) @@ -83,7 +86,7 @@ public class Finder { searchString = searchString.toUpperCase(); } - regex = new com.stevesoft.pat.Regex(searchString); + regex = new Regex(searchString); regex.setIgnoreCase(!caseSensitive); searchResults = new SearchResults(); idMatch = new Vector(); @@ -180,7 +183,7 @@ public class Finder for (int j = 0; j < item.length(); j++) { - if (!jalview.util.Comparison.isGap(item.charAt(j))) + if (!Comparison.isGap(item.charAt(j))) { noGapsSB.append(item.charAt(j)); spaces.addElement(new Integer(insertCount)); @@ -305,7 +308,7 @@ public class Finder /** * @return the selection */ - public jalview.datamodel.SequenceGroup getSelection() + public SequenceGroup getSelection() { return selection; } @@ -314,7 +317,7 @@ public class Finder * @param selection * the selection to set */ - public void setSelection(jalview.datamodel.SequenceGroup selection) + public void setSelection(SequenceGroup selection) { this.selection = selection; } @@ -330,7 +333,7 @@ public class Finder /** * @return the regex */ - public com.stevesoft.pat.Regex getRegex() + public Regex getRegex() { return regex; } diff --git a/src/jalview/analysis/NJTree.java b/src/jalview/analysis/NJTree.java index 3470dbc..3674be1 100644 --- a/src/jalview/analysis/NJTree.java +++ b/src/jalview/analysis/NJTree.java @@ -31,6 +31,7 @@ import jalview.datamodel.SequenceI; import jalview.datamodel.SequenceNode; import jalview.io.NewickFile; import jalview.schemes.ResidueProperties; +import jalview.util.Format; import java.util.Enumeration; import java.util.List; @@ -116,7 +117,7 @@ public class NJTree } /* * sequenceString = new String[odata.length]; char gapChar = - * jalview.util.Comparison.GapChars.charAt(0); for (int i = 0; i < + * Comparison.GapChars.charAt(0); for (int i = 0; i < * odata.length; i++) { SequenceI oseq_aligned = odata[i].getSeq(gapChar); * sequenceString[i] = oseq_aligned.getSequence(); } */ @@ -179,8 +180,8 @@ public class NJTree if (one2many.contains(nam)) { countOne2Many++; - // if (jalview.bin.Cache.log.isDebugEnabled()) - // jalview.bin.Cache.log.debug("One 2 many relationship for + // if (Cache.log.isDebugEnabled()) + // Cache.log.debug("One 2 many relationship for // "+nam.getName()); } else @@ -195,8 +196,8 @@ public class NJTree j.setPlaceholder(true); } } - // if (jalview.bin.Cache.log.isDebugEnabled() && countOne2Many>0) { - // jalview.bin.Cache.log.debug("There were "+countOne2Many+" alignment + // if (Cache.log.isDebugEnabled() && countOne2Many>0) { + // Cache.log.debug("There were "+countOne2Many+" alignment // sequence ids (out of "+one2many.size()+" unique ids) linked to two or // more leaves."); // } @@ -284,7 +285,7 @@ public class NJTree */ public String toString() { - jalview.io.NewickFile fout = new jalview.io.NewickFile(getTopNode()); + NewickFile fout = new NewickFile(getTopNode()); return fout.print(isHasBootstrap(), isHasDistances(), isHasRootDistance()); // output all data available for tree @@ -1068,8 +1069,7 @@ public class NJTree String[] seqdatas = seqData.getSequenceStrings(gapChar); for (int i = 0; i < seqdatas.length; i++) { - sb.append(new jalview.util.Format("%-" + 15 + "s").form(sequence[i] - .getName())); + sb.append(new Format("%-" + 15 + "s").form(sequence[i].getName())); sb.append(" " + seqdatas[i] + "\n"); } return sb.toString(); diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index 2ede9ed..1a552d7 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -20,14 +20,15 @@ */ package jalview.analysis; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - import jalview.datamodel.PDBEntry; import jalview.datamodel.Sequence; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; +import jalview.util.Comparison; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; public class SeqsetUtils { @@ -51,7 +52,7 @@ public class SeqsetUtils sqinfo.put("Description", seq.getDescription()); } Vector sfeat = new Vector(); - jalview.datamodel.SequenceFeature[] sfarray = seq.getSequenceFeatures(); + SequenceFeature[] sfarray = seq.getSequenceFeatures(); if (sfarray != null && sfarray.length > 0) { for (int i = 0; i < sfarray.length; i++) @@ -216,8 +217,7 @@ public class SeqsetUtils public static boolean deuniquify(Hashtable map, SequenceI[] sequences, boolean quiet) { - jalview.analysis.SequenceIdMatcher matcher = new SequenceIdMatcher( - sequences); + SequenceIdMatcher matcher = new SequenceIdMatcher(sequences); SequenceI msq = null; Enumeration keys = map.keys(); Vector unmatched = new Vector(); @@ -275,8 +275,7 @@ public class SeqsetUtils int msflen = 0; for (int i = 0, j = sequences.length; i < j; i++) { - String tempseq = jalview.analysis.AlignSeq.extractGaps( - jalview.util.Comparison.GapChars, + String tempseq = AlignSeq.extractGaps(Comparison.GapChars, sequences[i].getSequenceAsString()); if (tempseq.length() == 0) diff --git a/src/jalview/analysis/SequenceIdMatcher.java b/src/jalview/analysis/SequenceIdMatcher.java index 5b812dd..270ddd1 100755 --- a/src/jalview/analysis/SequenceIdMatcher.java +++ b/src/jalview/analysis/SequenceIdMatcher.java @@ -243,7 +243,7 @@ public class SequenceIdMatcher * @return SequenceI */ private SequenceI findIdMatch( - jalview.analysis.SequenceIdMatcher.SeqIdName nam) +SequenceIdMatcher.SeqIdName nam) { Vector matches = new Vector(); while (names.containsKey(nam)) @@ -260,8 +260,7 @@ public class SequenceIdMatcher * SeqIdName * @return SequenceI[] */ - private List findAllIdMatches( - jalview.analysis.SequenceIdMatcher.SeqIdName nam) + private List findAllIdMatches(SequenceIdMatcher.SeqIdName nam) { ArrayList matches = new ArrayList(); while (names.containsKey(nam)) diff --git a/src/jalview/analysis/StructureFrequency.java b/src/jalview/analysis/StructureFrequency.java index 7502724..d7d07bc 100644 --- a/src/jalview/analysis/StructureFrequency.java +++ b/src/jalview/analysis/StructureFrequency.java @@ -25,6 +25,7 @@ import jalview.datamodel.Annotation; import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.util.Format; +import jalview.util.QuickSort; import java.util.ArrayList; import java.util.Hashtable; @@ -433,7 +434,7 @@ public class StructureFrequency x++; } } - jalview.util.QuickSort.sortFloat(vl, ca); + QuickSort.sortFloat(vl, ca); int p = 0; /* @@ -499,7 +500,7 @@ public class StructureFrequency x++; } } - jalview.util.QuickSort.sortFloat(vl, ca); + QuickSort.sortFloat(vl, ca); int valuesCount = 0; rtnval[1] = 0; diff --git a/src/jalview/analysis/scoremodels/FeatureScoreModel.java b/src/jalview/analysis/scoremodels/FeatureScoreModel.java index e2a8b9a..f54d627 100644 --- a/src/jalview/analysis/scoremodels/FeatureScoreModel.java +++ b/src/jalview/analysis/scoremodels/FeatureScoreModel.java @@ -1,5 +1,7 @@ package jalview.analysis.scoremodels; +import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureRenderer; import jalview.api.analysis.ScoreModelI; import jalview.api.analysis.ViewBasedAnalysisI; import jalview.datamodel.AlignmentView; @@ -14,11 +16,10 @@ import java.util.List; public class FeatureScoreModel implements ScoreModelI, ViewBasedAnalysisI { - jalview.api.FeatureRenderer fr; + FeatureRenderer fr; @Override - public boolean configureFromAlignmentView( - jalview.api.AlignmentViewPanel view) + public boolean configureFromAlignmentView(AlignmentViewPanel view) { fr = view.cloneFeatureRenderer(); return true;