Skip to content

Commit b2e9704

Browse files
authored
Merge pull request biojava#43 from biojava/master
Catch back up with biojava/master
2 parents 7b931b4 + 87a7644 commit b2e9704

427 files changed

Lines changed: 36833 additions & 33221 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptideProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ public static final double getEnrichment(String sequence, SingleLetterAACode ami
460460
* @return the composition of specified amino acid in the sequence
461461
*/
462462
public static final double getEnrichment(String sequence, char aminoAcidCode){
463-
return getEnrichment(sequence, aminoAcidCode + "");
463+
return getEnrichment(sequence, aminoAcidCode);
464464
}
465465

466466
/**

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/PeptidePropertiesImpl.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public double getMolecularWeight(ProteinSequence sequence) {
7575
AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
7676
char[] seq = getSequence(sequence.toString(), true);//ignore case
7777
for(char aa:seq){
78-
AminoAcidCompound c = aaSet.getCompoundForString(aa + "");
78+
AminoAcidCompound c = aaSet.getCompoundForString(String.valueOf(aa));
7979
if(Constraints.aa2MolecularWeight.containsKey(c)){
8080
value += Constraints.aa2MolecularWeight.get(c);
8181
}
@@ -263,7 +263,7 @@ public double getAvgHydropathy(ProteinSequence sequence) {
263263
AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
264264
char[] seq = this.getSequence(sequence.toString(), true);
265265
for(char aa:seq){
266-
AminoAcidCompound c = aaSet.getCompoundForString(aa + "");
266+
AminoAcidCompound c = aaSet.getCompoundForString(String.valueOf(aa));
267267
if(Constraints.aa2Hydrophathicity.containsKey(c)){
268268
total += Constraints.aa2Hydrophathicity.get(c);
269269
validLength++;
@@ -322,7 +322,7 @@ private double getIsoelectricPointInnovagen(ProteinSequence sequence){
322322
//
323323
// Ct Nt Sm Sc Sn
324324
//
325-
private final double cPk[][] = {
325+
private final double[][] cPk = {
326326
{3.55, 7.59, 0.0}, // A
327327
{3.55, 7.50, 0.0}, // B
328328
{3.55, 7.50, 9.00}, // C
@@ -365,7 +365,7 @@ private double getIsoelectricPointExpasy(String sequence){
365365
//
366366
// Compute the amino-acid composition.
367367
//
368-
int comp[] = new int[26];
368+
int[] comp = new int[26];
369369
for(int i = 0; i < sequence.length(); i++){
370370
int index = sequence.charAt(i) - 'A';
371371
if(index < 0 || index >= 26) continue;
@@ -430,7 +430,7 @@ private double getNetChargeExpasy(String sequence, double pHPoint){
430430
//
431431
// Compute the amino-acid composition.
432432
//
433-
int comp[] = new int[26];
433+
int[] comp = new int[26];
434434
for(int i = 0; i < sequence.length(); i++){
435435
int index = sequence.charAt(i) - 'A';
436436
if(index < 0 || index >= 26) continue;
@@ -444,7 +444,7 @@ private double getNetChargeExpasy(String sequence, double pHPoint){
444444
return getNetChargeExpasy(comp, nTermResidue, cTermResidue, pHPoint);
445445
}
446446

447-
private double getNetChargeExpasy(int comp[], int nTermResidue, int cTermResidue, double ph){
447+
private double getNetChargeExpasy(int[] comp, int nTermResidue, int cTermResidue, double ph){
448448
double cter = 0.0;
449449
if(cTermResidue >= 0 && cTermResidue < 26) cter = exp10(-cPk[cTermResidue][0]) / (exp10(-cPk[cTermResidue][0]) + exp10(-ph));
450450
double nter = 0.0;
@@ -477,13 +477,13 @@ private double getNetChargeInnovagen(Map<AminoAcidCompound, Integer> chargedAA2C
477477
AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
478478

479479
double nTerminalCharge = 0.0;
480-
AminoAcidCompound nTermCompound = aaSet.getCompoundForString(nTerminalChar + "");
480+
AminoAcidCompound nTermCompound = aaSet.getCompoundForString(String.valueOf(nTerminalChar));
481481
if(Constraints.aa2NTerminalPka.containsKey(nTermCompound)){
482482
nTerminalCharge = this.getPosCharge(Constraints.aa2NTerminalPka.get(nTermCompound), ph);
483483
}
484484

485485
double cTerminalCharge = 0.0;
486-
AminoAcidCompound cTermCompound = aaSet.getCompoundForString(cTerminalChar + "");
486+
AminoAcidCompound cTermCompound = aaSet.getCompoundForString(String.valueOf(cTerminalChar));
487487
if(Constraints.aa2CTerminalPka.containsKey(cTermCompound)){
488488
cTerminalCharge = this.getNegCharge(Constraints.aa2CTerminalPka.get(cTermCompound), ph);
489489
}
@@ -548,7 +548,7 @@ public double getEnrichment(ProteinSequence sequence, AminoAcidCompound aminoAci
548548
double counter = 0.0;
549549
char[] seq = this.getSequence(sequence.getSequenceAsString(), true);
550550
for(char aa:seq){
551-
if(aminoAcidCode.getShortName().equals(aa + "")){
551+
if(aminoAcidCode.getShortName().equals(String.valueOf(aa))){
552552
counter++;
553553
}
554554
}
@@ -566,7 +566,7 @@ public Map<AminoAcidCompound, Double> getAAComposition(ProteinSequence sequence)
566566
char[] seq = this.getSequence(sequence.toString(), true);
567567
for(char aa:seq){
568568
if(PeptideProperties.standardAASet.contains(aa)){
569-
AminoAcidCompound compound = aaSet.getCompoundForString(aa + "");
569+
AminoAcidCompound compound = aaSet.getCompoundForString(String.valueOf(aa));
570570
aa2Composition.put(compound, aa2Composition.get(compound) + 1.0);
571571
validLength++;
572572
}

biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/Convertor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public String convert(ProteinSequence sequence){
8181
String convertedSequence = "";
8282
String uppercaseSequence = sequence.getSequenceAsString().toUpperCase();
8383
for(int x = 0; x < uppercaseSequence.length(); x++){
84-
convertedSequence += convert(uppercaseSequence.charAt(x));
84+
convertedSequence += String.valueOf(convert(uppercaseSequence.charAt(x)));
8585
}
8686
return convertedSequence;
8787
}

biojava-alignment/pom.xml

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@
2626

2727
<!-- Excluding demo package is required for avoiding namespace clashes
2828
(demo package is in all modules) for signing the jar. See issue #387 -->
29-
<plugin>
30-
<groupId>org.apache.maven.plugins</groupId>
31-
<artifactId>maven-jar-plugin</artifactId>
32-
<configuration>
33-
<excludes>
34-
<exclude>demo/**</exclude>
35-
</excludes>
36-
</configuration>
37-
</plugin>
38-
29+
<plugin>
30+
<groupId>org.apache.maven.plugins</groupId>
31+
<artifactId>maven-jar-plugin</artifactId>
32+
<configuration>
33+
<excludes>
34+
<exclude>demo/**</exclude>
35+
</excludes>
36+
</configuration>
37+
</plugin>
38+
3939
</plugins>
4040
</build>
4141
<dependencies>
@@ -57,26 +57,26 @@
5757
<!-- logging dependencies (managed by parent pom, don't set versions or
5858
scopes here) -->
5959
<dependency>
60-
<groupId>org.slf4j</groupId>
61-
<artifactId>slf4j-api</artifactId>
62-
</dependency>
63-
<!-- binding for log4j2, scope=runTime set in parent pom -->
64-
<dependency>
65-
<groupId>org.apache.logging.log4j</groupId>
66-
<artifactId>log4j-slf4j-impl</artifactId>
67-
</dependency>
68-
<dependency>
69-
<groupId>org.apache.logging.log4j</groupId>
70-
<artifactId>log4j-api</artifactId>
71-
</dependency>
72-
<dependency>
73-
<groupId>org.apache.logging.log4j</groupId>
74-
<artifactId>log4j-core</artifactId>
75-
</dependency>
76-
<dependency>
77-
<groupId>org.biojava</groupId>
78-
<artifactId>biojava-phylo</artifactId>
60+
<groupId>org.slf4j</groupId>
61+
<artifactId>slf4j-api</artifactId>
62+
</dependency>
63+
<!-- binding for log4j2, scope=runTime set in parent pom -->
64+
<dependency>
65+
<groupId>org.apache.logging.log4j</groupId>
66+
<artifactId>log4j-slf4j-impl</artifactId>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.apache.logging.log4j</groupId>
70+
<artifactId>log4j-api</artifactId>
71+
</dependency>
72+
<dependency>
73+
<groupId>org.apache.logging.log4j</groupId>
74+
<artifactId>log4j-core</artifactId>
75+
</dependency>
76+
<dependency>
77+
<groupId>org.biojava</groupId>
78+
<artifactId>biojava-phylo</artifactId>
7979
<version>5.0.0-SNAPSHOT</version>
80-
</dependency>
80+
</dependency>
8181
</dependencies>
8282
</project>

biojava-alignment/src/main/java/org/biojava/nbio/alignment/GuideTree.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,11 @@ public boolean hasNext() {
318318

319319
@Override
320320
public GuideTreeNode<S, C> next() {
321-
while (hasNext()) {
321+
if(!hasNext()){
322+
throw new NoSuchElementException();
323+
}
324+
325+
while (hasNext()) {
322326
Node next = nodes.peek(), child1 = (Node) next.getChild1(), child2 = (Node) next.getChild2();
323327
if (child1 != null && !child1.isVisited()) {
324328
nodes.push(child1);

biojava-alignment/src/main/java/org/biojava/nbio/alignment/io/StockholmStructure.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public List<AbstractSequence<? extends AbstractCompound>> getBioSequences(boolea
301301
private String[] splitSeqName(String sequenceName) {
302302
String[] result = new String[3];
303303

304-
String[] barSplit = sequenceName.toString().split("/");
304+
String[] barSplit = sequenceName.split("/");
305305
if (barSplit.length == 2) {
306306
result[0] = barSplit[0];
307307
String[] positions = barSplit[1].split("-");

biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.biojava.nbio.core.alignment.template.AlignedSequence.Step;
2727

28+
import java.io.Serializable;
2829
import java.util.ArrayList;
2930
import java.util.Collections;
3031
import java.util.Comparator;
@@ -207,7 +208,9 @@ public Anchor(int queryIndex, int targetIndex) {
207208
this.queryIndex = queryIndex;
208209
this.targetIndex = targetIndex;
209210
}
210-
public static class QueryIndexComparator implements Comparator<Anchor> {
211+
public static class QueryIndexComparator implements Comparator<Anchor>, Serializable {
212+
private static final long serialVersionUID = 1;
213+
211214
@Override
212215
public int compare(Anchor o1, Anchor o2) {
213216
return o1.getQueryIndex() - o2.getQueryIndex();

biojava-core/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[![Dependency Status](https://www.versioneye.com/user/projects/54ce5357de7924b7ed000542/badge.svg?style=flat)](https://www.versioneye.com/user/projects/54ce5357de7924b7ed000542)
1+
[![Dependency Status](https://www.versioneye.com/user/projects/5776f02568ee07004137f521/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5776f02568ee07004137f521)

biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public class SimpleAlignedSequence<S extends Sequence<C>, C extends Compound> im
5959

6060
// cached (lazily initialized)
6161
private int numGaps = -1;
62+
private int numGapPositions = -1;
6263
private int[] alignmentFromSequence, sequenceFromAlignment;
6364

6465
/**
@@ -167,6 +168,7 @@ public Location getLocationInAlignment() {
167168
public int getNumGaps() {
168169
if (numGaps == -1) {
169170
numGaps = 0;
171+
numGapPositions = 0;
170172
C cGap = getCompoundSet().getCompoundForString(gap);
171173
boolean inGap = false;
172174
for (C compound : getAsList()) {
@@ -175,6 +177,7 @@ public int getNumGaps() {
175177
numGaps++;
176178
inGap = true;
177179
}
180+
numGapPositions++;
178181
} else {
179182
inGap = false;
180183
}
@@ -382,4 +385,18 @@ private void setLocation(List<Step> steps) {
382385
public SequenceView<C> getInverse() {
383386
throw new UnsupportedOperationException("Not supported yet.");
384387
}
388+
389+
@Override
390+
public int getNumGapPositions() {
391+
if (numGapPositions == -1)
392+
getNumGaps();
393+
return numGapPositions;
394+
}
395+
396+
@Override
397+
public double getCoverage() {
398+
399+
double coverage = getLength() - getNumGapPositions();
400+
return coverage / getOriginalSequence().getLength();
401+
}
385402
}

biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleProfile.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ private void printConservation(StringBuilder s, String idFormat, int seqIndexPad
567567
private boolean isSimilar(char c1, char c2) {
568568
AminoAcidCompoundSet set = AminoAcidCompoundSet.getAminoAcidCompoundSet();
569569

570-
AminoAcidCompound aa1 = set.getCompoundForString(""+c1);
571-
AminoAcidCompound aa2 = set.getCompoundForString(""+c2);
570+
AminoAcidCompound aa1 = set.getCompoundForString(String.valueOf(c1));
571+
AminoAcidCompound aa2 = set.getCompoundForString(String.valueOf(c2));
572572

573573
short val = matrix.getValue(aa1,aa2);
574574
return val > 0;

0 commit comments

Comments
 (0)