Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc changes #1

Open
wants to merge 23 commits into
base: #855-code-cleaning-not-related-to-issue
Choose a base branch
from
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Set the default behavior, in case people don't have core.autocrlf set.
# Set
* text=auto

# Explicitly declare text files you want to always be normalized and converted
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Welcome to <img src="logo-full.png" height="35"/>

[![Build Status](https://travis-ci.org/biojava/biojava.svg?branch=master)](https://travis-ci.org/biojava/biojava) [![Version](http://img.shields.io/badge/version-5.3.0-blue.svg?style=flat)](https://github.com/biojava/biojava/releases/tag/biojava-5.2.0) [![License](http://img.shields.io/badge/license-LGPL_2.1-blue.svg?style=flat)](https://github.com/biojava/biojava/blob/master/LICENSE) [![Join the chat at https://gitter.im/biojava/biojava](https://badges.gitter.im/biojava/biojava.svg)](https://gitter.im/biojava/biojava?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/biojava/biojava.svg?branch=master)](https://travis-ci.org/biojava/biojava) [![Version](http://img.shields.io/badge/version-5.3.0-blue.svg?style=flat)](https://github.com/biojava/biojava/releases/tag/biojava-5.3.0) [![License](http://img.shields.io/badge/license-LGPL_2.1-blue.svg?style=flat)](https://github.com/biojava/biojava/blob/master/LICENSE) [![Join the chat at https://gitter.im/biojava/biojava](https://badges.gitter.im/biojava/biojava.svg)](https://gitter.im/biojava/biojava?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)


BioJava is an open-source project dedicated to providing a Java framework for **processing biological data**. It provides analytical and statistical routines, parsers for common file formats, reference implementations of popular algorithms, and allows the manipulation of sequences and 3D structures. The goal of the biojava project is to facilitate rapid application development for bioinformatics.
Expand Down Expand Up @@ -34,6 +34,17 @@ If you are using Maven you can add the BioJava repository by adding the followin
</dependencies>
```

### Quick Demo

on Linux, Mac, or in (git-bash)[https://gitforwindows.org/] run

```bash

mvn install
bin/biojava.sh
```


### Snapshot builds

To use the latest builds from BioJava, you can add the following config your project's pom.xml:
Expand Down
15 changes: 15 additions & 0 deletions bin/biojava.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

# this runs any main function in the source tree.
# to change the class to be run
# EXECMAIN=org.biojava.not.demo.main bin/biojava.sh
mkdir -p target/lib/ && {
ln -s 2>/dev/null $PWD/*/target{,/lib}/*jar target/lib
cp 2>/dev/null -as $PWD/*/src/main/resources/* target/
}

set -fx
JDIR=$PWD/$(dirname $0)/../
pushd target
exec java -classpath "$JDIR/target/*:$JDIR/target/lib/*" ${EXECMAIN:=demo.DemoSixFrameTranslation} "$@"
popd
10 changes: 1 addition & 9 deletions biojava-aa-prop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,7 @@
<build>
<plugins>
<!-- Excluding demo package is required for avoiding namespace clashes (demo package is in all modules) for signing the jar. See issue #387 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>demo/**</exclude>
</excludes>
</configuration>
</plugin>


<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class AminoAcidProperties {
* @param aa The one-letter amino acid code
* @return true if amino acid is charged
*/
public static final boolean isCharged(char aa) {
public static boolean isCharged(char aa) {
if (negChargedAAs.contains(String.valueOf(aa))) {
return true;
}
Expand All @@ -60,7 +60,7 @@ else if (posChargedAAs.contains(String.valueOf(aa))) {
* @param aa The one-letter amino acid code
* @return the charge of amino acid (1 if positively charged, -1 if negatively charged, 0 if not charged)
*/
public static final int getChargeOfAminoAcid(char aa) {
public static int getChargeOfAminoAcid(char aa) {
if (negChargedAAs.contains(String.valueOf(aa))) {
return -1;
}
Expand All @@ -76,7 +76,7 @@ else if (posChargedAAs.contains(String.valueOf(aa))) {
* @param aa The one-letter amino acid code
* @return true if amino acid is polar
*/
public static final boolean isPolar(char aa) {
public static boolean isPolar(char aa) {
if (polarAAs.contains(String.valueOf(aa))) {
return true;
}
Expand All @@ -89,7 +89,7 @@ public static final boolean isPolar(char aa) {
* @param aa The one-letter amino acid code
* @return the polarity of amino acid (1 if polar, 0 if not polar)
*/
public static final int getPolarityOfAminoAcid(char aa) {
public static int getPolarityOfAminoAcid(char aa) {
if (polarAAs.contains(String.valueOf(aa))) {
return 1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.LinkedHashMap;
Expand Down Expand Up @@ -95,8 +94,8 @@ public static void run(String[] args) throws Exception{
/*
* Parse input arguments
*/
List<Character> propertyList = new ArrayList<Character>();
List<Character> specificList = new ArrayList<Character>();
List<Character> propertyList = new ArrayList<>();
List<Character> specificList = new ArrayList<>();
String inputLocation = null;
String outputLocation = null;
String aminoAcidCompositionLocation = null;
Expand Down Expand Up @@ -179,15 +178,15 @@ private static LinkedHashMap<String, ProteinSequence> readInputFile(String input
}
LinkedHashMap<String, ProteinSequence> ret;
if ( inputLocation.toLowerCase().contains(".gb")) {
GenbankReader<ProteinSequence, AminoAcidCompound> genbankReader = new GenbankReader<ProteinSequence, AminoAcidCompound>(
inStream, new GenericGenbankHeaderParser<ProteinSequence, AminoAcidCompound>(),
GenbankReader<ProteinSequence, AminoAcidCompound> genbankReader = new GenbankReader<>(
inStream, new GenericGenbankHeaderParser<>(),
new ProteinSequenceCreator(set));
ret = genbankReader.process();


} else {
FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<ProteinSequence, AminoAcidCompound>(
inStream, new GenericFastaHeaderParser<ProteinSequence, AminoAcidCompound>(),
FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<>(
inStream, new GenericFastaHeaderParser<>(),
new ProteinSequenceCreator(set));
ret = fastaReader.process();

Expand All @@ -198,9 +197,9 @@ private static LinkedHashMap<String, ProteinSequence> readInputFile(String input
public enum PropertyName{MolecularWeight, Absorbance_True, Absorbance_False, ExtinctionCoefficient_True, ExtinctionCoefficient_False,
InstabilityIndex, ApliphaticIndex, AverageHydropathyValue, IsoelectricPoint, NetCharge_pH_7, A, R,
N, D, C, E, Q, G, H, I, L,
K, M, F, P, S, T, W, Y, V};
K, M, F, P, S, T, W, Y, V}

private static void printHeader(PrintStream output, List<Character> propertyList, List<Character> specificList, String delimiter) throws IOException{
private static void printHeader(PrintStream output, List<Character> propertyList, List<Character> specificList, String delimiter) {
int specificCount = 0;
/*
* 1 Molecular weight
Expand All @@ -214,7 +213,7 @@ private static void printHeader(PrintStream output, List<Character> propertyList
* 9 Composition of the 20 standard amino acid
* 0 Composition of the specific amino acid
*/
List<String> sList = new ArrayList<String>();
List<String> sList = new ArrayList<>();
sList.add("SequenceName");
for(Character c:propertyList){
switch(c){
Expand All @@ -238,7 +237,7 @@ private static void printHeader(PrintStream output, List<Character> propertyList
sList.add(PropertyName.T.toString()); sList.add(PropertyName.W.toString());
sList.add(PropertyName.Y.toString()); sList.add(PropertyName.V.toString());
break;
case '0': sList.add("" + specificList.get(specificCount++)); break;
case '0': sList.add(String.valueOf(specificList.get(specificCount++))); break;
}
}
for(int i = 0; i < sList.size(); i++){
Expand Down Expand Up @@ -272,19 +271,16 @@ private static void compute(PrintStream output, String header, String sequence,
}else{
sequence = Utils.checkSequence(sequence);
pSequence = new ProteinSequence(sequence);
aaSet = AminoAcidCompoundSet.getAminoAcidCompoundSet();
aaSet = AminoAcidCompoundSet.aminoAcidCompoundSet;
}
IPeptideProperties pp = new PeptidePropertiesImpl();

int specificCount = 0;
List<Double> dList = new ArrayList<Double>();
List<Double> dList = new ArrayList<>();
for(Character c:propertyList){
switch(c){
case '1':
if(aaTable == null)
dList.add(pp.getMolecularWeight(pSequence));
else
dList.add(pp.getMolecularWeight(pSequence));
dList.add(pp.getMolecularWeight(pSequence));
break;
case '2':
dList.add(pp.getAbsorbance(pSequence, true));
Expand Down Expand Up @@ -323,7 +319,7 @@ private static void compute(PrintStream output, String header, String sequence,
dList.add(aaCompound2Double.get(Constraints.Y));
dList.add(aaCompound2Double.get(Constraints.V));
break;
case '0': dList.add(pp.getEnrichment(pSequence, aaSet.getCompoundForString("" + specificList.get(specificCount++)))); break;
case '0': dList.add(pp.getEnrichment(pSequence, aaSet.getCompoundForString(String.valueOf(specificList.get(specificCount++))))); break;
}
}
output.print(header.replace(delimiter, "_"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,37 @@
* @see IPeptideProperties
*/
public class Constraints {
private static AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
private static final AminoAcidCompoundSet aaSet = new AminoAcidCompoundSet();
//A, R, N, D, C, E, Q, G, H, I, L, K, M, F, P, S, T, W, Y, V
public static AminoAcidCompound A = aaSet.getCompoundForString("A");
public static AminoAcidCompound R = aaSet.getCompoundForString("R");
public static AminoAcidCompound N = aaSet.getCompoundForString("N");
public static AminoAcidCompound D = aaSet.getCompoundForString("D");
public static AminoAcidCompound C = aaSet.getCompoundForString("C");
public static AminoAcidCompound E = aaSet.getCompoundForString("E");
public static AminoAcidCompound Q = aaSet.getCompoundForString("Q");
public static AminoAcidCompound G = aaSet.getCompoundForString("G");
public static AminoAcidCompound H = aaSet.getCompoundForString("H");
public static AminoAcidCompound I = aaSet.getCompoundForString("I");
public static AminoAcidCompound L = aaSet.getCompoundForString("L");
public static AminoAcidCompound K = aaSet.getCompoundForString("K");
public static AminoAcidCompound M = aaSet.getCompoundForString("M");
public static AminoAcidCompound F = aaSet.getCompoundForString("F");
public static AminoAcidCompound P = aaSet.getCompoundForString("P");
public static AminoAcidCompound S = aaSet.getCompoundForString("S");
public static AminoAcidCompound T = aaSet.getCompoundForString("T");
public static AminoAcidCompound W = aaSet.getCompoundForString("W");
public static AminoAcidCompound Y = aaSet.getCompoundForString("Y");
public static AminoAcidCompound V = aaSet.getCompoundForString("V");
public static final AminoAcidCompound A = aaSet.getCompoundForString("A");
public static final AminoAcidCompound R = aaSet.getCompoundForString("R");
public static final AminoAcidCompound N = aaSet.getCompoundForString("N");
public static final AminoAcidCompound D = aaSet.getCompoundForString("D");
public static final AminoAcidCompound C = aaSet.getCompoundForString("C");
public static final AminoAcidCompound E = aaSet.getCompoundForString("E");
public static final AminoAcidCompound Q = aaSet.getCompoundForString("Q");
public static final AminoAcidCompound G = aaSet.getCompoundForString("G");
public static final AminoAcidCompound H = aaSet.getCompoundForString("H");
public static final AminoAcidCompound I = aaSet.getCompoundForString("I");
public static final AminoAcidCompound L = aaSet.getCompoundForString("L");
public static final AminoAcidCompound K = aaSet.getCompoundForString("K");
public static final AminoAcidCompound M = aaSet.getCompoundForString("M");
public static final AminoAcidCompound F = aaSet.getCompoundForString("F");
public static final AminoAcidCompound P = aaSet.getCompoundForString("P");
public static final AminoAcidCompound S = aaSet.getCompoundForString("S");
public static final AminoAcidCompound T = aaSet.getCompoundForString("T");
public static final AminoAcidCompound W = aaSet.getCompoundForString("W");
public static final AminoAcidCompound Y = aaSet.getCompoundForString("Y");
public static final AminoAcidCompound V = aaSet.getCompoundForString("V");

public static Map<AminoAcidCompound, Double> aa2ExtinctionCoefficient = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2MolecularWeight = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2Hydrophathicity = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2PKa = new HashMap<AminoAcidCompound, Double>();
public static Map<String, Double> diAA2Instability = new HashMap<String, Double>();
public static final Map<AminoAcidCompound, Double> aa2ExtinctionCoefficient = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2MolecularWeight = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2Hydrophathicity = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2PKa = new HashMap<>();
public static final Map<String, Double> diAA2Instability = new HashMap<>();

public static Map<AminoAcidCompound, Double> aa2NTerminalPka = new HashMap<AminoAcidCompound, Double>();
public static Map<AminoAcidCompound, Double> aa2CTerminalPka = new HashMap<AminoAcidCompound, Double>();
public static final Map<AminoAcidCompound, Double> aa2NTerminalPka = new HashMap<>();
public static final Map<AminoAcidCompound, Double> aa2CTerminalPka = new HashMap<>();

static{
initMolecularWeight();
Expand Down Expand Up @@ -287,7 +287,7 @@ private static void initInstability(){
SingleLetterAACode[] aa = SingleLetterAACode.values();
for(int i = 0; i < aa.length; i++){
for(int j = 0; j < aa.length; j++){
diAA2Instability.put("" + aa[i] + aa[j], instability[i][j]);
diAA2Instability.put(String.valueOf(aa[i]) + aa[j], instability[i][j]);
}
}
}
Expand Down
Loading