id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
31,700
biojava/biojava
biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java
SequenceUtil.isAmbiguosProtein
public static boolean isAmbiguosProtein(String sequence) { sequence = SequenceUtil.cleanSequence(sequence); if (SequenceUtil.isNonAmbNucleotideSequence(sequence)) { return false; } if (SequenceUtil.DIGIT.matcher(sequence).find()) { return false; } if (SequenceUtil.NON_AA.matcher(sequence).find()) { return false; } if (SequenceUtil.AA.matcher(sequence).find()) { return false; } final Matcher amb_prot = SequenceUtil.AMBIGUOUS_AA.matcher(sequence); return amb_prot.find(); }
java
public static boolean isAmbiguosProtein(String sequence) { sequence = SequenceUtil.cleanSequence(sequence); if (SequenceUtil.isNonAmbNucleotideSequence(sequence)) { return false; } if (SequenceUtil.DIGIT.matcher(sequence).find()) { return false; } if (SequenceUtil.NON_AA.matcher(sequence).find()) { return false; } if (SequenceUtil.AA.matcher(sequence).find()) { return false; } final Matcher amb_prot = SequenceUtil.AMBIGUOUS_AA.matcher(sequence); return amb_prot.find(); }
[ "public", "static", "boolean", "isAmbiguosProtein", "(", "String", "sequence", ")", "{", "sequence", "=", "SequenceUtil", ".", "cleanSequence", "(", "sequence", ")", ";", "if", "(", "SequenceUtil", ".", "isNonAmbNucleotideSequence", "(", "sequence", ")", ")", "{...
Check whether the sequence confirms to amboguous protein sequence @param sequence @return return true only if the sequence if ambiguous protein sequence Return false otherwise. e.g. if the sequence is non-ambiguous protein or DNA
[ "Check", "whether", "the", "sequence", "confirms", "to", "amboguous", "protein", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java#L201-L217
31,701
biojava/biojava
biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java
SequenceUtil.writeFasta
public static void writeFasta(final OutputStream outstream, final List<FastaSequence> sequences, final int width) throws IOException { final OutputStreamWriter writer = new OutputStreamWriter(outstream); final BufferedWriter fastawriter = new BufferedWriter(writer); for (final FastaSequence fs : sequences) { fastawriter.write(fs.getFormatedSequence(width)); } outstream.flush(); fastawriter.close(); writer.close(); }
java
public static void writeFasta(final OutputStream outstream, final List<FastaSequence> sequences, final int width) throws IOException { final OutputStreamWriter writer = new OutputStreamWriter(outstream); final BufferedWriter fastawriter = new BufferedWriter(writer); for (final FastaSequence fs : sequences) { fastawriter.write(fs.getFormatedSequence(width)); } outstream.flush(); fastawriter.close(); writer.close(); }
[ "public", "static", "void", "writeFasta", "(", "final", "OutputStream", "outstream", ",", "final", "List", "<", "FastaSequence", ">", "sequences", ",", "final", "int", "width", ")", "throws", "IOException", "{", "final", "OutputStreamWriter", "writer", "=", "new...
Writes list of FastaSequeces into the outstream formatting the sequence so that it contains width chars on each line @param outstream @param sequences @param width - the maximum number of characters to write in one line @throws IOException
[ "Writes", "list", "of", "FastaSequeces", "into", "the", "outstream", "formatting", "the", "sequence", "so", "that", "it", "contains", "width", "chars", "on", "each", "line" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java#L229-L240
31,702
biojava/biojava
biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java
SequenceUtil.readFasta
public static List<FastaSequence> readFasta(final InputStream inStream) throws IOException { final List<FastaSequence> seqs = new ArrayList<FastaSequence>(); final BufferedReader infasta = new BufferedReader( new InputStreamReader(inStream, "UTF8"), 16000); final Pattern pattern = Pattern.compile("//s+"); String line; String sname = "", seqstr = null; do { line = infasta.readLine(); if ((line == null) || line.startsWith(">")) { if (seqstr != null) { seqs.add(new FastaSequence(sname.substring(1), seqstr)); } sname = line; // remove > seqstr = ""; } else { final String subseq = pattern.matcher(line).replaceAll(""); seqstr += subseq; } } while (line != null); infasta.close(); return seqs; }
java
public static List<FastaSequence> readFasta(final InputStream inStream) throws IOException { final List<FastaSequence> seqs = new ArrayList<FastaSequence>(); final BufferedReader infasta = new BufferedReader( new InputStreamReader(inStream, "UTF8"), 16000); final Pattern pattern = Pattern.compile("//s+"); String line; String sname = "", seqstr = null; do { line = infasta.readLine(); if ((line == null) || line.startsWith(">")) { if (seqstr != null) { seqs.add(new FastaSequence(sname.substring(1), seqstr)); } sname = line; // remove > seqstr = ""; } else { final String subseq = pattern.matcher(line).replaceAll(""); seqstr += subseq; } } while (line != null); infasta.close(); return seqs; }
[ "public", "static", "List", "<", "FastaSequence", ">", "readFasta", "(", "final", "InputStream", "inStream", ")", "throws", "IOException", "{", "final", "List", "<", "FastaSequence", ">", "seqs", "=", "new", "ArrayList", "<", "FastaSequence", ">", "(", ")", ...
Reads fasta sequences from inStream into the list of FastaSequence objects @param inStream from @return list of FastaSequence objects @throws IOException
[ "Reads", "fasta", "sequences", "from", "inStream", "into", "the", "list", "of", "FastaSequence", "objects" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java#L251-L277
31,703
biojava/biojava
biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java
SequenceUtil.writeFasta
public static void writeFasta(final OutputStream os, final List<FastaSequence> sequences) throws IOException { final OutputStreamWriter outWriter = new OutputStreamWriter(os); final BufferedWriter fasta_out = new BufferedWriter(outWriter); for (final FastaSequence fs : sequences) { fasta_out.write(fs.getOnelineFasta()); } fasta_out.close(); outWriter.close(); }
java
public static void writeFasta(final OutputStream os, final List<FastaSequence> sequences) throws IOException { final OutputStreamWriter outWriter = new OutputStreamWriter(os); final BufferedWriter fasta_out = new BufferedWriter(outWriter); for (final FastaSequence fs : sequences) { fasta_out.write(fs.getOnelineFasta()); } fasta_out.close(); outWriter.close(); }
[ "public", "static", "void", "writeFasta", "(", "final", "OutputStream", "os", ",", "final", "List", "<", "FastaSequence", ">", "sequences", ")", "throws", "IOException", "{", "final", "OutputStreamWriter", "outWriter", "=", "new", "OutputStreamWriter", "(", "os", ...
Writes FastaSequence in the file, each sequence will take one line only @param os @param sequences @throws IOException
[ "Writes", "FastaSequence", "in", "the", "file", "each", "sequence", "will", "take", "one", "line", "only" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-protein-disorder/src/main/java/org/biojava/nbio/data/sequence/SequenceUtil.java#L286-L295
31,704
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java
GenericGenbankHeaderParser.reset
@SuppressWarnings("unused") private void reset() { this.version = 0; this.versionSeen = false; this.accession = null; this.description = null; this.identifier = null; this.name = null; this.comments.clear(); }
java
@SuppressWarnings("unused") private void reset() { this.version = 0; this.versionSeen = false; this.accession = null; this.description = null; this.identifier = null; this.name = null; this.comments.clear(); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "void", "reset", "(", ")", "{", "this", ".", "version", "=", "0", ";", "this", ".", "versionSeen", "=", "false", ";", "this", ".", "accession", "=", "null", ";", "this", ".", "description", "=...
Sets the sequence info back to default values, ie. in order to start constructing a new sequence from scratch.
[ "Sets", "the", "sequence", "info", "back", "to", "default", "values", "ie", ".", "in", "order", "to", "start", "constructing", "a", "new", "sequence", "from", "scratch", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderParser.java#L67-L76
31,705
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java
Prism.setInscribedRadius
public void setInscribedRadius(double radius) { double side = getSideLengthFromInscribedRadius(radius, n); this.circumscribedRadius = getCircumscribedRadiusFromSideLength(side, n); }
java
public void setInscribedRadius(double radius) { double side = getSideLengthFromInscribedRadius(radius, n); this.circumscribedRadius = getCircumscribedRadiusFromSideLength(side, n); }
[ "public", "void", "setInscribedRadius", "(", "double", "radius", ")", "{", "double", "side", "=", "getSideLengthFromInscribedRadius", "(", "radius", ",", "n", ")", ";", "this", ".", "circumscribedRadius", "=", "getCircumscribedRadiusFromSideLength", "(", "side", ","...
Sets the radius of an inscribed sphere, that is tangent to each of the icosahedron's faces @param inscribedRadius the inscribedRadius to set
[ "Sets", "the", "radius", "of", "an", "inscribed", "sphere", "that", "is", "tangent", "to", "each", "of", "the", "icosahedron", "s", "faces" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Prism.java#L92-L95
31,706
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneIDGFF2Reader.java
GeneIDGFF2Reader.read
public static FeatureList read(String filename) throws IOException { logger.info("Reading: {}", filename); FeatureList features = new FeatureList(); BufferedReader br = new BufferedReader(new FileReader(filename)); String s; for (s = br.readLine(); null != s; s = br.readLine()) { s = s.trim(); if (s.length() > 0) { if (s.charAt(0) == '#') { //ignore comment lines } else { FeatureI f = parseLine(s); if (f != null) { features.add(f); } } } } br.close(); return features; }
java
public static FeatureList read(String filename) throws IOException { logger.info("Reading: {}", filename); FeatureList features = new FeatureList(); BufferedReader br = new BufferedReader(new FileReader(filename)); String s; for (s = br.readLine(); null != s; s = br.readLine()) { s = s.trim(); if (s.length() > 0) { if (s.charAt(0) == '#') { //ignore comment lines } else { FeatureI f = parseLine(s); if (f != null) { features.add(f); } } } } br.close(); return features; }
[ "public", "static", "FeatureList", "read", "(", "String", "filename", ")", "throws", "IOException", "{", "logger", ".", "info", "(", "\"Reading: {}\"", ",", "filename", ")", ";", "FeatureList", "features", "=", "new", "FeatureList", "(", ")", ";", "BufferedRea...
Read a file into a FeatureList. Each line of the file becomes one Feature object. @param filename The path to the GFF file. @return A FeatureList. @throws IOException Something went wrong -- check exception detail message.
[ "Read", "a", "file", "into", "a", "FeatureList", ".", "Each", "line", "of", "the", "file", "becomes", "one", "Feature", "object", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/GeneIDGFF2Reader.java#L61-L87
31,707
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java
CeCPMain.invertAlignment
public AFPChain invertAlignment(AFPChain a) { String name1 = a.getName1(); String name2 = a.getName2(); a.setName1(name2); a.setName2(name1); int len1 = a.getCa1Length(); a.setCa1Length( a.getCa2Length() ); a.setCa2Length( len1 ); int beg1 = a.getAlnbeg1(); a.setAlnbeg1(a.getAlnbeg2()); a.setAlnbeg2(beg1); char[] alnseq1 = a.getAlnseq1(); a.setAlnseq1(a.getAlnseq2()); a.setAlnseq2(alnseq1); Matrix distab1 = a.getDisTable1(); a.setDisTable1(a.getDisTable2()); a.setDisTable2(distab1); int[] focusRes1 = a.getFocusRes1(); a.setFocusRes1(a.getFocusRes2()); a.setFocusRes2(focusRes1); //What are aftIndex and befIndex used for? How are they indexed? //a.getAfpAftIndex() String[][][] pdbAln = a.getPdbAln(); if( pdbAln != null) { for(int block = 0; block < a.getBlockNum(); block++) { String[] paln1 = pdbAln[block][0]; pdbAln[block][0] = pdbAln[block][1]; pdbAln[block][1] = paln1; } } int[][][] optAln = a.getOptAln(); if( optAln != null ) { for(int block = 0; block < a.getBlockNum(); block++) { int[] aln1 = optAln[block][0]; optAln[block][0] = optAln[block][1]; optAln[block][1] = aln1; } } a.setOptAln(optAln); // triggers invalidate() Matrix distmat = a.getDistanceMatrix(); if(distmat != null) a.setDistanceMatrix(distmat.transpose()); // invert the rotation matrices Matrix[] blockRotMat = a.getBlockRotationMatrix(); Atom[] shiftVec = a.getBlockShiftVector(); if( blockRotMat != null) { for(int block = 0; block < a.getBlockNum(); block++) { if(blockRotMat[block] != null) { // if y=x*A+b, then x=y*inv(A)-b*inv(A) blockRotMat[block] = blockRotMat[block].inverse(); Calc.rotate(shiftVec[block],blockRotMat[block]); shiftVec[block] = Calc.invert(shiftVec[block]); } } } return a; }
java
public AFPChain invertAlignment(AFPChain a) { String name1 = a.getName1(); String name2 = a.getName2(); a.setName1(name2); a.setName2(name1); int len1 = a.getCa1Length(); a.setCa1Length( a.getCa2Length() ); a.setCa2Length( len1 ); int beg1 = a.getAlnbeg1(); a.setAlnbeg1(a.getAlnbeg2()); a.setAlnbeg2(beg1); char[] alnseq1 = a.getAlnseq1(); a.setAlnseq1(a.getAlnseq2()); a.setAlnseq2(alnseq1); Matrix distab1 = a.getDisTable1(); a.setDisTable1(a.getDisTable2()); a.setDisTable2(distab1); int[] focusRes1 = a.getFocusRes1(); a.setFocusRes1(a.getFocusRes2()); a.setFocusRes2(focusRes1); //What are aftIndex and befIndex used for? How are they indexed? //a.getAfpAftIndex() String[][][] pdbAln = a.getPdbAln(); if( pdbAln != null) { for(int block = 0; block < a.getBlockNum(); block++) { String[] paln1 = pdbAln[block][0]; pdbAln[block][0] = pdbAln[block][1]; pdbAln[block][1] = paln1; } } int[][][] optAln = a.getOptAln(); if( optAln != null ) { for(int block = 0; block < a.getBlockNum(); block++) { int[] aln1 = optAln[block][0]; optAln[block][0] = optAln[block][1]; optAln[block][1] = aln1; } } a.setOptAln(optAln); // triggers invalidate() Matrix distmat = a.getDistanceMatrix(); if(distmat != null) a.setDistanceMatrix(distmat.transpose()); // invert the rotation matrices Matrix[] blockRotMat = a.getBlockRotationMatrix(); Atom[] shiftVec = a.getBlockShiftVector(); if( blockRotMat != null) { for(int block = 0; block < a.getBlockNum(); block++) { if(blockRotMat[block] != null) { // if y=x*A+b, then x=y*inv(A)-b*inv(A) blockRotMat[block] = blockRotMat[block].inverse(); Calc.rotate(shiftVec[block],blockRotMat[block]); shiftVec[block] = Calc.invert(shiftVec[block]); } } } return a; }
[ "public", "AFPChain", "invertAlignment", "(", "AFPChain", "a", ")", "{", "String", "name1", "=", "a", ".", "getName1", "(", ")", ";", "String", "name2", "=", "a", ".", "getName2", "(", ")", ";", "a", ".", "setName1", "(", "name2", ")", ";", "a", "....
Swaps the order of structures in an AFPChain @param a @return
[ "Swaps", "the", "order", "of", "structures", "in", "an", "AFPChain" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java#L233-L303
31,708
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java
CeCPMain.filterDuplicateAFPs
public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCalc, Atom[] ca1, Atom[] ca2duplicated) throws StructureException { return filterDuplicateAFPs(afpChain, ceCalc, ca1, ca2duplicated, null); }
java
public static AFPChain filterDuplicateAFPs(AFPChain afpChain, CECalculator ceCalc, Atom[] ca1, Atom[] ca2duplicated) throws StructureException { return filterDuplicateAFPs(afpChain, ceCalc, ca1, ca2duplicated, null); }
[ "public", "static", "AFPChain", "filterDuplicateAFPs", "(", "AFPChain", "afpChain", ",", "CECalculator", "ceCalc", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2duplicated", ")", "throws", "StructureException", "{", "return", "filterDuplicateAFPs", "(",...
Takes as input an AFPChain where ca2 has been artificially duplicated. This raises the possibility that some residues of ca2 will appear in multiple AFPs. This method filters out duplicates and makes sure that all AFPs are numbered relative to the original ca2. <p>The current version chooses a CP site such that the length of the alignment is maximized. <p>This method does <i>not</i> update scores to reflect the filtered alignment. It <i>does</i> update the RMSD and superposition. @param afpChain The alignment between ca1 and ca2-ca2. Blindly assumes that ca2 has been duplicated. @return A new AFPChain consisting of ca1 to ca2, with each residue in at most 1 AFP. @throws StructureException
[ "Takes", "as", "input", "an", "AFPChain", "where", "ca2", "has", "been", "artificially", "duplicated", ".", "This", "raises", "the", "possibility", "that", "some", "residues", "of", "ca2", "will", "appear", "in", "multiple", "AFPs", ".", "This", "method", "f...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java#L323-L325
31,709
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java
CeCPMain.calculateMinCP
protected static CPRange calculateMinCP(int[] block, int blockLen, int ca2len, int minCPlength) { CPRange range = new CPRange(); // Find the cut point within the alignment. // Either returns the index i of the alignment such that block[i] == ca2len, // or else returns -i-1 where block[i] is the first element > ca2len. int middle = Arrays.binarySearch(block, ca2len); if(middle < 0) { middle = -middle -1; } // Middle is now the first res after the duplication range.mid = middle; int minCPntermIndex = middle-minCPlength; if(minCPntermIndex >= 0) { range.n = block[minCPntermIndex]; } else { range.n = -1; } int minCPctermIndex = middle+minCPlength-1; if(minCPctermIndex < blockLen) { range.c = block[minCPctermIndex]; } else { range.c = ca2len*2; } // Stub: // Best-case: assume all residues in the termini are aligned //range.n = ca2len - minCPlength; //range.c = ca2len + minCPlength-1; return range; }
java
protected static CPRange calculateMinCP(int[] block, int blockLen, int ca2len, int minCPlength) { CPRange range = new CPRange(); // Find the cut point within the alignment. // Either returns the index i of the alignment such that block[i] == ca2len, // or else returns -i-1 where block[i] is the first element > ca2len. int middle = Arrays.binarySearch(block, ca2len); if(middle < 0) { middle = -middle -1; } // Middle is now the first res after the duplication range.mid = middle; int minCPntermIndex = middle-minCPlength; if(minCPntermIndex >= 0) { range.n = block[minCPntermIndex]; } else { range.n = -1; } int minCPctermIndex = middle+minCPlength-1; if(minCPctermIndex < blockLen) { range.c = block[minCPctermIndex]; } else { range.c = ca2len*2; } // Stub: // Best-case: assume all residues in the termini are aligned //range.n = ca2len - minCPlength; //range.c = ca2len + minCPlength-1; return range; }
[ "protected", "static", "CPRange", "calculateMinCP", "(", "int", "[", "]", "block", ",", "int", "blockLen", ",", "int", "ca2len", ",", "int", "minCPlength", ")", "{", "CPRange", "range", "=", "new", "CPRange", "(", ")", ";", "// Find the cut point within the al...
Finds the alignment index of the residues minCPlength before and after the duplication. @param block The permuted block being considered, generally optAln[0][1] @param blockLen The length of the block (in case extra memory was allocated in block) @param ca2len The length, in residues, of the protein specified by block @param minCPlength The minimum number of residues allowed for a CP @return a CPRange with the following components: <dl><dt>n</dt><dd>Index into <code>block</code> of the residue such that <code>minCPlength</code> residues remain to the end of <code>ca2len</code>, or -1 if no residue fits that criterium.</dd> <dt>mid</dt><dd>Index of the first residue higher than <code>ca2len</code>.</dd> <dt>c</dt><dd>Index of <code>minCPlength</code>-th residue after ca2len, or ca2len*2 if no residue fits that criterium.</dd> </dl>
[ "Finds", "the", "alignment", "index", "of", "the", "residues", "minCPlength", "before", "and", "after", "the", "duplication", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/CeCPMain.java#L635-L668
31,710
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/SandboxStyleStructureProvider.java
SandboxStyleStructureProvider.setPath
public void setPath(String p){ path = p ; if ( ! (path.endsWith(fileSeparator) ) ) path = path + fileSeparator; }
java
public void setPath(String p){ path = p ; if ( ! (path.endsWith(fileSeparator) ) ) path = path + fileSeparator; }
[ "public", "void", "setPath", "(", "String", "p", ")", "{", "path", "=", "p", ";", "if", "(", "!", "(", "path", ".", "endsWith", "(", "fileSeparator", ")", ")", ")", "path", "=", "path", "+", "fileSeparator", ";", "}" ]
directory where to find PDB files
[ "directory", "where", "to", "find", "PDB", "files" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SandboxStyleStructureProvider.java#L127-L134
31,711
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/SandboxStyleStructureProvider.java
SandboxStyleStructureProvider.getAllPDBIDs
public List<String> getAllPDBIDs() throws IOException{ File f = new File(path); if ( ! f.isDirectory()) throw new IOException("Path " + path + " is not a directory!"); String[] dirName = f.list(); List<String>pdbIds = new ArrayList<String>(); for (String dir : dirName) { File d2= new File(f,dir); if ( ! d2.isDirectory()) continue; String[] pdbDirs = d2.list(); for (String pdbId : pdbDirs) { if ( ! pdbIds.contains(pdbId)) pdbIds.add(pdbId); } } return pdbIds; }
java
public List<String> getAllPDBIDs() throws IOException{ File f = new File(path); if ( ! f.isDirectory()) throw new IOException("Path " + path + " is not a directory!"); String[] dirName = f.list(); List<String>pdbIds = new ArrayList<String>(); for (String dir : dirName) { File d2= new File(f,dir); if ( ! d2.isDirectory()) continue; String[] pdbDirs = d2.list(); for (String pdbId : pdbDirs) { if ( ! pdbIds.contains(pdbId)) pdbIds.add(pdbId); } } return pdbIds; }
[ "public", "List", "<", "String", ">", "getAllPDBIDs", "(", ")", "throws", "IOException", "{", "File", "f", "=", "new", "File", "(", "path", ")", ";", "if", "(", "!", "f", ".", "isDirectory", "(", ")", ")", "throw", "new", "IOException", "(", "\"Path ...
Returns a list of all PDB IDs that are available in this installation @return a list of PDB IDs
[ "Returns", "a", "list", "of", "all", "PDB", "IDs", "that", "are", "available", "in", "this", "installation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SandboxStyleStructureProvider.java#L182-L205
31,712
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java
BioAssemblyTools.getMaximumExtend
public static double getMaximumExtend( final Structure structure ) { double[][] bounds = getAtomCoordinateBounds(structure); double xMax = Math.abs(bounds[0][0] - bounds[1][0]); double yMax = Math.abs(bounds[0][1] - bounds[1][1]); double zMax = Math.abs(bounds[0][2] - bounds[1][2]); return Math.max(xMax, Math.max(yMax, zMax)); }
java
public static double getMaximumExtend( final Structure structure ) { double[][] bounds = getAtomCoordinateBounds(structure); double xMax = Math.abs(bounds[0][0] - bounds[1][0]); double yMax = Math.abs(bounds[0][1] - bounds[1][1]); double zMax = Math.abs(bounds[0][2] - bounds[1][2]); return Math.max(xMax, Math.max(yMax, zMax)); }
[ "public", "static", "double", "getMaximumExtend", "(", "final", "Structure", "structure", ")", "{", "double", "[", "]", "[", "]", "bounds", "=", "getAtomCoordinateBounds", "(", "structure", ")", ";", "double", "xMax", "=", "Math", ".", "abs", "(", "bounds", ...
Returns the maximum extend of the structure in the x, y, or z direction. @param structure @return maximum extend
[ "Returns", "the", "maximum", "extend", "of", "the", "structure", "in", "the", "x", "y", "or", "z", "direction", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java#L242-L248
31,713
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java
BioAssemblyTools.getBiologicalMoleculeMaximumExtend
public static double getBiologicalMoleculeMaximumExtend( final Structure structure,List<BiologicalAssemblyTransformation> transformations ) { double[][] bounds = getBiologicalMoleculeBounds(structure, transformations); double xMax = Math.abs(bounds[0][0] - bounds[1][0]); double yMax = Math.abs(bounds[0][1] - bounds[1][1]); double zMax = Math.abs(bounds[0][2] - bounds[1][2]); return Math.max(xMax, Math.max(yMax, zMax)); }
java
public static double getBiologicalMoleculeMaximumExtend( final Structure structure,List<BiologicalAssemblyTransformation> transformations ) { double[][] bounds = getBiologicalMoleculeBounds(structure, transformations); double xMax = Math.abs(bounds[0][0] - bounds[1][0]); double yMax = Math.abs(bounds[0][1] - bounds[1][1]); double zMax = Math.abs(bounds[0][2] - bounds[1][2]); return Math.max(xMax, Math.max(yMax, zMax)); }
[ "public", "static", "double", "getBiologicalMoleculeMaximumExtend", "(", "final", "Structure", "structure", ",", "List", "<", "BiologicalAssemblyTransformation", ">", "transformations", ")", "{", "double", "[", "]", "[", "]", "bounds", "=", "getBiologicalMoleculeBounds"...
Returns the maximum extend of the biological molecule in the x, y, or z direction. @param structure @return maximum extend
[ "Returns", "the", "maximum", "extend", "of", "the", "biological", "molecule", "in", "the", "x", "y", "or", "z", "direction", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java#L255-L261
31,714
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java
BioAssemblyTools.getBiologicalMoleculeCentroid
public static double[] getBiologicalMoleculeCentroid( final Structure asymUnit,List<BiologicalAssemblyTransformation> transformations ) throws IllegalArgumentException { if ( asymUnit == null ) { throw new IllegalArgumentException( "null structure" ); } Atom[] atoms = StructureTools.getAllAtomArray(asymUnit); int atomCount = atoms.length; double[] centroid = new double[3]; if ( atomCount <= 0 ) { return centroid; } if ( transformations.size() == 0) { return Calc.getCentroid(atoms).getCoords(); } int count = 0; double[] transformedCoordinate = new double[3]; for (int i = 0; i < atomCount; i++) { Atom atom = atoms[i]; Chain chain = atom.getGroup().getChain(); String intChainID = chain.getId(); for (BiologicalAssemblyTransformation m: transformations) { if (! m.getChainId().equals(intChainID)) continue; Point3d coords = atom.getCoordsAsPoint3d(); transformedCoordinate[0] = coords.x; transformedCoordinate[1] = coords.y; transformedCoordinate[2] = coords.z; m.transformPoint(transformedCoordinate); centroid[0] += transformedCoordinate[0]; centroid[1] += transformedCoordinate[1]; centroid[2] += transformedCoordinate[2]; count++; } } centroid[0] /= count; centroid[1] /= count; centroid[2] /= count; return centroid; }
java
public static double[] getBiologicalMoleculeCentroid( final Structure asymUnit,List<BiologicalAssemblyTransformation> transformations ) throws IllegalArgumentException { if ( asymUnit == null ) { throw new IllegalArgumentException( "null structure" ); } Atom[] atoms = StructureTools.getAllAtomArray(asymUnit); int atomCount = atoms.length; double[] centroid = new double[3]; if ( atomCount <= 0 ) { return centroid; } if ( transformations.size() == 0) { return Calc.getCentroid(atoms).getCoords(); } int count = 0; double[] transformedCoordinate = new double[3]; for (int i = 0; i < atomCount; i++) { Atom atom = atoms[i]; Chain chain = atom.getGroup().getChain(); String intChainID = chain.getId(); for (BiologicalAssemblyTransformation m: transformations) { if (! m.getChainId().equals(intChainID)) continue; Point3d coords = atom.getCoordsAsPoint3d(); transformedCoordinate[0] = coords.x; transformedCoordinate[1] = coords.y; transformedCoordinate[2] = coords.z; m.transformPoint(transformedCoordinate); centroid[0] += transformedCoordinate[0]; centroid[1] += transformedCoordinate[1]; centroid[2] += transformedCoordinate[2]; count++; } } centroid[0] /= count; centroid[1] /= count; centroid[2] /= count; return centroid; }
[ "public", "static", "double", "[", "]", "getBiologicalMoleculeCentroid", "(", "final", "Structure", "asymUnit", ",", "List", "<", "BiologicalAssemblyTransformation", ">", "transformations", ")", "throws", "IllegalArgumentException", "{", "if", "(", "asymUnit", "==", "...
Returns the centroid of the biological molecule. @param structure @return centroid @throws IllegalArgumentException if structure is null
[ "Returns", "the", "centroid", "of", "the", "biological", "molecule", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BioAssemblyTools.java#L270-L323
31,715
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.fromBioExt
public static Location fromBioExt( int start, int length, char strand, int totalLength ) { int s= start; int e= s + length; if( !( strand == '-' || strand == '+' || strand == '.' )) { throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" ); } if( strand == '-' ) { s= s - totalLength; e= e - totalLength; } return new Location( s, e ); }
java
public static Location fromBioExt( int start, int length, char strand, int totalLength ) { int s= start; int e= s + length; if( !( strand == '-' || strand == '+' || strand == '.' )) { throw new IllegalArgumentException( "Strand must be '+', '-', or '.'" ); } if( strand == '-' ) { s= s - totalLength; e= e - totalLength; } return new Location( s, e ); }
[ "public", "static", "Location", "fromBioExt", "(", "int", "start", ",", "int", "length", ",", "char", "strand", ",", "int", "totalLength", ")", "{", "int", "s", "=", "start", ";", "int", "e", "=", "s", "+", "length", ";", "if", "(", "!", "(", "stra...
Create a location from MAF file coordinates, which represent negative strand locations as the distance from the end of the sequence. @param start Origin 1 index of first symbol. @param length Number of symbols in range. @param strand '+' or '-' or '.' ('.' is interpreted as '+'). @param totalLength Total number of symbols in sequence. @throws IllegalArgumentException Strand must be '+', '-', '.'
[ "Create", "a", "location", "from", "MAF", "file", "coordinates", "which", "represent", "negative", "strand", "locations", "as", "the", "distance", "from", "the", "end", "of", "the", "sequence", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L164-L181
31,716
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.intersection
public Location intersection(Location other) { if (isSameStrand(other)) { return intersect(mStart, mEnd, other.mStart, other.mEnd); } else { throw new IllegalArgumentException("Locations are on opposite strands."); } }
java
public Location intersection(Location other) { if (isSameStrand(other)) { return intersect(mStart, mEnd, other.mStart, other.mEnd); } else { throw new IllegalArgumentException("Locations are on opposite strands."); } }
[ "public", "Location", "intersection", "(", "Location", "other", ")", "{", "if", "(", "isSameStrand", "(", "other", ")", ")", "{", "return", "intersect", "(", "mStart", ",", "mEnd", ",", "other", ".", "mStart", ",", "other", ".", "mEnd", ")", ";", "}", ...
Return the intersection, or null if no overlap. @param other The location to intersect. @return The maximal location that is contained by both. Returns null if no overlap! @throws IllegalArgumentException Locations are on opposite strands.
[ "Return", "the", "intersection", "or", "null", "if", "no", "overlap", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L288-L294
31,717
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.upstream
public Location upstream( int length ) { if( length < 0 ) { throw new IllegalArgumentException( "Parameter must be >= 0; is=" + length ); } if( Math.signum( mStart - length) == Math.signum( mStart ) || 0 == Math.signum( mStart - length ) ) { return new Location(mStart - length, mStart ); } else { throw new IndexOutOfBoundsException( "Specified length causes crossing of origin: " + length + "; " + toString() ); } }
java
public Location upstream( int length ) { if( length < 0 ) { throw new IllegalArgumentException( "Parameter must be >= 0; is=" + length ); } if( Math.signum( mStart - length) == Math.signum( mStart ) || 0 == Math.signum( mStart - length ) ) { return new Location(mStart - length, mStart ); } else { throw new IndexOutOfBoundsException( "Specified length causes crossing of origin: " + length + "; " + toString() ); } }
[ "public", "Location", "upstream", "(", "int", "length", ")", "{", "if", "(", "length", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter must be >= 0; is=\"", "+", "length", ")", ";", "}", "if", "(", "Math", ".", "signum", "...
Return the adjacent location of specified length directly upstream of this location. @return Upstream location. @param length The length of the upstream location. @throws IndexOutOfBoundsException Specified length causes crossing of origin.
[ "Return", "the", "adjacent", "location", "of", "specified", "length", "directly", "upstream", "of", "this", "location", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L556-L571
31,718
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.downstream
public Location downstream( int length ) { if( length < 0 ) { throw new IllegalArgumentException( "Parameter must be >= 0; is=" + length ); } if( Math.signum( mEnd + length) == Math.signum( mEnd ) || 0 == Math.signum( mEnd + length ) ) { return new Location( mEnd, mEnd + length ); } else { throw new IndexOutOfBoundsException( "Specified length causes crossing of origin: " + length + "; " + toString() ); } }
java
public Location downstream( int length ) { if( length < 0 ) { throw new IllegalArgumentException( "Parameter must be >= 0; is=" + length ); } if( Math.signum( mEnd + length) == Math.signum( mEnd ) || 0 == Math.signum( mEnd + length ) ) { return new Location( mEnd, mEnd + length ); } else { throw new IndexOutOfBoundsException( "Specified length causes crossing of origin: " + length + "; " + toString() ); } }
[ "public", "Location", "downstream", "(", "int", "length", ")", "{", "if", "(", "length", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter must be >= 0; is=\"", "+", "length", ")", ";", "}", "if", "(", "Math", ".", "signum", ...
Return the adjacent location of specified length directly downstream of this location. @return The downstream location. @param length The length of the downstream location. @throws IndexOutOfBoundsException Specified length causes crossing of origin.
[ "Return", "the", "adjacent", "location", "of", "specified", "length", "directly", "downstream", "of", "this", "location", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L580-L596
31,719
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.distance
public int distance( Location other ) { if( isSameStrand( other )) { if( overlaps( other )) { return -1; } else { return ( mEnd <= other.mStart )? (other.mStart - mEnd) : (mStart - other.mEnd); } } else { throw new IllegalArgumentException( "Locations are on opposite strands." ); } }
java
public int distance( Location other ) { if( isSameStrand( other )) { if( overlaps( other )) { return -1; } else { return ( mEnd <= other.mStart )? (other.mStart - mEnd) : (mStart - other.mEnd); } } else { throw new IllegalArgumentException( "Locations are on opposite strands." ); } }
[ "public", "int", "distance", "(", "Location", "other", ")", "{", "if", "(", "isSameStrand", "(", "other", ")", ")", "{", "if", "(", "overlaps", "(", "other", ")", ")", "{", "return", "-", "1", ";", "}", "else", "{", "return", "(", "mEnd", "<=", "...
Return distance between this location and the other location. Distance is defined only if both locations are on same strand. @param other The location to compare. @return The integer distance. Returns -1 if they overlap; 0 if directly adjacent. @throws IllegalArgumentException Locations are on opposite strands.
[ "Return", "distance", "between", "this", "location", "and", "the", "other", "location", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L609-L626
31,720
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.percentOverlap
public double percentOverlap( Location other ) { if( length() > 0 && overlaps( other )) { return 100.0 * (((double) intersection( other ).length()) / (double) length()); } else { return 0; } }
java
public double percentOverlap( Location other ) { if( length() > 0 && overlaps( other )) { return 100.0 * (((double) intersection( other ).length()) / (double) length()); } else { return 0; } }
[ "public", "double", "percentOverlap", "(", "Location", "other", ")", "{", "if", "(", "length", "(", ")", ">", "0", "&&", "overlaps", "(", "other", ")", ")", "{", "return", "100.0", "*", "(", "(", "(", "double", ")", "intersection", "(", "other", ")",...
Return percent overlap of two locations. @param other The location to compare. @return 100.0 * intersection(other).length() / this.length() @throws IllegalArgumentException Locations are on opposite strands.
[ "Return", "percent", "overlap", "of", "two", "locations", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L635-L645
31,721
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java
Location.contains
public boolean contains( Location other ) { if( isSameStrand( other )) { return ( mStart <= other.mStart && mEnd >= other.mEnd ); } else { throw new IllegalArgumentException( "Locations are on opposite strands." ); } }
java
public boolean contains( Location other ) { if( isSameStrand( other )) { return ( mStart <= other.mStart && mEnd >= other.mEnd ); } else { throw new IllegalArgumentException( "Locations are on opposite strands." ); } }
[ "public", "boolean", "contains", "(", "Location", "other", ")", "{", "if", "(", "isSameStrand", "(", "other", ")", ")", "{", "return", "(", "mStart", "<=", "other", ".", "mStart", "&&", "mEnd", ">=", "other", ".", "mEnd", ")", ";", "}", "else", "{", ...
Check if this location contains the other. @param other The location to compare. @return True if other is entirely contained by this location. @throws IllegalArgumentException Locations are on opposite strands.
[ "Check", "if", "this", "location", "contains", "the", "other", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/Location.java#L673-L683
31,722
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java
BiologicalAssemblyTransformation.transformPoint
public void transformPoint(final double[] point) { Point3d p = new Point3d(point[0],point[1],point[2]); transformation.transform(p); point[0] = p.x; point[1] = p.y; point[2] = p.z; }
java
public void transformPoint(final double[] point) { Point3d p = new Point3d(point[0],point[1],point[2]); transformation.transform(p); point[0] = p.x; point[1] = p.y; point[2] = p.z; }
[ "public", "void", "transformPoint", "(", "final", "double", "[", "]", "point", ")", "{", "Point3d", "p", "=", "new", "Point3d", "(", "point", "[", "0", "]", ",", "point", "[", "1", "]", ",", "point", "[", "2", "]", ")", ";", "transformation", ".", ...
Applies the transformation to given point.
[ "Applies", "the", "transformation", "to", "given", "point", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyTransformation.java#L153-L159
31,723
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java
StrataInfo.getNearestTime
public Double getNearestTime(double timePercentage) { //the arrays should be sorted by time so this step is probably not needed Double minTime = null; Double maxTime = null; for (Double t : time) { if (minTime == null || t < minTime) { minTime = t; } if (maxTime == null || t > maxTime) { maxTime = t; } } Double timeRange = maxTime - minTime; Double targetTime = minTime + timePercentage * timeRange; Double previousTime = null; for (Double t : time) { if (previousTime == null || t <= targetTime) { previousTime = t; } else { return previousTime; } } return previousTime; }
java
public Double getNearestTime(double timePercentage) { //the arrays should be sorted by time so this step is probably not needed Double minTime = null; Double maxTime = null; for (Double t : time) { if (minTime == null || t < minTime) { minTime = t; } if (maxTime == null || t > maxTime) { maxTime = t; } } Double timeRange = maxTime - minTime; Double targetTime = minTime + timePercentage * timeRange; Double previousTime = null; for (Double t : time) { if (previousTime == null || t <= targetTime) { previousTime = t; } else { return previousTime; } } return previousTime; }
[ "public", "Double", "getNearestTime", "(", "double", "timePercentage", ")", "{", "//the arrays should be sorted by time so this step is probably not needed", "Double", "minTime", "=", "null", ";", "Double", "maxTime", "=", "null", ";", "for", "(", "Double", "t", ":", ...
Need to find the actual time for the nearest time represented as a percentage Would be used to then look up the number at risk at that particular time @param timePercentage @return
[ "Need", "to", "find", "the", "actual", "time", "for", "the", "nearest", "time", "represented", "as", "a", "percentage", "Would", "be", "used", "to", "then", "look", "up", "the", "number", "at", "risk", "at", "that", "particular", "time" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java#L58-L81
31,724
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java
StrataInfo.getNearestAtRisk
public Double getNearestAtRisk(double t) { Integer index = 0; /* String timeValue = t + ""; String format = "#"; int numDecimals = 0; int decimalIndex = timeValue.indexOf("."); if (decimalIndex > 0) { for (int i = timeValue.length() - 1; i > decimalIndex; i--) { if (timeValue.charAt(i) == '0' && numDecimals == 0) { continue; } if (i == decimalIndex - 1) { format = format + ".#"; } else { format = format + "#"; } } } */ DecimalFormat newFormat = new DecimalFormat("#.#"); //used to round on expected precision of time. Not correct but trying to match the other packages for (int i = 0; i < time.size(); i++) { Double compareTime = time.get(i); // compareTime = new Double(Math.round(compareTime)); //this is rounding up so that we stop on the first match trying to get this to match another report. Not correct or the other report is wrong compareTime = Double.valueOf(newFormat.format(compareTime)); if (compareTime < t) { index = i + 1 ; } else if(compareTime == t){ index = i; break; }else { break; } } //http://www.inside-r.org/packages/cran/rms/docs/survplot //per validation using survplot from RMS package and ggkm they select the next //time in the future which doesn't seem to be correct as the next time represents //knowledge about the future but maybe nrisk at that point in time is defined //as the nrisk prior to that time. This appears to be the case where at time 0 //you would expect that everyone is at risk and you should report that time which //is the case in survplot. Added in index = 0 or if the time you are requesting has //an exact match //survplot(kma,n.risk=TRUE,time.inc=1090) //ggkm(kma,timeby=1090) // if(index != 0 && time.get(index) != t){ // index++; // } if (index >= nrisk.size()) { return null; } else { return nrisk.get(index); } }
java
public Double getNearestAtRisk(double t) { Integer index = 0; /* String timeValue = t + ""; String format = "#"; int numDecimals = 0; int decimalIndex = timeValue.indexOf("."); if (decimalIndex > 0) { for (int i = timeValue.length() - 1; i > decimalIndex; i--) { if (timeValue.charAt(i) == '0' && numDecimals == 0) { continue; } if (i == decimalIndex - 1) { format = format + ".#"; } else { format = format + "#"; } } } */ DecimalFormat newFormat = new DecimalFormat("#.#"); //used to round on expected precision of time. Not correct but trying to match the other packages for (int i = 0; i < time.size(); i++) { Double compareTime = time.get(i); // compareTime = new Double(Math.round(compareTime)); //this is rounding up so that we stop on the first match trying to get this to match another report. Not correct or the other report is wrong compareTime = Double.valueOf(newFormat.format(compareTime)); if (compareTime < t) { index = i + 1 ; } else if(compareTime == t){ index = i; break; }else { break; } } //http://www.inside-r.org/packages/cran/rms/docs/survplot //per validation using survplot from RMS package and ggkm they select the next //time in the future which doesn't seem to be correct as the next time represents //knowledge about the future but maybe nrisk at that point in time is defined //as the nrisk prior to that time. This appears to be the case where at time 0 //you would expect that everyone is at risk and you should report that time which //is the case in survplot. Added in index = 0 or if the time you are requesting has //an exact match //survplot(kma,n.risk=TRUE,time.inc=1090) //ggkm(kma,timeby=1090) // if(index != 0 && time.get(index) != t){ // index++; // } if (index >= nrisk.size()) { return null; } else { return nrisk.get(index); } }
[ "public", "Double", "getNearestAtRisk", "(", "double", "t", ")", "{", "Integer", "index", "=", "0", ";", "/* String timeValue = t + \"\";\n\t\tString format = \"#\";\n\t\tint numDecimals = 0;\n\t\tint decimalIndex = timeValue.indexOf(\".\");\n\t\tif (decimalIndex > 0) {\n\t\t\tfor (i...
Selection of number of risk will depend on the precision and rounding of time in the survival table. If you are asking for 12 and entry exists for 11.9999999 then 12 is greater than 11.99999 unless you round. @param t @return
[ "Selection", "of", "number", "of", "risk", "will", "depend", "on", "the", "precision", "and", "rounding", "of", "time", "in", "the", "survival", "table", ".", "If", "you", "are", "asking", "for", "12", "and", "entry", "exists", "for", "11", ".", "9999999...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/StrataInfo.java#L91-L144
31,725
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java
JmolSymmetryScriptGeneratorH.getDefaultOrientation
@Override public String getDefaultOrientation() { StringBuilder s = new StringBuilder(); s.append(setCentroid()); Quat4d q = new Quat4d(); q.set(helixAxisAligner.getRotationMatrix()); // set orientation s.append("moveto 0 quaternion{"); s.append(jMolFloat(q.x)); s.append(","); s.append(jMolFloat(q.y)); s.append(","); s.append(jMolFloat(q.z)); s.append(","); s.append(jMolFloat(q.w)); s.append("};"); return s.toString(); }
java
@Override public String getDefaultOrientation() { StringBuilder s = new StringBuilder(); s.append(setCentroid()); Quat4d q = new Quat4d(); q.set(helixAxisAligner.getRotationMatrix()); // set orientation s.append("moveto 0 quaternion{"); s.append(jMolFloat(q.x)); s.append(","); s.append(jMolFloat(q.y)); s.append(","); s.append(jMolFloat(q.z)); s.append(","); s.append(jMolFloat(q.w)); s.append("};"); return s.toString(); }
[ "@", "Override", "public", "String", "getDefaultOrientation", "(", ")", "{", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "s", ".", "append", "(", "setCentroid", "(", ")", ")", ";", "Quat4d", "q", "=", "new", "Quat4d", "(", ")", ";...
Returns a Jmol script to set the default orientation for a structure @return Jmol script
[ "Returns", "a", "Jmol", "script", "to", "set", "the", "default", "orientation", "for", "a", "structure" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java#L69-L88
31,726
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java
JmolSymmetryScriptGeneratorH.playOrientations
@Override public String playOrientations() { StringBuilder s = new StringBuilder(); // draw footer s.append(drawFooter("Symmetry Helical", "white")); // draw polygon s.append(drawPolyhedron()); // draw invisibly s.append(showPolyhedron()); // draw axes s.append(drawAxes()); s.append(showAxes()); // loop over all orientations with 4 sec. delay for (int i = 0; i < getOrientationCount(); i++) { s.append(deleteHeader()); s.append(getOrientationWithZoom(i)); s.append(drawHeader(getOrientationName(i), "white")); s.append("delay 4;"); } // go back to first orientation s.append(deleteHeader()); s.append(getOrientationWithZoom(0)); s.append(drawHeader(getOrientationName(0), "white")); return s.toString(); }
java
@Override public String playOrientations() { StringBuilder s = new StringBuilder(); // draw footer s.append(drawFooter("Symmetry Helical", "white")); // draw polygon s.append(drawPolyhedron()); // draw invisibly s.append(showPolyhedron()); // draw axes s.append(drawAxes()); s.append(showAxes()); // loop over all orientations with 4 sec. delay for (int i = 0; i < getOrientationCount(); i++) { s.append(deleteHeader()); s.append(getOrientationWithZoom(i)); s.append(drawHeader(getOrientationName(i), "white")); s.append("delay 4;"); } // go back to first orientation s.append(deleteHeader()); s.append(getOrientationWithZoom(0)); s.append(drawHeader(getOrientationName(0), "white")); return s.toString(); }
[ "@", "Override", "public", "String", "playOrientations", "(", ")", "{", "StringBuilder", "s", "=", "new", "StringBuilder", "(", ")", ";", "// draw footer", "s", ".", "append", "(", "drawFooter", "(", "\"Symmetry Helical\"", ",", "\"white\"", ")", ")", ";", "...
Returns a Jmol script that displays a symmetry polyhedron and symmetry axes and then loop through different orientations @return Jmol script
[ "Returns", "a", "Jmol", "script", "that", "displays", "a", "symmetry", "polyhedron", "and", "symmetry", "axes", "and", "then", "loop", "through", "different", "orientations" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java#L366-L395
31,727
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java
JmolSymmetryScriptGeneratorH.colorBySymmetry
@Override public String colorBySymmetry() { List<List<Integer>> units = helixAxisAligner.getHelixLayers().getByLargestContacts().getLayerLines(); units = orientLayerLines(units); QuatSymmetrySubunits subunits = helixAxisAligner.getSubunits(); List<Integer> modelNumbers = subunits.getModelNumbers(); List<String> chainIds = subunits.getChainIds(); List<Integer> clusterIds = subunits.getClusterIds(); int clusterCount = Collections.max(clusterIds) + 1; Map<Color4f, List<String>> colorMap = new HashMap<Color4f, List<String>>(); int maxLen = 0; for (List<Integer> unit: units) { maxLen = Math.max(maxLen, unit.size()); } // Color4f[] colors = getSymmetryColors(permutation.size()); Color4f[] colors = getSymmetryColors(subunits.getSubunitCount()); int count = 0; for (int i = 0; i < maxLen; i++) { for (int j = 0; j < units.size(); j++) { int m = units.get(j).size(); if (i < m) { int subunit = units.get(j).get(i); int cluster = clusterIds.get(subunit); float scale = 0.3f + 0.7f * (cluster+1)/clusterCount; Color4f c = new Color4f(colors[count]); count++; c.scale(scale); List<String> ids = colorMap.get(c); if (ids == null) { ids = new ArrayList<String>(); colorMap.put(c, ids); } String id = getChainSpecification(modelNumbers, chainIds, subunit); ids.add(id); } } } String coloring = defaultColoring + getJmolColorScript(colorMap); return coloring; }
java
@Override public String colorBySymmetry() { List<List<Integer>> units = helixAxisAligner.getHelixLayers().getByLargestContacts().getLayerLines(); units = orientLayerLines(units); QuatSymmetrySubunits subunits = helixAxisAligner.getSubunits(); List<Integer> modelNumbers = subunits.getModelNumbers(); List<String> chainIds = subunits.getChainIds(); List<Integer> clusterIds = subunits.getClusterIds(); int clusterCount = Collections.max(clusterIds) + 1; Map<Color4f, List<String>> colorMap = new HashMap<Color4f, List<String>>(); int maxLen = 0; for (List<Integer> unit: units) { maxLen = Math.max(maxLen, unit.size()); } // Color4f[] colors = getSymmetryColors(permutation.size()); Color4f[] colors = getSymmetryColors(subunits.getSubunitCount()); int count = 0; for (int i = 0; i < maxLen; i++) { for (int j = 0; j < units.size(); j++) { int m = units.get(j).size(); if (i < m) { int subunit = units.get(j).get(i); int cluster = clusterIds.get(subunit); float scale = 0.3f + 0.7f * (cluster+1)/clusterCount; Color4f c = new Color4f(colors[count]); count++; c.scale(scale); List<String> ids = colorMap.get(c); if (ids == null) { ids = new ArrayList<String>(); colorMap.put(c, ids); } String id = getChainSpecification(modelNumbers, chainIds, subunit); ids.add(id); } } } String coloring = defaultColoring + getJmolColorScript(colorMap); return coloring; }
[ "@", "Override", "public", "String", "colorBySymmetry", "(", ")", "{", "List", "<", "List", "<", "Integer", ">>", "units", "=", "helixAxisAligner", ".", "getHelixLayers", "(", ")", ".", "getByLargestContacts", "(", ")", ".", "getLayerLines", "(", ")", ";", ...
Returns a Jmol script that colors subunits to highlight the symmetry within a structure Different subunits should have a consistent color scheme or different shade of the same colors @return Jmol script
[ "Returns", "a", "Jmol", "script", "that", "colors", "subunits", "to", "highlight", "the", "symmetry", "within", "a", "structure", "Different", "subunits", "should", "have", "a", "consistent", "color", "scheme", "or", "different", "shade", "of", "the", "same", ...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java#L474-L518
31,728
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java
JmolSymmetryScriptGeneratorH.orientLayerLines
private List<List<Integer>> orientLayerLines(List<List<Integer>> layerLines) { Matrix4d transformation = helixAxisAligner.getTransformation(); List<Point3d> centers = helixAxisAligner.getSubunits().getOriginalCenters(); for (int i = 0; i < layerLines.size(); i++) { List<Integer> layerLine = layerLines.get(i); // get center of first subunit in layerline and transform to standard orientation (helix axis aligned with y-axis) int first = layerLine.get(0); Point3d firstSubunit = new Point3d(centers.get(first)); transformation.transform(firstSubunit); // get center of last subunit in layerline and transform to standard orientation (helix axis aligned with y-axis) int last = layerLine.get(layerLine.size()-1); Point3d lastSubunit = new Point3d(centers.get(last)); transformation.transform(lastSubunit); // a layerline should start at the lowest y-value, so all layerlines have a consistent direction from -y value to +y value if (firstSubunit.y > lastSubunit.y) { // System.out.println("reorienting layer line: " + layerLine); Collections.reverse(layerLine); } } return layerLines; }
java
private List<List<Integer>> orientLayerLines(List<List<Integer>> layerLines) { Matrix4d transformation = helixAxisAligner.getTransformation(); List<Point3d> centers = helixAxisAligner.getSubunits().getOriginalCenters(); for (int i = 0; i < layerLines.size(); i++) { List<Integer> layerLine = layerLines.get(i); // get center of first subunit in layerline and transform to standard orientation (helix axis aligned with y-axis) int first = layerLine.get(0); Point3d firstSubunit = new Point3d(centers.get(first)); transformation.transform(firstSubunit); // get center of last subunit in layerline and transform to standard orientation (helix axis aligned with y-axis) int last = layerLine.get(layerLine.size()-1); Point3d lastSubunit = new Point3d(centers.get(last)); transformation.transform(lastSubunit); // a layerline should start at the lowest y-value, so all layerlines have a consistent direction from -y value to +y value if (firstSubunit.y > lastSubunit.y) { // System.out.println("reorienting layer line: " + layerLine); Collections.reverse(layerLine); } } return layerLines; }
[ "private", "List", "<", "List", "<", "Integer", ">", ">", "orientLayerLines", "(", "List", "<", "List", "<", "Integer", ">", ">", "layerLines", ")", "{", "Matrix4d", "transformation", "=", "helixAxisAligner", ".", "getTransformation", "(", ")", ";", "List", ...
Orients layer lines from lowest y-axis value to largest y-axis value
[ "Orients", "layer", "lines", "from", "lowest", "y", "-", "axis", "value", "to", "largest", "y", "-", "axis", "value" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/symmetry/jmolScript/JmolSymmetryScriptGeneratorH.java#L536-L560
31,729
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java
MultipleAlignmentWriter.toTransformMatrices
public static String toTransformMatrices(MultipleAlignment alignment) { StringBuffer txt = new StringBuffer(); for (int bs = 0; bs < alignment.getBlockSets().size(); bs++) { List<Matrix4d> btransforms = alignment.getBlockSet(bs) .getTransformations(); if (btransforms == null || btransforms.size() < 1) continue; if (alignment.getBlockSets().size() > 1) { txt.append("Operations for block "); txt.append(bs + 1); txt.append("\n"); } for (int str = 0; str < alignment.size(); str++) { String origString = "ref"; txt.append(String.format(" X"+(str+1)+ " = (%9.6f)*X"+ origString +" + (%9.6f)*Y"+ origString +" + (%9.6f)*Z"+ origString +" + (%12.6f)", btransforms.get(str).getElement(0,0), btransforms.get(str).getElement(0,1), btransforms.get(str).getElement(0,2), btransforms.get(str).getElement(0,3))); txt.append( "\n"); txt.append(String.format(" Y"+(str+1)+" = (%9.6f)*X"+ origString +" + (%9.6f)*Y"+ origString +" + (%9.6f)*Z"+ origString +" + (%12.6f)", btransforms.get(str).getElement(1,0), btransforms.get(str).getElement(1,1), btransforms.get(str).getElement(1,2), btransforms.get(str).getElement(1,3))); txt.append( "\n"); txt.append(String.format(" Z"+(str+1)+" = (%9.6f)*X"+ origString +" + (%9.6f)*Y"+ origString +" + (%9.6f)*Z"+ origString +" + (%12.6f)", btransforms.get(str).getElement(2,0), btransforms.get(str).getElement(2,1), btransforms.get(str).getElement(2,2), btransforms.get(str).getElement(2,3))); txt.append("\n\n"); } } return txt.toString(); }
java
public static String toTransformMatrices(MultipleAlignment alignment) { StringBuffer txt = new StringBuffer(); for (int bs = 0; bs < alignment.getBlockSets().size(); bs++) { List<Matrix4d> btransforms = alignment.getBlockSet(bs) .getTransformations(); if (btransforms == null || btransforms.size() < 1) continue; if (alignment.getBlockSets().size() > 1) { txt.append("Operations for block "); txt.append(bs + 1); txt.append("\n"); } for (int str = 0; str < alignment.size(); str++) { String origString = "ref"; txt.append(String.format(" X"+(str+1)+ " = (%9.6f)*X"+ origString +" + (%9.6f)*Y"+ origString +" + (%9.6f)*Z"+ origString +" + (%12.6f)", btransforms.get(str).getElement(0,0), btransforms.get(str).getElement(0,1), btransforms.get(str).getElement(0,2), btransforms.get(str).getElement(0,3))); txt.append( "\n"); txt.append(String.format(" Y"+(str+1)+" = (%9.6f)*X"+ origString +" + (%9.6f)*Y"+ origString +" + (%9.6f)*Z"+ origString +" + (%12.6f)", btransforms.get(str).getElement(1,0), btransforms.get(str).getElement(1,1), btransforms.get(str).getElement(1,2), btransforms.get(str).getElement(1,3))); txt.append( "\n"); txt.append(String.format(" Z"+(str+1)+" = (%9.6f)*X"+ origString +" + (%9.6f)*Y"+ origString +" + (%9.6f)*Z"+ origString +" + (%12.6f)", btransforms.get(str).getElement(2,0), btransforms.get(str).getElement(2,1), btransforms.get(str).getElement(2,2), btransforms.get(str).getElement(2,3))); txt.append("\n\n"); } } return txt.toString(); }
[ "public", "static", "String", "toTransformMatrices", "(", "MultipleAlignment", "alignment", ")", "{", "StringBuffer", "txt", "=", "new", "StringBuffer", "(", ")", ";", "for", "(", "int", "bs", "=", "0", ";", "bs", "<", "alignment", ".", "getBlockSets", "(", ...
Converts the transformation Matrices of the alignment into a String output. @param afpChain @return String transformation Matrices
[ "Converts", "the", "transformation", "Matrices", "of", "the", "alignment", "into", "a", "String", "output", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java#L198-L248
31,730
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java
MultipleAlignmentWriter.toXML
public static String toXML(MultipleAlignmentEnsemble ensemble) throws IOException { StringWriter result = new StringWriter(); PrintWriter writer = new PrintWriter(result); PrettyXMLWriter xml = new PrettyXMLWriter(writer); MultipleAlignmentXMLConverter.printXMLensemble(xml, ensemble); writer.close(); return result.toString(); }
java
public static String toXML(MultipleAlignmentEnsemble ensemble) throws IOException { StringWriter result = new StringWriter(); PrintWriter writer = new PrintWriter(result); PrettyXMLWriter xml = new PrettyXMLWriter(writer); MultipleAlignmentXMLConverter.printXMLensemble(xml, ensemble); writer.close(); return result.toString(); }
[ "public", "static", "String", "toXML", "(", "MultipleAlignmentEnsemble", "ensemble", ")", "throws", "IOException", "{", "StringWriter", "result", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "result", ")", "...
Converts all the information of a multiple alignment ensemble into an XML String format. Cached variables, like transformation matrices and scores, are also converted. @param ensemble the MultipleAlignmentEnsemble to convert. @return String XML representation of the ensemble @throws IOException @see MultipleAlignmentXMLConverter Helper methods for XML conversion
[ "Converts", "all", "the", "information", "of", "a", "multiple", "alignment", "ensemble", "into", "an", "XML", "String", "format", ".", "Cached", "variables", "like", "transformation", "matrices", "and", "scores", "are", "also", "converted", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentWriter.java#L261-L273
31,731
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java
FastqTools.qualityScores
public static Iterable<Number> qualityScores(final Fastq fastq) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } int size = fastq.getQuality().length(); List<Number> qualityScores = Lists.newArrayListWithExpectedSize(size); FastqVariant variant = fastq.getVariant(); for (int i = 0; i < size; i++) { char c = fastq.getQuality().charAt(i); qualityScores.add(variant.qualityScore(c)); } return ImmutableList.copyOf(qualityScores); }
java
public static Iterable<Number> qualityScores(final Fastq fastq) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } int size = fastq.getQuality().length(); List<Number> qualityScores = Lists.newArrayListWithExpectedSize(size); FastqVariant variant = fastq.getVariant(); for (int i = 0; i < size; i++) { char c = fastq.getQuality().charAt(i); qualityScores.add(variant.qualityScore(c)); } return ImmutableList.copyOf(qualityScores); }
[ "public", "static", "Iterable", "<", "Number", ">", "qualityScores", "(", "final", "Fastq", "fastq", ")", "{", "if", "(", "fastq", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fastq must not be null\"", ")", ";", "}", "int", "s...
Return the quality scores from the specified FASTQ formatted sequence. @param fastq FASTQ formatted sequence, must not be null @return the quality scores from the specified FASTQ formatted sequence
[ "Return", "the", "quality", "scores", "from", "the", "specified", "FASTQ", "formatted", "sequence", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java#L167-L182
31,732
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java
FastqTools.qualityScores
public static int[] qualityScores(final Fastq fastq, final int[] qualityScores) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (qualityScores == null) { throw new IllegalArgumentException("qualityScores must not be null"); } int size = fastq.getQuality().length(); if (qualityScores.length != size) { throw new IllegalArgumentException("qualityScores must be the same length as the FASTQ formatted sequence quality"); } FastqVariant variant = fastq.getVariant(); for (int i = 0; i < size; i++) { char c = fastq.getQuality().charAt(i); qualityScores[i] = variant.qualityScore(c); } return qualityScores; }
java
public static int[] qualityScores(final Fastq fastq, final int[] qualityScores) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (qualityScores == null) { throw new IllegalArgumentException("qualityScores must not be null"); } int size = fastq.getQuality().length(); if (qualityScores.length != size) { throw new IllegalArgumentException("qualityScores must be the same length as the FASTQ formatted sequence quality"); } FastqVariant variant = fastq.getVariant(); for (int i = 0; i < size; i++) { char c = fastq.getQuality().charAt(i); qualityScores[i] = variant.qualityScore(c); } return qualityScores; }
[ "public", "static", "int", "[", "]", "qualityScores", "(", "final", "Fastq", "fastq", ",", "final", "int", "[", "]", "qualityScores", ")", "{", "if", "(", "fastq", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fastq must not be ...
Copy the quality scores from the specified FASTQ formatted sequence into the specified int array. @param fastq FASTQ formatted sequence, must not be null @param qualityScores int array of quality scores, must not be null and must be the same length as the FASTQ formatted sequence quality @return the specified int array of quality scores
[ "Copy", "the", "quality", "scores", "from", "the", "specified", "FASTQ", "formatted", "sequence", "into", "the", "specified", "int", "array", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java#L192-L214
31,733
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java
FastqTools.errorProbabilities
public static double[] errorProbabilities(final Fastq fastq, final double[] errorProbabilities) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (errorProbabilities == null) { throw new IllegalArgumentException("errorProbabilities must not be null"); } int size = fastq.getQuality().length(); if (errorProbabilities.length != size) { throw new IllegalArgumentException("errorProbabilities must be the same length as the FASTQ formatted sequence quality"); } FastqVariant variant = fastq.getVariant(); for (int i = 0; i < size; i++) { char c = fastq.getQuality().charAt(i); errorProbabilities[i] = variant.errorProbability(c); } return errorProbabilities; }
java
public static double[] errorProbabilities(final Fastq fastq, final double[] errorProbabilities) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (errorProbabilities == null) { throw new IllegalArgumentException("errorProbabilities must not be null"); } int size = fastq.getQuality().length(); if (errorProbabilities.length != size) { throw new IllegalArgumentException("errorProbabilities must be the same length as the FASTQ formatted sequence quality"); } FastqVariant variant = fastq.getVariant(); for (int i = 0; i < size; i++) { char c = fastq.getQuality().charAt(i); errorProbabilities[i] = variant.errorProbability(c); } return errorProbabilities; }
[ "public", "static", "double", "[", "]", "errorProbabilities", "(", "final", "Fastq", "fastq", ",", "final", "double", "[", "]", "errorProbabilities", ")", "{", "if", "(", "fastq", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fa...
Copy the error probabilities from the specified FASTQ formatted sequence into the specified double array. @param fastq FASTQ formatted sequence, must not be null @param errorProbabilities double array of error probabilities, must not be null and must be the same length as the FASTQ formatted sequence quality @return the specified double array of error probabilities
[ "Copy", "the", "error", "probabilities", "from", "the", "specified", "FASTQ", "formatted", "sequence", "into", "the", "specified", "double", "array", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java#L247-L269
31,734
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java
FastqTools.convert
public static Fastq convert(final Fastq fastq, final FastqVariant variant) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (variant == null) { throw new IllegalArgumentException("variant must not be null"); } if (fastq.getVariant().equals(variant)) { return fastq; } return new Fastq(fastq.getDescription(), fastq.getSequence(), convertQualities(fastq, variant), variant); }
java
public static Fastq convert(final Fastq fastq, final FastqVariant variant) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (variant == null) { throw new IllegalArgumentException("variant must not be null"); } if (fastq.getVariant().equals(variant)) { return fastq; } return new Fastq(fastq.getDescription(), fastq.getSequence(), convertQualities(fastq, variant), variant); }
[ "public", "static", "Fastq", "convert", "(", "final", "Fastq", "fastq", ",", "final", "FastqVariant", "variant", ")", "{", "if", "(", "fastq", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fastq must not be null\"", ")", ";", "}",...
Convert the specified FASTQ formatted sequence to the specified FASTQ sequence format variant. @since 4.2 @param fastq FASTQ formatted sequence, must not be null @param variant FASTQ sequence format variant, must not be null @return the specified FASTQ formatted sequence converted to the specified FASTQ sequence format variant
[ "Convert", "the", "specified", "FASTQ", "formatted", "sequence", "to", "the", "specified", "FASTQ", "sequence", "format", "variant", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java#L281-L296
31,735
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java
FastqTools.convertQualities
static String convertQualities(final Fastq fastq, final FastqVariant variant) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (variant == null) { throw new IllegalArgumentException("variant must not be null"); } if (fastq.getVariant().equals(variant)) { return fastq.getQuality(); } int size = fastq.getQuality().length(); double[] errorProbabilities = errorProbabilities(fastq, new double[size]); StringBuilder sb = new StringBuilder(size); for (int i = 0; i < size; i++) { sb.append(variant.quality(variant.qualityScore(errorProbabilities[i]))); } return sb.toString(); }
java
static String convertQualities(final Fastq fastq, final FastqVariant variant) { if (fastq == null) { throw new IllegalArgumentException("fastq must not be null"); } if (variant == null) { throw new IllegalArgumentException("variant must not be null"); } if (fastq.getVariant().equals(variant)) { return fastq.getQuality(); } int size = fastq.getQuality().length(); double[] errorProbabilities = errorProbabilities(fastq, new double[size]); StringBuilder sb = new StringBuilder(size); for (int i = 0; i < size; i++) { sb.append(variant.quality(variant.qualityScore(errorProbabilities[i]))); } return sb.toString(); }
[ "static", "String", "convertQualities", "(", "final", "Fastq", "fastq", ",", "final", "FastqVariant", "variant", ")", "{", "if", "(", "fastq", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fastq must not be null\"", ")", ";", "}", ...
Convert the qualities in the specified FASTQ formatted sequence to the specified FASTQ sequence format variant. @since 4.2 @param fastq FASTQ formatted sequence, must not be null @param variant FASTQ sequence format variant, must not be null @return the qualities in the specified FASTQ formatted sequence converted to the specified FASTQ sequence format variant
[ "Convert", "the", "qualities", "in", "the", "specified", "FASTQ", "formatted", "sequence", "to", "the", "specified", "FASTQ", "sequence", "format", "variant", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java#L308-L330
31,736
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java
FastqTools.toList
@SuppressWarnings("unchecked") static <T> List<T> toList(final Iterable<? extends T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } return ImmutableList.copyOf(iterable); }
java
@SuppressWarnings("unchecked") static <T> List<T> toList(final Iterable<? extends T> iterable) { if (iterable instanceof List) { return (List<T>) iterable; } return ImmutableList.copyOf(iterable); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "<", "T", ">", "List", "<", "T", ">", "toList", "(", "final", "Iterable", "<", "?", "extends", "T", ">", "iterable", ")", "{", "if", "(", "iterable", "instanceof", "List", ")", "{", "return"...
Return the specified iterable as a list. @paam <T> element type @param iterable iterable @return the specified iterable as a list
[ "Return", "the", "specified", "iterable", "as", "a", "list", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/io/fastq/FastqTools.java#L339-L347
31,737
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java
CDSComparator.compare
@Override public int compare(CDSSequence o1, CDSSequence o2) { if(o1.getStrand() != o2.getStrand()){ return o1.getBioBegin() - o2.getBioBegin(); } if(o1.getStrand() == Strand.NEGATIVE){ return -1 * (o1.getBioBegin() - o2.getBioBegin()); } return o1.getBioBegin() - o2.getBioBegin(); }
java
@Override public int compare(CDSSequence o1, CDSSequence o2) { if(o1.getStrand() != o2.getStrand()){ return o1.getBioBegin() - o2.getBioBegin(); } if(o1.getStrand() == Strand.NEGATIVE){ return -1 * (o1.getBioBegin() - o2.getBioBegin()); } return o1.getBioBegin() - o2.getBioBegin(); }
[ "@", "Override", "public", "int", "compare", "(", "CDSSequence", "o1", ",", "CDSSequence", "o2", ")", "{", "if", "(", "o1", ".", "getStrand", "(", ")", "!=", "o2", ".", "getStrand", "(", ")", ")", "{", "return", "o1", ".", "getBioBegin", "(", ")", ...
Used to sort two CDSSequences where Negative Strand makes it tough @param o1 @param o2 @return val
[ "Used", "to", "sort", "two", "CDSSequences", "where", "Negative", "Strand", "makes", "it", "tough" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/CDSComparator.java#L40-L50
31,738
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java
AtomContactSet.getContact
public AtomContact getContact(Atom atom1, Atom atom2) { return contacts.get(new Pair<AtomIdentifier>( new AtomIdentifier(atom1.getPDBserial(),atom1.getGroup().getChainId()), new AtomIdentifier(atom2.getPDBserial(),atom2.getGroup().getChainId()) )); }
java
public AtomContact getContact(Atom atom1, Atom atom2) { return contacts.get(new Pair<AtomIdentifier>( new AtomIdentifier(atom1.getPDBserial(),atom1.getGroup().getChainId()), new AtomIdentifier(atom2.getPDBserial(),atom2.getGroup().getChainId()) )); }
[ "public", "AtomContact", "getContact", "(", "Atom", "atom1", ",", "Atom", "atom2", ")", "{", "return", "contacts", ".", "get", "(", "new", "Pair", "<", "AtomIdentifier", ">", "(", "new", "AtomIdentifier", "(", "atom1", ".", "getPDBserial", "(", ")", ",", ...
Returns the corresponding AtomContact or null if no contact exists between the 2 given atoms @param atom1 @param atom2 @return
[ "Returns", "the", "corresponding", "AtomContact", "or", "null", "if", "no", "contact", "exists", "between", "the", "2", "given", "atoms" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java#L74-L78
31,739
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java
AtomContactSet.hasContactsWithinDistance
public boolean hasContactsWithinDistance(double distance) { if (distance>=cutoff) throw new IllegalArgumentException("Given distance "+ String.format("%.2f", distance)+" is larger than contacts' distance cutoff "+ String.format("%.2f", cutoff)); for (AtomContact contact:this.contacts.values()) { if (contact.getDistance()<distance) { return true; } } return false; }
java
public boolean hasContactsWithinDistance(double distance) { if (distance>=cutoff) throw new IllegalArgumentException("Given distance "+ String.format("%.2f", distance)+" is larger than contacts' distance cutoff "+ String.format("%.2f", cutoff)); for (AtomContact contact:this.contacts.values()) { if (contact.getDistance()<distance) { return true; } } return false; }
[ "public", "boolean", "hasContactsWithinDistance", "(", "double", "distance", ")", "{", "if", "(", "distance", ">=", "cutoff", ")", "throw", "new", "IllegalArgumentException", "(", "\"Given distance \"", "+", "String", ".", "format", "(", "\"%.2f\"", ",", "distance...
Returns true if at least 1 contact from this set is within the given distance. Note that if the distance given is larger than the distance cutoff used to calculate the contacts then nothing will be found. @param distance @return @throws IllegalArgumentException if given distance is larger than distance cutoff used for calculation of contacts
[ "Returns", "true", "if", "at", "least", "1", "contact", "from", "this", "set", "is", "within", "the", "given", "distance", ".", "Note", "that", "if", "the", "distance", "given", "is", "larger", "than", "the", "distance", "cutoff", "used", "to", "calculate"...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java#L106-L119
31,740
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java
AtomContactSet.getContactsWithinDistance
public List<AtomContact> getContactsWithinDistance(double distance) { if (distance>=cutoff) throw new IllegalArgumentException("Given distance "+ String.format("%.2f", distance)+" is larger than contacts' distance cutoff "+ String.format("%.2f", cutoff)); List<AtomContact> list = new ArrayList<AtomContact>(); for (AtomContact contact:this.contacts.values()) { if (contact.getDistance()<distance) { list.add(contact); } } return list; }
java
public List<AtomContact> getContactsWithinDistance(double distance) { if (distance>=cutoff) throw new IllegalArgumentException("Given distance "+ String.format("%.2f", distance)+" is larger than contacts' distance cutoff "+ String.format("%.2f", cutoff)); List<AtomContact> list = new ArrayList<AtomContact>(); for (AtomContact contact:this.contacts.values()) { if (contact.getDistance()<distance) { list.add(contact); } } return list; }
[ "public", "List", "<", "AtomContact", ">", "getContactsWithinDistance", "(", "double", "distance", ")", "{", "if", "(", "distance", ">=", "cutoff", ")", "throw", "new", "IllegalArgumentException", "(", "\"Given distance \"", "+", "String", ".", "format", "(", "\...
Returns the list of contacts from this set that are within the given distance. @param distance @return @throws IllegalArgumentException if given distance is larger than distance cutoff used for calculation of contacts
[ "Returns", "the", "list", "of", "contacts", "from", "this", "set", "that", "are", "within", "the", "given", "distance", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java#L128-L142
31,741
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java
StructureSequenceMatcher.getProteinSequenceForStructure
public static ProteinSequence getProteinSequenceForStructure(Structure struct, Map<Integer,Group> groupIndexPosition ) { if( groupIndexPosition != null) { groupIndexPosition.clear(); } StringBuilder seqStr = new StringBuilder(); for(Chain chain : struct.getChains()) { List<Group> groups = chain.getAtomGroups(); Map<Integer,Integer> chainIndexPosition = new HashMap<Integer, Integer>(); int prevLen = seqStr.length(); // get the sequence for this chain String chainSeq = SeqRes2AtomAligner.getFullAtomSequence(groups, chainIndexPosition, false); seqStr.append(chainSeq); // fix up the position to include previous chains, and map the value back to a Group for(Integer seqIndex : chainIndexPosition.keySet()) { Integer groupIndex = chainIndexPosition.get(seqIndex); groupIndexPosition.put(prevLen + seqIndex, groups.get(groupIndex)); } } ProteinSequence s = null; try { s = new ProteinSequence(seqStr.toString()); } catch (CompoundNotFoundException e) { // I believe this can't happen, please correct this if I'm wrong - JD 2014-10-24 // we can log an error if it does, it would mean there's a bad bug somewhere logger.error("Could not create protein sequence, unknown compounds in string: {}", e.getMessage()); } return s; }
java
public static ProteinSequence getProteinSequenceForStructure(Structure struct, Map<Integer,Group> groupIndexPosition ) { if( groupIndexPosition != null) { groupIndexPosition.clear(); } StringBuilder seqStr = new StringBuilder(); for(Chain chain : struct.getChains()) { List<Group> groups = chain.getAtomGroups(); Map<Integer,Integer> chainIndexPosition = new HashMap<Integer, Integer>(); int prevLen = seqStr.length(); // get the sequence for this chain String chainSeq = SeqRes2AtomAligner.getFullAtomSequence(groups, chainIndexPosition, false); seqStr.append(chainSeq); // fix up the position to include previous chains, and map the value back to a Group for(Integer seqIndex : chainIndexPosition.keySet()) { Integer groupIndex = chainIndexPosition.get(seqIndex); groupIndexPosition.put(prevLen + seqIndex, groups.get(groupIndex)); } } ProteinSequence s = null; try { s = new ProteinSequence(seqStr.toString()); } catch (CompoundNotFoundException e) { // I believe this can't happen, please correct this if I'm wrong - JD 2014-10-24 // we can log an error if it does, it would mean there's a bad bug somewhere logger.error("Could not create protein sequence, unknown compounds in string: {}", e.getMessage()); } return s; }
[ "public", "static", "ProteinSequence", "getProteinSequenceForStructure", "(", "Structure", "struct", ",", "Map", "<", "Integer", ",", "Group", ">", "groupIndexPosition", ")", "{", "if", "(", "groupIndexPosition", "!=", "null", ")", "{", "groupIndexPosition", ".", ...
Generates a ProteinSequence corresponding to the sequence of struct, and maintains a mapping from the sequence back to the original groups. Chains are appended to one another. 'X' is used for heteroatoms. @param struct Input structure @param groupIndexPosition An empty map, which will be populated with (residue index in returned ProteinSequence) -> (Group within struct) @return A ProteinSequence with the full sequence of struct. Chains are concatenated in the same order as the input structures @see {@link SeqRes2AtomAligner#getFullAtomSequence(List, Map)}, which does the heavy lifting.
[ "Generates", "a", "ProteinSequence", "corresponding", "to", "the", "sequence", "of", "struct", "and", "maintains", "a", "mapping", "from", "the", "sequence", "back", "to", "the", "original", "groups", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java#L112-L147
31,742
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java
StructureSequenceMatcher.matchSequenceToStructure
public static ResidueNumber[] matchSequenceToStructure(ProteinSequence seq, Structure struct) { //1. Create ProteinSequence for struct while remembering to which group each residue corresponds Map<Integer,Group> atomIndexPosition = new HashMap<Integer, Group>(); ProteinSequence structSeq = getProteinSequenceForStructure(struct,atomIndexPosition); // TODO This should really be semi-global alignment, though global for either sequence OR structure (we don't know which) //2. Run Smith-Waterman to get the alignment // Identity substitution matrix with +1 for match, -1 for mismatch // TODO SubstitutionMatrix<AminoAcidCompound> matrix = new SimpleSubstitutionMatrix<AminoAcidCompound>( AminoAcidCompoundSet.getAminoAcidCompoundSet(), (short)1, (short)-1 ); matrix = new SimpleSubstitutionMatrix<AminoAcidCompound>( AminoAcidCompoundSet.getAminoAcidCompoundSet(), new InputStreamReader( SimpleSubstitutionMatrix.class.getResourceAsStream("/matrices/blosum100.txt")), "blosum100"); SequencePair<ProteinSequence, AminoAcidCompound> pair = Alignments.getPairwiseAlignment(seq, structSeq, PairwiseSequenceAlignerType.GLOBAL, new SimpleGapPenalty(), matrix); //System.out.print(pair.toString()); //3. Convert the alignment back to Atoms AlignedSequence<ProteinSequence,AminoAcidCompound> alignedSeq = pair.getQuery(); AlignedSequence<ProteinSequence,AminoAcidCompound> alignedStruct = pair.getTarget(); assert(alignedSeq.getLength() == alignedStruct.getLength()); // System.out.println(pair.toString(80)); // System.out.format("%d/min{%d,%d}\n", pair.getNumIdenticals(), // alignedSeq.getLength()-alignedSeq.getNumGaps(), // alignedStruct.getLength()-alignedStruct.getNumGaps()); ResidueNumber[] ca = new ResidueNumber[seq.getLength()]; for( int pos = alignedSeq.getStart().getPosition(); pos <= alignedSeq.getEnd().getPosition(); pos++ ) { // 1-indexed //skip missing residues from sequence. These probably represent alignment errors if(alignedSeq.isGap(pos)) { int structIndex = alignedStruct.getSequenceIndexAt(pos)-1; assert(structIndex > 0);//should be defined since seq gap Group g = atomIndexPosition.get(structIndex); logger.warn("Chain {} residue {} in the Structure {} has no corresponding amino acid in the sequence.", g.getChainId(), g.getResidueNumber().toString(), g.getChain().getStructure().getPDBCode() ); continue; } if(! alignedStruct.isGap(pos) ) { int seqIndex = alignedSeq.getSequenceIndexAt(pos)-1;//1-indexed int structIndex = alignedStruct.getSequenceIndexAt(pos)-1;//1-indexed Group g = atomIndexPosition.get(structIndex); assert(0<=seqIndex && seqIndex < ca.length); ca[seqIndex] = g.getResidueNumber(); //remains null for gaps } } return ca; }
java
public static ResidueNumber[] matchSequenceToStructure(ProteinSequence seq, Structure struct) { //1. Create ProteinSequence for struct while remembering to which group each residue corresponds Map<Integer,Group> atomIndexPosition = new HashMap<Integer, Group>(); ProteinSequence structSeq = getProteinSequenceForStructure(struct,atomIndexPosition); // TODO This should really be semi-global alignment, though global for either sequence OR structure (we don't know which) //2. Run Smith-Waterman to get the alignment // Identity substitution matrix with +1 for match, -1 for mismatch // TODO SubstitutionMatrix<AminoAcidCompound> matrix = new SimpleSubstitutionMatrix<AminoAcidCompound>( AminoAcidCompoundSet.getAminoAcidCompoundSet(), (short)1, (short)-1 ); matrix = new SimpleSubstitutionMatrix<AminoAcidCompound>( AminoAcidCompoundSet.getAminoAcidCompoundSet(), new InputStreamReader( SimpleSubstitutionMatrix.class.getResourceAsStream("/matrices/blosum100.txt")), "blosum100"); SequencePair<ProteinSequence, AminoAcidCompound> pair = Alignments.getPairwiseAlignment(seq, structSeq, PairwiseSequenceAlignerType.GLOBAL, new SimpleGapPenalty(), matrix); //System.out.print(pair.toString()); //3. Convert the alignment back to Atoms AlignedSequence<ProteinSequence,AminoAcidCompound> alignedSeq = pair.getQuery(); AlignedSequence<ProteinSequence,AminoAcidCompound> alignedStruct = pair.getTarget(); assert(alignedSeq.getLength() == alignedStruct.getLength()); // System.out.println(pair.toString(80)); // System.out.format("%d/min{%d,%d}\n", pair.getNumIdenticals(), // alignedSeq.getLength()-alignedSeq.getNumGaps(), // alignedStruct.getLength()-alignedStruct.getNumGaps()); ResidueNumber[] ca = new ResidueNumber[seq.getLength()]; for( int pos = alignedSeq.getStart().getPosition(); pos <= alignedSeq.getEnd().getPosition(); pos++ ) { // 1-indexed //skip missing residues from sequence. These probably represent alignment errors if(alignedSeq.isGap(pos)) { int structIndex = alignedStruct.getSequenceIndexAt(pos)-1; assert(structIndex > 0);//should be defined since seq gap Group g = atomIndexPosition.get(structIndex); logger.warn("Chain {} residue {} in the Structure {} has no corresponding amino acid in the sequence.", g.getChainId(), g.getResidueNumber().toString(), g.getChain().getStructure().getPDBCode() ); continue; } if(! alignedStruct.isGap(pos) ) { int seqIndex = alignedSeq.getSequenceIndexAt(pos)-1;//1-indexed int structIndex = alignedStruct.getSequenceIndexAt(pos)-1;//1-indexed Group g = atomIndexPosition.get(structIndex); assert(0<=seqIndex && seqIndex < ca.length); ca[seqIndex] = g.getResidueNumber(); //remains null for gaps } } return ca; }
[ "public", "static", "ResidueNumber", "[", "]", "matchSequenceToStructure", "(", "ProteinSequence", "seq", ",", "Structure", "struct", ")", "{", "//1. Create ProteinSequence for struct while remembering to which group each residue corresponds", "Map", "<", "Integer", ",", "Group...
Given a sequence and the corresponding Structure, get the ResidueNumber for each residue in the sequence. <p>Smith-Waterman alignment is used to match the sequences. Residues in the sequence but not the structure or mismatched between sequence and structure will have a null atom, while residues in the structure but not the sequence are ignored with a warning. @param seq The protein sequence. Should match the sequence of struct very closely. @param struct The corresponding protein structure @return A list of ResidueNumbers of the same length as seq, containing either the corresponding residue or null.
[ "Given", "a", "sequence", "and", "the", "corresponding", "Structure", "get", "the", "ResidueNumber", "for", "each", "residue", "in", "the", "sequence", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java#L163-L229
31,743
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java
StructureSequenceMatcher.removeGaps
public static <T> T[][] removeGaps(final T[][] gapped) { if(gapped == null ) return null; if(gapped.length < 1) return Arrays.copyOf(gapped, gapped.length); final int nProts = gapped.length; final int protLen = gapped[0].length; // length of gapped proteins // Verify that input is rectangular for(int i=0;i<nProts;i++) { if(gapped[i].length != protLen) { throw new IllegalArgumentException(String.format( "Expected a rectangular array, but row 0 has %d elements " + "while row %d has %d.", protLen,i,gapped[i].length)); } } // determine where gaps exist in any structures boolean[] isGap = new boolean[protLen]; int gaps = 0; for(int j=0;j<protLen;j++) { for(int i=0;i<nProts;i++) { if(gapped[i][j] == null ) { isGap[j] = true; gaps++; break; //go to next position } } } // Create ungapped array T[][] ungapped = Arrays.copyOf(gapped,nProts); final int ungappedLen = protLen-gaps; for(int i=0;i<nProts;i++) { ungapped[i] = Arrays.copyOf(gapped[i],ungappedLen); int k = 0; for(int j=0;j<protLen;j++) { if(!isGap[j]) { //skip gaps assert(gapped[i][j] != null); ungapped[i][k] = gapped[i][j]; k++; } } assert(k == ungappedLen); } return ungapped; }
java
public static <T> T[][] removeGaps(final T[][] gapped) { if(gapped == null ) return null; if(gapped.length < 1) return Arrays.copyOf(gapped, gapped.length); final int nProts = gapped.length; final int protLen = gapped[0].length; // length of gapped proteins // Verify that input is rectangular for(int i=0;i<nProts;i++) { if(gapped[i].length != protLen) { throw new IllegalArgumentException(String.format( "Expected a rectangular array, but row 0 has %d elements " + "while row %d has %d.", protLen,i,gapped[i].length)); } } // determine where gaps exist in any structures boolean[] isGap = new boolean[protLen]; int gaps = 0; for(int j=0;j<protLen;j++) { for(int i=0;i<nProts;i++) { if(gapped[i][j] == null ) { isGap[j] = true; gaps++; break; //go to next position } } } // Create ungapped array T[][] ungapped = Arrays.copyOf(gapped,nProts); final int ungappedLen = protLen-gaps; for(int i=0;i<nProts;i++) { ungapped[i] = Arrays.copyOf(gapped[i],ungappedLen); int k = 0; for(int j=0;j<protLen;j++) { if(!isGap[j]) { //skip gaps assert(gapped[i][j] != null); ungapped[i][k] = gapped[i][j]; k++; } } assert(k == ungappedLen); } return ungapped; }
[ "public", "static", "<", "T", ">", "T", "[", "]", "[", "]", "removeGaps", "(", "final", "T", "[", "]", "[", "]", "gapped", ")", "{", "if", "(", "gapped", "==", "null", ")", "return", "null", ";", "if", "(", "gapped", ".", "length", "<", "1", ...
Creates a new list consisting of all columns of gapped where no row contained a null value. Here, "row" refers to the first index and "column" to the second, eg gapped.get(row).get(column) @param gapped A rectangular matrix containing null to mark gaps @return A new List without columns containing nulls
[ "Creates", "a", "new", "list", "consisting", "of", "all", "columns", "of", "gapped", "where", "no", "row", "contained", "a", "null", "value", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java#L283-L330
31,744
biojava/biojava
biojava-structure/src/main/java/demo/DemoSCOP.java
DemoSCOP.traverseHierarchy
public void traverseHierarchy() { String pdbId = "4HHB"; // download SCOP if required and load into memory ScopDatabase scop = ScopFactory.getSCOP(); List<ScopDomain> domains = scop.getDomainsForPDB(pdbId); // show the hierachy for the first domain: ScopNode node = scop.getScopNode(domains.get(0).getSunid()); while (node != null){ System.out.println("This node: sunid:" + node.getSunid() ); System.out.println(scop.getScopDescriptionBySunid(node.getSunid())); node = scop.getScopNode(node.getParentSunid()); } }
java
public void traverseHierarchy() { String pdbId = "4HHB"; // download SCOP if required and load into memory ScopDatabase scop = ScopFactory.getSCOP(); List<ScopDomain> domains = scop.getDomainsForPDB(pdbId); // show the hierachy for the first domain: ScopNode node = scop.getScopNode(domains.get(0).getSunid()); while (node != null){ System.out.println("This node: sunid:" + node.getSunid() ); System.out.println(scop.getScopDescriptionBySunid(node.getSunid())); node = scop.getScopNode(node.getParentSunid()); } }
[ "public", "void", "traverseHierarchy", "(", ")", "{", "String", "pdbId", "=", "\"4HHB\"", ";", "// download SCOP if required and load into memory", "ScopDatabase", "scop", "=", "ScopFactory", ".", "getSCOP", "(", ")", ";", "List", "<", "ScopDomain", ">", "domains", ...
Traverse throught the SCOP hierarchy
[ "Traverse", "throught", "the", "SCOP", "hierarchy" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/demo/DemoSCOP.java#L72-L91
31,745
biojava/biojava
biojava-structure/src/main/java/demo/DemoSCOP.java
DemoSCOP.getCategories
public void getCategories(){ // download SCOP if required and load into memory ScopDatabase scop = ScopFactory.getSCOP(); List<ScopDescription> superfams = scop.getByCategory(ScopCategory.Superfamily); System.out.println("Total nr. of superfamilies:" + superfams.size()); List<ScopDescription> folds = scop.getByCategory(ScopCategory.Fold); System.out.println("Total nr. of folds:" + folds.size()); }
java
public void getCategories(){ // download SCOP if required and load into memory ScopDatabase scop = ScopFactory.getSCOP(); List<ScopDescription> superfams = scop.getByCategory(ScopCategory.Superfamily); System.out.println("Total nr. of superfamilies:" + superfams.size()); List<ScopDescription> folds = scop.getByCategory(ScopCategory.Fold); System.out.println("Total nr. of folds:" + folds.size()); }
[ "public", "void", "getCategories", "(", ")", "{", "// download SCOP if required and load into memory", "ScopDatabase", "scop", "=", "ScopFactory", ".", "getSCOP", "(", ")", ";", "List", "<", "ScopDescription", ">", "superfams", "=", "scop", ".", "getByCategory", "("...
Get various categories
[ "Get", "various", "categories" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/demo/DemoSCOP.java#L96-L106
31,746
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java
GenericGenbankHeaderFormat._write_the_first_line
private String _write_the_first_line(S sequence) { /* * locus = record.name if not locus or locus == "<unknown name>": locus * = record.id if not locus or locus == "<unknown id>": locus = * self._get_annotation_str(record, "accession", just_first=True)\ */ String locus; try { locus = sequence.getAccession().getID(); } catch (Exception e) { locus = ""; } if (locus.length() > 16) { throw new RuntimeException("Locus identifier " + locus + " is too long"); } String units = ""; String mol_type = ""; if (sequence.getCompoundSet() instanceof DNACompoundSet) { units = "bp"; mol_type = "DNA"; } else if (sequence.getCompoundSet() instanceof DNACompoundSet) { units = "bp"; mol_type = "RNA"; } else if (sequence.getCompoundSet() instanceof AminoAcidCompoundSet) { units = "aa"; mol_type = ""; } else { throw new RuntimeException( "Need a DNACompoundSet, RNACompoundSet, or an AminoAcidCompoundSet"); } String division = _get_data_division(sequence); if (seqType != null) { division = seqType; } assert units.length() == 2; // the next line does not seem right.. seqType == linear // uncommenting for now //assert division.length() == 3; StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb, Locale.US); formatter .format("LOCUS %s %s %s %s %s %s" + lineSep, StringManipulationHelper.padRight(locus, 16), StringManipulationHelper.padLeft( Integer.toString(sequence.getLength()), 11), units, StringManipulationHelper.padRight(mol_type, 6), division, _get_date(sequence)); String output = formatter.toString(); formatter.close(); return output; /* * assert len(line) == 79+1, repr(line) #plus one for new line * * assert line[12:28].rstrip() == locus, \ 'LOCUS line does not contain * the locus at the expected position:\n' + line assert line[28:29] == * " " assert line[29:40].lstrip() == str(len(record)), \ 'LOCUS line * does not contain the length at the expected position:\n' + line * * #Tests copied from Bio.GenBank.Scanner assert line[40:44] in [' bp ', * ' aa '] , \ 'LOCUS line does not contain size units at expected * position:\n' + line assert line[44:47] in [' ', 'ss-', 'ds-', 'ms-'], * \ 'LOCUS line does not have valid strand type (Single stranded, * ...):\n' + line assert line[47:54].strip() == "" \ or * line[47:54].strip().find('DNA') != -1 \ or * line[47:54].strip().find('RNA') != -1, \ 'LOCUS line does not contain * valid sequence type (DNA, RNA, ...):\n' + line assert line[54:55] == * ' ', \ 'LOCUS line does not contain space at position 55:\n' + line * assert line[55:63].strip() in ['', 'linear', 'circular'], \ 'LOCUS * line does not contain valid entry (linear, circular, ...):\n' + line * assert line[63:64] == ' ', \ 'LOCUS line does not contain space at * position 64:\n' + line assert line[67:68] == ' ', \ 'LOCUS line does * not contain space at position 68:\n' + line assert line[70:71] == * '-', \ 'LOCUS line does not contain - at position 71 in date:\n' + * line assert line[74:75] == '-', \ 'LOCUS line does not contain - at * position 75 in date:\n' + line */ }
java
private String _write_the_first_line(S sequence) { /* * locus = record.name if not locus or locus == "<unknown name>": locus * = record.id if not locus or locus == "<unknown id>": locus = * self._get_annotation_str(record, "accession", just_first=True)\ */ String locus; try { locus = sequence.getAccession().getID(); } catch (Exception e) { locus = ""; } if (locus.length() > 16) { throw new RuntimeException("Locus identifier " + locus + " is too long"); } String units = ""; String mol_type = ""; if (sequence.getCompoundSet() instanceof DNACompoundSet) { units = "bp"; mol_type = "DNA"; } else if (sequence.getCompoundSet() instanceof DNACompoundSet) { units = "bp"; mol_type = "RNA"; } else if (sequence.getCompoundSet() instanceof AminoAcidCompoundSet) { units = "aa"; mol_type = ""; } else { throw new RuntimeException( "Need a DNACompoundSet, RNACompoundSet, or an AminoAcidCompoundSet"); } String division = _get_data_division(sequence); if (seqType != null) { division = seqType; } assert units.length() == 2; // the next line does not seem right.. seqType == linear // uncommenting for now //assert division.length() == 3; StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb, Locale.US); formatter .format("LOCUS %s %s %s %s %s %s" + lineSep, StringManipulationHelper.padRight(locus, 16), StringManipulationHelper.padLeft( Integer.toString(sequence.getLength()), 11), units, StringManipulationHelper.padRight(mol_type, 6), division, _get_date(sequence)); String output = formatter.toString(); formatter.close(); return output; /* * assert len(line) == 79+1, repr(line) #plus one for new line * * assert line[12:28].rstrip() == locus, \ 'LOCUS line does not contain * the locus at the expected position:\n' + line assert line[28:29] == * " " assert line[29:40].lstrip() == str(len(record)), \ 'LOCUS line * does not contain the length at the expected position:\n' + line * * #Tests copied from Bio.GenBank.Scanner assert line[40:44] in [' bp ', * ' aa '] , \ 'LOCUS line does not contain size units at expected * position:\n' + line assert line[44:47] in [' ', 'ss-', 'ds-', 'ms-'], * \ 'LOCUS line does not have valid strand type (Single stranded, * ...):\n' + line assert line[47:54].strip() == "" \ or * line[47:54].strip().find('DNA') != -1 \ or * line[47:54].strip().find('RNA') != -1, \ 'LOCUS line does not contain * valid sequence type (DNA, RNA, ...):\n' + line assert line[54:55] == * ' ', \ 'LOCUS line does not contain space at position 55:\n' + line * assert line[55:63].strip() in ['', 'linear', 'circular'], \ 'LOCUS * line does not contain valid entry (linear, circular, ...):\n' + line * assert line[63:64] == ' ', \ 'LOCUS line does not contain space at * position 64:\n' + line assert line[67:68] == ' ', \ 'LOCUS line does * not contain space at position 68:\n' + line assert line[70:71] == * '-', \ 'LOCUS line does not contain - at position 71 in date:\n' + * line assert line[74:75] == '-', \ 'LOCUS line does not contain - at * position 75 in date:\n' + line */ }
[ "private", "String", "_write_the_first_line", "(", "S", "sequence", ")", "{", "/*\n\t\t * locus = record.name if not locus or locus == \"<unknown name>\": locus\n\t\t * = record.id if not locus or locus == \"<unknown id>\": locus =\n\t\t * self._get_annotation_str(record, \"accession\", just_first=T...
Write the LOCUS line. @param sequence @param seqType
[ "Write", "the", "LOCUS", "line", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericGenbankHeaderFormat.java#L155-L237
31,747
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/model/ChemComp.java
ChemComp.getEmptyChemComp
public static ChemComp getEmptyChemComp(){ ChemComp comp = new ChemComp(); comp.setOne_letter_code("?"); comp.setThree_letter_code("???"); // Main signal for isEmpty() comp.setPolymerType(PolymerType.unknown); comp.setResidueType(ResidueType.atomn); return comp; }
java
public static ChemComp getEmptyChemComp(){ ChemComp comp = new ChemComp(); comp.setOne_letter_code("?"); comp.setThree_letter_code("???"); // Main signal for isEmpty() comp.setPolymerType(PolymerType.unknown); comp.setResidueType(ResidueType.atomn); return comp; }
[ "public", "static", "ChemComp", "getEmptyChemComp", "(", ")", "{", "ChemComp", "comp", "=", "new", "ChemComp", "(", ")", ";", "comp", ".", "setOne_letter_code", "(", "\"?\"", ")", ";", "comp", ".", "setThree_letter_code", "(", "\"???\"", ")", ";", "// Main s...
Creates a new instance of the dummy empty ChemComp. @return
[ "Creates", "a", "new", "instance", "of", "the", "dummy", "empty", "ChemComp", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/model/ChemComp.java#L599-L607
31,748
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java
ZipChemCompProvider.initializeZip
private void initializeZip() throws IOException { s_logger.info("Using chemical component dictionary: " + m_zipFile.toString()); final File f = m_zipFile.toFile(); if (!f.exists()) { s_logger.info("Creating missing zip archive: " + m_zipFile.toString()); FileOutputStream fo = new FileOutputStream(f); ZipOutputStream zip = new ZipOutputStream(new BufferedOutputStream(fo)); try { zip.putNextEntry(new ZipEntry("chemcomp/")); zip.closeEntry(); } finally { zip.close(); } } }
java
private void initializeZip() throws IOException { s_logger.info("Using chemical component dictionary: " + m_zipFile.toString()); final File f = m_zipFile.toFile(); if (!f.exists()) { s_logger.info("Creating missing zip archive: " + m_zipFile.toString()); FileOutputStream fo = new FileOutputStream(f); ZipOutputStream zip = new ZipOutputStream(new BufferedOutputStream(fo)); try { zip.putNextEntry(new ZipEntry("chemcomp/")); zip.closeEntry(); } finally { zip.close(); } } }
[ "private", "void", "initializeZip", "(", ")", "throws", "IOException", "{", "s_logger", ".", "info", "(", "\"Using chemical component dictionary: \"", "+", "m_zipFile", ".", "toString", "(", ")", ")", ";", "final", "File", "f", "=", "m_zipFile", ".", "toFile", ...
ZipFileSystems - due to URI issues in Java7.
[ "ZipFileSystems", "-", "due", "to", "URI", "issues", "in", "Java7", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java#L101-L115
31,749
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java
ZipChemCompProvider.downloadAndAdd
private ChemComp downloadAndAdd(String recordName){ final ChemComp cc = m_dlProvider.getChemComp(recordName); // final File [] files = finder(m_tempDir.resolve("chemcomp").toString(), "cif.gz"); final File [] files = new File[1]; Path cif = m_tempDir.resolve("chemcomp").resolve(recordName + ".cif.gz"); files[0] = cif.toFile(); if (files[0] != null) { addToZipFileSystem(m_zipFile, files, m_zipRootDir); if (m_removeCif) for (File f : files) f.delete(); } return cc; }
java
private ChemComp downloadAndAdd(String recordName){ final ChemComp cc = m_dlProvider.getChemComp(recordName); // final File [] files = finder(m_tempDir.resolve("chemcomp").toString(), "cif.gz"); final File [] files = new File[1]; Path cif = m_tempDir.resolve("chemcomp").resolve(recordName + ".cif.gz"); files[0] = cif.toFile(); if (files[0] != null) { addToZipFileSystem(m_zipFile, files, m_zipRootDir); if (m_removeCif) for (File f : files) f.delete(); } return cc; }
[ "private", "ChemComp", "downloadAndAdd", "(", "String", "recordName", ")", "{", "final", "ChemComp", "cc", "=", "m_dlProvider", ".", "getChemComp", "(", "recordName", ")", ";", "// final File [] files = finder(m_tempDir.resolve(\"chemcomp\").toString(), \"cif.gz\");", "final"...
Use DownloadChemCompProvider to grab a gzipped cif record from the PDB. Zip all downloaded cif.gz files into the dictionary. @param recordName is the three-letter chemical component code (i.e. residue name). @return ChemComp matching recordName
[ "Use", "DownloadChemCompProvider", "to", "grab", "a", "gzipped", "cif", "record", "from", "the", "PDB", ".", "Zip", "all", "downloaded", "cif", ".", "gz", "files", "into", "the", "dictionary", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java#L163-L175
31,750
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java
ZipChemCompProvider.getEmptyChemComp
private ChemComp getEmptyChemComp(String resName){ String pdbName = ""; // Empty string is default if (null != resName && resName.length() >= 3) { pdbName = resName.substring(0,3); } final ChemComp comp = new ChemComp(); comp.setOne_letter_code("?"); comp.setThree_letter_code(pdbName); comp.setPolymerType(PolymerType.unknown); comp.setResidueType(ResidueType.atomn); return comp; }
java
private ChemComp getEmptyChemComp(String resName){ String pdbName = ""; // Empty string is default if (null != resName && resName.length() >= 3) { pdbName = resName.substring(0,3); } final ChemComp comp = new ChemComp(); comp.setOne_letter_code("?"); comp.setThree_letter_code(pdbName); comp.setPolymerType(PolymerType.unknown); comp.setResidueType(ResidueType.atomn); return comp; }
[ "private", "ChemComp", "getEmptyChemComp", "(", "String", "resName", ")", "{", "String", "pdbName", "=", "\"\"", ";", "// Empty string is default", "if", "(", "null", "!=", "resName", "&&", "resName", ".", "length", "(", ")", ">=", "3", ")", "{", "pdbName", ...
Return an empty ChemComp group for a three-letter resName. @param resName @return
[ "Return", "an", "empty", "ChemComp", "group", "for", "a", "three", "-", "letter", "resName", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ZipChemCompProvider.java#L196-L207
31,751
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java
SimpleAlignedSequence.countCompounds
@Override public int countCompounds(C... compounds) { int count = 0; List<C> search = Arrays.asList(compounds); for (C compound : getAsList()) { if (search.contains(compound)) { count++; } } return count; }
java
@Override public int countCompounds(C... compounds) { int count = 0; List<C> search = Arrays.asList(compounds); for (C compound : getAsList()) { if (search.contains(compound)) { count++; } } return count; }
[ "@", "Override", "public", "int", "countCompounds", "(", "C", "...", "compounds", ")", "{", "int", "count", "=", "0", ";", "List", "<", "C", ">", "search", "=", "Arrays", ".", "asList", "(", "compounds", ")", ";", "for", "(", "C", "compound", ":", ...
methods for Sequence
[ "methods", "for", "Sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java#L269-L279
31,752
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java
SimpleAlignedSequence.setLocation
private void setLocation(List<Step> steps) { List<Location> sublocations = new ArrayList<Location>(); int start = 0, step = 0, oStep = numBefore+numAfter, oMax = this.original.getLength(), pStep = 0, pMax = (prev == null) ? 0 : prev.getLength(); boolean inGap = true; // build sublocations: pieces of sequence separated by gaps for (; step < length; step++) { boolean isGapStep = (steps.get(step) == Step.GAP), isGapPrev = (pStep < pMax && prev.isGap(pStep + 1)); if (!isGapStep && !isGapPrev) { oStep++; if (inGap) { inGap = false; start = step + 1; } } else if (!inGap) { inGap = true; sublocations.add(new SimpleLocation(start, step, Strand.UNDEFINED)); } if (prev != null && !isGapStep) { pStep++; } } if (!inGap) { sublocations.add(new SimpleLocation(start, step, Strand.UNDEFINED)); } // combine sublocations into 1 Location if (sublocations.size() == 0) { location = null; } else if (sublocations.size() == 1) { location = sublocations.get(0); } else { location = new SimpleLocation(sublocations.get(0).getStart(), sublocations.get(sublocations.size() - 1).getEnd(), Strand.UNDEFINED, false, sublocations); } // TODO handle circular alignments // check that alignment has correct number of compounds in it to fit original sequence if (step != length || oStep != oMax || pStep != pMax) { throw new IllegalArgumentException("Given sequence does not fit in alignment."); } }
java
private void setLocation(List<Step> steps) { List<Location> sublocations = new ArrayList<Location>(); int start = 0, step = 0, oStep = numBefore+numAfter, oMax = this.original.getLength(), pStep = 0, pMax = (prev == null) ? 0 : prev.getLength(); boolean inGap = true; // build sublocations: pieces of sequence separated by gaps for (; step < length; step++) { boolean isGapStep = (steps.get(step) == Step.GAP), isGapPrev = (pStep < pMax && prev.isGap(pStep + 1)); if (!isGapStep && !isGapPrev) { oStep++; if (inGap) { inGap = false; start = step + 1; } } else if (!inGap) { inGap = true; sublocations.add(new SimpleLocation(start, step, Strand.UNDEFINED)); } if (prev != null && !isGapStep) { pStep++; } } if (!inGap) { sublocations.add(new SimpleLocation(start, step, Strand.UNDEFINED)); } // combine sublocations into 1 Location if (sublocations.size() == 0) { location = null; } else if (sublocations.size() == 1) { location = sublocations.get(0); } else { location = new SimpleLocation(sublocations.get(0).getStart(), sublocations.get(sublocations.size() - 1).getEnd(), Strand.UNDEFINED, false, sublocations); } // TODO handle circular alignments // check that alignment has correct number of compounds in it to fit original sequence if (step != length || oStep != oMax || pStep != pMax) { throw new IllegalArgumentException("Given sequence does not fit in alignment."); } }
[ "private", "void", "setLocation", "(", "List", "<", "Step", ">", "steps", ")", "{", "List", "<", "Location", ">", "sublocations", "=", "new", "ArrayList", "<", "Location", ">", "(", ")", ";", "int", "start", "=", "0", ",", "step", "=", "0", ",", "o...
helper method to initialize the location
[ "helper", "method", "to", "initialize", "the", "location" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java#L384-L428
31,753
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/StructureAlignmentDisplay.java
StructureAlignmentDisplay.display
public static StructureAlignmentJmol display(AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException { if ( ca1.length < 1 || ca2.length < 1){ throw new StructureException("length of atoms arrays is too short! " + ca1.length + "," + ca2.length); } Group[] twistedGroups = AlignmentTools.prepareGroupsForDisplay(afpChain, ca1, ca2); List<Group> hetatms = StructureTools.getUnalignedGroups(ca1); List<Group> hetatms2 = StructureTools.getUnalignedGroups(ca2); return DisplayAFP.display(afpChain, twistedGroups, ca1, ca2, hetatms, hetatms2); }
java
public static StructureAlignmentJmol display(AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException { if ( ca1.length < 1 || ca2.length < 1){ throw new StructureException("length of atoms arrays is too short! " + ca1.length + "," + ca2.length); } Group[] twistedGroups = AlignmentTools.prepareGroupsForDisplay(afpChain, ca1, ca2); List<Group> hetatms = StructureTools.getUnalignedGroups(ca1); List<Group> hetatms2 = StructureTools.getUnalignedGroups(ca2); return DisplayAFP.display(afpChain, twistedGroups, ca1, ca2, hetatms, hetatms2); }
[ "public", "static", "StructureAlignmentJmol", "display", "(", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "StructureException", "{", "if", "(", "ca1", ".", "length", "<", "1", "||", "ca2", ".", "leng...
Display an AFPChain alignment @param afpChain @param ca1 @param ca2 @return a StructureAlignmentJmol instance @throws StructureException
[ "Display", "an", "AFPChain", "alignment" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/StructureAlignmentDisplay.java#L43-L56
31,754
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsChainToUniprotMapping.java
SiftsChainToUniprotMapping.load
public static SiftsChainToUniprotMapping load(boolean useOnlyLocal) throws IOException { UserConfiguration config = new UserConfiguration(); File cacheDir = new File(config.getCacheFilePath()); DEFAULT_FILE = new File(cacheDir, DEFAULT_FILENAME); if (!DEFAULT_FILE.exists() || DEFAULT_FILE.length() == 0) { if (useOnlyLocal) throw new IOException(DEFAULT_FILE + " does not exist, and did not download"); download(); } try { return build(); } catch (IOException e) { logger.info("Caught IOException while reading {}. Error: {}",DEFAULT_FILE,e.getMessage()); if (useOnlyLocal) throw new IOException(DEFAULT_FILE + " could not be read, and did not redownload"); download(); return build(); } }
java
public static SiftsChainToUniprotMapping load(boolean useOnlyLocal) throws IOException { UserConfiguration config = new UserConfiguration(); File cacheDir = new File(config.getCacheFilePath()); DEFAULT_FILE = new File(cacheDir, DEFAULT_FILENAME); if (!DEFAULT_FILE.exists() || DEFAULT_FILE.length() == 0) { if (useOnlyLocal) throw new IOException(DEFAULT_FILE + " does not exist, and did not download"); download(); } try { return build(); } catch (IOException e) { logger.info("Caught IOException while reading {}. Error: {}",DEFAULT_FILE,e.getMessage()); if (useOnlyLocal) throw new IOException(DEFAULT_FILE + " could not be read, and did not redownload"); download(); return build(); } }
[ "public", "static", "SiftsChainToUniprotMapping", "load", "(", "boolean", "useOnlyLocal", ")", "throws", "IOException", "{", "UserConfiguration", "config", "=", "new", "UserConfiguration", "(", ")", ";", "File", "cacheDir", "=", "new", "File", "(", "config", ".", ...
Loads the SIFTS mapping. Attempts to load the mapping file in the PDB cache directory. If the file does not exist or could not be parsed, downloads and stores a GZ-compressed file. @param useOnlyLocal If true, will throw an IOException if the file needs to be downloaded @return @throws IOException If the local file could not be read and could not be downloaded (including if onlyLocal is true)
[ "Loads", "the", "SIFTS", "mapping", ".", "Attempts", "to", "load", "the", "mapping", "file", "in", "the", "PDB", "cache", "directory", ".", "If", "the", "file", "does", "not", "exist", "or", "could", "not", "be", "parsed", "downloads", "and", "stores", "...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/sifts/SiftsChainToUniprotMapping.java#L94-L114
31,755
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java
SparseVector.get
public double get(int i) { if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N); if (symbolTable.contains(i)) return symbolTable.get(i); else return 0.0; }
java
public double get(int i) { if (i < 0 || i >= N) throw new IllegalArgumentException("Illegal index " + i + " should be > 0 and < " + N); if (symbolTable.contains(i)) return symbolTable.get(i); else return 0.0; }
[ "public", "double", "get", "(", "int", "i", ")", "{", "if", "(", "i", "<", "0", "||", "i", ">=", "N", ")", "throw", "new", "IllegalArgumentException", "(", "\"Illegal index \"", "+", "i", "+", "\" should be > 0 and < \"", "+", "N", ")", ";", "if", "(",...
get a value @param i @return return symbolTable[i]
[ "get", "a", "value" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java#L76-L80
31,756
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java
SparseVector.dot
public double dot(SparseVector b) { SparseVector a = this; if (a.N != b.N) throw new IllegalArgumentException("Vector lengths disagree. " + a.N + " != " + b.N); double sum = 0.0; // iterate over the vector with the fewest nonzeros if (a.symbolTable.size() <= b.symbolTable.size()) { for (int i : a.symbolTable) if (b.symbolTable.contains(i)) sum += a.get(i) * b.get(i); } else { for (int i : b.symbolTable) if (a.symbolTable.contains(i)) sum += a.get(i) * b.get(i); } return sum; }
java
public double dot(SparseVector b) { SparseVector a = this; if (a.N != b.N) throw new IllegalArgumentException("Vector lengths disagree. " + a.N + " != " + b.N); double sum = 0.0; // iterate over the vector with the fewest nonzeros if (a.symbolTable.size() <= b.symbolTable.size()) { for (int i : a.symbolTable) if (b.symbolTable.contains(i)) sum += a.get(i) * b.get(i); } else { for (int i : b.symbolTable) if (a.symbolTable.contains(i)) sum += a.get(i) * b.get(i); } return sum; }
[ "public", "double", "dot", "(", "SparseVector", "b", ")", "{", "SparseVector", "a", "=", "this", ";", "if", "(", "a", ".", "N", "!=", "b", ".", "N", ")", "throw", "new", "IllegalArgumentException", "(", "\"Vector lengths disagree. \"", "+", "a", ".", "N"...
Calculates the dot product of this vector a with b @param b @return
[ "Calculates", "the", "dot", "product", "of", "this", "vector", "a", "with", "b" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java#L97-L112
31,757
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java
SparseVector.plus
public SparseVector plus(SparseVector b) { SparseVector a = this; if (a.N != b.N) throw new IllegalArgumentException("Vector lengths disagree : " + a.N + " != " + b.N); SparseVector c = new SparseVector(N); for (int i : a.symbolTable) c.put(i, a.get(i)); // c = a for (int i : b.symbolTable) c.put(i, b.get(i) + c.get(i)); // c = c + b return c; }
java
public SparseVector plus(SparseVector b) { SparseVector a = this; if (a.N != b.N) throw new IllegalArgumentException("Vector lengths disagree : " + a.N + " != " + b.N); SparseVector c = new SparseVector(N); for (int i : a.symbolTable) c.put(i, a.get(i)); // c = a for (int i : b.symbolTable) c.put(i, b.get(i) + c.get(i)); // c = c + b return c; }
[ "public", "SparseVector", "plus", "(", "SparseVector", "b", ")", "{", "SparseVector", "a", "=", "this", ";", "if", "(", "a", ".", "N", "!=", "b", ".", "N", ")", "throw", "new", "IllegalArgumentException", "(", "\"Vector lengths disagree : \"", "+", "a", "....
Calcualtes return a + b @param b @return
[ "Calcualtes", "return", "a", "+", "b" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SparseVector.java#L140-L147
31,758
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.location
public static Location location(List<Location> subLocations, String type) { if (subLocations.size() == 1) { return subLocations.get(0); } boolean circular = detectCicular(subLocations); Strand strand = detectStrand(subLocations); Point start = detectStart(subLocations); Point end = detectEnd(subLocations, circular); Location l; if ("join".equals(type)) { l = new SimpleLocation(start, end, strand, circular, subLocations); } else if ("order".equals(type)) { l = new InsdcLocations.OrderLocation(start, end, strand, circular, subLocations); } else if ("one-of".equals(type)) { l = new InsdcLocations.OneOfLocation(subLocations); } else if ("group".equals(type)) { l = new InsdcLocations.GroupLocation(start, end, strand, circular, subLocations); } else if ("bond".equals(type)) { l = new InsdcLocations.BondLocation(subLocations); } else { throw new ParserException("Unknown join type " + type); } return l; }
java
public static Location location(List<Location> subLocations, String type) { if (subLocations.size() == 1) { return subLocations.get(0); } boolean circular = detectCicular(subLocations); Strand strand = detectStrand(subLocations); Point start = detectStart(subLocations); Point end = detectEnd(subLocations, circular); Location l; if ("join".equals(type)) { l = new SimpleLocation(start, end, strand, circular, subLocations); } else if ("order".equals(type)) { l = new InsdcLocations.OrderLocation(start, end, strand, circular, subLocations); } else if ("one-of".equals(type)) { l = new InsdcLocations.OneOfLocation(subLocations); } else if ("group".equals(type)) { l = new InsdcLocations.GroupLocation(start, end, strand, circular, subLocations); } else if ("bond".equals(type)) { l = new InsdcLocations.BondLocation(subLocations); } else { throw new ParserException("Unknown join type " + type); } return l; }
[ "public", "static", "Location", "location", "(", "List", "<", "Location", ">", "subLocations", ",", "String", "type", ")", "{", "if", "(", "subLocations", ".", "size", "(", ")", "==", "1", ")", "{", "return", "subLocations", ".", "get", "(", "0", ")", ...
Builds a location from a List of locations; this can be circular or linear joins. The code expects that these locations are in a sensible format. @param subLocations The list of locations to use to build the location. If given a list of size 1 we will return that location. @param type The type of join for this location; defaults to join @return
[ "Builds", "a", "location", "from", "a", "List", "of", "locations", ";", "this", "can", "be", "circular", "or", "linear", "joins", ".", "The", "code", "expects", "that", "these", "locations", "are", "in", "a", "sensible", "format", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L60-L90
31,759
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.location
public static Location location(int start, int end, Strand strand, int length) { int min = Math.min(start, end); //if this is true then we have a coord on the +ve strand even though Strand could be negative boolean isReverse = (min != start); if (isReverse) { return new SimpleLocation( new SimplePoint(start).reverse(length), new SimplePoint(end).reverse(length), strand); } return new SimpleLocation(start, end, strand); }
java
public static Location location(int start, int end, Strand strand, int length) { int min = Math.min(start, end); //if this is true then we have a coord on the +ve strand even though Strand could be negative boolean isReverse = (min != start); if (isReverse) { return new SimpleLocation( new SimplePoint(start).reverse(length), new SimplePoint(end).reverse(length), strand); } return new SimpleLocation(start, end, strand); }
[ "public", "static", "Location", "location", "(", "int", "start", ",", "int", "end", ",", "Strand", "strand", ",", "int", "length", ")", "{", "int", "min", "=", "Math", ".", "min", "(", "start", ",", "end", ")", ";", "//if this is true then we have a coord ...
Returns a location object which unlike the location constructors allows you to input reverse coordinates and will convert these into the right location on the positive strand.
[ "Returns", "a", "location", "object", "which", "unlike", "the", "location", "constructors", "allows", "you", "to", "input", "reverse", "coordinates", "and", "will", "convert", "these", "into", "the", "right", "location", "on", "the", "positive", "strand", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L97-L108
31,760
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.circularLocation
public static Location circularLocation(int start, int end, Strand strand, int length) { int min = Math.min(start, end); int max = Math.max(start, end); //Tells us we're dealing with something that's not _right_ boolean isReverse = (min != start); if (min > length) { throw new IllegalArgumentException("Cannot process a " + "location whose lowest coordinate is less than " + "the given length " + length); } //If max positon was less than length the return a normal location if (max <= length) { return location(start, end, strand, length); } //Fine for forward coords (i..e start < end) int modStart = modulateCircularIndex(start, length); int modEnd = modulateCircularIndex(end, length); int numberOfPasses = completeCircularPasses(Math.max(start, end), length); if (isReverse) { int reversedModStart = new SimplePoint(modStart).reverse(length).getPosition(); int reversedModEnd = new SimplePoint(modEnd).reverse(length).getPosition(); modStart = reversedModStart; modEnd = reversedModEnd; start = reversedModStart; //+1 to number of passes to skip the run encoded by the start end = (length * (numberOfPasses + 1)) + modEnd; } List<Location> locations = new ArrayList<Location>(); locations.add(new SimpleLocation(modStart, length, strand)); for (int i = 0; i < numberOfPasses; i++) { locations.add(new SimpleLocation(1, length, strand)); } locations.add(new SimpleLocation(1, modEnd, strand)); return new SimpleLocation(new SimplePoint(start), new SimplePoint(end), strand, true, false, locations); }
java
public static Location circularLocation(int start, int end, Strand strand, int length) { int min = Math.min(start, end); int max = Math.max(start, end); //Tells us we're dealing with something that's not _right_ boolean isReverse = (min != start); if (min > length) { throw new IllegalArgumentException("Cannot process a " + "location whose lowest coordinate is less than " + "the given length " + length); } //If max positon was less than length the return a normal location if (max <= length) { return location(start, end, strand, length); } //Fine for forward coords (i..e start < end) int modStart = modulateCircularIndex(start, length); int modEnd = modulateCircularIndex(end, length); int numberOfPasses = completeCircularPasses(Math.max(start, end), length); if (isReverse) { int reversedModStart = new SimplePoint(modStart).reverse(length).getPosition(); int reversedModEnd = new SimplePoint(modEnd).reverse(length).getPosition(); modStart = reversedModStart; modEnd = reversedModEnd; start = reversedModStart; //+1 to number of passes to skip the run encoded by the start end = (length * (numberOfPasses + 1)) + modEnd; } List<Location> locations = new ArrayList<Location>(); locations.add(new SimpleLocation(modStart, length, strand)); for (int i = 0; i < numberOfPasses; i++) { locations.add(new SimpleLocation(1, length, strand)); } locations.add(new SimpleLocation(1, modEnd, strand)); return new SimpleLocation(new SimplePoint(start), new SimplePoint(end), strand, true, false, locations); }
[ "public", "static", "Location", "circularLocation", "(", "int", "start", ",", "int", "end", ",", "Strand", "strand", ",", "int", "length", ")", "{", "int", "min", "=", "Math", ".", "min", "(", "start", ",", "end", ")", ";", "int", "max", "=", "Math",...
Converts a location which defines the outer bounds of a circular location and splits it into the required portions. Unlike any other location builder this allows you to express your input location on the reverse strand @param location The location which currently expresses the outer bounds of a circular location. @param length The length of the circular genomic unit @return The circular location; can optionally return a normal non circular location if the one you give is within the bounds of the length
[ "Converts", "a", "location", "which", "defines", "the", "outer", "bounds", "of", "a", "circular", "location", "and", "splits", "it", "into", "the", "required", "portions", ".", "Unlike", "any", "other", "location", "builder", "this", "allows", "you", "to", "...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L123-L164
31,761
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.getMin
public static Location getMin(List<Location> locations) { return scanLocations(locations, new LocationPredicate() { @Override public boolean accept(Location previous, Location current) { int res = current.getStart().compareTo(previous.getStart()); return res < 0; } }); }
java
public static Location getMin(List<Location> locations) { return scanLocations(locations, new LocationPredicate() { @Override public boolean accept(Location previous, Location current) { int res = current.getStart().compareTo(previous.getStart()); return res < 0; } }); }
[ "public", "static", "Location", "getMin", "(", "List", "<", "Location", ">", "locations", ")", "{", "return", "scanLocations", "(", "locations", ",", "new", "LocationPredicate", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "Location", ...
Scans through a list of locations to find the Location with the lowest start
[ "Scans", "through", "a", "list", "of", "locations", "to", "find", "the", "Location", "with", "the", "lowest", "start" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L174-L182
31,762
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.getMax
public static Location getMax(List<Location> locations) { return scanLocations(locations, new LocationPredicate() { @Override public boolean accept(Location previous, Location current) { int res = current.getEnd().compareTo(previous.getEnd()); return res > 0; } }); }
java
public static Location getMax(List<Location> locations) { return scanLocations(locations, new LocationPredicate() { @Override public boolean accept(Location previous, Location current) { int res = current.getEnd().compareTo(previous.getEnd()); return res > 0; } }); }
[ "public", "static", "Location", "getMax", "(", "List", "<", "Location", ">", "locations", ")", "{", "return", "scanLocations", "(", "locations", ",", "new", "LocationPredicate", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "Location", ...
Scans through a list of locations to find the Location with the highest end
[ "Scans", "through", "a", "list", "of", "locations", "to", "find", "the", "Location", "with", "the", "highest", "end" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L188-L196
31,763
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.scanLocations
private static Location scanLocations(List<Location> locations, LocationPredicate predicate) { Location location = null; for (Location l : locations) { if (location == null) { location = l; } else { if (predicate.accept(location, l)) { location = l; } } } return location; }
java
private static Location scanLocations(List<Location> locations, LocationPredicate predicate) { Location location = null; for (Location l : locations) { if (location == null) { location = l; } else { if (predicate.accept(location, l)) { location = l; } } } return location; }
[ "private", "static", "Location", "scanLocations", "(", "List", "<", "Location", ">", "locations", ",", "LocationPredicate", "predicate", ")", "{", "Location", "location", "=", "null", ";", "for", "(", "Location", "l", ":", "locations", ")", "{", "if", "(", ...
Used for scanning through a list of locations; assumes the locations given will have at least one value otherwise we will get a null pointer
[ "Used", "for", "scanning", "through", "a", "list", "of", "locations", ";", "assumes", "the", "locations", "given", "will", "have", "at", "least", "one", "value", "otherwise", "we", "will", "get", "a", "null", "pointer" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L203-L216
31,764
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.modulateCircularIndex
public static int modulateCircularIndex(int index, int seqLength) { // Dummy case if (seqLength == 0) { return index; } // Modulate while (index > seqLength) { index -= seqLength; } return index; }
java
public static int modulateCircularIndex(int index, int seqLength) { // Dummy case if (seqLength == 0) { return index; } // Modulate while (index > seqLength) { index -= seqLength; } return index; }
[ "public", "static", "int", "modulateCircularIndex", "(", "int", "index", ",", "int", "seqLength", ")", "{", "// Dummy case", "if", "(", "seqLength", "==", "0", ")", "{", "return", "index", ";", "}", "// Modulate", "while", "(", "index", ">", "seqLength", "...
Takes a point on a circular location and moves it left until it falls at the earliest possible point that represents the same base. @param index Index of the position to work with @param seqLength Length of the Sequence @return The shifted point
[ "Takes", "a", "point", "on", "a", "circular", "location", "and", "moves", "it", "left", "until", "it", "falls", "at", "the", "earliest", "possible", "point", "that", "represents", "the", "same", "base", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L226-L236
31,765
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.completeCircularPasses
public static int completeCircularPasses(int index, int seqLength) { int count = 0; while (index > seqLength) { count++; index -= seqLength; } return count - 1; }
java
public static int completeCircularPasses(int index, int seqLength) { int count = 0; while (index > seqLength) { count++; index -= seqLength; } return count - 1; }
[ "public", "static", "int", "completeCircularPasses", "(", "int", "index", ",", "int", "seqLength", ")", "{", "int", "count", "=", "0", ";", "while", "(", "index", ">", "seqLength", ")", "{", "count", "++", ";", "index", "-=", "seqLength", ";", "}", "re...
Works in a similar way to modulateCircularLocation but returns the number of complete passes over a Sequence length a circular location makes i.e. if we have a sequence of length 10 and the location 3..52 we make 4 complete passes through the genome to go from position 3 to position 52.
[ "Works", "in", "a", "similar", "way", "to", "modulateCircularLocation", "but", "returns", "the", "number", "of", "complete", "passes", "over", "a", "Sequence", "length", "a", "circular", "location", "makes", "i", ".", "e", ".", "if", "we", "have", "a", "se...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L245-L252
31,766
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.detectCicular
public static boolean detectCicular(List<Location> subLocations) { boolean isCircular = false; if(! consistentAccessions(subLocations)) return isCircular; int lastMax = 0; for (Location sub : subLocations) { if (sub.getEnd().getPosition() > lastMax) { lastMax = sub.getEnd().getPosition(); } else { isCircular = true; break; } } return isCircular; }
java
public static boolean detectCicular(List<Location> subLocations) { boolean isCircular = false; if(! consistentAccessions(subLocations)) return isCircular; int lastMax = 0; for (Location sub : subLocations) { if (sub.getEnd().getPosition() > lastMax) { lastMax = sub.getEnd().getPosition(); } else { isCircular = true; break; } } return isCircular; }
[ "public", "static", "boolean", "detectCicular", "(", "List", "<", "Location", ">", "subLocations", ")", "{", "boolean", "isCircular", "=", "false", ";", "if", "(", "!", "consistentAccessions", "(", "subLocations", ")", ")", "return", "isCircular", ";", "int", ...
Loops through the given list of locations and returns true if it looks like they represent a circular location. Detection cannot happen if we do not have consistent accessions
[ "Loops", "through", "the", "given", "list", "of", "locations", "and", "returns", "true", "if", "it", "looks", "like", "they", "represent", "a", "circular", "location", ".", "Detection", "cannot", "happen", "if", "we", "do", "not", "have", "consistent", "acce...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L259-L275
31,767
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.consistentAccessions
public static boolean consistentAccessions(List<Location> subLocations) { Set<AccessionID> set = new HashSet<AccessionID>(); for(Location sub: subLocations) { set.add(sub.getAccession()); } return set.size() == 1; }
java
public static boolean consistentAccessions(List<Location> subLocations) { Set<AccessionID> set = new HashSet<AccessionID>(); for(Location sub: subLocations) { set.add(sub.getAccession()); } return set.size() == 1; }
[ "public", "static", "boolean", "consistentAccessions", "(", "List", "<", "Location", ">", "subLocations", ")", "{", "Set", "<", "AccessionID", ">", "set", "=", "new", "HashSet", "<", "AccessionID", ">", "(", ")", ";", "for", "(", "Location", "sub", ":", ...
Scans a list of locations and returns true if all the given locations are linked to the same sequence. A list of null accessioned locations is the same as a list where the accession is the same @param subLocations The locations to scan @return Returns a boolean indicating if this is consistently accessioned
[ "Scans", "a", "list", "of", "locations", "and", "returns", "true", "if", "all", "the", "given", "locations", "are", "linked", "to", "the", "same", "sequence", ".", "A", "list", "of", "null", "accessioned", "locations", "is", "the", "same", "as", "a", "li...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L285-L291
31,768
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.detectStrand
public static Strand detectStrand(List<Location> subLocations) { Strand strand = subLocations.get(0).getStrand(); for (Location sub : subLocations) { if (strand != sub.getStrand()) { strand = Strand.UNDEFINED; break; } } return strand; }
java
public static Strand detectStrand(List<Location> subLocations) { Strand strand = subLocations.get(0).getStrand(); for (Location sub : subLocations) { if (strand != sub.getStrand()) { strand = Strand.UNDEFINED; break; } } return strand; }
[ "public", "static", "Strand", "detectStrand", "(", "List", "<", "Location", ">", "subLocations", ")", "{", "Strand", "strand", "=", "subLocations", ".", "get", "(", "0", ")", ".", "getStrand", "(", ")", ";", "for", "(", "Location", "sub", ":", "subLocati...
Loops through the given list of locations and returns the consensus Strand class. If the class switches then we will return an undefined strand
[ "Loops", "through", "the", "given", "list", "of", "locations", "and", "returns", "the", "consensus", "Strand", "class", ".", "If", "the", "class", "switches", "then", "we", "will", "return", "an", "undefined", "strand" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L298-L307
31,769
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java
LocationHelper.detectEnd
public static Point detectEnd(List<Location> subLocations, boolean isCircular) { int end = 0; Point lastPoint = null; if(isCircular) { for (Location sub : subLocations) { lastPoint = sub.getEnd(); end += lastPoint.getPosition(); } } else { lastPoint = subLocations.get(subLocations.size()-1).getEnd(); end = lastPoint.getPosition(); } return new SimplePoint(end, lastPoint.isUnknown(), lastPoint.isUncertain()); }
java
public static Point detectEnd(List<Location> subLocations, boolean isCircular) { int end = 0; Point lastPoint = null; if(isCircular) { for (Location sub : subLocations) { lastPoint = sub.getEnd(); end += lastPoint.getPosition(); } } else { lastPoint = subLocations.get(subLocations.size()-1).getEnd(); end = lastPoint.getPosition(); } return new SimplePoint(end, lastPoint.isUnknown(), lastPoint.isUncertain()); }
[ "public", "static", "Point", "detectEnd", "(", "List", "<", "Location", ">", "subLocations", ",", "boolean", "isCircular", ")", "{", "int", "end", "=", "0", ";", "Point", "lastPoint", "=", "null", ";", "if", "(", "isCircular", ")", "{", "for", "(", "Lo...
This will attempt to find what the last point is and returns that position. If the location is circular this will return the total length of the location and does not mean the maximum point on the Sequence we may find the locations on
[ "This", "will", "attempt", "to", "find", "what", "the", "last", "point", "is", "and", "returns", "that", "position", ".", "If", "the", "location", "is", "circular", "this", "will", "return", "the", "total", "length", "of", "the", "location", "and", "does",...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/LocationHelper.java#L322-L336
31,770
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleSequencePair.java
SimpleSequencePair.getPercentageOfIdentity
@Override public double getPercentageOfIdentity(boolean countGaps) { double seqid = getNumIdenticals(); double length = getLength(); if (!countGaps) { length = length - getAlignedSequence(1).getNumGapPositions() - getAlignedSequence(2).getNumGapPositions(); } return seqid / length; }
java
@Override public double getPercentageOfIdentity(boolean countGaps) { double seqid = getNumIdenticals(); double length = getLength(); if (!countGaps) { length = length - getAlignedSequence(1).getNumGapPositions() - getAlignedSequence(2).getNumGapPositions(); } return seqid / length; }
[ "@", "Override", "public", "double", "getPercentageOfIdentity", "(", "boolean", "countGaps", ")", "{", "double", "seqid", "=", "getNumIdenticals", "(", ")", ";", "double", "length", "=", "getLength", "(", ")", ";", "if", "(", "!", "countGaps", ")", "{", "l...
Returns the percentage of identity between the two sequences in the alignment as a fraction between 0 and 1. @param countGaps If true, gap positions are counted as mismatches, i.e., the percentage is normalized by the alignment length. If false, gap positions are not counted, i.e. the percentage is normalized by the number of aligned residue pairs. See May (2004). "Percent sequence identity: the need to be explicit." @return the percentage of sequence identity as a fraction in [0,1]
[ "Returns", "the", "percentage", "of", "identity", "between", "the", "two", "sequences", "in", "the", "alignment", "as", "a", "fraction", "between", "0", "and", "1", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleSequencePair.java#L219-L228
31,771
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setCuts
public static void setCuts(int x, Subproblem subproblem, Last[][] pointers, Cut[]cuts) { for (Cut c : cuts) { c.update(x, subproblem, pointers); } }
java
public static void setCuts(int x, Subproblem subproblem, Last[][] pointers, Cut[]cuts) { for (Cut c : cuts) { c.update(x, subproblem, pointers); } }
[ "public", "static", "void", "setCuts", "(", "int", "x", ",", "Subproblem", "subproblem", ",", "Last", "[", "]", "[", "]", "pointers", ",", "Cut", "[", "]", "cuts", ")", "{", "for", "(", "Cut", "c", ":", "cuts", ")", "{", "c", ".", "update", "(", ...
updates cut rows given the latest row of traceback pointers
[ "updates", "cut", "rows", "given", "the", "latest", "row", "of", "traceback", "pointers" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L298-L302
31,772
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setScorePoint
public static Last[] setScorePoint(int x, int y, int gop, int gep, int sub, int[][][] scores) { Last[] pointers = new Last[3]; // substitution if (scores[x - 1][y - 1][1] >= scores[x - 1][y - 1][0] && scores[x - 1][y - 1][1] >= scores[x - 1][y - 1][2]) { scores[x][y][0] = scores[x - 1][y - 1][1] + sub; pointers[0] = Last.DELETION; } else if (scores[x - 1][y - 1][0] >= scores[x - 1][y - 1][2]) { scores[x][y][0] = scores[x - 1][y - 1][0] + sub; pointers[0] = Last.SUBSTITUTION; } else { scores[x][y][0] = scores[x - 1][y - 1][2] + sub; pointers[0] = Last.INSERTION; } // deletion if (scores[x - 1][y][1] >= scores[x - 1][y][0] + gop) { scores[x][y][1] = scores[x - 1][y][1] + gep; pointers[1] = Last.DELETION; } else { scores[x][y][1] = scores[x - 1][y][0] + gop + gep; pointers[1] = Last.SUBSTITUTION; } // insertion if (scores[x][y - 1][0] + gop >= scores[x][y - 1][2]) { scores[x][y][2] = scores[x][y - 1][0] + gop + gep; pointers[2] = Last.SUBSTITUTION; } else { scores[x][y][2] = scores[x][y - 1][2] + gep; pointers[2] = Last.INSERTION; } return pointers; }
java
public static Last[] setScorePoint(int x, int y, int gop, int gep, int sub, int[][][] scores) { Last[] pointers = new Last[3]; // substitution if (scores[x - 1][y - 1][1] >= scores[x - 1][y - 1][0] && scores[x - 1][y - 1][1] >= scores[x - 1][y - 1][2]) { scores[x][y][0] = scores[x - 1][y - 1][1] + sub; pointers[0] = Last.DELETION; } else if (scores[x - 1][y - 1][0] >= scores[x - 1][y - 1][2]) { scores[x][y][0] = scores[x - 1][y - 1][0] + sub; pointers[0] = Last.SUBSTITUTION; } else { scores[x][y][0] = scores[x - 1][y - 1][2] + sub; pointers[0] = Last.INSERTION; } // deletion if (scores[x - 1][y][1] >= scores[x - 1][y][0] + gop) { scores[x][y][1] = scores[x - 1][y][1] + gep; pointers[1] = Last.DELETION; } else { scores[x][y][1] = scores[x - 1][y][0] + gop + gep; pointers[1] = Last.SUBSTITUTION; } // insertion if (scores[x][y - 1][0] + gop >= scores[x][y - 1][2]) { scores[x][y][2] = scores[x][y - 1][0] + gop + gep; pointers[2] = Last.SUBSTITUTION; } else { scores[x][y][2] = scores[x][y - 1][2] + gep; pointers[2] = Last.INSERTION; } return pointers; }
[ "public", "static", "Last", "[", "]", "setScorePoint", "(", "int", "x", ",", "int", "y", ",", "int", "gop", ",", "int", "gep", ",", "int", "sub", ",", "int", "[", "]", "[", "]", "[", "]", "scores", ")", "{", "Last", "[", "]", "pointers", "=", ...
Calculate the optimal alignment score for the given sequence positions with an affine or constant gap penalty @param x position in query @param y position in target @param gop gap opening penalty @param gep gap extension penalty @param sub compound match score @param scores dynamic programming score matrix to fill at the given position @return traceback direction for substitution, deletion and insertion
[ "Calculate", "the", "optimal", "alignment", "score", "for", "the", "given", "sequence", "positions", "with", "an", "affine", "or", "constant", "gap", "penalty" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L313-L347
31,773
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setScorePoint
public static Last setScorePoint(int x, int y, int gep, int sub, int[][][] scores) { int d = scores[x - 1][y][0] + gep; int i = scores[x][y - 1][0] + gep; int s = scores[x - 1][y - 1][0] + sub; if (d >= s && d >= i) { scores[x][y][0] = d; return Last.DELETION; } else if (s >= i) { scores[x][y][0] = s; return Last.SUBSTITUTION; } else { scores[x][y][0] = i; return Last.INSERTION; } }
java
public static Last setScorePoint(int x, int y, int gep, int sub, int[][][] scores) { int d = scores[x - 1][y][0] + gep; int i = scores[x][y - 1][0] + gep; int s = scores[x - 1][y - 1][0] + sub; if (d >= s && d >= i) { scores[x][y][0] = d; return Last.DELETION; } else if (s >= i) { scores[x][y][0] = s; return Last.SUBSTITUTION; } else { scores[x][y][0] = i; return Last.INSERTION; } }
[ "public", "static", "Last", "setScorePoint", "(", "int", "x", ",", "int", "y", ",", "int", "gep", ",", "int", "sub", ",", "int", "[", "]", "[", "]", "[", "]", "scores", ")", "{", "int", "d", "=", "scores", "[", "x", "-", "1", "]", "[", "y", ...
Calculates the optimal alignment score for the given sequence positions and a linear gap penalty @param x position in query @param y position in target @param gep gap extension penalty @param sub compound match score @param scores dynamic programming score matrix to fill at the given position @return traceback directions for substitution, deletion and insertion respectively
[ "Calculates", "the", "optimal", "alignment", "score", "for", "the", "given", "sequence", "positions", "and", "a", "linear", "gap", "penalty" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L357-L371
31,774
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setScoreVector
public static Last[][] setScoreVector(int x, int xb, int yb, int ye, int gep, int[] subs, boolean storing, int[][][] scores, boolean startAnchored) { Last[][] pointers = new Last[ye + 1][1]; ensureScoringMatrixColumn(x, storing, scores); if (x == xb) { if (startAnchored) { assert (xb > 0 && yb > 0); scores[xb][yb][0] = scores[xb - 1][yb - 1][0] + subs[yb]; pointers[yb][0] = Last.SUBSTITUTION; } for (int y = yb + 1; y <= ye; y++) { scores[xb][y][0] = scores[xb][y - 1][0] + gep; pointers[y][0] = Last.INSERTION; } } else { scores[x][yb][0] = scores[x - 1][yb][0] + gep; pointers[yb][0] = Last.DELETION; for (int y = yb + 1; y <= ye; y++) { pointers[y][0] = setScorePoint(x, y, gep, subs[y], scores); } } return pointers; }
java
public static Last[][] setScoreVector(int x, int xb, int yb, int ye, int gep, int[] subs, boolean storing, int[][][] scores, boolean startAnchored) { Last[][] pointers = new Last[ye + 1][1]; ensureScoringMatrixColumn(x, storing, scores); if (x == xb) { if (startAnchored) { assert (xb > 0 && yb > 0); scores[xb][yb][0] = scores[xb - 1][yb - 1][0] + subs[yb]; pointers[yb][0] = Last.SUBSTITUTION; } for (int y = yb + 1; y <= ye; y++) { scores[xb][y][0] = scores[xb][y - 1][0] + gep; pointers[y][0] = Last.INSERTION; } } else { scores[x][yb][0] = scores[x - 1][yb][0] + gep; pointers[yb][0] = Last.DELETION; for (int y = yb + 1; y <= ye; y++) { pointers[y][0] = setScorePoint(x, y, gep, subs[y], scores); } } return pointers; }
[ "public", "static", "Last", "[", "]", "[", "]", "setScoreVector", "(", "int", "x", ",", "int", "xb", ",", "int", "yb", ",", "int", "ye", ",", "int", "gep", ",", "int", "[", "]", "subs", ",", "boolean", "storing", ",", "int", "[", "]", "[", "]",...
Score global alignment for a given position in the query sequence for a linear gap penalty @param x @param xb @param yb @param ye @param gep @param subs @param storing @param scores @param startAnchored @return
[ "Score", "global", "alignment", "for", "a", "given", "position", "in", "the", "query", "sequence", "for", "a", "linear", "gap", "penalty" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L464-L486
31,775
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setScoreVector
public static Last[][] setScoreVector(int x, int xb, int yb, int ye, int gop, int gep, int[] subs, boolean storing, int[][][] scores, int[] xyMax, int score) { Last[][] pointers; ensureScoringMatrixColumn(x, storing, scores); if (x == xb) { pointers = new Last[ye + 1][scores[0][0].length]; } else { pointers = new Last[ye + 1][]; pointers[0] = new Last[scores[0][0].length]; for (int y = 1; y < scores[0].length; y++) { pointers[y] = setScorePoint(x, y, gop, gep, subs[y], scores); for (int z = 0; z < scores[0][0].length; z++) { if (scores[x][y][z] <= 0) { scores[x][y][z] = 0; pointers[y][z] = null; } } if (scores[x][y][0] > score) { xyMax[0] = x; xyMax[1] = y; score = scores[x][y][0]; } } } return pointers; }
java
public static Last[][] setScoreVector(int x, int xb, int yb, int ye, int gop, int gep, int[] subs, boolean storing, int[][][] scores, int[] xyMax, int score) { Last[][] pointers; ensureScoringMatrixColumn(x, storing, scores); if (x == xb) { pointers = new Last[ye + 1][scores[0][0].length]; } else { pointers = new Last[ye + 1][]; pointers[0] = new Last[scores[0][0].length]; for (int y = 1; y < scores[0].length; y++) { pointers[y] = setScorePoint(x, y, gop, gep, subs[y], scores); for (int z = 0; z < scores[0][0].length; z++) { if (scores[x][y][z] <= 0) { scores[x][y][z] = 0; pointers[y][z] = null; } } if (scores[x][y][0] > score) { xyMax[0] = x; xyMax[1] = y; score = scores[x][y][0]; } } } return pointers; }
[ "public", "static", "Last", "[", "]", "[", "]", "setScoreVector", "(", "int", "x", ",", "int", "xb", ",", "int", "yb", ",", "int", "ye", ",", "int", "gop", ",", "int", "gep", ",", "int", "[", "]", "subs", ",", "boolean", "storing", ",", "int", ...
Score local alignment for a given position in the query sequence @param x @param xb @param yb @param ye @param gop @param gep @param subs @param storing @param scores @param xyMax @param score @return
[ "Score", "local", "alignment", "for", "a", "given", "position", "in", "the", "query", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L520-L545
31,776
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setScoreVector
public static Last[][] setScoreVector(int x, int gep, int[] subs, boolean storing, int[][][] scores, int[] xyMax, int score) { return setScoreVector(x, 0, 0, scores[0].length - 1, gep, subs, storing, scores, xyMax, score); }
java
public static Last[][] setScoreVector(int x, int gep, int[] subs, boolean storing, int[][][] scores, int[] xyMax, int score) { return setScoreVector(x, 0, 0, scores[0].length - 1, gep, subs, storing, scores, xyMax, score); }
[ "public", "static", "Last", "[", "]", "[", "]", "setScoreVector", "(", "int", "x", ",", "int", "gep", ",", "int", "[", "]", "subs", ",", "boolean", "storing", ",", "int", "[", "]", "[", "]", "[", "]", "scores", ",", "int", "[", "]", "xyMax", ",...
Score local alignment for a given position in the query sequence for a linear gap penalty @param x @param gep @param subs @param storing @param scores @param xyMax @param score @return
[ "Score", "local", "alignment", "for", "a", "given", "position", "in", "the", "query", "sequence", "for", "a", "linear", "gap", "penalty" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L558-L561
31,777
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setSteps
public static int[] setSteps(Last[][][] traceback, boolean local, int[] xyMax, Last last, List<Step> sx, List<Step> sy) { int x = xyMax[0], y = xyMax[1]; boolean linear = (traceback[x][y].length == 1); while (local ? (linear ? last : traceback[x][y][last.ordinal()]) != null : x > 0 || y > 0) { switch (last) { case DELETION: sx.add(Step.COMPOUND); sy.add(Step.GAP); last = linear ? traceback[--x][y][0] : traceback[x--][y][1]; break; case SUBSTITUTION: sx.add(Step.COMPOUND); sy.add(Step.COMPOUND); last = linear ? traceback[--x][--y][0] : traceback[x--][y--][0]; break; case INSERTION: sx.add(Step.GAP); sy.add(Step.COMPOUND); last = linear ? traceback[x][--y][0] : traceback[x][y--][2]; } } Collections.reverse(sx); Collections.reverse(sy); return new int[] {x, y}; }
java
public static int[] setSteps(Last[][][] traceback, boolean local, int[] xyMax, Last last, List<Step> sx, List<Step> sy) { int x = xyMax[0], y = xyMax[1]; boolean linear = (traceback[x][y].length == 1); while (local ? (linear ? last : traceback[x][y][last.ordinal()]) != null : x > 0 || y > 0) { switch (last) { case DELETION: sx.add(Step.COMPOUND); sy.add(Step.GAP); last = linear ? traceback[--x][y][0] : traceback[x--][y][1]; break; case SUBSTITUTION: sx.add(Step.COMPOUND); sy.add(Step.COMPOUND); last = linear ? traceback[--x][--y][0] : traceback[x--][y--][0]; break; case INSERTION: sx.add(Step.GAP); sy.add(Step.COMPOUND); last = linear ? traceback[x][--y][0] : traceback[x][y--][2]; } } Collections.reverse(sx); Collections.reverse(sy); return new int[] {x, y}; }
[ "public", "static", "int", "[", "]", "setSteps", "(", "Last", "[", "]", "[", "]", "[", "]", "traceback", ",", "boolean", "local", ",", "int", "[", "]", "xyMax", ",", "Last", "last", ",", "List", "<", "Step", ">", "sx", ",", "List", "<", "Step", ...
Find alignment path through traceback matrix @param traceback @param local @param xyMax @param last @param sx @param sy @return
[ "Find", "alignment", "path", "through", "traceback", "matrix" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L617-L642
31,778
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setSteps
public static int[] setSteps(Last[][][] traceback, int[][][] scores, List<Step> sx, List<Step> sy) { int xMax = scores.length - 1, yMax = scores[xMax].length - 1; boolean linear = (traceback[xMax][yMax].length == 1); Last last = linear ? traceback[xMax][yMax][0] : (scores[xMax][yMax][1] > scores[xMax][yMax][0] && scores[xMax][yMax][1] > scores[xMax][yMax][2] ) ? Last.DELETION : (scores[xMax][yMax][0] > scores[xMax][yMax][2]) ? Last.SUBSTITUTION : Last.INSERTION; return setSteps(traceback, false, new int[] {xMax, yMax}, last, sx, sy); }
java
public static int[] setSteps(Last[][][] traceback, int[][][] scores, List<Step> sx, List<Step> sy) { int xMax = scores.length - 1, yMax = scores[xMax].length - 1; boolean linear = (traceback[xMax][yMax].length == 1); Last last = linear ? traceback[xMax][yMax][0] : (scores[xMax][yMax][1] > scores[xMax][yMax][0] && scores[xMax][yMax][1] > scores[xMax][yMax][2] ) ? Last.DELETION : (scores[xMax][yMax][0] > scores[xMax][yMax][2]) ? Last.SUBSTITUTION : Last.INSERTION; return setSteps(traceback, false, new int[] {xMax, yMax}, last, sx, sy); }
[ "public", "static", "int", "[", "]", "setSteps", "(", "Last", "[", "]", "[", "]", "[", "]", "traceback", ",", "int", "[", "]", "[", "]", "[", "]", "scores", ",", "List", "<", "Step", ">", "sx", ",", "List", "<", "Step", ">", "sy", ")", "{", ...
Find global alignment path through traceback matrix @param traceback @param scores @param sx @param sy @return
[ "Find", "global", "alignment", "path", "through", "traceback", "matrix" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L652-L671
31,779
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java
AlignerHelper.setSteps
public static int[] setSteps(Last[][][] traceback, int[] xyMax, List<Step> sx, List<Step> sy) { return setSteps(traceback, true, xyMax, Last.SUBSTITUTION, sx, sy); }
java
public static int[] setSteps(Last[][][] traceback, int[] xyMax, List<Step> sx, List<Step> sy) { return setSteps(traceback, true, xyMax, Last.SUBSTITUTION, sx, sy); }
[ "public", "static", "int", "[", "]", "setSteps", "(", "Last", "[", "]", "[", "]", "[", "]", "traceback", ",", "int", "[", "]", "xyMax", ",", "List", "<", "Step", ">", "sx", ",", "List", "<", "Step", ">", "sy", ")", "{", "return", "setSteps", "(...
Find local alignment path through traceback matrix @param traceback @param xyMax @param sx @param sy @return
[ "Find", "local", "alignment", "path", "through", "traceback", "matrix" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AlignerHelper.java#L681-L683
31,780
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/Matrices.java
Matrices.getRotationJAMA
public static Matrix getRotationJAMA(Matrix4d transform) { Matrix rot = new Matrix(3, 3); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { rot.set(j, i, transform.getElement(i, j)); // transposed } } return rot; }
java
public static Matrix getRotationJAMA(Matrix4d transform) { Matrix rot = new Matrix(3, 3); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { rot.set(j, i, transform.getElement(i, j)); // transposed } } return rot; }
[ "public", "static", "Matrix", "getRotationJAMA", "(", "Matrix4d", "transform", ")", "{", "Matrix", "rot", "=", "new", "Matrix", "(", "3", ",", "3", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "for", ...
Convert a transformation matrix into a JAMA rotation matrix. Because the JAMA matrix is a pre-multiplication matrix and the Vecmath matrix is a post-multiplication one, the rotation matrix is transposed to ensure that the transformation they produce is the same. @param transform Matrix4d with transposed rotation matrix @return rotation matrix as JAMA object
[ "Convert", "a", "transformation", "matrix", "into", "a", "JAMA", "rotation", "matrix", ".", "Because", "the", "JAMA", "matrix", "is", "a", "pre", "-", "multiplication", "matrix", "and", "the", "Vecmath", "matrix", "is", "a", "post", "-", "multiplication", "o...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/Matrices.java#L54-L63
31,781
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/Matrices.java
Matrices.getRotationMatrix
public static Matrix3d getRotationMatrix(Matrix4d transform) { Matrix3d rot = new Matrix3d(); transform.setRotationScale(rot); return rot; }
java
public static Matrix3d getRotationMatrix(Matrix4d transform) { Matrix3d rot = new Matrix3d(); transform.setRotationScale(rot); return rot; }
[ "public", "static", "Matrix3d", "getRotationMatrix", "(", "Matrix4d", "transform", ")", "{", "Matrix3d", "rot", "=", "new", "Matrix3d", "(", ")", ";", "transform", ".", "setRotationScale", "(", "rot", ")", ";", "return", "rot", ";", "}" ]
Convert a transformation matrix into a rotation matrix. @param transform Matrix4d @return rotation matrix
[ "Convert", "a", "transformation", "matrix", "into", "a", "rotation", "matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/Matrices.java#L72-L77
31,782
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/Matrices.java
Matrices.getTranslationVector
public static Vector3d getTranslationVector(Matrix4d transform) { Vector3d transl = new Vector3d(); transform.get(transl); return transl; }
java
public static Vector3d getTranslationVector(Matrix4d transform) { Vector3d transl = new Vector3d(); transform.get(transl); return transl; }
[ "public", "static", "Vector3d", "getTranslationVector", "(", "Matrix4d", "transform", ")", "{", "Vector3d", "transl", "=", "new", "Vector3d", "(", ")", ";", "transform", ".", "get", "(", "transl", ")", ";", "return", "transl", ";", "}" ]
Extract the translational vector of a transformation matrix. @param transform Matrix4d @return Vector3d translation vector
[ "Extract", "the", "translational", "vector", "of", "a", "transformation", "matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/Matrices.java#L86-L90
31,783
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java
ProteinSequence.setParentDNASequence
public void setParentDNASequence(AbstractSequence<NucleotideCompound> parentDNASequence, Integer begin, Integer end) { this.setParentSequence(parentDNASequence); setBioBegin(begin); setBioEnd(end); }
java
public void setParentDNASequence(AbstractSequence<NucleotideCompound> parentDNASequence, Integer begin, Integer end) { this.setParentSequence(parentDNASequence); setBioBegin(begin); setBioEnd(end); }
[ "public", "void", "setParentDNASequence", "(", "AbstractSequence", "<", "NucleotideCompound", ">", "parentDNASequence", ",", "Integer", "begin", ",", "Integer", "end", ")", "{", "this", ".", "setParentSequence", "(", "parentDNASequence", ")", ";", "setBioBegin", "("...
However, due to the derivation of this class, this is the only possible type argument for this parameter...
[ "However", "due", "to", "the", "derivation", "of", "this", "class", "this", "is", "the", "only", "possible", "type", "argument", "for", "this", "parameter", "..." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/ProteinSequence.java#L149-L153
31,784
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/AAIndexFileParser.java
AAIndexFileParser.parse
public void parse(InputStream inputStream) throws IOException { currentMatrix = null; currentRows = ""; currentCols = ""; max = Short.MIN_VALUE; min = Short.MAX_VALUE; inMatrix = false; BufferedReader buf = new BufferedReader (new InputStreamReader (inputStream)); String line = null; line = buf.readLine(); while ( line != null ) { if ( line.startsWith("//")) { finalizeMatrix(); inMatrix = false; } else if ( line.startsWith("H ")){ // a new matric! newMatrix(line); } else if ( line.startsWith("D ")) { currentMatrix.setDescription(line.substring(2)); } else if ( line.startsWith("M ")) { initMatrix(line); inMatrix = true; } else if ( line.startsWith(" ")){ if ( inMatrix) processScores(line); } line = buf.readLine(); } }
java
public void parse(InputStream inputStream) throws IOException { currentMatrix = null; currentRows = ""; currentCols = ""; max = Short.MIN_VALUE; min = Short.MAX_VALUE; inMatrix = false; BufferedReader buf = new BufferedReader (new InputStreamReader (inputStream)); String line = null; line = buf.readLine(); while ( line != null ) { if ( line.startsWith("//")) { finalizeMatrix(); inMatrix = false; } else if ( line.startsWith("H ")){ // a new matric! newMatrix(line); } else if ( line.startsWith("D ")) { currentMatrix.setDescription(line.substring(2)); } else if ( line.startsWith("M ")) { initMatrix(line); inMatrix = true; } else if ( line.startsWith(" ")){ if ( inMatrix) processScores(line); } line = buf.readLine(); } }
[ "public", "void", "parse", "(", "InputStream", "inputStream", ")", "throws", "IOException", "{", "currentMatrix", "=", "null", ";", "currentRows", "=", "\"\"", ";", "currentCols", "=", "\"\"", ";", "max", "=", "Short", ".", "MIN_VALUE", ";", "min", "=", "S...
parse an inputStream that points to an AAINDEX database file @param inputStream @throws IOException
[ "parse", "an", "inputStream", "that", "points", "to", "an", "AAINDEX", "database", "file" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/AAIndexFileParser.java#L64-L99
31,785
biojava/biojava
biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonnModel.java
ORonnModel.align
private final float[] align(final int sResidue, final int dIndex) { int dResidue, r; float maxScore = -1000000; float rho1 = 0; int maxIdx = 0; float rho0 = 0; short[] dbAARow = model.dbAA[dIndex]; int numOfIterations = model.Length[dIndex] - ORonnModel.AA_ALPHABET; for (dResidue = 0; dResidue <= numOfIterations; dResidue++) { // go though the database sequence for maximised alignment rho1 = 0.0f; for (r = 0; r < ORonnModel.AA_ALPHABET; r++) { // go through the query sequence for one alignment rho1 += RonnConstraint.Blosum62[seqAA[sResidue + r]][dbAARow[dResidue + r]]; } if (rho1 > maxScore) { maxScore = rho1; maxIdx = dResidue; } } for (r = 0; r < ORonnModel.AA_ALPHABET; r++) { rho0 += RonnConstraint.Blosum62[dbAARow[maxIdx + r]][dbAARow[maxIdx + r]]; } return new float[] { rho0, maxScore }; }
java
private final float[] align(final int sResidue, final int dIndex) { int dResidue, r; float maxScore = -1000000; float rho1 = 0; int maxIdx = 0; float rho0 = 0; short[] dbAARow = model.dbAA[dIndex]; int numOfIterations = model.Length[dIndex] - ORonnModel.AA_ALPHABET; for (dResidue = 0; dResidue <= numOfIterations; dResidue++) { // go though the database sequence for maximised alignment rho1 = 0.0f; for (r = 0; r < ORonnModel.AA_ALPHABET; r++) { // go through the query sequence for one alignment rho1 += RonnConstraint.Blosum62[seqAA[sResidue + r]][dbAARow[dResidue + r]]; } if (rho1 > maxScore) { maxScore = rho1; maxIdx = dResidue; } } for (r = 0; r < ORonnModel.AA_ALPHABET; r++) { rho0 += RonnConstraint.Blosum62[dbAARow[maxIdx + r]][dbAARow[maxIdx + r]]; } return new float[] { rho0, maxScore }; }
[ "private", "final", "float", "[", "]", "align", "(", "final", "int", "sResidue", ",", "final", "int", "dIndex", ")", "{", "int", "dResidue", ",", "r", ";", "float", "maxScore", "=", "-", "1000000", ";", "float", "rho1", "=", "0", ";", "int", "maxIdx"...
sResidue query sequence index and dIndex database sequence index
[ "sResidue", "query", "sequence", "index", "and", "dIndex", "database", "sequence", "index" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-protein-disorder/src/main/java/org/biojava/nbio/ronn/ORonnModel.java#L142-L168
31,786
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java
StructureAlignmentFactory.addAlgorithm
public static void addAlgorithm(StructureAlignment alg) { //ensure uniqueness try { getAlgorithm(alg.getAlgorithmName()); // algorithm was found. Do nothing. } catch(StructureException e) { // no algorithm found, so it's new algorithms.add(alg); } }
java
public static void addAlgorithm(StructureAlignment alg) { //ensure uniqueness try { getAlgorithm(alg.getAlgorithmName()); // algorithm was found. Do nothing. } catch(StructureException e) { // no algorithm found, so it's new algorithms.add(alg); } }
[ "public", "static", "void", "addAlgorithm", "(", "StructureAlignment", "alg", ")", "{", "//ensure uniqueness", "try", "{", "getAlgorithm", "(", "alg", ".", "getAlgorithmName", "(", ")", ")", ";", "// algorithm was found. Do nothing.", "}", "catch", "(", "StructureEx...
Adds a new StructureAlignment algorithm to the list. Only one instance is stored for each algorithmName, so it is possible that a different instance may be returned by getAlgorithm(alg.getAlgorithmName()) @param alg the alignment algorithm
[ "Adds", "a", "new", "StructureAlignment", "algorithm", "to", "the", "list", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java#L68-L77
31,787
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java
StructureAlignmentFactory.removeAlgorithm
public static boolean removeAlgorithm(String name) { ListIterator<StructureAlignment> algIt = algorithms.listIterator(); while(algIt.hasNext()) { StructureAlignment alg = algIt.next(); if(alg.getAlgorithmName().equalsIgnoreCase(name)) { algIt.remove(); return true; } } return false; }
java
public static boolean removeAlgorithm(String name) { ListIterator<StructureAlignment> algIt = algorithms.listIterator(); while(algIt.hasNext()) { StructureAlignment alg = algIt.next(); if(alg.getAlgorithmName().equalsIgnoreCase(name)) { algIt.remove(); return true; } } return false; }
[ "public", "static", "boolean", "removeAlgorithm", "(", "String", "name", ")", "{", "ListIterator", "<", "StructureAlignment", ">", "algIt", "=", "algorithms", ".", "listIterator", "(", ")", ";", "while", "(", "algIt", ".", "hasNext", "(", ")", ")", "{", "S...
Removes the specified algorithm from the list of options @param name the name of the algorithm to remove @return true if the specified algorithm was found and removed
[ "Removes", "the", "specified", "algorithm", "from", "the", "list", "of", "options" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructureAlignmentFactory.java#L84-L94
31,788
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java
QsAlignResult.getAlignedSubunits1
public List<Subunit> getAlignedSubunits1() { List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size()); for (Integer key : subunitMap.keySet()) aligned.add(subunits1.get(key)); return aligned; }
java
public List<Subunit> getAlignedSubunits1() { List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size()); for (Integer key : subunitMap.keySet()) aligned.add(subunits1.get(key)); return aligned; }
[ "public", "List", "<", "Subunit", ">", "getAlignedSubunits1", "(", ")", "{", "List", "<", "Subunit", ">", "aligned", "=", "new", "ArrayList", "<", "Subunit", ">", "(", "subunitMap", ".", "size", "(", ")", ")", ";", "for", "(", "Integer", "key", ":", ...
Return the aligned subunits of the first Subunit group, in the alignment order. @return a List of Subunits in the alignment order
[ "Return", "the", "aligned", "subunits", "of", "the", "first", "Subunit", "group", "in", "the", "alignment", "order", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java#L235-L243
31,789
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java
QsAlignResult.getAlignedSubunits2
public List<Subunit> getAlignedSubunits2() { List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size()); for (Integer key : subunitMap.keySet()) aligned.add(subunits2.get(subunitMap.get(key))); return aligned; }
java
public List<Subunit> getAlignedSubunits2() { List<Subunit> aligned = new ArrayList<Subunit>(subunitMap.size()); for (Integer key : subunitMap.keySet()) aligned.add(subunits2.get(subunitMap.get(key))); return aligned; }
[ "public", "List", "<", "Subunit", ">", "getAlignedSubunits2", "(", ")", "{", "List", "<", "Subunit", ">", "aligned", "=", "new", "ArrayList", "<", "Subunit", ">", "(", "subunitMap", ".", "size", "(", ")", ")", ";", "for", "(", "Integer", "key", ":", ...
Return the aligned subunits of the second Subunit group, in the alignment order. @return a List of Subunits in the alignment order
[ "Return", "the", "aligned", "subunits", "of", "the", "second", "Subunit", "group", "in", "the", "alignment", "order", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/quaternary/QsAlignResult.java#L251-L259
31,790
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java
HetatomImpl.setPDBName
@Override public void setPDBName(String s) { // hetatoms can have pdb_name length < 3. e.g. CU (see 1a4a position 1200 ) //if (s.length() != 3) { //throw new PDBParseException("amino acid name is not of length 3!"); //} if (s != null && s.equals("?")) logger.info("invalid pdbname: ?"); pdb_name =s ; }
java
@Override public void setPDBName(String s) { // hetatoms can have pdb_name length < 3. e.g. CU (see 1a4a position 1200 ) //if (s.length() != 3) { //throw new PDBParseException("amino acid name is not of length 3!"); //} if (s != null && s.equals("?")) logger.info("invalid pdbname: ?"); pdb_name =s ; }
[ "@", "Override", "public", "void", "setPDBName", "(", "String", "s", ")", "{", "// hetatoms can have pdb_name length < 3. e.g. CU (see 1a4a position 1200 )", "//if (s.length() != 3) {", "//throw new PDBParseException(\"amino acid name is not of length 3!\");", "//}", "if", "(", "s", ...
Set three character name of Group . @param s a String specifying the PDBName value @see #getPDBName
[ "Set", "three", "character", "name", "of", "Group", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java#L144-L153
31,791
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java
HetatomImpl.clearAtoms
@Override public void clearAtoms() { atoms.clear(); setPDBFlag(false); if ( atomNameLookup != null) atomNameLookup.clear(); }
java
@Override public void clearAtoms() { atoms.clear(); setPDBFlag(false); if ( atomNameLookup != null) atomNameLookup.clear(); }
[ "@", "Override", "public", "void", "clearAtoms", "(", ")", "{", "atoms", ".", "clear", "(", ")", ";", "setPDBFlag", "(", "false", ")", ";", "if", "(", "atomNameLookup", "!=", "null", ")", "atomNameLookup", ".", "clear", "(", ")", ";", "}" ]
remove all atoms
[ "remove", "all", "atoms" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java#L196-L202
31,792
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java
HetatomImpl.trimToSize
@Override public void trimToSize(){ if ( atoms instanceof ArrayList<?>) { ArrayList<Atom> myatoms = (ArrayList<Atom>) atoms; myatoms.trimToSize(); } if ( altLocs instanceof ArrayList<?>){ ArrayList<Group> myAltLocs = (ArrayList<Group>) altLocs; myAltLocs.trimToSize(); } if ( hasAltLoc()) { for (Group alt : getAltLocs()){ alt.trimToSize(); } } // now let's fit the hashmaps to size properties = new HashMap<String, Object>(properties); if ( atomNameLookup != null) atomNameLookup = new HashMap<String,Atom>(atomNameLookup); }
java
@Override public void trimToSize(){ if ( atoms instanceof ArrayList<?>) { ArrayList<Atom> myatoms = (ArrayList<Atom>) atoms; myatoms.trimToSize(); } if ( altLocs instanceof ArrayList<?>){ ArrayList<Group> myAltLocs = (ArrayList<Group>) altLocs; myAltLocs.trimToSize(); } if ( hasAltLoc()) { for (Group alt : getAltLocs()){ alt.trimToSize(); } } // now let's fit the hashmaps to size properties = new HashMap<String, Object>(properties); if ( atomNameLookup != null) atomNameLookup = new HashMap<String,Atom>(atomNameLookup); }
[ "@", "Override", "public", "void", "trimToSize", "(", ")", "{", "if", "(", "atoms", "instanceof", "ArrayList", "<", "?", ">", ")", "{", "ArrayList", "<", "Atom", ">", "myatoms", "=", "(", "ArrayList", "<", "Atom", ">", ")", "atoms", ";", "myatoms", "...
attempts to reduce the memory imprint of this group by trimming all internal Collection objects to the required size.
[ "attempts", "to", "reduce", "the", "memory", "imprint", "of", "this", "group", "by", "trimming", "all", "internal", "Collection", "objects", "to", "the", "required", "size", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/HetatomImpl.java#L647-L671
31,793
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java
LinearColorInterpolator.interpolate
@Override public Color interpolate(Color a, Color b, float mixing) { float[] compA, compB; // Get components // Don't convert colorSpaces unless necessary if(a.getColorSpace().equals(colorSpace) ) { compA = a.getComponents(null); } else { compA = a.getComponents(colorSpace, null); } if(b.getColorSpace().equals(colorSpace)) { compB = b.getComponents(null); } else { compB = b.getComponents(colorSpace, null); } float[] compMixed = new float[compA.length]; for(int i=0;i<compA.length;i++){ //Normalizing to [0,1] after the interpolation, // INNER means between a and b // OUTER means between max(a,b) and min(a,b)+1 // UPPER means between a and b' s.t. b'>a and b' in {b, b+1} // LOWER means between a and b' s.t. b'<a and b' in {b, b-1} float left, right; left = compA[i]; //Alpha uses INNER direction InterpolationDirection dir = i<interpolationDirection.length ? interpolationDirection[i] : InterpolationDirection.INNER; switch(dir) { case INNER: right = compB[i]; break; case OUTER: if(compA[i]<compB[i]) { right = compB[i]-1; } else { right = compB[i]+1; } break; case UPPER: if(compA[i]<compB[i]) { right = compB[i]; } else { right = compB[i]+1; } break; case LOWER: if(compA[i]<compB[i]) { right = compB[i]-1; } else { right = compB[i]; } break; default: throw new IllegalStateException("Unkown interpolation Direction "+interpolationDirection[i]); } //Perform mixing compMixed[i] = mixing*left + (1-mixing)*right; if(dir != InterpolationDirection.INNER) { //Normalize to [0,1] if(compMixed[i] < 0) compMixed[i] += 1f; if(compMixed[i] > 1) compMixed[i] -= 1f; } } return new Color(colorSpace,compMixed,compMixed[compMixed.length-1]); }
java
@Override public Color interpolate(Color a, Color b, float mixing) { float[] compA, compB; // Get components // Don't convert colorSpaces unless necessary if(a.getColorSpace().equals(colorSpace) ) { compA = a.getComponents(null); } else { compA = a.getComponents(colorSpace, null); } if(b.getColorSpace().equals(colorSpace)) { compB = b.getComponents(null); } else { compB = b.getComponents(colorSpace, null); } float[] compMixed = new float[compA.length]; for(int i=0;i<compA.length;i++){ //Normalizing to [0,1] after the interpolation, // INNER means between a and b // OUTER means between max(a,b) and min(a,b)+1 // UPPER means between a and b' s.t. b'>a and b' in {b, b+1} // LOWER means between a and b' s.t. b'<a and b' in {b, b-1} float left, right; left = compA[i]; //Alpha uses INNER direction InterpolationDirection dir = i<interpolationDirection.length ? interpolationDirection[i] : InterpolationDirection.INNER; switch(dir) { case INNER: right = compB[i]; break; case OUTER: if(compA[i]<compB[i]) { right = compB[i]-1; } else { right = compB[i]+1; } break; case UPPER: if(compA[i]<compB[i]) { right = compB[i]; } else { right = compB[i]+1; } break; case LOWER: if(compA[i]<compB[i]) { right = compB[i]-1; } else { right = compB[i]; } break; default: throw new IllegalStateException("Unkown interpolation Direction "+interpolationDirection[i]); } //Perform mixing compMixed[i] = mixing*left + (1-mixing)*right; if(dir != InterpolationDirection.INNER) { //Normalize to [0,1] if(compMixed[i] < 0) compMixed[i] += 1f; if(compMixed[i] > 1) compMixed[i] -= 1f; } } return new Color(colorSpace,compMixed,compMixed[compMixed.length-1]); }
[ "@", "Override", "public", "Color", "interpolate", "(", "Color", "a", ",", "Color", "b", ",", "float", "mixing", ")", "{", "float", "[", "]", "compA", ",", "compB", ";", "// Get components", "// Don't convert colorSpaces unless necessary", "if", "(", "a", ".",...
Interpolates to a color between a and b @param a First color @param b Second color @param mixing Mixing coefficient; the fraction of a in the result. @return The color between a and b @throws IllegalArgumentException if mixing is not between 0 and 1 @see org.biojava.nbio.structure.gui.util.color.ColorInterpolator#interpolate(java.awt.Color, java.awt.Color, float)
[ "Interpolates", "to", "a", "color", "between", "a", "and", "b" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java#L60-L130
31,794
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java
LinearColorInterpolator.setColorSpace
public void setColorSpace(ColorSpace colorSpace, InterpolationDirection[] dir) { if(dir.length < colorSpace.getNumComponents()) { throw new IllegalArgumentException( "Must specify an interpolation " + "direction for each colorspace component ("+colorSpace.getNumComponents()+")"); } this.colorSpace = colorSpace; this.interpolationDirection = dir; }
java
public void setColorSpace(ColorSpace colorSpace, InterpolationDirection[] dir) { if(dir.length < colorSpace.getNumComponents()) { throw new IllegalArgumentException( "Must specify an interpolation " + "direction for each colorspace component ("+colorSpace.getNumComponents()+")"); } this.colorSpace = colorSpace; this.interpolationDirection = dir; }
[ "public", "void", "setColorSpace", "(", "ColorSpace", "colorSpace", ",", "InterpolationDirection", "[", "]", "dir", ")", "{", "if", "(", "dir", ".", "length", "<", "colorSpace", ".", "getNumComponents", "(", ")", ")", "{", "throw", "new", "IllegalArgumentExcep...
Sets the ColorSpace to use for interpolation. The most common scheme for color spaces is to use linear components between 0 and 1 (for instance red,green,blue). For such a component, a linear interpolation between two colors is used. Sometimes a component may be in cylindrical coordinates. In this case, the component can be mapped in a number of ways. These are set by InterpolationDirections. @param colorSpace The color space for interpolation @param interpDirection An array of size colorSpace.getNumComponents() giving the interpolation direction for each component.
[ "Sets", "the", "ColorSpace", "to", "use", "for", "interpolation", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/color/LinearColorInterpolator.java#L148-L155
31,795
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureHelper.java
FeatureHelper.buildFeatureAtrributeIndex
static public LinkedHashMap<String,FeatureList> buildFeatureAtrributeIndex(String attribute,FeatureList list){ LinkedHashMap<String,FeatureList> featureHashMap = new LinkedHashMap<String,FeatureList>(); FeatureList featureList = list.selectByAttribute(attribute); for(FeatureI feature : featureList){ String value = feature.getAttribute(attribute); FeatureList features = featureHashMap.get(value); if(features == null){ features = new FeatureList(); featureHashMap.put(value, features); } features.add(feature); } return featureHashMap; }
java
static public LinkedHashMap<String,FeatureList> buildFeatureAtrributeIndex(String attribute,FeatureList list){ LinkedHashMap<String,FeatureList> featureHashMap = new LinkedHashMap<String,FeatureList>(); FeatureList featureList = list.selectByAttribute(attribute); for(FeatureI feature : featureList){ String value = feature.getAttribute(attribute); FeatureList features = featureHashMap.get(value); if(features == null){ features = new FeatureList(); featureHashMap.put(value, features); } features.add(feature); } return featureHashMap; }
[ "static", "public", "LinkedHashMap", "<", "String", ",", "FeatureList", ">", "buildFeatureAtrributeIndex", "(", "String", "attribute", ",", "FeatureList", "list", ")", "{", "LinkedHashMap", "<", "String", ",", "FeatureList", ">", "featureHashMap", "=", "new", "Lin...
Build a list of individual features to allow easy indexing and to avoid iterating through large genome gff3 files The index for the returned HashMap is the value of the attribute used to build the index @param attribute @param list @return
[ "Build", "a", "list", "of", "individual", "features", "to", "allow", "easy", "indexing", "and", "to", "avoid", "iterating", "through", "large", "genome", "gff3", "files", "The", "index", "for", "the", "returned", "HashMap", "is", "the", "value", "of", "the",...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/gff/FeatureHelper.java#L39-L54
31,796
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.filterByHierarchy
@Override public List<EcodDomain> filterByHierarchy(String hierarchy) throws IOException { String[] xhtGroup = hierarchy.split("\\."); Integer xGroup = xhtGroup.length>0 ? Integer.parseInt(xhtGroup[0]) : null; Integer hGroup = xhtGroup.length>1 ? Integer.parseInt(xhtGroup[1]) : null; Integer tGroup = xhtGroup.length>2 ? Integer.parseInt(xhtGroup[2]) : null; List<EcodDomain> filtered = new ArrayList<EcodDomain>(); for(EcodDomain d: getAllDomains()) { boolean match = true; if(xhtGroup.length>0) { match = match && xGroup.equals(d.getXGroup()); } if(xhtGroup.length>1) { match = match && hGroup.equals(d.getHGroup()); } if(xhtGroup.length>2) { match = match && tGroup.equals(d.getTGroup()); } if(xhtGroup.length>3) { logger.warn("Ignoring unexpected additional parts of ECOD {}",hierarchy); } if(match) { filtered.add(d); } } return filtered; }
java
@Override public List<EcodDomain> filterByHierarchy(String hierarchy) throws IOException { String[] xhtGroup = hierarchy.split("\\."); Integer xGroup = xhtGroup.length>0 ? Integer.parseInt(xhtGroup[0]) : null; Integer hGroup = xhtGroup.length>1 ? Integer.parseInt(xhtGroup[1]) : null; Integer tGroup = xhtGroup.length>2 ? Integer.parseInt(xhtGroup[2]) : null; List<EcodDomain> filtered = new ArrayList<EcodDomain>(); for(EcodDomain d: getAllDomains()) { boolean match = true; if(xhtGroup.length>0) { match = match && xGroup.equals(d.getXGroup()); } if(xhtGroup.length>1) { match = match && hGroup.equals(d.getHGroup()); } if(xhtGroup.length>2) { match = match && tGroup.equals(d.getTGroup()); } if(xhtGroup.length>3) { logger.warn("Ignoring unexpected additional parts of ECOD {}",hierarchy); } if(match) { filtered.add(d); } } return filtered; }
[ "@", "Override", "public", "List", "<", "EcodDomain", ">", "filterByHierarchy", "(", "String", "hierarchy", ")", "throws", "IOException", "{", "String", "[", "]", "xhtGroup", "=", "hierarchy", ".", "split", "(", "\"\\\\.\"", ")", ";", "Integer", "xGroup", "=...
Get a list of domains within a particular level of the hierarchy @param hierarchy A dot-separated list giving the X-group, H-group, and/or T-group (e.g. "1.1" for all members of the RIFT-related H-group) @return @throws IOException
[ "Get", "a", "list", "of", "domains", "within", "a", "particular", "level", "of", "the", "hierarchy" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L169-L196
31,797
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.getAllDomains
@Override public List<EcodDomain> getAllDomains() throws IOException { domainsFileLock.readLock().lock(); logger.trace("LOCK readlock"); try { while( allDomains == null) { // unlock to allow ensureDomainsFileInstalled to get the write lock logger.trace("UNLOCK readlock"); domainsFileLock.readLock().unlock(); ensureDomainsFileInstalled(); domainsFileLock.readLock().lock(); logger.trace("LOCK readlock"); } return allDomains; } finally { logger.trace("UNLOCK readlock"); domainsFileLock.readLock().unlock(); } }
java
@Override public List<EcodDomain> getAllDomains() throws IOException { domainsFileLock.readLock().lock(); logger.trace("LOCK readlock"); try { while( allDomains == null) { // unlock to allow ensureDomainsFileInstalled to get the write lock logger.trace("UNLOCK readlock"); domainsFileLock.readLock().unlock(); ensureDomainsFileInstalled(); domainsFileLock.readLock().lock(); logger.trace("LOCK readlock"); } return allDomains; } finally { logger.trace("UNLOCK readlock"); domainsFileLock.readLock().unlock(); } }
[ "@", "Override", "public", "List", "<", "EcodDomain", ">", "getAllDomains", "(", ")", "throws", "IOException", "{", "domainsFileLock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "logger", ".", "trace", "(", "\"LOCK readlock\"", ")", ";", "try",...
Get all ECOD domains @return @throws IOException
[ "Get", "all", "ECOD", "domains" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L233-L252
31,798
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.clear
public void clear() { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); allDomains = null; domainMap = null; logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); }
java
public void clear() { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); allDomains = null; domainMap = null; logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); }
[ "public", "void", "clear", "(", ")", "{", "domainsFileLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "logger", ".", "trace", "(", "\"LOCK writelock\"", ")", ";", "allDomains", "=", "null", ";", "domainMap", "=", "null", ";", "logger", "...
Clears all domains, requiring the file to be reparsed for subsequent accesses
[ "Clears", "all", "domains", "requiring", "the", "file", "to", "be", "reparsed", "for", "subsequent", "accesses" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L257-L264
31,799
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.setCacheLocation
public void setCacheLocation(String cacheLocation) { if(cacheLocation.equals(this.cacheLocation)) { return; //no change } // update location domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); this.cacheLocation = cacheLocation; logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); }
java
public void setCacheLocation(String cacheLocation) { if(cacheLocation.equals(this.cacheLocation)) { return; //no change } // update location domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); this.cacheLocation = cacheLocation; logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); }
[ "public", "void", "setCacheLocation", "(", "String", "cacheLocation", ")", "{", "if", "(", "cacheLocation", ".", "equals", "(", "this", ".", "cacheLocation", ")", ")", "{", "return", ";", "//no change", "}", "// update location", "domainsFileLock", ".", "writeLo...
Set an alternate download location for files @param cacheLocation
[ "Set", "an", "alternate", "download", "location", "for", "files" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L311-L321