Skip to content

Commit

Permalink
Merge pull request #2 from tzok/develop
Browse files Browse the repository at this point in the history
Pseudoknot analysis and RNA secondary structure annotation
  • Loading branch information
tzok authored Aug 17, 2016
2 parents 8057722 + dc49f81 commit 19a1cd3
Show file tree
Hide file tree
Showing 159 changed files with 5,459 additions and 3,423 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<dependency>
<groupId>org.biojava</groupId>
<artifactId>biojava-structure</artifactId>
<version>4.2.1</version>
<version>4.2.4</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
Expand Down
41 changes: 21 additions & 20 deletions src/main/java/pl/poznan/put/atom/AtomName.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package pl.poznan.put.atom;

import java.util.Arrays;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.List;

public enum AtomName {
C(AtomType.C, "C"),
C1(AtomType.C, "C1"),
Expand Down Expand Up @@ -236,7 +236,8 @@ public enum AtomName {
SG2(AtomType.S, "SG2", "2SG"),
UNKNOWN(AtomType.OTHER, "");

private static final Logger LOGGER = LoggerFactory.getLogger(AtomName.class);
private static final Logger LOGGER =
LoggerFactory.getLogger(AtomName.class);

private final AtomType type;
private final List<String> names;
Expand All @@ -246,22 +247,6 @@ public enum AtomName {
this.names = Arrays.asList(names);
}

public AtomType getType() {
return type;
}

public boolean isHeavy() {
return type.isHeavy();
}

public String getName() {
return names.get(0);
}

public boolean matchesName(String pdbName) {
return names.contains(pdbName.trim());
}

public static AtomName fromString(String pdbName) {
if (pdbName == null) {
return AtomName.UNKNOWN;
Expand All @@ -276,4 +261,20 @@ public static AtomName fromString(String pdbName) {
AtomName.LOGGER.trace("Unknown atom name: " + pdbName);
return AtomName.UNKNOWN;
}

public boolean matchesName(String pdbName) {
return names.contains(pdbName.trim());
}

public AtomType getType() {
return type;
}

public boolean isHeavy() {
return type.isHeavy();
}

public String getName() {
return names.get(0);
}
}
8 changes: 7 additions & 1 deletion src/main/java/pl/poznan/put/atom/AtomType.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package pl.poznan.put.atom;

public enum AtomType {
C(true), H(false), N(true), O(true), P(true), S(true), OTHER(true);
C(true),
H(false),
N(true),
O(true),
P(true),
S(true),
OTHER(true);

private final boolean isHeavy;

Expand Down
57 changes: 30 additions & 27 deletions src/main/java/pl/poznan/put/atom/Bond.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,11 @@
* Values are taken from Charm36 parameters file
*/
public class Bond {
public static class Length {
private final double min;
private final double max;
private final double avg;

Length(double min, double max, double avg) {
super();
this.min = min;
this.max = max;
this.avg = avg;
}

public double getMin() {
return min;
}

public double getMax() {
return max;
}

public double getAvg() {
return avg;
}
}

private static final MultiKeyMap<AtomType, Bond.Length> MAP = new MultiKeyMap<>();
private static final Bond.Length INVALID = new Length(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
private static final MultiKeyMap<AtomType, Bond.Length> MAP =
new MultiKeyMap<>();
private static final Bond.Length INVALID =
new Length(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY,
Double.POSITIVE_INFINITY);

static {
Bond.MAP.put(AtomType.C, AtomType.C, new Length(1.320, 1.538, 1.463));
Expand Down Expand Up @@ -68,4 +46,29 @@ public static Bond.Length length(AtomType left, AtomType right) {

return length;
}

public static class Length {
private final double min;
private final double max;
private final double avg;

Length(double min, double max, double avg) {
super();
this.min = min;
this.max = max;
this.avg = avg;
}

public double getMin() {
return min;
}

public double getMax() {
return max;
}

public double getAvg() {
return avg;
}
}
}
51 changes: 42 additions & 9 deletions src/main/java/pl/poznan/put/notation/LeontisWesthof.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,37 @@ public static LeontisWesthof fromString(String str) {
return UNKNOWN;
}

public static LeontisWesthof fromOrdinal(int ordinal) {
switch (ordinal) {
case 1:
return CWW;
case 2:
return TWW;
case 3:
return CWH;
case 4:
return TWH;
case 5:
return CWS;
case 6:
return TWS;
case 7:
return CHH;
case 8:
return THH;
case 9:
return CHS;
case 10:
return THS;
case 11:
return CSS;
case 12:
return TSS;
default:
return UNKNOWN;
}
}

@Override
public String toString() {
if (this == UNKNOWN) {
Expand All @@ -89,11 +120,9 @@ public String toString() {

char[] cs = name().toCharArray();

return String.valueOf(cs[1]) +
'/' +
cs[2] +
' ' +
(cs[0] == 'C' ? "cis" : "trans");
return String.valueOf(cs[1]) + '/' + cs[2] + ' ' + (cs[0] == 'C' ? "cis"
:
"trans");
}

public String getFullName() {
Expand All @@ -103,9 +132,13 @@ public String getFullName() {

char[] cs = name().toCharArray();

return (cs[0] == 'C' ? "cis " : "trans ") +
(cs[1] == 'W' ? "Watson-Crick" : cs[1] == 'H' ? "Hoogsteen" : "Sugar Edge") +
'/' +
(cs[2] == 'W' ? "Watson-Crick" : cs[2] == 'H' ? "Hoogsteen" : "Sugar Edge");
return (cs[0] == 'C' ? "cis " : "trans ") + (cs[1] == 'W'
? "Watson-Crick"
: cs[1] == 'H'
? "Hoogsteen"
: "Sugar Edge") + '/' + (
cs[2] == 'W' ? "Watson-Crick"
: cs[2] == 'H' ? "Hoogsteen"
: "Sugar Edge");
}
}
23 changes: 15 additions & 8 deletions src/main/java/pl/poznan/put/notation/Saenger.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,26 @@ public static Saenger fromString(String str) {
return UNKNOWN;
}

public static boolean isCanonical(Saenger s) {
return s == XIX || s == XX || s == XXVIII;
}

public boolean isCanonical() {
return Saenger.isCanonical(this);
}

@Override
public String toString() {
if (this == UNKNOWN) {
return "n/a";
}
return name();
}

public static Saenger fromOrdinal(int ordinal) {
if (ordinal >= 1 && ordinal <= 28) {
return Saenger.values()[ordinal];
}
return Saenger.UNKNOWN;
}

public boolean isCanonical() {
return Saenger.isCanonical(this);
}

public static boolean isCanonical(Saenger s) {
return s == XIX || s == XX || s == XXVIII;
}
}
2 changes: 1 addition & 1 deletion src/main/java/pl/poznan/put/pdb/ChainNumberICode.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public interface ChainNumberICode {
int getResidueNumber();

String getInsertionCode();

PdbResidueIdentifier getResidueIdentifier();
}
Loading

0 comments on commit 19a1cd3

Please sign in to comment.