Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ so it should be done here (manualy).
logger.info("taxonomy name '{}'", taxonName);
Assert.assertNotNull(taxonName);

if (seq.getFeaturesByType("CDS").size() > 0) {
if (!seq.getFeaturesByType("CDS").isEmpty()) {
FeatureInterface<AbstractSequence<AminoAcidCompound>, AminoAcidCompound> CDS = seq.getFeaturesByType("CDS").get(0);
logger.info("CDS: {}", CDS);
String codedBy = CDS.getQualifiers().get("coded_by").get(0).getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

/**
*
* @author Scooter Willis
* @author Scooter Willis
*/
public class GeneFeatureHelper {

Expand Down Expand Up @@ -418,7 +418,7 @@ static public void addGmodGFF3GeneFeatures(Map<String, ChromosomeSequence> chrom
String startCodonName = "";
String stopCodonName = "";
FeatureList startCodonList = mRNAChildren.selectByType("five_prime_UTR");
if (startCodonList != null && startCodonList.size() > 0) {
if (startCodonList != null && !startCodonList.isEmpty()) {
startCodon = startCodonList.get(0);
if (strand == Strand.NEGATIVE) {
startCodonBegin = startCodon.location().bioEnd();
Expand All @@ -430,7 +430,7 @@ static public void addGmodGFF3GeneFeatures(Map<String, ChromosomeSequence> chrom

FeatureList stopCodonList = mRNAChildren.selectByType("three_prime_UTR");

if (stopCodonList != null && stopCodonList.size() > 0) {
if (stopCodonList != null && !stopCodonList.isEmpty()) {
stopCodon = stopCodonList.get(0);
if (strand == Strand.NEGATIVE) {
stopCodonEnd = stopCodon.location().bioStart();
Expand Down Expand Up @@ -577,7 +577,7 @@ static public void addGlimmerGFF3GeneFeatures(Map<String, ChromosomeSequence> ch
String startCodonName = "";
String stopCodonName = "";
FeatureList startCodonList = gene.selectByAttribute("Note", "initial-exon");
if (startCodonList != null && startCodonList.size() > 0) {
if (startCodonList != null && !startCodonList.isEmpty()) {
startCodon = startCodonList.get(0);
if (strand == Strand.NEGATIVE) {
startCodonBegin = startCodon.location().bioEnd();
Expand All @@ -589,7 +589,7 @@ static public void addGlimmerGFF3GeneFeatures(Map<String, ChromosomeSequence> ch

FeatureList stopCodonList = gene.selectByAttribute("Note", "final-exon");

if (stopCodonList != null && stopCodonList.size() > 0) {
if (stopCodonList != null && !stopCodonList.isEmpty()) {
stopCodon = stopCodonList.get(0);
if (strand == Strand.NEGATIVE) {
stopCodonEnd = stopCodon.location().bioStart();
Expand Down Expand Up @@ -723,7 +723,7 @@ static public void addGeneMarkGTFGeneFeatures(Map<String, ChromosomeSequence> ch
String startCodonName = "";
String stopCodonName = "";
FeatureList startCodonList = transcriptFeature.selectByType("start_codon");
if (startCodonList != null && startCodonList.size() > 0) {
if (startCodonList != null && !startCodonList.isEmpty()) {
startCodon = startCodonList.get(0);
if (strand == Strand.POSITIVE) {
startCodonBegin = startCodon.location().bioStart();
Expand All @@ -735,7 +735,7 @@ static public void addGeneMarkGTFGeneFeatures(Map<String, ChromosomeSequence> ch

FeatureList stopCodonList = transcriptFeature.selectByType("stop_codon");

if (stopCodonList != null && stopCodonList.size() > 0) {
if (stopCodonList != null && !stopCodonList.isEmpty()) {
stopCodon = stopCodonList.get(0);
if (strand == Strand.POSITIVE) {
stopCodonEnd = stopCodon.location().bioEnd();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

/**
*
* @author Scooter Willis
* @author Scooter Willis
* @author Mark Chapman
*/
public class GFF3FromUniprotBlastHits {
Expand Down Expand Up @@ -163,7 +163,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
String notes = "";
if (featureKeyWords != null) {
List<String> keyWords = featureKeyWords.getKeyWords();
if (keyWords.size() > 0) {
if (!keyWords.isEmpty()) {
notes = ";Note=";
for (String note : keyWords) {
if ("Complete proteome".equals(note)) {
Expand All @@ -187,7 +187,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
List<DBReferenceInfo> cazyList = databaseReferenceHashMap.get("CAZy");
List<DBReferenceInfo> goList = databaseReferenceHashMap.get("GO");
List<DBReferenceInfo> eccList = databaseReferenceHashMap.get("BRENDA");
if (pfamList != null && pfamList.size() > 0) {
if (pfamList != null && !pfamList.isEmpty()) {
if (notes.length() == 0) {
notes = ";Note=";
}
Expand All @@ -197,7 +197,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
}
}

if (cazyList != null && cazyList.size() > 0) {
if (cazyList != null && !cazyList.isEmpty()) {
if (notes.length() == 0) {
notes = ";Note=";
}
Expand All @@ -208,7 +208,7 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
}
}

if (eccList != null && eccList.size() > 0) {
if (eccList != null && !eccList.isEmpty()) {
if (notes.length() == 0) {
notes = ";Note=";
}
Expand All @@ -221,8 +221,8 @@ PairwiseSequenceAlignerType.LOCAL, new SimpleGapPenalty(),
}
}

if (goList != null && goList.size() > 0) {
if (notes.length() == 0) {
if (goList != null && !goList.isEmpty()) {
if (notes.isEmpty()) {
notes = ";Note=";
}
for (DBReferenceInfo note : goList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

/**
*
* @author Scooter Willis
* @author Scooter Willis
*/
public class GFF3Writer {

Expand Down Expand Up @@ -122,7 +122,7 @@ public void write(OutputStream outputStream, Map<String, ChromosomeSequence> chr
private String getGFF3Note(List<String> notesList) {
String notes = "";

if (notesList.size() > 0) {
if (!notesList.isEmpty()) {
notes = ";Note=";
int noteindex = 1;
for (String note : notesList) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void test11GS() throws IOException, StructureException{

s = StructureIO.getStructure(pdbID);
assertNotNull(s);
assertTrue(s.getChains().size() > 0);
assertFalse(s.getChains().isEmpty());
Chain c = s.getChainByIndex(0);

assertTrue(c.getSeqResGroups().size() > 2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static String toXML(ModifiedCompound mc) throws IOException{


Set<StructureAtomLinkage > linkages = mc.getAtomLinkages();
if ( linkages.size() > 0 ) {
if (!linkages.isEmpty()) {
int pos = -1;
for ( StructureAtomLinkage link: linkages){
pos ++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public void identify(final List<Chain> chains,

if (residues.isEmpty()) {
String pdbId = "?";
if ( chains.size() > 0) {
if (!chains.isEmpty()) {
Structure struc = chains.get(0).getStructure();
if ( struc != null)
pdbId = struc.getPDBCode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
import java.net.URL;
import java.util.List;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;


Expand Down Expand Up @@ -100,11 +101,11 @@ public void testAcetylation() throws IOException {

List<Site> sites = Site.parseSites(localFile);

assertTrue(sites.size() > 0);
assertFalse(sites.isEmpty());

for (Site s : sites) {

assertTrue(s.getResidue() != null);
assertNotNull(s.getResidue());

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ public WeakValueHashMap() {
private void diddleReferenceQueue() {
// Avoid making behind-the-scenes modifications while iterators exist.

if (iteratorRefs.size() > 0) {
if (!iteratorRefs.isEmpty()) {
Reference ref;
while ((ref = iteratorRefQueue.poll()) != null) {
iteratorRefs.remove(ref);
}
if (iteratorRefs.size() > 0) {
if (!iteratorRefs.isEmpty()) {
return;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public void keyReleased(KeyEvent e) {
list.ensureIndexIsVisible(list.getSelectedIndex() - 1);
return;
} else if (e.getKeyCode() == KeyEvent.VK_ENTER
&& list.getSelectedIndex() != -1 && suggestions.size() > 0) {
&& list.getSelectedIndex() != -1 && !suggestions.isEmpty()) {
setText((String) list.getSelectedValue());


Expand Down Expand Up @@ -365,7 +365,7 @@ public String doInBackground() {

setFont(regular);

if (suggestions.size() > 0) {
if (!suggestions.isEmpty()) {
list.setListData(suggestions);
list.setSelectedIndex(0);
list.ensureIndexIsVisible(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private List<ScopDomain> getPossibleScopDomains(String userInput) {
if ( stop.get())
return domains;

if ( domains == null || domains.size() < 1){
if ( domains == null || domains.isEmpty()){

if ( userInput.length() > 5){
// e.g. d4hhba
Expand All @@ -127,11 +127,11 @@ private List<ScopDomain> getPossibleScopDomains(String userInput) {
if (DEBUG)
System.out.println("domains: " + domains);

if ( domains == null || domains.size() < 1) {
if ( domains == null || domains.isEmpty()) {
if ( userInput.length() > 0 ){
List<ScopDescription> descs = scop.filterByClassificationId(userInput);

if ( descs == null || descs.size() < 1){
if ( descs == null || descs.isEmpty()){
descs = scop.filterByDescription(userInput);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void actionPerformed(ActionEvent event) {
// check last command in history
// if equivalent, don't add,
// otherwise add
if (history.size()>0){
if (!history.isEmpty()){
String txt=history.get(history.size()-1);
if (! txt.equals(cmd)) {
history.add(cmd);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public String toPDB() {

@Override
public void toPDB(StringBuffer buf) {
if (groups == null || groups.size() < 1) {
if (groups == null || groups.isEmpty()) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public static String toTransformMatrices(MultipleAlignment alignment) {

List<Matrix4d> btransforms = alignment.getBlockSet(bs)
.getTransformations();
if (btransforms == null || btransforms.size() < 1)
if (btransforms == null || btransforms.isEmpty())
continue;

if (alignment.getBlockSets().size() > 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1313,7 +1313,7 @@ public static Group[] prepareGroupsForDisplay(AFPChain afpChain, Atom[] ca1, Ato
if ( afpChain.getBlockNum() > 0){

// Superimpose ligands relative to the first block
if( hetatms2.size() > 0 ) {
if(!hetatms2.isEmpty()) {

if ( afpChain.getBlockRotationMatrix().length > 0 ) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ else if ("ScoresCache".equals(child.getNodeName())){
}
}
//Because if it is 0 means that there were no transformations
if (transforms.size() != 0){
if (!transforms.isEmpty()){
bs.setTransformations(transforms);
}
return bs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void setPair(Pair<Group> pair) {
}

public double getMinDistance() {
if (atomContacts.size()==0) return 0;
if (atomContacts.isEmpty()) return 0;

double minDistance = Double.MAX_VALUE;
for (AtomContact atomContact:atomContacts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ public List<StructureInterfaceCluster> getClusters(double contactOverlapScoreClu
clusters = new ArrayList<>();

// nothing to do if we have no interfaces
if (list.size()==0) return clusters;
if (list.isEmpty()) return clusters;

logger.debug("Calculating all-vs-all Jaccard scores for {} interfaces", list.size());
double[][] matrix = new double[list.size()][list.size()];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private void trimBondLists() {
for (Chain chain : structure.getChains(modelInd)) {
for (Group group : chain.getAtomGroups()) {
for (Atom atom : group.getAtoms()) {
if (atom.getBonds()!=null && atom.getBonds().size() > 0) {
if (atom.getBonds()!=null && !atom.getBonds().isEmpty()) {
((ArrayList<Bond>) atom.getBonds()).trimToSize();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ private Group getCorrectAltLocGroup( Character altLoc,

// see if we know this altLoc already;
List<Atom> atoms = currentGroup.getAtoms();
if ( atoms.size() > 0) {
if (!atoms.isEmpty()) {
Atom a1 = atoms.get(0);
// we are just adding atoms to the current group
// probably there is a second group following later...
Expand All @@ -1956,7 +1956,7 @@ private Group getCorrectAltLocGroup( Character altLoc,
List<Group> altLocs = currentGroup.getAltLocs();
for ( Group altLocG : altLocs ){
atoms = altLocG.getAtoms();
if ( atoms.size() > 0) {
if (!atoms.isEmpty()) {
for ( Atom a1 : atoms) {
if (a1.getAltLoc().equals( altLoc)) {

Expand Down Expand Up @@ -2921,7 +2921,7 @@ private void triggerEndFileChecks(){
pdbHeader.setBioAssemblies(bioAssemblyParser.getTransformationMap());
}

if (ncsOperators !=null && ncsOperators.size()>0) {
if (ncsOperators !=null && !ncsOperators.isEmpty()) {
crystallographicInfo.setNcsOperators(
ncsOperators.toArray(new Matrix4d[ncsOperators.size()]));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void mapSeqresRecords(Chain atomRes, Chain seqRes) {
}
}

if ( atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) {
if (atomRes.getAtomGroups(GroupType.AMINOACID).isEmpty()) {
logger.debug("ATOM chain {} does not contain amino acids, ignoring...", atomRes.getId());
return;
}
Expand All @@ -215,7 +215,7 @@ public void mapSeqresRecords(Chain atomRes, Chain seqRes) {

private void alignNucleotideChains(Chain seqRes, Chain atomRes) {

if ( atomRes.getAtomGroups(GroupType.NUCLEOTIDE).size() < 1) {
if (atomRes.getAtomGroups(GroupType.NUCLEOTIDE).isEmpty()) {
logger.debug("ATOM chain {} does not contain nucleotides, ignoring...", atomRes.getId());

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ public void consumeAtomSite(AtomSite atomSite) {
private Group getAltLocGroup(String recordName, Character altLoc, Character oneLetterCode, String threeLetterCode,
long seqId) {
List<Atom> atoms = currentGroup.getAtoms();
if (atoms.size() > 0) {
if (!atoms.isEmpty()) {
if (atoms.get(0).getAltLoc().equals(altLoc)) {
return currentGroup;
}
Expand All @@ -381,7 +381,7 @@ private Group getAltLocGroup(String recordName, Character altLoc, Character oneL
List<Group> altLocs = currentGroup.getAltLocs();
for (Group altLocGroup : altLocs) {
atoms = altLocGroup.getAtoms();
if (atoms.size() > 0) {
if (!atoms.isEmpty()) {
for (Atom a1 : atoms) {
if (a1.getAltLoc().equals(altLoc)) {
return altLocGroup;
Expand Down Expand Up @@ -1478,7 +1478,7 @@ private void setStructNcsOps() {
}
}

if (ncsOperators.size() > 0) {
if (!ncsOperators.isEmpty()) {
structure.getCrystallographicInfo()
.setNcsOperators(ncsOperators.toArray(new Matrix4d[0]));
}
Expand Down
Loading