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,500
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIFarmJobRunnable.java
GUIFarmJobRunnable.createAndShowGUI
private static void createAndShowGUI(GUIAlignmentProgressListener progressListener) { //Create and set up the window. JFrame frame = new JFrame("Monitor alignment process"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = progressListener; newContentPane.setOpaque(true); //content panes must be opaque newContentPane.setSize(new Dimension(400,400)); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
java
private static void createAndShowGUI(GUIAlignmentProgressListener progressListener) { //Create and set up the window. JFrame frame = new JFrame("Monitor alignment process"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = progressListener; newContentPane.setOpaque(true); //content panes must be opaque newContentPane.setSize(new Dimension(400,400)); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
[ "private", "static", "void", "createAndShowGUI", "(", "GUIAlignmentProgressListener", "progressListener", ")", "{", "//Create and set up the window.", "JFrame", "frame", "=", "new", "JFrame", "(", "\"Monitor alignment process\"", ")", ";", "frame", ".", "setDefaultCloseOper...
Create the GUI and show it. As with all GUI code, this must run on the event-dispatching thread.
[ "Create", "the", "GUI", "and", "show", "it", ".", "As", "with", "all", "GUI", "code", "this", "must", "run", "on", "the", "event", "-", "dispatching", "thread", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIFarmJobRunnable.java#L42-L56
31,501
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java
HelixSolver.getPermutation
private List<Integer> getPermutation(Matrix4d transformation) { double rmsdThresholdSq = Math .pow(this.parameters.getRmsdThreshold(), 2); List<Point3d> centers = subunits.getOriginalCenters(); List<Integer> seqClusterId = subunits.getClusterIds(); List<Integer> permutations = new ArrayList<Integer>(centers.size()); double[] dSqs = new double[centers.size()]; boolean[] used = new boolean[centers.size()]; Arrays.fill(used, false); for (int i = 0; i < centers.size(); i++) { Point3d tCenter = new Point3d(centers.get(i)); transformation.transform(tCenter); int permutation = -1; double minDistSq = Double.MAX_VALUE; for (int j = 0; j < centers.size(); j++) { if (seqClusterId.get(i) == seqClusterId.get(j)) { if (!used[j]) { double dSq = tCenter.distanceSquared(centers.get(j)); if (dSq < minDistSq && dSq <= rmsdThresholdSq) { minDistSq = dSq; permutation = j; dSqs[j] = dSq; } } } } // can't map to itself if (permutations.size() == permutation) { permutation = -1; } if (permutation != -1) { used[permutation] = true; } permutations.add(permutation); } return permutations; }
java
private List<Integer> getPermutation(Matrix4d transformation) { double rmsdThresholdSq = Math .pow(this.parameters.getRmsdThreshold(), 2); List<Point3d> centers = subunits.getOriginalCenters(); List<Integer> seqClusterId = subunits.getClusterIds(); List<Integer> permutations = new ArrayList<Integer>(centers.size()); double[] dSqs = new double[centers.size()]; boolean[] used = new boolean[centers.size()]; Arrays.fill(used, false); for (int i = 0; i < centers.size(); i++) { Point3d tCenter = new Point3d(centers.get(i)); transformation.transform(tCenter); int permutation = -1; double minDistSq = Double.MAX_VALUE; for (int j = 0; j < centers.size(); j++) { if (seqClusterId.get(i) == seqClusterId.get(j)) { if (!used[j]) { double dSq = tCenter.distanceSquared(centers.get(j)); if (dSq < minDistSq && dSq <= rmsdThresholdSq) { minDistSq = dSq; permutation = j; dSqs[j] = dSq; } } } } // can't map to itself if (permutations.size() == permutation) { permutation = -1; } if (permutation != -1) { used[permutation] = true; } permutations.add(permutation); } return permutations; }
[ "private", "List", "<", "Integer", ">", "getPermutation", "(", "Matrix4d", "transformation", ")", "{", "double", "rmsdThresholdSq", "=", "Math", ".", "pow", "(", "this", ".", "parameters", ".", "getRmsdThreshold", "(", ")", ",", "2", ")", ";", "List", "<",...
Returns a permutation of subunit indices for the given helix transformation. An index of -1 is used to indicate subunits that do not superpose onto any other subunit. @param transformation @return
[ "Returns", "a", "permutation", "of", "subunit", "indices", "for", "the", "given", "helix", "transformation", ".", "An", "index", "of", "-", "1", "is", "used", "to", "indicate", "subunits", "that", "do", "not", "superpose", "onto", "any", "other", "subunit", ...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java#L351-L393
31,502
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java
HelixSolver.getRise
private static double getRise(Matrix4d transformation, Point3d p1, Point3d p2) { AxisAngle4d axis = getAxisAngle(transformation); Vector3d h = new Vector3d(axis.x, axis.y, axis.z); Vector3d p = new Vector3d(); p.sub(p1, p2); return p.dot(h); }
java
private static double getRise(Matrix4d transformation, Point3d p1, Point3d p2) { AxisAngle4d axis = getAxisAngle(transformation); Vector3d h = new Vector3d(axis.x, axis.y, axis.z); Vector3d p = new Vector3d(); p.sub(p1, p2); return p.dot(h); }
[ "private", "static", "double", "getRise", "(", "Matrix4d", "transformation", ",", "Point3d", "p1", ",", "Point3d", "p2", ")", "{", "AxisAngle4d", "axis", "=", "getAxisAngle", "(", "transformation", ")", ";", "Vector3d", "h", "=", "new", "Vector3d", "(", "axi...
Returns the rise of a helix given the subunit centers of two adjacent subunits and the helix transformation @param transformation helix transformation @param p1 center of one subunit @param p2 center of an adjacent subunit @return
[ "Returns", "the", "rise", "of", "a", "helix", "given", "the", "subunit", "centers", "of", "two", "adjacent", "subunits", "and", "the", "helix", "transformation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java#L407-L414
31,503
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java
HelixSolver.getAxisAngle
private static AxisAngle4d getAxisAngle(Matrix4d transformation) { AxisAngle4d axis = new AxisAngle4d(); axis.set(transformation); return axis; }
java
private static AxisAngle4d getAxisAngle(Matrix4d transformation) { AxisAngle4d axis = new AxisAngle4d(); axis.set(transformation); return axis; }
[ "private", "static", "AxisAngle4d", "getAxisAngle", "(", "Matrix4d", "transformation", ")", "{", "AxisAngle4d", "axis", "=", "new", "AxisAngle4d", "(", ")", ";", "axis", ".", "set", "(", "transformation", ")", ";", "return", "axis", ";", "}" ]
Returns the AxisAngle of the helix transformation @param transformation helix transformation @return
[ "Returns", "the", "AxisAngle", "of", "the", "helix", "transformation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/HelixSolver.java#L434-L438
31,504
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/CartesianProduct.java
CartesianProduct.getOrderedPairs
public List<OrderedPair<T>> getOrderedPairs() { List<OrderedPair<T>> pairs = new ArrayList<OrderedPair<T>>(list1.size()*list2.size()); for (T element1: list1) { for (T element2: list2) { pairs.add(new OrderedPair<T>(element1, element2)); } } return pairs; }
java
public List<OrderedPair<T>> getOrderedPairs() { List<OrderedPair<T>> pairs = new ArrayList<OrderedPair<T>>(list1.size()*list2.size()); for (T element1: list1) { for (T element2: list2) { pairs.add(new OrderedPair<T>(element1, element2)); } } return pairs; }
[ "public", "List", "<", "OrderedPair", "<", "T", ">", ">", "getOrderedPairs", "(", ")", "{", "List", "<", "OrderedPair", "<", "T", ">>", "pairs", "=", "new", "ArrayList", "<", "OrderedPair", "<", "T", ">", ">", "(", "list1", ".", "size", "(", ")", "...
Generates the list of ordered pair between two sets. @return the list of ordered pairs
[ "Generates", "the", "list", "of", "ordered", "pair", "between", "two", "sets", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/CartesianProduct.java#L62-L72
31,505
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java
RemotePDPProvider.getDomain
@Override public Structure getDomain(String pdpDomainName, AtomCache cache) throws IOException, StructureException { return cache.getStructure(getPDPDomain(pdpDomainName)); }
java
@Override public Structure getDomain(String pdpDomainName, AtomCache cache) throws IOException, StructureException { return cache.getStructure(getPDPDomain(pdpDomainName)); }
[ "@", "Override", "public", "Structure", "getDomain", "(", "String", "pdpDomainName", ",", "AtomCache", "cache", ")", "throws", "IOException", ",", "StructureException", "{", "return", "cache", ".", "getStructure", "(", "getPDPDomain", "(", "pdpDomainName", ")", ")...
Get the structure for a particular PDP domain @param pdpDomainName PDP identifier, e.g. "PDP:4HHBAa" @param cache AtomCache, responsible for fetching and storing the coordinates @return Structure representing the PDP domain @throws IOException if the server cannot be reached @throws StructureException For errors parsing the structure
[ "Get", "the", "structure", "for", "a", "particular", "PDP", "domain" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java#L162-L165
31,506
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java
RemotePDPProvider.getPDPDomain
@Override public PDPDomain getPDPDomain(String pdpDomainName) throws IOException{ SortedSet<String> domainRanges = null; if ( serializedCache != null){ if ( serializedCache.containsKey(pdpDomainName)){ domainRanges= serializedCache.get(pdpDomainName); } } boolean shouldRequestDomainRanges = checkDomainRanges(domainRanges); try { if (shouldRequestDomainRanges){ URL u = new URL(server + "getPDPDomain?pdpId="+pdpDomainName); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); domainRanges = XMLUtil.getDomainRangesFromXML(xml); if ( domainRanges != null) cache(pdpDomainName,domainRanges); } } catch (MalformedURLException e){ logger.error("Problem generating PDP request URL for "+pdpDomainName,e); throw new IllegalArgumentException("Invalid PDP name: "+pdpDomainName, e); } String pdbId = null; List<ResidueRange> ranges = new ArrayList<ResidueRange>(); for(String domainRange : domainRanges) { SubstructureIdentifier strucId = new SubstructureIdentifier(domainRange); if(pdbId == null) { pdbId = strucId.getPdbId(); } else if(!pdbId.equals(strucId.getPdbId())) { // should never happen with correct server implementation throw new RuntimeException("Don't know how to take the union of domains from multiple PDB IDs."); } ranges.addAll(strucId.getResidueRanges()); } return new PDPDomain(pdpDomainName,ranges); }
java
@Override public PDPDomain getPDPDomain(String pdpDomainName) throws IOException{ SortedSet<String> domainRanges = null; if ( serializedCache != null){ if ( serializedCache.containsKey(pdpDomainName)){ domainRanges= serializedCache.get(pdpDomainName); } } boolean shouldRequestDomainRanges = checkDomainRanges(domainRanges); try { if (shouldRequestDomainRanges){ URL u = new URL(server + "getPDPDomain?pdpId="+pdpDomainName); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); domainRanges = XMLUtil.getDomainRangesFromXML(xml); if ( domainRanges != null) cache(pdpDomainName,domainRanges); } } catch (MalformedURLException e){ logger.error("Problem generating PDP request URL for "+pdpDomainName,e); throw new IllegalArgumentException("Invalid PDP name: "+pdpDomainName, e); } String pdbId = null; List<ResidueRange> ranges = new ArrayList<ResidueRange>(); for(String domainRange : domainRanges) { SubstructureIdentifier strucId = new SubstructureIdentifier(domainRange); if(pdbId == null) { pdbId = strucId.getPdbId(); } else if(!pdbId.equals(strucId.getPdbId())) { // should never happen with correct server implementation throw new RuntimeException("Don't know how to take the union of domains from multiple PDB IDs."); } ranges.addAll(strucId.getResidueRanges()); } return new PDPDomain(pdpDomainName,ranges); }
[ "@", "Override", "public", "PDPDomain", "getPDPDomain", "(", "String", "pdpDomainName", ")", "throws", "IOException", "{", "SortedSet", "<", "String", ">", "domainRanges", "=", "null", ";", "if", "(", "serializedCache", "!=", "null", ")", "{", "if", "(", "se...
Get a StructureIdentifier representing the specified PDP domain. @param pdpDomainName PDP domain name @return a PDPDomain representing this domain name @throws IOException if the server cannot be reached
[ "Get", "a", "StructureIdentifier", "representing", "the", "specified", "PDP", "domain", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java#L174-L216
31,507
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java
RemotePDPProvider.checkDomainRanges
private boolean checkDomainRanges(SortedSet<String> domainRanges) { if ( (domainRanges == null) || (domainRanges.size() == 0)){ return true; } for ( String d : domainRanges){ //System.out.println("domainRange: >" + d +"< " + d.length()); if ( (d != null) && (d.length() >0)){ return false; } } return true; }
java
private boolean checkDomainRanges(SortedSet<String> domainRanges) { if ( (domainRanges == null) || (domainRanges.size() == 0)){ return true; } for ( String d : domainRanges){ //System.out.println("domainRange: >" + d +"< " + d.length()); if ( (d != null) && (d.length() >0)){ return false; } } return true; }
[ "private", "boolean", "checkDomainRanges", "(", "SortedSet", "<", "String", ">", "domainRanges", ")", "{", "if", "(", "(", "domainRanges", "==", "null", ")", "||", "(", "domainRanges", ".", "size", "(", ")", "==", "0", ")", ")", "{", "return", "true", ...
returns true if client should fetch domain definitions from server @param domainRanges @return
[ "returns", "true", "if", "client", "should", "fetch", "domain", "definitions", "from", "server" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java#L223-L237
31,508
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java
RemotePDPProvider.getPDPDomainNamesForPDB
@Override public SortedSet<String> getPDPDomainNamesForPDB(String pdbId) throws IOException{ SortedSet<String> results = null; try { URL u = new URL(server + "getPDPDomainNamesForPDB?pdbId="+pdbId); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); results = XMLUtil.getDomainRangesFromXML(xml); } catch (MalformedURLException e){ logger.error("Problem generating PDP request URL for "+pdbId,e); throw new IllegalArgumentException("Invalid PDB name: "+pdbId, e); } return results; }
java
@Override public SortedSet<String> getPDPDomainNamesForPDB(String pdbId) throws IOException{ SortedSet<String> results = null; try { URL u = new URL(server + "getPDPDomainNamesForPDB?pdbId="+pdbId); logger.info("Fetching {}",u); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); results = XMLUtil.getDomainRangesFromXML(xml); } catch (MalformedURLException e){ logger.error("Problem generating PDP request URL for "+pdbId,e); throw new IllegalArgumentException("Invalid PDB name: "+pdbId, e); } return results; }
[ "@", "Override", "public", "SortedSet", "<", "String", ">", "getPDPDomainNamesForPDB", "(", "String", "pdbId", ")", "throws", "IOException", "{", "SortedSet", "<", "String", ">", "results", "=", "null", ";", "try", "{", "URL", "u", "=", "new", "URL", "(", ...
Get a list of all PDP domains for a given PDB entry @param pdbId PDB ID @return Set of domain names, e.g. "PDP:4HHBAa" @throws IOException if the server cannot be reached
[ "Get", "a", "list", "of", "all", "PDP", "domains", "for", "a", "given", "PDB", "entry" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/RemotePDPProvider.java#L245-L260
31,509
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPOptimizer.java
AFPOptimizer.blockInfo
public static void blockInfo(AFPChain afpChain) { int i, j, k, a, n; int blockNum = afpChain.getBlockNum(); int[] blockSize =afpChain.getBlockSize(); int[] afpChainList = afpChain.getAfpChainList(); int[] block2Afp = afpChain.getBlock2Afp(); int[][][]blockResList = afpChain.getBlockResList(); List<AFP>afpSet = afpChain.getAfpSet(); int[] blockResSize = afpChain.getBlockResSize(); for(i = 0; i < blockNum; i ++) { n = 0; for(j = 0; j < blockSize[i]; j ++) { //the index in afpChainList, not in the whole afp set a = afpChainList[block2Afp[i] + j]; for(k = 0; k < afpSet.get(a).getFragLen(); k ++) { blockResList[i][0][n] = afpSet.get(a).getP1() + k; blockResList[i][1][n] = afpSet.get(a).getP2() + k; n ++; } } blockResSize[i] = n; } afpChain.setBlockResSize(blockResSize); afpChain.setBlockSize(blockSize); afpChain.setAfpChainList(afpChainList); afpChain.setBlock2Afp(block2Afp); afpChain.setBlockResList(blockResList); }
java
public static void blockInfo(AFPChain afpChain) { int i, j, k, a, n; int blockNum = afpChain.getBlockNum(); int[] blockSize =afpChain.getBlockSize(); int[] afpChainList = afpChain.getAfpChainList(); int[] block2Afp = afpChain.getBlock2Afp(); int[][][]blockResList = afpChain.getBlockResList(); List<AFP>afpSet = afpChain.getAfpSet(); int[] blockResSize = afpChain.getBlockResSize(); for(i = 0; i < blockNum; i ++) { n = 0; for(j = 0; j < blockSize[i]; j ++) { //the index in afpChainList, not in the whole afp set a = afpChainList[block2Afp[i] + j]; for(k = 0; k < afpSet.get(a).getFragLen(); k ++) { blockResList[i][0][n] = afpSet.get(a).getP1() + k; blockResList[i][1][n] = afpSet.get(a).getP2() + k; n ++; } } blockResSize[i] = n; } afpChain.setBlockResSize(blockResSize); afpChain.setBlockSize(blockSize); afpChain.setAfpChainList(afpChainList); afpChain.setBlock2Afp(block2Afp); afpChain.setBlockResList(blockResList); }
[ "public", "static", "void", "blockInfo", "(", "AFPChain", "afpChain", ")", "{", "int", "i", ",", "j", ",", "k", ",", "a", ",", "n", ";", "int", "blockNum", "=", "afpChain", ".", "getBlockNum", "(", ")", ";", "int", "[", "]", "blockSize", "=", "afpC...
get the afp list and residue list for each block
[ "get", "the", "afp", "list", "and", "residue", "list", "for", "each", "block" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPOptimizer.java#L170-L203
31,510
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPOptimizer.java
AFPOptimizer.updateScore
public static void updateScore(FatCatParameters params, AFPChain afpChain) { int i, j, bknow, bkold, g1, g2; afpChain.setConn(0d); afpChain.setDVar(0d); int blockNum = afpChain.getBlockNum(); int alignScoreUpdate = 0; double[] blockScore = afpChain.getBlockScore(); int[] blockGap = afpChain.getBlockGap(); int[] blockSize =afpChain.getBlockSize(); int[] afpChainList = afpChain.getAfpChainList(); List<AFP>afpSet = afpChain.getAfpSet(); int[] block2Afp = afpChain.getBlock2Afp(); double torsionPenalty = params.getTorsionPenalty(); bkold = 0; for(i = 0; i < blockNum; i ++) { blockScore[i] = 0; blockGap[i] = 0; for(j = 0; j < blockSize[i]; j ++) { bknow = afpChainList[block2Afp[i] + j]; if(j == 0) { blockScore[i] = afpSet.get(bknow).getScore(); } else { AFPChainer.afpPairConn(bkold, bknow, params, afpChain); //note: j, i Double conn = afpChain.getConn(); blockScore[i] += afpSet.get(bknow).getScore() + conn; g1 = afpSet.get(bknow).getP1() - afpSet.get(bkold).getP1() - afpSet.get(bkold).getFragLen(); g2 = afpSet.get(bknow).getP2() - afpSet.get(bkold).getP2() - afpSet.get(bkold).getFragLen(); blockGap[i] += (g1 > g2)?g1:g2; } bkold = bknow; } alignScoreUpdate += blockScore[i]; } if(blockNum >= 2) { alignScoreUpdate += (blockNum - 1) * torsionPenalty; } afpChain.setBlockGap(blockGap); afpChain.setAlignScoreUpdate(alignScoreUpdate); afpChain.setBlockScore(blockScore); afpChain.setBlockSize(blockSize); afpChain.setAfpChainList(afpChainList); afpChain.setBlock2Afp(block2Afp); }
java
public static void updateScore(FatCatParameters params, AFPChain afpChain) { int i, j, bknow, bkold, g1, g2; afpChain.setConn(0d); afpChain.setDVar(0d); int blockNum = afpChain.getBlockNum(); int alignScoreUpdate = 0; double[] blockScore = afpChain.getBlockScore(); int[] blockGap = afpChain.getBlockGap(); int[] blockSize =afpChain.getBlockSize(); int[] afpChainList = afpChain.getAfpChainList(); List<AFP>afpSet = afpChain.getAfpSet(); int[] block2Afp = afpChain.getBlock2Afp(); double torsionPenalty = params.getTorsionPenalty(); bkold = 0; for(i = 0; i < blockNum; i ++) { blockScore[i] = 0; blockGap[i] = 0; for(j = 0; j < blockSize[i]; j ++) { bknow = afpChainList[block2Afp[i] + j]; if(j == 0) { blockScore[i] = afpSet.get(bknow).getScore(); } else { AFPChainer.afpPairConn(bkold, bknow, params, afpChain); //note: j, i Double conn = afpChain.getConn(); blockScore[i] += afpSet.get(bknow).getScore() + conn; g1 = afpSet.get(bknow).getP1() - afpSet.get(bkold).getP1() - afpSet.get(bkold).getFragLen(); g2 = afpSet.get(bknow).getP2() - afpSet.get(bkold).getP2() - afpSet.get(bkold).getFragLen(); blockGap[i] += (g1 > g2)?g1:g2; } bkold = bknow; } alignScoreUpdate += blockScore[i]; } if(blockNum >= 2) { alignScoreUpdate += (blockNum - 1) * torsionPenalty; } afpChain.setBlockGap(blockGap); afpChain.setAlignScoreUpdate(alignScoreUpdate); afpChain.setBlockScore(blockScore); afpChain.setBlockSize(blockSize); afpChain.setAfpChainList(afpChainList); afpChain.setBlock2Afp(block2Afp); }
[ "public", "static", "void", "updateScore", "(", "FatCatParameters", "params", ",", "AFPChain", "afpChain", ")", "{", "int", "i", ",", "j", ",", "bknow", ",", "bkold", ",", "g1", ",", "g2", ";", "afpChain", ".", "setConn", "(", "0d", ")", ";", "afpChain...
to update the chaining score after block delete and merge processed the blockScore value is important for significance evaluation
[ "to", "update", "the", "chaining", "score", "after", "block", "delete", "and", "merge", "processed", "the", "blockScore", "value", "is", "important", "for", "significance", "evaluation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPOptimizer.java#L209-L260
31,511
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java
CeSymm.analyze
public static CeSymmResult analyze(Atom[] atoms) throws StructureException { CESymmParameters params = new CESymmParameters(); return analyze(atoms, params); }
java
public static CeSymmResult analyze(Atom[] atoms) throws StructureException { CESymmParameters params = new CESymmParameters(); return analyze(atoms, params); }
[ "public", "static", "CeSymmResult", "analyze", "(", "Atom", "[", "]", "atoms", ")", "throws", "StructureException", "{", "CESymmParameters", "params", "=", "new", "CESymmParameters", "(", ")", ";", "return", "analyze", "(", "atoms", ",", "params", ")", ";", ...
Analyze the symmetries of the input Atom array using the DEFAULT parameters. @param atoms representative Atom array of the Structure @return CeSymmResult @throws StructureException
[ "Analyze", "the", "symmetries", "of", "the", "input", "Atom", "array", "using", "the", "DEFAULT", "parameters", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java#L354-L357
31,512
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java
CeSymm.analyze
public static CeSymmResult analyze(Atom[] atoms, CESymmParameters params) throws StructureException { if (atoms.length < 1) throw new IllegalArgumentException("Empty Atom array given."); // If the SSE information is needed, we calculate it if the user did not if (params.getSSEThreshold() > 0) { Structure s = atoms[0].getGroup().getChain().getStructure(); if (SecStrucTools.getSecStrucInfo(s).isEmpty()) { logger.info("Calculating Secondary Structure..."); SecStrucCalc ssp = new SecStrucCalc(); ssp.calculate(s, true); } } CeSymmIterative iter = new CeSymmIterative(params); CeSymmResult result = iter.execute(atoms); if (result.isRefined()) { // Optimize the global alignment freely once more (final step) if (params.getOptimization() && result.getSymmLevels() > 1) { try { SymmOptimizer optimizer = new SymmOptimizer(result); MultipleAlignment optimized = optimizer.optimize(); // Set the optimized MultipleAlignment and the axes result.setMultipleAlignment(optimized); } catch (RefinerFailedException e) { logger.info("Final optimization failed:" + e.getMessage()); } } result.getMultipleAlignment().getEnsemble() .setStructureIdentifiers(result.getRepeatsID()); } return result; }
java
public static CeSymmResult analyze(Atom[] atoms, CESymmParameters params) throws StructureException { if (atoms.length < 1) throw new IllegalArgumentException("Empty Atom array given."); // If the SSE information is needed, we calculate it if the user did not if (params.getSSEThreshold() > 0) { Structure s = atoms[0].getGroup().getChain().getStructure(); if (SecStrucTools.getSecStrucInfo(s).isEmpty()) { logger.info("Calculating Secondary Structure..."); SecStrucCalc ssp = new SecStrucCalc(); ssp.calculate(s, true); } } CeSymmIterative iter = new CeSymmIterative(params); CeSymmResult result = iter.execute(atoms); if (result.isRefined()) { // Optimize the global alignment freely once more (final step) if (params.getOptimization() && result.getSymmLevels() > 1) { try { SymmOptimizer optimizer = new SymmOptimizer(result); MultipleAlignment optimized = optimizer.optimize(); // Set the optimized MultipleAlignment and the axes result.setMultipleAlignment(optimized); } catch (RefinerFailedException e) { logger.info("Final optimization failed:" + e.getMessage()); } } result.getMultipleAlignment().getEnsemble() .setStructureIdentifiers(result.getRepeatsID()); } return result; }
[ "public", "static", "CeSymmResult", "analyze", "(", "Atom", "[", "]", "atoms", ",", "CESymmParameters", "params", ")", "throws", "StructureException", "{", "if", "(", "atoms", ".", "length", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Em...
Analyze the symmetries of the input Atom array using the provided parameters. @param atoms representative Atom array of the Structure @param param CeSymmParameters bean @return CeSymmResult @throws StructureException
[ "Analyze", "the", "symmetries", "of", "the", "input", "Atom", "array", "using", "the", "provided", "parameters", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java#L370-L405
31,513
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java
CeSymm.analyzeLevel
public static CeSymmResult analyzeLevel(Atom[] atoms, CESymmParameters params) throws StructureException { if (atoms.length < 1) throw new IllegalArgumentException("Empty Atom array given."); CeSymmResult result = align(atoms, params); if (result.isRefined()) { // STEP 5: symmetry alignment optimization if (result.getParams().getOptimization()) { try { MultipleAlignment msa = result.getMultipleAlignment(); SymmOptimizer optimizer = new SymmOptimizer(result); msa = optimizer.optimize(); result.setMultipleAlignment(msa); } catch (RefinerFailedException e) { logger.debug("Optimization failed:" + e.getMessage()); } } } return result; }
java
public static CeSymmResult analyzeLevel(Atom[] atoms, CESymmParameters params) throws StructureException { if (atoms.length < 1) throw new IllegalArgumentException("Empty Atom array given."); CeSymmResult result = align(atoms, params); if (result.isRefined()) { // STEP 5: symmetry alignment optimization if (result.getParams().getOptimization()) { try { MultipleAlignment msa = result.getMultipleAlignment(); SymmOptimizer optimizer = new SymmOptimizer(result); msa = optimizer.optimize(); result.setMultipleAlignment(msa); } catch (RefinerFailedException e) { logger.debug("Optimization failed:" + e.getMessage()); } } } return result; }
[ "public", "static", "CeSymmResult", "analyzeLevel", "(", "Atom", "[", "]", "atoms", ",", "CESymmParameters", "params", ")", "throws", "StructureException", "{", "if", "(", "atoms", ".", "length", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", ...
Analyze a single level of symmetry. @param atoms Atom array of the current level @return CeSymmResult @throws StructureException
[ "Analyze", "a", "single", "level", "of", "symmetry", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymm.java#L415-L437
31,514
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java
AtomPositionMap.getLength
public int getLength(int positionA, int positionB, String startingChain) { int positionStart, positionEnd; if (positionA <= positionB) { positionStart = positionA; positionEnd = positionB; } else { positionStart = positionB; positionEnd = positionA; } int count = 0; // Inefficient search for (Map.Entry<ResidueNumber, Integer> entry : treeMap.entrySet()) { if (entry.getKey().getChainName().equals(startingChain) && positionStart <= entry.getValue() && entry.getValue() <= positionEnd) { count++; } } return count; }
java
public int getLength(int positionA, int positionB, String startingChain) { int positionStart, positionEnd; if (positionA <= positionB) { positionStart = positionA; positionEnd = positionB; } else { positionStart = positionB; positionEnd = positionA; } int count = 0; // Inefficient search for (Map.Entry<ResidueNumber, Integer> entry : treeMap.entrySet()) { if (entry.getKey().getChainName().equals(startingChain) && positionStart <= entry.getValue() && entry.getValue() <= positionEnd) { count++; } } return count; }
[ "public", "int", "getLength", "(", "int", "positionA", ",", "int", "positionB", ",", "String", "startingChain", ")", "{", "int", "positionStart", ",", "positionEnd", ";", "if", "(", "positionA", "<=", "positionB", ")", "{", "positionStart", "=", "positionA", ...
Calculates the number of residues of the specified chain in a given range, inclusive. @param positionA index of the first atom to count @param positionB index of the last atom to count @param startingChain Case-sensitive chain @return The number of atoms between A and B inclusive belonging to the given chain
[ "Calculates", "the", "number", "of", "residues", "of", "the", "specified", "chain", "in", "a", "given", "range", "inclusive", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L187-L209
31,515
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java
AtomPositionMap.getLengthDirectional
public int getLengthDirectional(int positionStart, int positionEnd, String startingChain) { int count = getLength(positionStart,positionEnd,startingChain); if(positionStart <= positionEnd) { return count; } else { return -count; } }
java
public int getLengthDirectional(int positionStart, int positionEnd, String startingChain) { int count = getLength(positionStart,positionEnd,startingChain); if(positionStart <= positionEnd) { return count; } else { return -count; } }
[ "public", "int", "getLengthDirectional", "(", "int", "positionStart", ",", "int", "positionEnd", ",", "String", "startingChain", ")", "{", "int", "count", "=", "getLength", "(", "positionStart", ",", "positionEnd", ",", "startingChain", ")", ";", "if", "(", "p...
Calculates the number of residues of the specified chain in a given range. Will return a negative value if the start is past the end. @param positionStart index of the first atom to count @param positionEnd index of the last atom to count @param startingChain Case-sensitive chain @return The number of atoms from A to B inclusive belonging to the given chain
[ "Calculates", "the", "number", "of", "residues", "of", "the", "specified", "chain", "in", "a", "given", "range", ".", "Will", "return", "a", "negative", "value", "if", "the", "start", "is", "past", "the", "end", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L220-L227
31,516
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java
AtomPositionMap.getLength
public int getLength(ResidueNumber start, ResidueNumber end) { if( ! start.getChainName().equals(end.getChainName())) { throw new IllegalArgumentException(String.format( "Chains differ between %s and %s. Unable to calculate length.", start,end)); } Integer startPos = getPosition(start); Integer endPos = getPosition(end); if(startPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } if(endPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } return getLength(startPos, endPos, start.getChainName()); }
java
public int getLength(ResidueNumber start, ResidueNumber end) { if( ! start.getChainName().equals(end.getChainName())) { throw new IllegalArgumentException(String.format( "Chains differ between %s and %s. Unable to calculate length.", start,end)); } Integer startPos = getPosition(start); Integer endPos = getPosition(end); if(startPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } if(endPos == null) { throw new IllegalArgumentException("Residue "+start+" was not found."); } return getLength(startPos, endPos, start.getChainName()); }
[ "public", "int", "getLength", "(", "ResidueNumber", "start", ",", "ResidueNumber", "end", ")", "{", "if", "(", "!", "start", ".", "getChainName", "(", ")", ".", "equals", "(", "end", ".", "getChainName", "(", ")", ")", ")", "{", "throw", "new", "Illega...
Calculates the number of atoms between two ResidueNumbers, inclusive. Both residues must belong to the same chain. @param start First residue @param end Last residue @return The number of atoms from A to B inclusive @throws IllegalArgumentException if start and end are on different chains, or if either of the residues doesn't exist
[ "Calculates", "the", "number", "of", "atoms", "between", "two", "ResidueNumbers", "inclusive", ".", "Both", "residues", "must", "belong", "to", "the", "same", "chain", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L238-L253
31,517
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java
AtomPositionMap.trimToValidResidues
public ResidueRangeAndLength trimToValidResidues(ResidueRange rr) { ResidueNumber start = rr.getStart(); ResidueNumber end = rr.getEnd(); String chain = rr.getChainName(); // Add chainName if(start.getChainName() == null) { start = new ResidueNumber(chain,start.getSeqNum(),start.getInsCode()); } if(end.getChainName() == null) { end = new ResidueNumber(chain,end.getSeqNum(),end.getInsCode()); } // Check that start and end are present in the map. // If not, try to find the next valid residue // (terminal residues sometimes lack CA atoms, so they don't appear) Integer startIndex = getPosition(start); if( startIndex == null) { // Assume that the residue numbers are sequential // Find startIndex such that the SeqNum is bigger than start's seqNum for(ResidueNumber key : treeMap.keySet()) { if( !key.getChainName().equals(chain) ) continue; if( start.getSeqNum() <= key.getSeqNum() ) { start = key; startIndex = getPosition(key); break; } } if( startIndex == null ) { logger.error("Unable to find Residue {} in AtomPositionMap, and no plausible substitute.",start); return null; } else { logger.warn("Unable to find Residue {}, so substituting {}.",rr.getStart(),start); } } Integer endIndex = getPosition(end); if( endIndex == null) { // Assume that the residue numbers are sequential // Find startIndex such that the SeqNum is bigger than start's seqNum for(ResidueNumber key : treeMap.descendingKeySet()) { if( !key.getChainName().equals(chain) ) continue; Integer value = getPosition(key); if( value < startIndex ) { // start is before the end! break; } if( end.getSeqNum() >= key.getSeqNum() ) { end = key; endIndex = value; break; } } if( endIndex == null ) { logger.error("Unable to find Residue {} in AtomPositionMap, and no plausible substitute.",end); return null; } else { logger.warn("Unable to find Residue {}, so substituting {}.",rr.getEnd(),end); } } // now use those to calculate the length // if start or end is null, will throw NPE int length = getLength(startIndex, endIndex,chain); return new ResidueRangeAndLength(chain, start, end, length); }
java
public ResidueRangeAndLength trimToValidResidues(ResidueRange rr) { ResidueNumber start = rr.getStart(); ResidueNumber end = rr.getEnd(); String chain = rr.getChainName(); // Add chainName if(start.getChainName() == null) { start = new ResidueNumber(chain,start.getSeqNum(),start.getInsCode()); } if(end.getChainName() == null) { end = new ResidueNumber(chain,end.getSeqNum(),end.getInsCode()); } // Check that start and end are present in the map. // If not, try to find the next valid residue // (terminal residues sometimes lack CA atoms, so they don't appear) Integer startIndex = getPosition(start); if( startIndex == null) { // Assume that the residue numbers are sequential // Find startIndex such that the SeqNum is bigger than start's seqNum for(ResidueNumber key : treeMap.keySet()) { if( !key.getChainName().equals(chain) ) continue; if( start.getSeqNum() <= key.getSeqNum() ) { start = key; startIndex = getPosition(key); break; } } if( startIndex == null ) { logger.error("Unable to find Residue {} in AtomPositionMap, and no plausible substitute.",start); return null; } else { logger.warn("Unable to find Residue {}, so substituting {}.",rr.getStart(),start); } } Integer endIndex = getPosition(end); if( endIndex == null) { // Assume that the residue numbers are sequential // Find startIndex such that the SeqNum is bigger than start's seqNum for(ResidueNumber key : treeMap.descendingKeySet()) { if( !key.getChainName().equals(chain) ) continue; Integer value = getPosition(key); if( value < startIndex ) { // start is before the end! break; } if( end.getSeqNum() >= key.getSeqNum() ) { end = key; endIndex = value; break; } } if( endIndex == null ) { logger.error("Unable to find Residue {} in AtomPositionMap, and no plausible substitute.",end); return null; } else { logger.warn("Unable to find Residue {}, so substituting {}.",rr.getEnd(),end); } } // now use those to calculate the length // if start or end is null, will throw NPE int length = getLength(startIndex, endIndex,chain); return new ResidueRangeAndLength(chain, start, end, length); }
[ "public", "ResidueRangeAndLength", "trimToValidResidues", "(", "ResidueRange", "rr", ")", "{", "ResidueNumber", "start", "=", "rr", ".", "getStart", "(", ")", ";", "ResidueNumber", "end", "=", "rr", ".", "getEnd", "(", ")", ";", "String", "chain", "=", "rr",...
Trims a residue range so that both endpoints are contained in this map. @param rr residue range @return residue range and length
[ "Trims", "a", "residue", "range", "so", "that", "both", "endpoints", "are", "contained", "in", "this", "map", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L366-L431
31,518
biojava/biojava
biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/StructureUtil.java
StructureUtil.findNearestAtomLinkage
public static Atom[] findNearestAtomLinkage(final Group group1, final Group group2, List<String> potentialNamesOfAtomOnGroup1, List<String> potentialNamesOfAtomOnGroup2, final boolean ignoreNCLinkage, double bondLengthTolerance) { List<Atom[]> linkages = findAtomLinkages(group1, group2, potentialNamesOfAtomOnGroup1, potentialNamesOfAtomOnGroup2, ignoreNCLinkage, bondLengthTolerance); Atom[] ret = null; double minDistance = Double.POSITIVE_INFINITY; for (Atom[] linkage : linkages) { double distance; distance = Calc.getDistance(linkage[0], linkage[1]); if (distance < minDistance) { minDistance = distance; ret = linkage; } } return ret; }
java
public static Atom[] findNearestAtomLinkage(final Group group1, final Group group2, List<String> potentialNamesOfAtomOnGroup1, List<String> potentialNamesOfAtomOnGroup2, final boolean ignoreNCLinkage, double bondLengthTolerance) { List<Atom[]> linkages = findAtomLinkages(group1, group2, potentialNamesOfAtomOnGroup1, potentialNamesOfAtomOnGroup2, ignoreNCLinkage, bondLengthTolerance); Atom[] ret = null; double minDistance = Double.POSITIVE_INFINITY; for (Atom[] linkage : linkages) { double distance; distance = Calc.getDistance(linkage[0], linkage[1]); if (distance < minDistance) { minDistance = distance; ret = linkage; } } return ret; }
[ "public", "static", "Atom", "[", "]", "findNearestAtomLinkage", "(", "final", "Group", "group1", ",", "final", "Group", "group2", ",", "List", "<", "String", ">", "potentialNamesOfAtomOnGroup1", ",", "List", "<", "String", ">", "potentialNamesOfAtomOnGroup2", ",",...
Find a linkage between two groups within tolerance of bond length, from potential atoms. @param group1 the first {@link Group}. @param group2 the second {@link Group}. @param potentialNamesOfAtomOnGroup1 potential names of the atom on the first group. If null, search all atoms on the first group. @param potentialNamesOfAtomOnGroup2 potential names of the atom on the second group. If null, search all atoms on the second group. @param ignoreNCLinkage true to ignore all N-C linkages @param bondLengthTolerance bond length error tolerance. @return an array of two Atoms that form bond between each other if found; null, otherwise.
[ "Find", "a", "linkage", "between", "two", "groups", "within", "tolerance", "of", "bond", "length", "from", "potential", "atoms", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/StructureUtil.java#L111-L136
31,519
biojava/biojava
biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/StructureUtil.java
StructureUtil.findLinkage
public static Atom[] findLinkage(final Group group1, final Group group2, String nameOfAtomOnGroup1, String nameOfAtomOnGroup2, double bondLengthTolerance) { Atom[] ret = new Atom[2]; ret[0] = group1.getAtom(nameOfAtomOnGroup1); ret[1] = group2.getAtom(nameOfAtomOnGroup2); if (ret[0]==null || ret[1]==null) { return null; } Atom a1 = ret[0]; Atom a2 = ret[1]; boolean hasBond = a1.hasBond(a2); if ( hasBond ) { return ret; } // is it a metal ? if ( a1.getElement().isMetal() || a2.getElement().isMetal()){ MetalBondDistance defined = getMetalDistanceCutoff(a1.getElement().name(),a2.getElement().name()); if ( defined != null) { if (hasMetalBond(a1, a2, defined)) return ret; else return null; } } // not a metal double distance = Calc.getDistance(a1, a2); float radiusOfAtom1 = ret[0].getElement().getCovalentRadius(); float radiusOfAtom2 = ret[1].getElement().getCovalentRadius(); if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) { return null; } return ret; }
java
public static Atom[] findLinkage(final Group group1, final Group group2, String nameOfAtomOnGroup1, String nameOfAtomOnGroup2, double bondLengthTolerance) { Atom[] ret = new Atom[2]; ret[0] = group1.getAtom(nameOfAtomOnGroup1); ret[1] = group2.getAtom(nameOfAtomOnGroup2); if (ret[0]==null || ret[1]==null) { return null; } Atom a1 = ret[0]; Atom a2 = ret[1]; boolean hasBond = a1.hasBond(a2); if ( hasBond ) { return ret; } // is it a metal ? if ( a1.getElement().isMetal() || a2.getElement().isMetal()){ MetalBondDistance defined = getMetalDistanceCutoff(a1.getElement().name(),a2.getElement().name()); if ( defined != null) { if (hasMetalBond(a1, a2, defined)) return ret; else return null; } } // not a metal double distance = Calc.getDistance(a1, a2); float radiusOfAtom1 = ret[0].getElement().getCovalentRadius(); float radiusOfAtom2 = ret[1].getElement().getCovalentRadius(); if (Math.abs(distance - radiusOfAtom1 - radiusOfAtom2) > bondLengthTolerance) { return null; } return ret; }
[ "public", "static", "Atom", "[", "]", "findLinkage", "(", "final", "Group", "group1", ",", "final", "Group", "group2", ",", "String", "nameOfAtomOnGroup1", ",", "String", "nameOfAtomOnGroup2", ",", "double", "bondLengthTolerance", ")", "{", "Atom", "[", "]", "...
Find a linkage between two groups within tolerance of bond length. @param group1 the first {@link Group}. @param group2 the second {@link Group}. @param nameOfAtomOnGroup1 atom name of the first group. @param nameOfAtomOnGroup2 atom name of the second group. @param bondLengthTolerance bond length error tolerance. @return an array of two Atoms that form bond between each other if found; null, otherwise.
[ "Find", "a", "linkage", "between", "two", "groups", "within", "tolerance", "of", "bond", "length", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/StructureUtil.java#L225-L279
31,520
biojava/biojava
biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/StructureUtil.java
StructureUtil.getAminoAcids
public static List<Group> getAminoAcids(Chain chain) { List<Group> gs = new ArrayList<>(); for ( Group g : chain.getAtomGroups()){ if ( g.isAminoAcid()) gs.add(g); } return gs; }
java
public static List<Group> getAminoAcids(Chain chain) { List<Group> gs = new ArrayList<>(); for ( Group g : chain.getAtomGroups()){ if ( g.isAminoAcid()) gs.add(g); } return gs; }
[ "public", "static", "List", "<", "Group", ">", "getAminoAcids", "(", "Chain", "chain", ")", "{", "List", "<", "Group", ">", "gs", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Group", "g", ":", "chain", ".", "getAtomGroups", "(", ")", ...
Get all amino acids in a chain. @param chain @return
[ "Get", "all", "amino", "acids", "in", "a", "chain", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/structure/StructureUtil.java#L343-L356
31,521
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java
StructureImpl.isCrystallographic
@Override public boolean isCrystallographic() { if (pdbHeader.getExperimentalTechniques()!=null) { return ExperimentalTechnique.isCrystallographic(pdbHeader.getExperimentalTechniques()); } else { // no experimental technique known, we try to guess... if (pdbHeader.getCrystallographicInfo().getSpaceGroup()!=null) { // space group defined but no crystal cell: incomplete info, return false return pdbHeader.getCrystallographicInfo().getCrystalCell() != null && pdbHeader.getCrystallographicInfo().getCrystalCell().isCellReasonable(); } } return false; }
java
@Override public boolean isCrystallographic() { if (pdbHeader.getExperimentalTechniques()!=null) { return ExperimentalTechnique.isCrystallographic(pdbHeader.getExperimentalTechniques()); } else { // no experimental technique known, we try to guess... if (pdbHeader.getCrystallographicInfo().getSpaceGroup()!=null) { // space group defined but no crystal cell: incomplete info, return false return pdbHeader.getCrystallographicInfo().getCrystalCell() != null && pdbHeader.getCrystallographicInfo().getCrystalCell().isCellReasonable(); } } return false; }
[ "@", "Override", "public", "boolean", "isCrystallographic", "(", ")", "{", "if", "(", "pdbHeader", ".", "getExperimentalTechniques", "(", ")", "!=", "null", ")", "{", "return", "ExperimentalTechnique", ".", "isCrystallographic", "(", "pdbHeader", ".", "getExperime...
Whether this Structure is a crystallographic structure or not. It will first check the experimental technique and if not present it will try to guess from the presence of a space group and sensible cell parameters @return true if crystallographic, false otherwise
[ "Whether", "this", "Structure", "is", "a", "crystallographic", "structure", "or", "not", ".", "It", "will", "first", "check", "the", "experimental", "technique", "and", "if", "not", "present", "it", "will", "try", "to", "guess", "from", "the", "presence", "o...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java#L521-L534
31,522
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java
StructureImpl.isNmr
@Override public boolean isNmr() { // old implementation was: //return nmrflag; if (pdbHeader.getExperimentalTechniques()!=null) { return ExperimentalTechnique.isNmr(pdbHeader.getExperimentalTechniques()); } else { // no experimental technique known, we try to guess... if (nrModels()>1) { if (pdbHeader.getCrystallographicInfo().getSpaceGroup()!=null) { // multimodel, sg defined, but missing cell: must be NMR if (pdbHeader.getCrystallographicInfo().getCrystalCell()==null) return true; // multi-model, sg defined and cell unreasonable: must be NMR if (!pdbHeader.getCrystallographicInfo().getCrystalCell().isCellReasonable()) return true; } else { // multi-model and missing space group: must be NMR return true; } } } return false; }
java
@Override public boolean isNmr() { // old implementation was: //return nmrflag; if (pdbHeader.getExperimentalTechniques()!=null) { return ExperimentalTechnique.isNmr(pdbHeader.getExperimentalTechniques()); } else { // no experimental technique known, we try to guess... if (nrModels()>1) { if (pdbHeader.getCrystallographicInfo().getSpaceGroup()!=null) { // multimodel, sg defined, but missing cell: must be NMR if (pdbHeader.getCrystallographicInfo().getCrystalCell()==null) return true; // multi-model, sg defined and cell unreasonable: must be NMR if (!pdbHeader.getCrystallographicInfo().getCrystalCell().isCellReasonable()) return true; } else { // multi-model and missing space group: must be NMR return true; } } } return false; }
[ "@", "Override", "public", "boolean", "isNmr", "(", ")", "{", "// old implementation was:", "//return nmrflag;", "if", "(", "pdbHeader", ".", "getExperimentalTechniques", "(", ")", "!=", "null", ")", "{", "return", "ExperimentalTechnique", ".", "isNmr", "(", "pdbH...
Whether this Structure is a NMR structure or not. It will first check the experimental technique and if not present it will try to guess from the presence of more than 1 model and from b-factors being 0 in first chain of first model @return true if NMR, false otherwise
[ "Whether", "this", "Structure", "is", "a", "NMR", "structure", "or", "not", ".", "It", "will", "first", "check", "the", "experimental", "technique", "and", "if", "not", "present", "it", "will", "try", "to", "guess", "from", "the", "presence", "of", "more",...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java#L542-L567
31,523
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java
StructureImpl.toCanonical
private SubstructureIdentifier toCanonical() { StructureIdentifier real = getStructureIdentifier(); if(real != null) { try { return real.toCanonical(); } catch (StructureException e) { // generate fake one if needed } } // No identifier set, so generate based on residues present in the structure List<ResidueRange> range = new ArrayList<>(); for (Chain chain : getChains()) { List<Group> groups = chain.getAtomGroups(); ListIterator<Group> groupsIt = groups.listIterator(); if(!groupsIt.hasNext()) { continue; // no groups in chain } Group g = groupsIt.next(); ResidueNumber first = g.getResidueNumber(); //TODO Detect missing intermediate residues -sbliven, 2015-01-28 //Already better than previous whole-chain representation // get last residue while(groupsIt.hasNext()) { g = groupsIt.next(); } ResidueNumber last = g.getResidueNumber(); range.add(new ResidueRange(chain.getName(),first,last)); } return new SubstructureIdentifier(getPDBCode(),range); }
java
private SubstructureIdentifier toCanonical() { StructureIdentifier real = getStructureIdentifier(); if(real != null) { try { return real.toCanonical(); } catch (StructureException e) { // generate fake one if needed } } // No identifier set, so generate based on residues present in the structure List<ResidueRange> range = new ArrayList<>(); for (Chain chain : getChains()) { List<Group> groups = chain.getAtomGroups(); ListIterator<Group> groupsIt = groups.listIterator(); if(!groupsIt.hasNext()) { continue; // no groups in chain } Group g = groupsIt.next(); ResidueNumber first = g.getResidueNumber(); //TODO Detect missing intermediate residues -sbliven, 2015-01-28 //Already better than previous whole-chain representation // get last residue while(groupsIt.hasNext()) { g = groupsIt.next(); } ResidueNumber last = g.getResidueNumber(); range.add(new ResidueRange(chain.getName(),first,last)); } return new SubstructureIdentifier(getPDBCode(),range); }
[ "private", "SubstructureIdentifier", "toCanonical", "(", ")", "{", "StructureIdentifier", "real", "=", "getStructureIdentifier", "(", ")", ";", "if", "(", "real", "!=", "null", ")", "{", "try", "{", "return", "real", ".", "toCanonical", "(", ")", ";", "}", ...
Creates a SubstructureIdentifier based on the residues in this Structure. Only the first and last residues of each chain are considered, so chains with gaps @return A {@link SubstructureIdentifier} with residue ranges constructed from each chain
[ "Creates", "a", "SubstructureIdentifier", "based", "on", "the", "residues", "in", "this", "Structure", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureImpl.java#L1122-L1155
31,524
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/WrapLayout.java
WrapLayout.layoutSize
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the container // has not yet been calculated so lets ask for the maximum. int targetWidth = target.getSize().width; Container container = target; while (container.getSize().width == 0 && container.getParent() != null) { container = container.getParent(); } targetWidth = container.getSize().width; if (targetWidth == 0) targetWidth = Integer.MAX_VALUE; int hgap = getHgap(); int vgap = getVgap(); Insets insets = target.getInsets(); int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2); int maxWidth = targetWidth - horizontalInsetsAndGap; // Fit components into the allowed width Dimension dim = new Dimension(0, 0); int rowWidth = 0; int rowHeight = 0; int nmembers = target.getComponentCount(); for (int i = 0; i < nmembers; i++) { Component m = target.getComponent(i); if (m.isVisible()) { Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize(); // Can't add the component to current row. Start a new row. if (rowWidth + d.width > maxWidth) { addRow(dim, rowWidth, rowHeight); rowWidth = 0; rowHeight = 0; } // Add a horizontal gap for all components after the first if (rowWidth != 0) { rowWidth += hgap; } rowWidth += d.width; rowHeight = Math.max(rowHeight, d.height); } } addRow(dim, rowWidth, rowHeight); dim.width += horizontalInsetsAndGap; dim.height += insets.top + insets.bottom + vgap * 2; // When using a scroll pane or the DecoratedLookAndFeel we need to // make sure the preferred size is less than the size of the // target containter so shrinking the container size works // correctly. Removing the horizontal gap is an easy way to do this. Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target); if (scrollPane != null && target.isValid()) { dim.width -= (hgap + 1); } return dim; } }
java
private Dimension layoutSize(Container target, boolean preferred) { synchronized (target.getTreeLock()) { // Each row must fit with the width allocated to the containter. // When the container width = 0, the preferred width of the container // has not yet been calculated so lets ask for the maximum. int targetWidth = target.getSize().width; Container container = target; while (container.getSize().width == 0 && container.getParent() != null) { container = container.getParent(); } targetWidth = container.getSize().width; if (targetWidth == 0) targetWidth = Integer.MAX_VALUE; int hgap = getHgap(); int vgap = getVgap(); Insets insets = target.getInsets(); int horizontalInsetsAndGap = insets.left + insets.right + (hgap * 2); int maxWidth = targetWidth - horizontalInsetsAndGap; // Fit components into the allowed width Dimension dim = new Dimension(0, 0); int rowWidth = 0; int rowHeight = 0; int nmembers = target.getComponentCount(); for (int i = 0; i < nmembers; i++) { Component m = target.getComponent(i); if (m.isVisible()) { Dimension d = preferred ? m.getPreferredSize() : m.getMinimumSize(); // Can't add the component to current row. Start a new row. if (rowWidth + d.width > maxWidth) { addRow(dim, rowWidth, rowHeight); rowWidth = 0; rowHeight = 0; } // Add a horizontal gap for all components after the first if (rowWidth != 0) { rowWidth += hgap; } rowWidth += d.width; rowHeight = Math.max(rowHeight, d.height); } } addRow(dim, rowWidth, rowHeight); dim.width += horizontalInsetsAndGap; dim.height += insets.top + insets.bottom + vgap * 2; // When using a scroll pane or the DecoratedLookAndFeel we need to // make sure the preferred size is less than the size of the // target containter so shrinking the container size works // correctly. Removing the horizontal gap is an easy way to do this. Container scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane.class, target); if (scrollPane != null && target.isValid()) { dim.width -= (hgap + 1); } return dim; } }
[ "private", "Dimension", "layoutSize", "(", "Container", "target", ",", "boolean", "preferred", ")", "{", "synchronized", "(", "target", ".", "getTreeLock", "(", ")", ")", "{", "// Each row must fit with the width allocated to the containter.", "// When the container width...
Returns the minimum or preferred dimension needed to layout the target container. @param target target to get layout size for @param preferred should preferred size be calculated @return the dimension to layout the target container
[ "Returns", "the", "minimum", "or", "preferred", "dimension", "needed", "to", "layout", "the", "target", "container", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/WrapLayout.java#L111-L194
31,525
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java
NumbersAtRiskPanel.setKaplanMeierFigure
public void setKaplanMeierFigure(KaplanMeierFigure kmf) { this.kmf = kmf; int numRows = kmf.getSurvivalFitInfo().getStrataInfoHashMap().size(); int height = (numRows + 1) * getFontMetrics(getFont()).getHeight(); int width = kmf.getWidth(); setPreferredSize(new Dimension(width,height)); this.setSize(width, height); }
java
public void setKaplanMeierFigure(KaplanMeierFigure kmf) { this.kmf = kmf; int numRows = kmf.getSurvivalFitInfo().getStrataInfoHashMap().size(); int height = (numRows + 1) * getFontMetrics(getFont()).getHeight(); int width = kmf.getWidth(); setPreferredSize(new Dimension(width,height)); this.setSize(width, height); }
[ "public", "void", "setKaplanMeierFigure", "(", "KaplanMeierFigure", "kmf", ")", "{", "this", ".", "kmf", "=", "kmf", ";", "int", "numRows", "=", "kmf", ".", "getSurvivalFitInfo", "(", ")", ".", "getStrataInfoHashMap", "(", ")", ".", "size", "(", ")", ";", ...
Pick up needed info and details from the KM Figure @param kmf
[ "Pick", "up", "needed", "info", "and", "details", "from", "the", "KM", "Figure" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/kaplanmeier/figure/NumbersAtRiskPanel.java#L52-L61
31,526
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java
SurvivalInfoHelper.isCategorical
private static boolean isCategorical(LinkedHashMap<String, Double> values) { try { for (String value : values.keySet()) { Double.parseDouble(value); } return false; } catch (Exception e) { return true; } }
java
private static boolean isCategorical(LinkedHashMap<String, Double> values) { try { for (String value : values.keySet()) { Double.parseDouble(value); } return false; } catch (Exception e) { return true; } }
[ "private", "static", "boolean", "isCategorical", "(", "LinkedHashMap", "<", "String", ",", "Double", ">", "values", ")", "{", "try", "{", "for", "(", "String", "value", ":", "values", ".", "keySet", "(", ")", ")", "{", "Double", ".", "parseDouble", "(", ...
If any not numeric value then categorical @param values @return
[ "If", "any", "not", "numeric", "value", "then", "categorical" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java#L70-L80
31,527
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java
SurvivalInfoHelper.categorizeData
public static void categorizeData(ArrayList<SurvivalInfo> DataT) { //Go through and get all variable value pairs LinkedHashMap<String, LinkedHashMap<String, Double>> valueMap = new LinkedHashMap<String, LinkedHashMap<String, Double>>(); for (SurvivalInfo si : DataT) { for (String key : si.unknownDataType.keySet()) { LinkedHashMap<String, Double> map = valueMap.get(key); if (map == null) { map = new LinkedHashMap<String, Double>(); valueMap.put(key, map); } map.put(si.unknownDataType.get(key), null); } } for (String variable : valueMap.keySet()) { LinkedHashMap<String, Double> values = valueMap.get(variable); if (isCategorical(values)) { ArrayList<String> categories = new ArrayList<String>(values.keySet()); Collections.sort(categories); //go ahead and put in alphabetical order if (categories.size() == 2) { for (String value : values.keySet()) { int index = categories.indexOf(value); values.put(value, index + 0.0); } } else { for (String value : values.keySet()) { int index = categories.indexOf(value); values.put(value, index + 1.0); } } } else { for (String value : values.keySet()) { Double d = Double.parseDouble(value); values.put(value, d); } } } for (SurvivalInfo si : DataT) { for (String key : si.unknownDataType.keySet()) { LinkedHashMap<String, Double> map = valueMap.get(key); String value = si.unknownDataType.get(key); Double d = map.get(value); si.data.put(key, d); } } for (SurvivalInfo si : DataT) { si.unknownDataType.clear(); } }
java
public static void categorizeData(ArrayList<SurvivalInfo> DataT) { //Go through and get all variable value pairs LinkedHashMap<String, LinkedHashMap<String, Double>> valueMap = new LinkedHashMap<String, LinkedHashMap<String, Double>>(); for (SurvivalInfo si : DataT) { for (String key : si.unknownDataType.keySet()) { LinkedHashMap<String, Double> map = valueMap.get(key); if (map == null) { map = new LinkedHashMap<String, Double>(); valueMap.put(key, map); } map.put(si.unknownDataType.get(key), null); } } for (String variable : valueMap.keySet()) { LinkedHashMap<String, Double> values = valueMap.get(variable); if (isCategorical(values)) { ArrayList<String> categories = new ArrayList<String>(values.keySet()); Collections.sort(categories); //go ahead and put in alphabetical order if (categories.size() == 2) { for (String value : values.keySet()) { int index = categories.indexOf(value); values.put(value, index + 0.0); } } else { for (String value : values.keySet()) { int index = categories.indexOf(value); values.put(value, index + 1.0); } } } else { for (String value : values.keySet()) { Double d = Double.parseDouble(value); values.put(value, d); } } } for (SurvivalInfo si : DataT) { for (String key : si.unknownDataType.keySet()) { LinkedHashMap<String, Double> map = valueMap.get(key); String value = si.unknownDataType.get(key); Double d = map.get(value); si.data.put(key, d); } } for (SurvivalInfo si : DataT) { si.unknownDataType.clear(); } }
[ "public", "static", "void", "categorizeData", "(", "ArrayList", "<", "SurvivalInfo", ">", "DataT", ")", "{", "//Go through and get all variable value pairs", "LinkedHashMap", "<", "String", ",", "LinkedHashMap", "<", "String", ",", "Double", ">", ">", "valueMap", "=...
Take a collection of categorical data and convert it to numeric to be used in cox calculations @param DataT
[ "Take", "a", "collection", "of", "categorical", "data", "and", "convert", "it", "to", "numeric", "to", "be", "used", "in", "cox", "calculations" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java#L86-L140
31,528
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java
SurvivalInfoHelper.addInteraction
public static ArrayList<String> addInteraction(String variable1, String variable2, ArrayList<SurvivalInfo> survivalInfoList) { ArrayList<String> variables = new ArrayList<String>(); variables.add(variable1); variables.add(variable2); variables.add(variable1 + ":" + variable2); for (SurvivalInfo si : survivalInfoList) { Double value1 = si.getVariable(variable1); Double value2 = si.getVariable(variable2); Double value3 = value1 * value2; si.addContinuousVariable(variable1 + ":" + variable2, value3); } return variables; }
java
public static ArrayList<String> addInteraction(String variable1, String variable2, ArrayList<SurvivalInfo> survivalInfoList) { ArrayList<String> variables = new ArrayList<String>(); variables.add(variable1); variables.add(variable2); variables.add(variable1 + ":" + variable2); for (SurvivalInfo si : survivalInfoList) { Double value1 = si.getVariable(variable1); Double value2 = si.getVariable(variable2); Double value3 = value1 * value2; si.addContinuousVariable(variable1 + ":" + variable2, value3); } return variables; }
[ "public", "static", "ArrayList", "<", "String", ">", "addInteraction", "(", "String", "variable1", ",", "String", "variable2", ",", "ArrayList", "<", "SurvivalInfo", ">", "survivalInfoList", ")", "{", "ArrayList", "<", "String", ">", "variables", "=", "new", "...
To test for interactions use two variables and create a third variable where the two are multiplied together. @param variable1 @param variable2 @param survivalInfoList @return
[ "To", "test", "for", "interactions", "use", "two", "variables", "and", "create", "a", "third", "variable", "where", "the", "two", "are", "multiplied", "together", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java#L149-L161
31,529
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java
SurvivalInfoHelper.groupByRange
public static void groupByRange(double[] range, String variable, String groupName, ArrayList<SurvivalInfo> survivalInfoList) throws Exception { ArrayList<String> labels = new ArrayList<String>(); for (int i = 0; i < range.length; i++) { String label = ""; if (i == 0) { label = "[<=" + range[i] + "]"; } else if (i == range.length - 1) { label = "[" + (range[i - 1] + 1) + "-" + range[i] + "]"; labels.add(label); label = "[>" + range[i] + "]"; } else { label = "[" + (range[i - 1] + 1) + "-" + range[i] + "]"; } labels.add(label); } ArrayList<String> validLabels = new ArrayList<String>(); //need to find the categories so we can set 1 and 0 and not include ranges with no values for (SurvivalInfo si : survivalInfoList) { Double value = si.getContinuousVariable(variable); if (value == null) { throw new Exception("Variable " + variable + " not found in " + si.toString()); } int rangeIndex = getRangeIndex(range, value); String label = labels.get(rangeIndex); if (!validLabels.contains(groupName + "_" + label)) { validLabels.add(groupName + "_" + label); } } Collections.sort(validLabels); System.out.println("Valid Lables:" + validLabels); for (SurvivalInfo si : survivalInfoList) { Double value = si.getContinuousVariable(variable); if (value == null) { throw new Exception("Variable " + variable + " not found in " + si.toString()); } int rangeIndex = getRangeIndex(range, value); String label = labels.get(rangeIndex); String inLable = groupName + "_" + label; for (String gl : validLabels) { if (gl.equals(inLable)) { si.addContinuousVariable(gl, 1.0); } else { si.addContinuousVariable(gl, 0.0); } } } }
java
public static void groupByRange(double[] range, String variable, String groupName, ArrayList<SurvivalInfo> survivalInfoList) throws Exception { ArrayList<String> labels = new ArrayList<String>(); for (int i = 0; i < range.length; i++) { String label = ""; if (i == 0) { label = "[<=" + range[i] + "]"; } else if (i == range.length - 1) { label = "[" + (range[i - 1] + 1) + "-" + range[i] + "]"; labels.add(label); label = "[>" + range[i] + "]"; } else { label = "[" + (range[i - 1] + 1) + "-" + range[i] + "]"; } labels.add(label); } ArrayList<String> validLabels = new ArrayList<String>(); //need to find the categories so we can set 1 and 0 and not include ranges with no values for (SurvivalInfo si : survivalInfoList) { Double value = si.getContinuousVariable(variable); if (value == null) { throw new Exception("Variable " + variable + " not found in " + si.toString()); } int rangeIndex = getRangeIndex(range, value); String label = labels.get(rangeIndex); if (!validLabels.contains(groupName + "_" + label)) { validLabels.add(groupName + "_" + label); } } Collections.sort(validLabels); System.out.println("Valid Lables:" + validLabels); for (SurvivalInfo si : survivalInfoList) { Double value = si.getContinuousVariable(variable); if (value == null) { throw new Exception("Variable " + variable + " not found in " + si.toString()); } int rangeIndex = getRangeIndex(range, value); String label = labels.get(rangeIndex); String inLable = groupName + "_" + label; for (String gl : validLabels) { if (gl.equals(inLable)) { si.addContinuousVariable(gl, 1.0); } else { si.addContinuousVariable(gl, 0.0); } } } }
[ "public", "static", "void", "groupByRange", "(", "double", "[", "]", "range", ",", "String", "variable", ",", "String", "groupName", ",", "ArrayList", "<", "SurvivalInfo", ">", "survivalInfoList", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">...
Need to allow a range of values similar to cut in R and a continuous c @param range @param variable @param groupName @param survivalInfoList @throws Exception
[ "Need", "to", "allow", "a", "range", "of", "values", "similar", "to", "cut", "in", "R", "and", "a", "continuous", "c" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/SurvivalInfoHelper.java#L172-L220
31,530
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java
SymmetryTools.grayOutCEOrig
public static Matrix grayOutCEOrig(Atom[] ca2, int rows, int cols, CECalculator calculator, Matrix origM, int blankWindowSize, double[] gradientPolyCoeff, double gradientExpCoeff) { if (origM == null) { origM = new Matrix(calculator.getMatMatrix()); } // symmetry hack, disable main diagonal for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { int diff = Math.abs(i - j); double resetVal = getResetVal(origM.get(i, j), diff, gradientPolyCoeff, gradientExpCoeff); if (diff < blankWindowSize) { origM.set(i, j, origM.get(i, j) + resetVal); } int diff2 = Math.abs(i - (j - ca2.length / 2)); // other side double resetVal2 = getResetVal(origM.get(i, j), diff2, gradientPolyCoeff, gradientExpCoeff); if (diff2 < blankWindowSize) { origM.set(i, j, origM.get(i, j) + resetVal2); } } } return origM; }
java
public static Matrix grayOutCEOrig(Atom[] ca2, int rows, int cols, CECalculator calculator, Matrix origM, int blankWindowSize, double[] gradientPolyCoeff, double gradientExpCoeff) { if (origM == null) { origM = new Matrix(calculator.getMatMatrix()); } // symmetry hack, disable main diagonal for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { int diff = Math.abs(i - j); double resetVal = getResetVal(origM.get(i, j), diff, gradientPolyCoeff, gradientExpCoeff); if (diff < blankWindowSize) { origM.set(i, j, origM.get(i, j) + resetVal); } int diff2 = Math.abs(i - (j - ca2.length / 2)); // other side double resetVal2 = getResetVal(origM.get(i, j), diff2, gradientPolyCoeff, gradientExpCoeff); if (diff2 < blankWindowSize) { origM.set(i, j, origM.get(i, j) + resetVal2); } } } return origM; }
[ "public", "static", "Matrix", "grayOutCEOrig", "(", "Atom", "[", "]", "ca2", ",", "int", "rows", ",", "int", "cols", ",", "CECalculator", "calculator", ",", "Matrix", "origM", ",", "int", "blankWindowSize", ",", "double", "[", "]", "gradientPolyCoeff", ",", ...
Grays out the main diagonal of a duplicated distance matrix. @param ca2 @param rows Number of rows @param cols Number of original columns @param calculator Used to get the matrix if origM is null @param origM starting matrix. If null, uses {@link CECalculator#getMatMatrix()} @param blankWindowSize Width of section to gray out @param gradientPolyCoeff @param gradientExpCoeff @return
[ "Grays", "out", "the", "main", "diagonal", "of", "a", "duplicated", "distance", "matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java#L140-L173
31,531
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java
SymmetryTools.buildSymmetryGraph
public static List<List<Integer>> buildSymmetryGraph(List<AFPChain> afps, Atom[] atoms, boolean undirected) { List<List<Integer>> graph = new ArrayList<List<Integer>>(); for (int n = 0; n < atoms.length; n++) { graph.add(new ArrayList<Integer>()); } for (int k = 0; k < afps.size(); k++) { for (int i = 0; i < afps.get(k).getOptAln().length; i++) { for (int j = 0; j < afps.get(k).getOptAln()[i][0].length; j++) { Integer res1 = afps.get(k).getOptAln()[i][0][j]; Integer res2 = afps.get(k).getOptAln()[i][1][j]; graph.get(res1).add(res2); if (undirected) graph.get(res2).add(res1); } } } return graph; }
java
public static List<List<Integer>> buildSymmetryGraph(List<AFPChain> afps, Atom[] atoms, boolean undirected) { List<List<Integer>> graph = new ArrayList<List<Integer>>(); for (int n = 0; n < atoms.length; n++) { graph.add(new ArrayList<Integer>()); } for (int k = 0; k < afps.size(); k++) { for (int i = 0; i < afps.get(k).getOptAln().length; i++) { for (int j = 0; j < afps.get(k).getOptAln()[i][0].length; j++) { Integer res1 = afps.get(k).getOptAln()[i][0][j]; Integer res2 = afps.get(k).getOptAln()[i][1][j]; graph.get(res1).add(res2); if (undirected) graph.get(res2).add(res1); } } } return graph; }
[ "public", "static", "List", "<", "List", "<", "Integer", ">", ">", "buildSymmetryGraph", "(", "List", "<", "AFPChain", ">", "afps", ",", "Atom", "[", "]", "atoms", ",", "boolean", "undirected", ")", "{", "List", "<", "List", "<", "Integer", ">>", "grap...
Converts a set of AFP alignments into a Graph of aligned residues, where each vertex is a residue and each edge means the connection between the two residues in one of the alignments. @param afps List of AFPChains @param atoms Atom array of the symmetric structure @param undirected if true, the graph is undirected @return adjacency List of aligned residues
[ "Converts", "a", "set", "of", "AFP", "alignments", "into", "a", "Graph", "of", "aligned", "residues", "where", "each", "vertex", "is", "a", "residue", "and", "each", "edge", "means", "the", "connection", "between", "the", "two", "residues", "in", "one", "o...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java#L443-L464
31,532
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java
SymmetryTools.buildSymmetryGraph
public static Graph<Integer, DefaultEdge> buildSymmetryGraph( AFPChain selfAlignment) { Graph<Integer, DefaultEdge> graph = new SimpleGraph<Integer, DefaultEdge>( DefaultEdge.class); for (int i = 0; i < selfAlignment.getOptAln().length; i++) { for (int j = 0; j < selfAlignment.getOptAln()[i][0].length; j++) { Integer res1 = selfAlignment.getOptAln()[i][0][j]; Integer res2 = selfAlignment.getOptAln()[i][1][j]; graph.addVertex(res1); graph.addVertex(res2); graph.addEdge(res1, res2); } } return graph; }
java
public static Graph<Integer, DefaultEdge> buildSymmetryGraph( AFPChain selfAlignment) { Graph<Integer, DefaultEdge> graph = new SimpleGraph<Integer, DefaultEdge>( DefaultEdge.class); for (int i = 0; i < selfAlignment.getOptAln().length; i++) { for (int j = 0; j < selfAlignment.getOptAln()[i][0].length; j++) { Integer res1 = selfAlignment.getOptAln()[i][0][j]; Integer res2 = selfAlignment.getOptAln()[i][1][j]; graph.addVertex(res1); graph.addVertex(res2); graph.addEdge(res1, res2); } } return graph; }
[ "public", "static", "Graph", "<", "Integer", ",", "DefaultEdge", ">", "buildSymmetryGraph", "(", "AFPChain", "selfAlignment", ")", "{", "Graph", "<", "Integer", ",", "DefaultEdge", ">", "graph", "=", "new", "SimpleGraph", "<", "Integer", ",", "DefaultEdge", ">...
Converts a self alignment into a directed jGraphT of aligned residues, where each vertex is a residue and each edge means the equivalence between the two residues in the self-alignment. @param selfAlignment AFPChain @return alignment Graph
[ "Converts", "a", "self", "alignment", "into", "a", "directed", "jGraphT", "of", "aligned", "residues", "where", "each", "vertex", "is", "a", "residue", "and", "each", "edge", "means", "the", "equivalence", "between", "the", "two", "residues", "in", "the", "s...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java#L476-L492
31,533
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java
SymmetryTools.divideStructure
public static List<Structure> divideStructure(CeSymmResult symmetry) throws StructureException { if (!symmetry.isRefined()) throw new IllegalArgumentException("The symmetry result " + "is not refined, repeats cannot be defined"); int order = symmetry.getMultipleAlignment().size(); Atom[] atoms = symmetry.getAtoms(); Set<Group> allGroups = StructureTools.getAllGroupsFromSubset(atoms, GroupType.HETATM); List<StructureIdentifier> repeatsId = symmetry.getRepeatsID(); List<Structure> repeats = new ArrayList<Structure>(order); // Create new structure containing the repeat atoms for (int i = 0; i < order; i++) { Structure s = new StructureImpl(); s.addModel(new ArrayList<Chain>(1)); s.setStructureIdentifier(repeatsId.get(i)); Block align = symmetry.getMultipleAlignment().getBlock(0); // Get the start and end of the repeat // Repeats are always sequential blocks int res1 = align.getStartResidue(i); int res2 = align.getFinalResidue(i); // All atoms from the repeat, used for ligand search // AA have an average of 8.45 atoms, so guess capacity with that List<Atom> repeat = new ArrayList<>(Math.max(9*(res2-res1+1),9)); // speedy chain lookup Chain prevChain = null; for(int k=res1;k<=res2; k++) { Group g = atoms[k].getGroup(); prevChain = StructureTools.addGroupToStructure(s, g, 0, prevChain,true); repeat.addAll(g.getAtoms()); } List<Group> ligands = StructureTools.getLigandsByProximity( allGroups, repeat.toArray(new Atom[repeat.size()]), StructureTools.DEFAULT_LIGAND_PROXIMITY_CUTOFF); logger.warn("Adding {} ligands to {}",ligands.size(), symmetry.getMultipleAlignment().getStructureIdentifier(i)); for( Group ligand : ligands) { prevChain = StructureTools.addGroupToStructure(s, ligand, 0, prevChain,true); } repeats.add(s); } return repeats; }
java
public static List<Structure> divideStructure(CeSymmResult symmetry) throws StructureException { if (!symmetry.isRefined()) throw new IllegalArgumentException("The symmetry result " + "is not refined, repeats cannot be defined"); int order = symmetry.getMultipleAlignment().size(); Atom[] atoms = symmetry.getAtoms(); Set<Group> allGroups = StructureTools.getAllGroupsFromSubset(atoms, GroupType.HETATM); List<StructureIdentifier> repeatsId = symmetry.getRepeatsID(); List<Structure> repeats = new ArrayList<Structure>(order); // Create new structure containing the repeat atoms for (int i = 0; i < order; i++) { Structure s = new StructureImpl(); s.addModel(new ArrayList<Chain>(1)); s.setStructureIdentifier(repeatsId.get(i)); Block align = symmetry.getMultipleAlignment().getBlock(0); // Get the start and end of the repeat // Repeats are always sequential blocks int res1 = align.getStartResidue(i); int res2 = align.getFinalResidue(i); // All atoms from the repeat, used for ligand search // AA have an average of 8.45 atoms, so guess capacity with that List<Atom> repeat = new ArrayList<>(Math.max(9*(res2-res1+1),9)); // speedy chain lookup Chain prevChain = null; for(int k=res1;k<=res2; k++) { Group g = atoms[k].getGroup(); prevChain = StructureTools.addGroupToStructure(s, g, 0, prevChain,true); repeat.addAll(g.getAtoms()); } List<Group> ligands = StructureTools.getLigandsByProximity( allGroups, repeat.toArray(new Atom[repeat.size()]), StructureTools.DEFAULT_LIGAND_PROXIMITY_CUTOFF); logger.warn("Adding {} ligands to {}",ligands.size(), symmetry.getMultipleAlignment().getStructureIdentifier(i)); for( Group ligand : ligands) { prevChain = StructureTools.addGroupToStructure(s, ligand, 0, prevChain,true); } repeats.add(s); } return repeats; }
[ "public", "static", "List", "<", "Structure", ">", "divideStructure", "(", "CeSymmResult", "symmetry", ")", "throws", "StructureException", "{", "if", "(", "!", "symmetry", ".", "isRefined", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"The ...
Method that converts the symmetric units of a structure into different structures, so that they can be individually visualized. @param symmetry CeSymmResult @throws StructureException @result List of structures, by repeat index sequentially
[ "Method", "that", "converts", "the", "symmetric", "units", "of", "a", "structure", "into", "different", "structures", "so", "that", "they", "can", "be", "individually", "visualized", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java#L504-L556
31,534
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java
SymmetryTools.fromAFP
public static MultipleAlignment fromAFP(AFPChain symm, Atom[] atoms) throws StructureException { if (!symm.getAlgorithmName().contains("symm")) { throw new IllegalArgumentException( "The input alignment is not a symmetry alignment."); } MultipleAlignmentEnsemble e = new MultipleAlignmentEnsembleImpl(symm, atoms, atoms, false); e.setAtomArrays(new ArrayList<Atom[]>()); StructureIdentifier name = null; if (e.getStructureIdentifiers() != null) { if (!e.getStructureIdentifiers().isEmpty()) name = e.getStructureIdentifiers().get(0); } else name = atoms[0].getGroup().getChain().getStructure() .getStructureIdentifier(); e.setStructureIdentifiers(new ArrayList<StructureIdentifier>()); MultipleAlignment result = new MultipleAlignmentImpl(); BlockSet bs = new BlockSetImpl(result); Block b = new BlockImpl(bs); b.setAlignRes(new ArrayList<List<Integer>>()); int order = symm.getBlockNum(); for (int su = 0; su < order; su++) { List<Integer> residues = e.getMultipleAlignment(0).getBlock(su) .getAlignRes().get(0); b.getAlignRes().add(residues); e.getStructureIdentifiers().add(name); e.getAtomArrays().add(atoms); } e.getMultipleAlignments().set(0, result); result.setEnsemble(e); CoreSuperimposer imposer = new CoreSuperimposer(); imposer.superimpose(result); updateSymmetryScores(result); return result; }
java
public static MultipleAlignment fromAFP(AFPChain symm, Atom[] atoms) throws StructureException { if (!symm.getAlgorithmName().contains("symm")) { throw new IllegalArgumentException( "The input alignment is not a symmetry alignment."); } MultipleAlignmentEnsemble e = new MultipleAlignmentEnsembleImpl(symm, atoms, atoms, false); e.setAtomArrays(new ArrayList<Atom[]>()); StructureIdentifier name = null; if (e.getStructureIdentifiers() != null) { if (!e.getStructureIdentifiers().isEmpty()) name = e.getStructureIdentifiers().get(0); } else name = atoms[0].getGroup().getChain().getStructure() .getStructureIdentifier(); e.setStructureIdentifiers(new ArrayList<StructureIdentifier>()); MultipleAlignment result = new MultipleAlignmentImpl(); BlockSet bs = new BlockSetImpl(result); Block b = new BlockImpl(bs); b.setAlignRes(new ArrayList<List<Integer>>()); int order = symm.getBlockNum(); for (int su = 0; su < order; su++) { List<Integer> residues = e.getMultipleAlignment(0).getBlock(su) .getAlignRes().get(0); b.getAlignRes().add(residues); e.getStructureIdentifiers().add(name); e.getAtomArrays().add(atoms); } e.getMultipleAlignments().set(0, result); result.setEnsemble(e); CoreSuperimposer imposer = new CoreSuperimposer(); imposer.superimpose(result); updateSymmetryScores(result); return result; }
[ "public", "static", "MultipleAlignment", "fromAFP", "(", "AFPChain", "symm", ",", "Atom", "[", "]", "atoms", ")", "throws", "StructureException", "{", "if", "(", "!", "symm", ".", "getAlgorithmName", "(", ")", ".", "contains", "(", "\"symm\"", ")", ")", "{...
Converts a refined symmetry AFPChain alignment into the standard representation of symmetry in a MultipleAlignment, that contains the entire Atom array of the strcuture and the symmetric repeats are orgaized in different rows in a single Block. @param symm AFPChain created with a symmetry algorithm and refined @param atoms Atom array of the entire structure @return MultipleAlignment format of the symmetry @throws StructureException
[ "Converts", "a", "refined", "symmetry", "AFPChain", "alignment", "into", "the", "standard", "representation", "of", "symmetry", "in", "a", "MultipleAlignment", "that", "contains", "the", "entire", "Atom", "array", "of", "the", "strcuture", "and", "the", "symmetric...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java#L651-L693
31,535
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java
SymmetryTools.getRepresentativeAtoms
public static Atom[] getRepresentativeAtoms(Structure structure) { if (structure.isNmr()) return StructureTools.getRepresentativeAtomArray(structure); else { // Get Atoms of all models List<Atom> atomList = new ArrayList<Atom>(); for (int m = 0; m < structure.nrModels(); m++) { for (Chain c : structure.getModel(m)) atomList.addAll(Arrays.asList(StructureTools .getRepresentativeAtomArray(c))); } return atomList.toArray(new Atom[0]); } }
java
public static Atom[] getRepresentativeAtoms(Structure structure) { if (structure.isNmr()) return StructureTools.getRepresentativeAtomArray(structure); else { // Get Atoms of all models List<Atom> atomList = new ArrayList<Atom>(); for (int m = 0; m < structure.nrModels(); m++) { for (Chain c : structure.getModel(m)) atomList.addAll(Arrays.asList(StructureTools .getRepresentativeAtomArray(c))); } return atomList.toArray(new Atom[0]); } }
[ "public", "static", "Atom", "[", "]", "getRepresentativeAtoms", "(", "Structure", "structure", ")", "{", "if", "(", "structure", ".", "isNmr", "(", ")", ")", "return", "StructureTools", ".", "getRepresentativeAtomArray", "(", "structure", ")", ";", "else", "{"...
Returns the representative Atom Array of the first model, if the structure is NMR, or the Array for each model, if it is a biological assembly with multiple models. @param structure @return representative Atom[]
[ "Returns", "the", "representative", "Atom", "Array", "of", "the", "first", "model", "if", "the", "structure", "is", "NMR", "or", "the", "Array", "for", "each", "model", "if", "it", "is", "a", "biological", "assembly", "with", "multiple", "models", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/utils/SymmetryTools.java#L861-L878
31,536
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AligNPE.java
AligNPE.align_NPE
public static Alignable align_NPE(Matrix sim,StrucAligParameters params){ //System.out.println("align_NPE"); float gapOpen = params.getGapOpen(); float gapExtension = params.getGapExtension(); int rows = sim.getRowDimension(); int cols = sim.getColumnDimension(); Alignable al = new StrCompAlignment(rows,cols); al.setGapExtCol(gapExtension); al.setGapExtRow(gapExtension); al.setGapOpenCol(gapOpen); al.setGapOpenRow(gapOpen); //System.out.println("size of aligmat: " + rows+1 + " " + cols+1); //AligMatEl[][] aligmat = new AligMatEl[rows+1][cols+1]; AligMatEl[][] aligmat = al.getAligMat(); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { int e=0; //if ( ( i < rows) && // ( j < cols)) { //TODO: the ALIGFACTOR calc should be hidden in Gotoh!! e = (int)Math.round(Gotoh.ALIGFACTOR * sim.get(i,j)); //} //System.out.println(e); AligMatEl am = new AligMatEl(); am.setValue(e); //am.setTrack(new IndexPair((short)-99,(short)-99)); aligmat[i+1][j+1] = am; } } //al.setAligMat(aligmat); new Gotoh(al); return al; }
java
public static Alignable align_NPE(Matrix sim,StrucAligParameters params){ //System.out.println("align_NPE"); float gapOpen = params.getGapOpen(); float gapExtension = params.getGapExtension(); int rows = sim.getRowDimension(); int cols = sim.getColumnDimension(); Alignable al = new StrCompAlignment(rows,cols); al.setGapExtCol(gapExtension); al.setGapExtRow(gapExtension); al.setGapOpenCol(gapOpen); al.setGapOpenRow(gapOpen); //System.out.println("size of aligmat: " + rows+1 + " " + cols+1); //AligMatEl[][] aligmat = new AligMatEl[rows+1][cols+1]; AligMatEl[][] aligmat = al.getAligMat(); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { int e=0; //if ( ( i < rows) && // ( j < cols)) { //TODO: the ALIGFACTOR calc should be hidden in Gotoh!! e = (int)Math.round(Gotoh.ALIGFACTOR * sim.get(i,j)); //} //System.out.println(e); AligMatEl am = new AligMatEl(); am.setValue(e); //am.setTrack(new IndexPair((short)-99,(short)-99)); aligmat[i+1][j+1] = am; } } //al.setAligMat(aligmat); new Gotoh(al); return al; }
[ "public", "static", "Alignable", "align_NPE", "(", "Matrix", "sim", ",", "StrucAligParameters", "params", ")", "{", "//System.out.println(\"align_NPE\");", "float", "gapOpen", "=", "params", ".", "getGapOpen", "(", ")", ";", "float", "gapExtension", "=", "params", ...
Align without penalizing end-gaps. Return alignment and score @param sim the similarity matrix @param params the structure alignment parameters to be used @return an Alignable
[ "Align", "without", "penalizing", "end", "-", "gaps", ".", "Return", "alignment", "and", "score" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AligNPE.java#L43-L84
31,537
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java
MultipleAlignmentScorer.calculateScores
public static void calculateScores(MultipleAlignment alignment) throws StructureException { // Put RMSD List<Atom[]> trans = MultipleAlignmentTools.transformAtoms(alignment); alignment.putScore(RMSD, getRMSD(trans)); // Put AvgTM-Score List<Integer> lengths = new ArrayList<Integer>(alignment.size()); for (Atom[] atoms : alignment.getAtomArrays()) { lengths.add(atoms.length); } alignment.putScore(AVGTM_SCORE, getAvgTMScore(trans, lengths)); }
java
public static void calculateScores(MultipleAlignment alignment) throws StructureException { // Put RMSD List<Atom[]> trans = MultipleAlignmentTools.transformAtoms(alignment); alignment.putScore(RMSD, getRMSD(trans)); // Put AvgTM-Score List<Integer> lengths = new ArrayList<Integer>(alignment.size()); for (Atom[] atoms : alignment.getAtomArrays()) { lengths.add(atoms.length); } alignment.putScore(AVGTM_SCORE, getAvgTMScore(trans, lengths)); }
[ "public", "static", "void", "calculateScores", "(", "MultipleAlignment", "alignment", ")", "throws", "StructureException", "{", "// Put RMSD", "List", "<", "Atom", "[", "]", ">", "trans", "=", "MultipleAlignmentTools", ".", "transformAtoms", "(", "alignment", ")", ...
Calculates and puts the RMSD and the average TM-Score of the MultipleAlignment. @param alignment @throws StructureException @see #getAvgTMScore(MultipleAlignment) @see #getRMSD(MultipleAlignment)
[ "Calculates", "and", "puts", "the", "RMSD", "and", "the", "average", "TM", "-", "Score", "of", "the", "MultipleAlignment", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/util/MultipleAlignmentScorer.java#L61-L74
31,538
biojava/biojava
biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/TabDelimParser.java
TabDelimParser.parse
public Ontology parse(BufferedReader in, OntologyFactory of) throws IOException, OntologyException { String name = ""; String description = ""; Ontology onto = null; for( String line = in.readLine(); line != null; line = in.readLine() ) { line = line.trim(); if(line.length() > 0) { if(line.startsWith("#")) { // comment line - let's try to pull out name or description if(line.startsWith("#name:")) { name = line.substring("#name:".length()).trim(); } else if(line.startsWith("#description:")) { description = line.substring("#description:".length()).trim(); } } else { try { // make sure we have an ontology if(onto == null) { onto = of.createOntology(name, description); } // build a tripple /* int t1 = line.indexOf("\t"); int t2 = line.indexOf("\t", t1 + 1); String subject = line.substring(0, t1); String predicate = line.substring(t1 + 1, t2); String object = line.substring(t2 + 1); */ StringTokenizer toke = new StringTokenizer(line); String subject = toke.nextToken(); String predicate = toke.nextToken(); String object = toke.nextToken(); Term subT = resolveTerm(subject, onto); Term objT = resolveTerm(object, onto); Term relT = resolveTerm(predicate, onto); Triple trip = resolveTriple(subT, objT, relT, onto); trip = trip==null?null:trip; // prevent unused field error } catch (StringIndexOutOfBoundsException e) { throw new IOException("Could not parse line: " + line); } } } } return onto; }
java
public Ontology parse(BufferedReader in, OntologyFactory of) throws IOException, OntologyException { String name = ""; String description = ""; Ontology onto = null; for( String line = in.readLine(); line != null; line = in.readLine() ) { line = line.trim(); if(line.length() > 0) { if(line.startsWith("#")) { // comment line - let's try to pull out name or description if(line.startsWith("#name:")) { name = line.substring("#name:".length()).trim(); } else if(line.startsWith("#description:")) { description = line.substring("#description:".length()).trim(); } } else { try { // make sure we have an ontology if(onto == null) { onto = of.createOntology(name, description); } // build a tripple /* int t1 = line.indexOf("\t"); int t2 = line.indexOf("\t", t1 + 1); String subject = line.substring(0, t1); String predicate = line.substring(t1 + 1, t2); String object = line.substring(t2 + 1); */ StringTokenizer toke = new StringTokenizer(line); String subject = toke.nextToken(); String predicate = toke.nextToken(); String object = toke.nextToken(); Term subT = resolveTerm(subject, onto); Term objT = resolveTerm(object, onto); Term relT = resolveTerm(predicate, onto); Triple trip = resolveTriple(subT, objT, relT, onto); trip = trip==null?null:trip; // prevent unused field error } catch (StringIndexOutOfBoundsException e) { throw new IOException("Could not parse line: " + line); } } } } return onto; }
[ "public", "Ontology", "parse", "(", "BufferedReader", "in", ",", "OntologyFactory", "of", ")", "throws", "IOException", ",", "OntologyException", "{", "String", "name", "=", "\"\"", ";", "String", "description", "=", "\"\"", ";", "Ontology", "onto", "=", "null...
Parse an ontology from a reader. The reader will be emptied of text. It is the caller's responsibility to close the reader. @param in the BufferedReader to read from @param of an OntologyFactory used to create the Ontology instance @return a new Ontology @throws IOException if there is some problem with the buffered reader @throws OntologyException if it was not possible to instantiate a new ontology
[ "Parse", "an", "ontology", "from", "a", "reader", ".", "The", "reader", "will", "be", "emptied", "of", "text", ".", "It", "is", "the", "caller", "s", "responsibility", "to", "close", "the", "reader", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ontology/src/main/java/org/biojava/nbio/ontology/io/TabDelimParser.java#L92-L152
31,539
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java
AFPChainXMLParser.fromXML
public static AFPChain fromXML(String xml, String name1, String name2, Atom[] ca1, Atom[] ca2) throws IOException, StructureException{ AFPChain[] afps = parseMultiXML( xml); if ( afps.length > 0 ) { AFPChain afpChain = afps[0]; String n1 = afpChain.getName1(); String n2 = afpChain.getName2(); if ( n1 == null ) n1 = ""; if ( n2 == null) n2 = ""; //System.out.println("from AFPCHAIN: " + n1 + " " + n2); if ( n1.equals(name2) && n2.equals(name1)){ // flipped order //System.out.println("AfpChain in wrong order, flipping..."); afpChain = AFPChainFlipper.flipChain(afpChain); } rebuildAFPChain(afpChain, ca1, ca2); return afpChain; } return null; }
java
public static AFPChain fromXML(String xml, String name1, String name2, Atom[] ca1, Atom[] ca2) throws IOException, StructureException{ AFPChain[] afps = parseMultiXML( xml); if ( afps.length > 0 ) { AFPChain afpChain = afps[0]; String n1 = afpChain.getName1(); String n2 = afpChain.getName2(); if ( n1 == null ) n1 = ""; if ( n2 == null) n2 = ""; //System.out.println("from AFPCHAIN: " + n1 + " " + n2); if ( n1.equals(name2) && n2.equals(name1)){ // flipped order //System.out.println("AfpChain in wrong order, flipping..."); afpChain = AFPChainFlipper.flipChain(afpChain); } rebuildAFPChain(afpChain, ca1, ca2); return afpChain; } return null; }
[ "public", "static", "AFPChain", "fromXML", "(", "String", "xml", ",", "String", "name1", ",", "String", "name2", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "IOException", ",", "StructureException", "{", "AFPChain", "[", "]...
new utility method that checks that the order of the pair in the XML alignment is correct and flips the direction if needed @param xml @param name1 @param name1 @param ca1 @param ca2 @return
[ "new", "utility", "method", "that", "checks", "that", "the", "order", "of", "the", "pair", "in", "the", "XML", "alignment", "is", "correct", "and", "flips", "the", "direction", "if", "needed" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java#L64-L90
31,540
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java
AFPChainXMLParser.flipAlignment
public static String flipAlignment(String xml) throws IOException,StructureException{ AFPChain[] afps = parseMultiXML( xml); if ( afps.length < 1 ) return null; if ( afps.length == 1) { AFPChain newChain = AFPChainFlipper.flipChain(afps[0]); if ( newChain.getAlgorithmName() == null) { newChain.setAlgorithmName(DEFAULT_ALGORITHM_NAME); } return AFPChainXMLConverter.toXML(newChain); } throw new StructureException("not Implemented yet!"); }
java
public static String flipAlignment(String xml) throws IOException,StructureException{ AFPChain[] afps = parseMultiXML( xml); if ( afps.length < 1 ) return null; if ( afps.length == 1) { AFPChain newChain = AFPChainFlipper.flipChain(afps[0]); if ( newChain.getAlgorithmName() == null) { newChain.setAlgorithmName(DEFAULT_ALGORITHM_NAME); } return AFPChainXMLConverter.toXML(newChain); } throw new StructureException("not Implemented yet!"); }
[ "public", "static", "String", "flipAlignment", "(", "String", "xml", ")", "throws", "IOException", ",", "StructureException", "{", "AFPChain", "[", "]", "afps", "=", "parseMultiXML", "(", "xml", ")", ";", "if", "(", "afps", ".", "length", "<", "1", ")", ...
Takes an XML representation of the alignment and flips the positions of name1 and name2 @param xml String representing the alignment @return XML representation of the flipped alignment
[ "Takes", "an", "XML", "representation", "of", "the", "alignment", "and", "flips", "the", "positions", "of", "name1", "and", "name2" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java#L125-L138
31,541
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java
AFPChainXMLParser.getPositionForPDBresunm
private static int getPositionForPDBresunm(String pdbresnum, String authId , Atom[] atoms){ ResidueNumber residueNumber = ResidueNumber.fromString(pdbresnum); residueNumber.setChainName(authId); boolean blankChain = authId == null || authId.equalsIgnoreCase("null") || authId.equals("_"); for ( int i =0; i< atoms.length ;i++){ Group g = atoms[i].getGroup(); // match _ to any chain if( blankChain ) { residueNumber.setChainName(g.getChain().getName()); } //System.out.println(g.getResidueNumber() + "< ? >" + residueNumber +"<"); if ( g.getResidueNumber().equals(residueNumber)){ //System.out.println(g + " == " + residueNumber ); Chain c = g.getChain(); if ( blankChain || c.getName().equals(authId)){ return i; } } } return -1; }
java
private static int getPositionForPDBresunm(String pdbresnum, String authId , Atom[] atoms){ ResidueNumber residueNumber = ResidueNumber.fromString(pdbresnum); residueNumber.setChainName(authId); boolean blankChain = authId == null || authId.equalsIgnoreCase("null") || authId.equals("_"); for ( int i =0; i< atoms.length ;i++){ Group g = atoms[i].getGroup(); // match _ to any chain if( blankChain ) { residueNumber.setChainName(g.getChain().getName()); } //System.out.println(g.getResidueNumber() + "< ? >" + residueNumber +"<"); if ( g.getResidueNumber().equals(residueNumber)){ //System.out.println(g + " == " + residueNumber ); Chain c = g.getChain(); if ( blankChain || c.getName().equals(authId)){ return i; } } } return -1; }
[ "private", "static", "int", "getPositionForPDBresunm", "(", "String", "pdbresnum", ",", "String", "authId", ",", "Atom", "[", "]", "atoms", ")", "{", "ResidueNumber", "residueNumber", "=", "ResidueNumber", ".", "fromString", "(", "pdbresnum", ")", ";", "residueN...
get the position of PDB residue nr X in the ato marray @param pdbresnum pdbresidue number @param authId chain name @param atoms atom array @return
[ "get", "the", "position", "of", "PDB", "residue", "nr", "X", "in", "the", "ato", "marray" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java#L519-L543
31,542
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SpaceGroup.java
SpaceGroup.getTransformations
public List<Matrix4d> getTransformations() { List<Matrix4d> transfs = new ArrayList<Matrix4d>(); for (int i=1;i<this.transformations.size();i++){ transfs.add(transformations.get(i)); } return transfs; }
java
public List<Matrix4d> getTransformations() { List<Matrix4d> transfs = new ArrayList<Matrix4d>(); for (int i=1;i<this.transformations.size();i++){ transfs.add(transformations.get(i)); } return transfs; }
[ "public", "List", "<", "Matrix4d", ">", "getTransformations", "(", ")", "{", "List", "<", "Matrix4d", ">", "transfs", "=", "new", "ArrayList", "<", "Matrix4d", ">", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "this", ".", "trans...
Gets all transformations except for the identity in crystal axes basis. @return
[ "Gets", "all", "transformations", "except", "for", "the", "identity", "in", "crystal", "axes", "basis", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/SpaceGroup.java#L274-L280
31,543
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatAligner.java
FatCatAligner.rChainAfp
private static Group[] rChainAfp(FatCatParameters params, AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException{ params.setMaxTra(0); afpChain.setMaxTra(0); return chainAfp(params,afpChain,ca1,ca2); }
java
private static Group[] rChainAfp(FatCatParameters params, AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException{ params.setMaxTra(0); afpChain.setMaxTra(0); return chainAfp(params,afpChain,ca1,ca2); }
[ "private", "static", "Group", "[", "]", "rChainAfp", "(", "FatCatParameters", "params", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "StructureException", "{", "params", ".", "setMaxTra", "(", "0",...
runs rigid chaining process
[ "runs", "rigid", "chaining", "process" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatAligner.java#L125-L129
31,544
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatAligner.java
FatCatAligner.chainAfp
private static Group[] chainAfp(FatCatParameters params,AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException{ // we don;t want to rotate input atoms, do we? Atom[] ca2clone = StructureTools.cloneAtomArray(ca2); List<AFP> afpSet = afpChain.getAfpSet(); if (debug) System.out.println("entering chainAfp"); int afpNum = afpSet.size(); if ( afpNum < 1) return new Group[0]; long bgtime = System.currentTimeMillis(); if(debug) { System.out.println(String.format("total AFP %d\n", afpNum)); } //run AFP chaining AFPChainer.doChainAfp(params,afpChain ,ca1,ca2); int afpChainLen = afpChain.getAfpChainLen(); if(afpChainLen < 1) { afpChain.setShortAlign(true); return new Group[0]; } //very short alignment long chaintime = System.currentTimeMillis(); if(debug) { System.out.println("Afp chaining: time " + (chaintime-bgtime)); } // do post processing AFPPostProcessor.postProcess(params, afpChain,ca1,ca2); // Optimize the final alignment AFPOptimizer.optimizeAln(params, afpChain,ca1,ca2); AFPOptimizer.blockInfo( afpChain); AFPOptimizer.updateScore(params,afpChain); AFPAlignmentDisplay.getAlign(afpChain,ca1,ca2); Group[] twistedPDB = AFPTwister.twistPDB(afpChain, ca1, ca2clone); SigEva sig = new SigEva(); double probability = sig.calSigAll(params, afpChain); afpChain.setProbability(probability); double normAlignScore = sig.calNS(params,afpChain); afpChain.setNormAlignScore(normAlignScore); double tmScore = AFPChainScorer.getTMScore(afpChain, ca1, ca2,false); afpChain.setTMScore(tmScore); /* SIGEVA sig; probability = sig.calSigAll(maxTra, sparse, pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1); normAlignScore = sig.calNS(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1); */ //if(maxTra == 0) probability = sig.calSigRigid(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength); //else probability = sig.calSigFlexi(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1); if(debug) { long nowtime = System.currentTimeMillis(); long diff = nowtime - chaintime; System.out.println("Alignment optimization: time "+ diff); System.out.println("score: " + afpChain.getAlignScore()); System.out.println("opt length: " + afpChain.getOptLength()); System.out.println("opt rmsd: "+ afpChain.getTotalRmsdOpt()); } return twistedPDB; }
java
private static Group[] chainAfp(FatCatParameters params,AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException{ // we don;t want to rotate input atoms, do we? Atom[] ca2clone = StructureTools.cloneAtomArray(ca2); List<AFP> afpSet = afpChain.getAfpSet(); if (debug) System.out.println("entering chainAfp"); int afpNum = afpSet.size(); if ( afpNum < 1) return new Group[0]; long bgtime = System.currentTimeMillis(); if(debug) { System.out.println(String.format("total AFP %d\n", afpNum)); } //run AFP chaining AFPChainer.doChainAfp(params,afpChain ,ca1,ca2); int afpChainLen = afpChain.getAfpChainLen(); if(afpChainLen < 1) { afpChain.setShortAlign(true); return new Group[0]; } //very short alignment long chaintime = System.currentTimeMillis(); if(debug) { System.out.println("Afp chaining: time " + (chaintime-bgtime)); } // do post processing AFPPostProcessor.postProcess(params, afpChain,ca1,ca2); // Optimize the final alignment AFPOptimizer.optimizeAln(params, afpChain,ca1,ca2); AFPOptimizer.blockInfo( afpChain); AFPOptimizer.updateScore(params,afpChain); AFPAlignmentDisplay.getAlign(afpChain,ca1,ca2); Group[] twistedPDB = AFPTwister.twistPDB(afpChain, ca1, ca2clone); SigEva sig = new SigEva(); double probability = sig.calSigAll(params, afpChain); afpChain.setProbability(probability); double normAlignScore = sig.calNS(params,afpChain); afpChain.setNormAlignScore(normAlignScore); double tmScore = AFPChainScorer.getTMScore(afpChain, ca1, ca2,false); afpChain.setTMScore(tmScore); /* SIGEVA sig; probability = sig.calSigAll(maxTra, sparse, pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1); normAlignScore = sig.calNS(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1); */ //if(maxTra == 0) probability = sig.calSigRigid(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength); //else probability = sig.calSigFlexi(pro1Len, pro2Len, alignScore, totalRmsdOpt, optLength, blockNum - 1); if(debug) { long nowtime = System.currentTimeMillis(); long diff = nowtime - chaintime; System.out.println("Alignment optimization: time "+ diff); System.out.println("score: " + afpChain.getAlignScore()); System.out.println("opt length: " + afpChain.getOptLength()); System.out.println("opt rmsd: "+ afpChain.getTotalRmsdOpt()); } return twistedPDB; }
[ "private", "static", "Group", "[", "]", "chainAfp", "(", "FatCatParameters", "params", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "StructureException", "{", "// we don;t want to rotate input atoms, do we...
run AFP chaining allowing up to maxTra flexible regions. Input is original coordinates.
[ "run", "AFP", "chaining", "allowing", "up", "to", "maxTra", "flexible", "regions", ".", "Input", "is", "original", "coordinates", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/FatCatAligner.java#L136-L221
31,545
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriter.java
GenbankWriter.process
public void process() throws Exception { // Loosely based on code from Howard Salis // TODO - Force lower case? // boolean closeit = false; PrintWriter writer = new PrintWriter(os); for (S sequence : sequences) { String header = headerFormat.getHeader(sequence); writer.format(header); writer.println(); // os.write(lineSep); /* * if isinstance(record.seq, UnknownSeq): #We have already recorded * the length, and there is no need #to record a long sequence of * NNNNNNN...NNN or whatever. if "contig" in record.annotations: * self._write_contig(record) else: self.handle.write("ORIGIN\n") * return */ String data = sequence.getSequenceAsString().toLowerCase(); int seq_len = data.length(); writer.println("ORIGIN"); // os.write(lineSep); for (int line_number = 0; line_number < seq_len; line_number += lineLength) { writer.print(StringManipulationHelper.padLeft( Integer.toString(line_number + 1), SEQUENCE_INDENT)); for (int words = line_number; words < Math.min(line_number + lineLength, seq_len); words += 10) { if ((words + 10) > data.length()) { writer.print((" " + data.substring(words))); } else { writer.print((" " + data.substring(words, words + 10))); } } // os.write(lineSep); writer.println(); } writer.println("//"); } writer.flush(); }
java
public void process() throws Exception { // Loosely based on code from Howard Salis // TODO - Force lower case? // boolean closeit = false; PrintWriter writer = new PrintWriter(os); for (S sequence : sequences) { String header = headerFormat.getHeader(sequence); writer.format(header); writer.println(); // os.write(lineSep); /* * if isinstance(record.seq, UnknownSeq): #We have already recorded * the length, and there is no need #to record a long sequence of * NNNNNNN...NNN or whatever. if "contig" in record.annotations: * self._write_contig(record) else: self.handle.write("ORIGIN\n") * return */ String data = sequence.getSequenceAsString().toLowerCase(); int seq_len = data.length(); writer.println("ORIGIN"); // os.write(lineSep); for (int line_number = 0; line_number < seq_len; line_number += lineLength) { writer.print(StringManipulationHelper.padLeft( Integer.toString(line_number + 1), SEQUENCE_INDENT)); for (int words = line_number; words < Math.min(line_number + lineLength, seq_len); words += 10) { if ((words + 10) > data.length()) { writer.print((" " + data.substring(words))); } else { writer.print((" " + data.substring(words, words + 10))); } } // os.write(lineSep); writer.println(); } writer.println("//"); } writer.flush(); }
[ "public", "void", "process", "(", ")", "throws", "Exception", "{", "// Loosely based on code from Howard Salis", "// TODO - Force lower case?", "// boolean closeit = false;", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "os", ")", ";", "for", "(", "S", "sequ...
Allow an override of operating system line separator for programs that needs a specific CRLF or CR or LF option @param lineSeparator
[ "Allow", "an", "override", "of", "operating", "system", "line", "separator", "for", "programs", "that", "needs", "a", "specific", "CRLF", "or", "CR", "or", "LF", "option" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankWriter.java#L88-L133
31,546
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastOutputProperties.java
NCBIQBlastOutputProperties.getOutputOptions
@Override public Set<String> getOutputOptions() { Set<String> result = new HashSet<String>(); for (BlastOutputParameterEnum parameter : param.keySet()) { result.add(parameter.name()); } return result; }
java
@Override public Set<String> getOutputOptions() { Set<String> result = new HashSet<String>(); for (BlastOutputParameterEnum parameter : param.keySet()) { result.add(parameter.name()); } return result; }
[ "@", "Override", "public", "Set", "<", "String", ">", "getOutputOptions", "(", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "BlastOutputParameterEnum", "parameter", ":", "param", "."...
Gets output parameters, which are currently set
[ "Gets", "output", "parameters", "which", "are", "currently", "set" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastOutputProperties.java#L97-L104
31,547
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/GroupIterator.java
GroupIterator.getCurrentChain
public Chain getCurrentChain(){ if ( current_model_pos >= structure.nrModels()){ return null; } List<Chain> model = structure.getModel(current_model_pos); if ( current_chain_pos >= model.size() ){ return null; } return model.get(current_chain_pos); }
java
public Chain getCurrentChain(){ if ( current_model_pos >= structure.nrModels()){ return null; } List<Chain> model = structure.getModel(current_model_pos); if ( current_chain_pos >= model.size() ){ return null; } return model.get(current_chain_pos); }
[ "public", "Chain", "getCurrentChain", "(", ")", "{", "if", "(", "current_model_pos", ">=", "structure", ".", "nrModels", "(", ")", ")", "{", "return", "null", ";", "}", "List", "<", "Chain", ">", "model", "=", "structure", ".", "getModel", "(", "current_...
Get the current Chain. Returns null if we are at the end of the iteration. @return the Chain of the current position
[ "Get", "the", "current", "Chain", ".", "Returns", "null", "if", "we", "are", "at", "the", "end", "of", "the", "iteration", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/GroupIterator.java#L141-L154
31,548
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java
Utils.roundToDecimals
public final static double roundToDecimals(double d, int c) { if(c < 0) return d; double p = Math.pow(10,c); d = d * p; double tmp = Math.round(d); return tmp/p; }
java
public final static double roundToDecimals(double d, int c) { if(c < 0) return d; double p = Math.pow(10,c); d = d * p; double tmp = Math.round(d); return tmp/p; }
[ "public", "final", "static", "double", "roundToDecimals", "(", "double", "d", ",", "int", "c", ")", "{", "if", "(", "c", "<", "0", ")", "return", "d", ";", "double", "p", "=", "Math", ".", "pow", "(", "10", ",", "c", ")", ";", "d", "=", "d", ...
Returns a value with the desired number of decimal places. @param d value to round @param c number of decimal places desired. Must be greater or equal to zero, otherwise, the given value d would be returned without any modification. @return a value with the given number of decimal places.
[ "Returns", "a", "value", "with", "the", "desired", "number", "of", "decimal", "places", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java#L51-L57
31,549
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java
Utils.doesSequenceContainInvalidChar
public final static boolean doesSequenceContainInvalidChar(String sequence, Set<Character> cSet){ for(char c:sequence.toCharArray()){ if(!cSet.contains(c)) return true; } return false; }
java
public final static boolean doesSequenceContainInvalidChar(String sequence, Set<Character> cSet){ for(char c:sequence.toCharArray()){ if(!cSet.contains(c)) return true; } return false; }
[ "public", "final", "static", "boolean", "doesSequenceContainInvalidChar", "(", "String", "sequence", ",", "Set", "<", "Character", ">", "cSet", ")", "{", "for", "(", "char", "c", ":", "sequence", ".", "toCharArray", "(", ")", ")", "{", "if", "(", "!", "c...
Checks if given sequence contains invalid characters. Returns true if invalid characters are found, else return false. Note that any characters are deemed as valid only if it is found in cSet. @param sequence protein sequence to be check. @param cSet the set of characters that are deemed valid. @return true if invalid characters are found, else return false.
[ "Checks", "if", "given", "sequence", "contains", "invalid", "characters", ".", "Returns", "true", "if", "invalid", "characters", "are", "found", "else", "return", "false", ".", "Note", "that", "any", "characters", "are", "deemed", "as", "valid", "only", "if", ...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java#L70-L75
31,550
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java
Utils.getNumberOfInvalidChar
public final static int getNumberOfInvalidChar(String sequence, Set<Character> cSet, boolean ignoreCase){ int total = 0; char[] cArray; if(ignoreCase) cArray = sequence.toUpperCase().toCharArray(); else cArray = sequence.toCharArray(); if(cSet == null) cSet = PeptideProperties.standardAASet; for(char c:cArray){ if(!cSet.contains(c)) total++; } return total; }
java
public final static int getNumberOfInvalidChar(String sequence, Set<Character> cSet, boolean ignoreCase){ int total = 0; char[] cArray; if(ignoreCase) cArray = sequence.toUpperCase().toCharArray(); else cArray = sequence.toCharArray(); if(cSet == null) cSet = PeptideProperties.standardAASet; for(char c:cArray){ if(!cSet.contains(c)) total++; } return total; }
[ "public", "final", "static", "int", "getNumberOfInvalidChar", "(", "String", "sequence", ",", "Set", "<", "Character", ">", "cSet", ",", "boolean", "ignoreCase", ")", "{", "int", "total", "=", "0", ";", "char", "[", "]", "cArray", ";", "if", "(", "ignore...
Return the number of invalid characters in sequence. @param sequence protein sequence to count for invalid characters. @param cSet the set of characters that are deemed valid. @param ignoreCase indicates if cases should be ignored @return the number of invalid characters in sequence.
[ "Return", "the", "number", "of", "invalid", "characters", "in", "sequence", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java#L89-L99
31,551
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java
Utils.cleanSequence
public final static String cleanSequence(String sequence, Set<Character> cSet){ Set<Character> invalidCharSet = new HashSet<Character>(); StringBuilder cleanSeq = new StringBuilder(); if(cSet == null) cSet = PeptideProperties.standardAASet; for(char c:sequence.toCharArray()){ if(!cSet.contains(c)){ cleanSeq.append("-"); invalidCharSet.add(c); }else{ cleanSeq.append(c); } } // TODO: Should be StringJoiner once JDK8 used StringBuilder stringBuilder = new StringBuilder(); for(char c: invalidCharSet){ stringBuilder.append("\'" + c + "\'"); } stringBuilder.deleteCharAt(stringBuilder.length()-1); stringBuilder.append(" are being replaced with '-'"); logger.warn(stringBuilder.toString()); return cleanSeq.toString(); }
java
public final static String cleanSequence(String sequence, Set<Character> cSet){ Set<Character> invalidCharSet = new HashSet<Character>(); StringBuilder cleanSeq = new StringBuilder(); if(cSet == null) cSet = PeptideProperties.standardAASet; for(char c:sequence.toCharArray()){ if(!cSet.contains(c)){ cleanSeq.append("-"); invalidCharSet.add(c); }else{ cleanSeq.append(c); } } // TODO: Should be StringJoiner once JDK8 used StringBuilder stringBuilder = new StringBuilder(); for(char c: invalidCharSet){ stringBuilder.append("\'" + c + "\'"); } stringBuilder.deleteCharAt(stringBuilder.length()-1); stringBuilder.append(" are being replaced with '-'"); logger.warn(stringBuilder.toString()); return cleanSeq.toString(); }
[ "public", "final", "static", "String", "cleanSequence", "(", "String", "sequence", ",", "Set", "<", "Character", ">", "cSet", ")", "{", "Set", "<", "Character", ">", "invalidCharSet", "=", "new", "HashSet", "<", "Character", ">", "(", ")", ";", "StringBuil...
Returns a new sequence with all invalid characters being replaced by '-'. Note that any character outside of the 20 standard protein amino acid codes are considered as invalid. @param sequence protein sequence to be clean @param cSet user defined characters that are valid. Can be null. If null, then 20 standard protein amino acid codes will be considered as valid. @return a new sequence with all invalid characters being replaced by '-'.
[ "Returns", "a", "new", "sequence", "with", "all", "invalid", "characters", "being", "replaced", "by", "-", ".", "Note", "that", "any", "character", "outside", "of", "the", "20", "standard", "protein", "amino", "acid", "codes", "are", "considered", "as", "inv...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java#L112-L135
31,552
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java
Utils.checkSequence
public static final String checkSequence(String sequence, Set<Character> cSet){ boolean containInvalid = false; if(cSet != null){ containInvalid = sequence != null && doesSequenceContainInvalidChar(sequence, cSet); }else{ containInvalid = sequence != null && doesSequenceContainInvalidChar(sequence, PeptideProperties.standardAASet); } if(containInvalid){ String cSeq = cleanSequence(sequence, cSet); logger.warn("There exists invalid characters in the sequence. Computed results might not be precise."); logger.warn("To remove this warning: Please use org.biojava.nbio.aaproperties.Utils.cleanSequence to clean sequence."); return cSeq; } else{ return sequence; } }
java
public static final String checkSequence(String sequence, Set<Character> cSet){ boolean containInvalid = false; if(cSet != null){ containInvalid = sequence != null && doesSequenceContainInvalidChar(sequence, cSet); }else{ containInvalid = sequence != null && doesSequenceContainInvalidChar(sequence, PeptideProperties.standardAASet); } if(containInvalid){ String cSeq = cleanSequence(sequence, cSet); logger.warn("There exists invalid characters in the sequence. Computed results might not be precise."); logger.warn("To remove this warning: Please use org.biojava.nbio.aaproperties.Utils.cleanSequence to clean sequence."); return cSeq; } else{ return sequence; } }
[ "public", "static", "final", "String", "checkSequence", "(", "String", "sequence", ",", "Set", "<", "Character", ">", "cSet", ")", "{", "boolean", "containInvalid", "=", "false", ";", "if", "(", "cSet", "!=", "null", ")", "{", "containInvalid", "=", "seque...
Checks if the sequence contains invalid characters. Note that any character outside of the 20 standard protein amino acid codes are considered as invalid. If yes, it will return a new sequence where invalid characters are replaced with '-'. If no, it will simply return the input sequence. @param sequence protein sequence to be check for invalid characters. @param cSet character set which define the valid characters. @return a sequence with no invalid characters.
[ "Checks", "if", "the", "sequence", "contains", "invalid", "characters", ".", "Note", "that", "any", "character", "outside", "of", "the", "20", "standard", "protein", "amino", "acid", "codes", "are", "considered", "as", "invalid", ".", "If", "yes", "it", "wil...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/Utils.java#L165-L182
31,553
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java
FastaReaderHelper.readFastaProteinSequence
public static LinkedHashMap<String, ProteinSequence> readFastaProteinSequence( File file) throws IOException { FileInputStream inStream = new FileInputStream(file); LinkedHashMap<String, ProteinSequence> proteinSequences = readFastaProteinSequence(inStream); inStream.close(); return proteinSequences; }
java
public static LinkedHashMap<String, ProteinSequence> readFastaProteinSequence( File file) throws IOException { FileInputStream inStream = new FileInputStream(file); LinkedHashMap<String, ProteinSequence> proteinSequences = readFastaProteinSequence(inStream); inStream.close(); return proteinSequences; }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "ProteinSequence", ">", "readFastaProteinSequence", "(", "File", "file", ")", "throws", "IOException", "{", "FileInputStream", "inStream", "=", "new", "FileInputStream", "(", "file", ")", ";", "LinkedHashMap",...
Read a fasta file containing amino acids with setup that would handle most cases. @param file @return @throws IOException
[ "Read", "a", "fasta", "file", "containing", "amino", "acids", "with", "setup", "that", "would", "handle", "most", "cases", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java#L109-L115
31,554
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java
FastaReaderHelper.readFastaProteinSequence
public static LinkedHashMap<String, ProteinSequence> readFastaProteinSequence( InputStream inStream) throws IOException { FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<ProteinSequence, AminoAcidCompound>( inStream, new GenericFastaHeaderParser<ProteinSequence, AminoAcidCompound>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); return fastaReader.process(); }
java
public static LinkedHashMap<String, ProteinSequence> readFastaProteinSequence( InputStream inStream) throws IOException { FastaReader<ProteinSequence, AminoAcidCompound> fastaReader = new FastaReader<ProteinSequence, AminoAcidCompound>( inStream, new GenericFastaHeaderParser<ProteinSequence, AminoAcidCompound>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); return fastaReader.process(); }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "ProteinSequence", ">", "readFastaProteinSequence", "(", "InputStream", "inStream", ")", "throws", "IOException", "{", "FastaReader", "<", "ProteinSequence", ",", "AminoAcidCompound", ">", "fastaReader", "=", "n...
Read a fasta file containing amino acids with setup that would handle most cases. User is responsible for closing InputStream because you opened it @param inStream @return @throws IOException
[ "Read", "a", "fasta", "file", "containing", "amino", "acids", "with", "setup", "that", "would", "handle", "most", "cases", ".", "User", "is", "responsible", "for", "closing", "InputStream", "because", "you", "opened", "it" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java#L125-L132
31,555
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java
FastaReaderHelper.readFastaDNASequence
public static LinkedHashMap<String, DNASequence> readFastaDNASequence( InputStream inStream) throws IOException { FastaReader<DNASequence, NucleotideCompound> fastaReader = new FastaReader<DNASequence, NucleotideCompound>( inStream, new GenericFastaHeaderParser<DNASequence, NucleotideCompound>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet())); return fastaReader.process(); }
java
public static LinkedHashMap<String, DNASequence> readFastaDNASequence( InputStream inStream) throws IOException { FastaReader<DNASequence, NucleotideCompound> fastaReader = new FastaReader<DNASequence, NucleotideCompound>( inStream, new GenericFastaHeaderParser<DNASequence, NucleotideCompound>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet())); return fastaReader.process(); }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "DNASequence", ">", "readFastaDNASequence", "(", "InputStream", "inStream", ")", "throws", "IOException", "{", "FastaReader", "<", "DNASequence", ",", "NucleotideCompound", ">", "fastaReader", "=", "new", "Fas...
Read a fasta DNA sequence @param inStream @return @throws IOException
[ "Read", "a", "fasta", "DNA", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java#L140-L147
31,556
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java
FastaReaderHelper.readFastaRNASequence
public static LinkedHashMap<String, RNASequence> readFastaRNASequence( InputStream inStream) throws IOException { FastaReader<RNASequence, NucleotideCompound> fastaReader = new FastaReader<RNASequence, NucleotideCompound>( inStream, new GenericFastaHeaderParser<RNASequence, NucleotideCompound>(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet())); return fastaReader.process(); }
java
public static LinkedHashMap<String, RNASequence> readFastaRNASequence( InputStream inStream) throws IOException { FastaReader<RNASequence, NucleotideCompound> fastaReader = new FastaReader<RNASequence, NucleotideCompound>( inStream, new GenericFastaHeaderParser<RNASequence, NucleotideCompound>(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet())); return fastaReader.process(); }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "RNASequence", ">", "readFastaRNASequence", "(", "InputStream", "inStream", ")", "throws", "IOException", "{", "FastaReader", "<", "RNASequence", ",", "NucleotideCompound", ">", "fastaReader", "=", "new", "Fas...
Read a fasta RNA sequence @param inStream @return @throws IOException
[ "Read", "a", "fasta", "RNA", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/FastaReaderHelper.java#L169-L176
31,557
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java
ConcurrencyTools.setThreadPoolCPUsFraction
public static void setThreadPoolCPUsFraction(float fraction) { setThreadPoolSize(Math.max(1, Math.round(fraction * Runtime.getRuntime().availableProcessors()))); }
java
public static void setThreadPoolCPUsFraction(float fraction) { setThreadPoolSize(Math.max(1, Math.round(fraction * Runtime.getRuntime().availableProcessors()))); }
[ "public", "static", "void", "setThreadPoolCPUsFraction", "(", "float", "fraction", ")", "{", "setThreadPoolSize", "(", "Math", ".", "max", "(", "1", ",", "Math", ".", "round", "(", "fraction", "*", "Runtime", ".", "getRuntime", "(", ")", ".", "availableProce...
Sets thread pool to a given fraction of the available processors. @param fraction portion of available processors to use in thread pool
[ "Sets", "thread", "pool", "to", "a", "given", "fraction", "of", "the", "available", "processors", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java#L71-L73
31,558
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java
ConcurrencyTools.setThreadPoolSize
public static void setThreadPoolSize(int threads) { setThreadPool( new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>())); }
java
public static void setThreadPoolSize(int threads) { setThreadPool( new ThreadPoolExecutor(threads, threads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>())); }
[ "public", "static", "void", "setThreadPoolSize", "(", "int", "threads", ")", "{", "setThreadPool", "(", "new", "ThreadPoolExecutor", "(", "threads", ",", "threads", ",", "0L", ",", "TimeUnit", ".", "MILLISECONDS", ",", "new", "LinkedBlockingQueue", "<", "Runnabl...
Sets thread pool to given size. @param threads number of threads in pool
[ "Sets", "thread", "pool", "to", "given", "size", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java#L94-L100
31,559
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java
ConcurrencyTools.shutdownAndAwaitTermination
public static void shutdownAndAwaitTermination() { shutdown(); if (pool != null) { try { // wait a while for existing tasks to terminate if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { pool.shutdownNow(); // cancel currently executing tasks // wait a while for tasks to respond to being canceled if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { logger.warn("BioJava ConcurrencyTools thread pool did not terminate"); } } } catch (InterruptedException ie) { pool.shutdownNow(); // (re-)cancel if current thread also interrupted Thread.currentThread().interrupt(); // preserve interrupt status } } }
java
public static void shutdownAndAwaitTermination() { shutdown(); if (pool != null) { try { // wait a while for existing tasks to terminate if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { pool.shutdownNow(); // cancel currently executing tasks // wait a while for tasks to respond to being canceled if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) { logger.warn("BioJava ConcurrencyTools thread pool did not terminate"); } } } catch (InterruptedException ie) { pool.shutdownNow(); // (re-)cancel if current thread also interrupted Thread.currentThread().interrupt(); // preserve interrupt status } } }
[ "public", "static", "void", "shutdownAndAwaitTermination", "(", ")", "{", "shutdown", "(", ")", ";", "if", "(", "pool", "!=", "null", ")", "{", "try", "{", "// wait a while for existing tasks to terminate", "if", "(", "!", "pool", ".", "awaitTermination", "(", ...
Closes the thread pool. Waits 1 minute for a clean exit; if necessary, waits another minute for cancellation.
[ "Closes", "the", "thread", "pool", ".", "Waits", "1", "minute", "for", "a", "clean", "exit", ";", "if", "necessary", "waits", "another", "minute", "for", "cancellation", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java#L126-L143
31,560
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java
ConcurrencyTools.submit
public static<T> Future<T> submit(Callable<T> task, String message) { logger.debug("Task " + (++tasks) + " submitted to shared thread pool. " + message); return getThreadPool().submit(task); }
java
public static<T> Future<T> submit(Callable<T> task, String message) { logger.debug("Task " + (++tasks) + " submitted to shared thread pool. " + message); return getThreadPool().submit(task); }
[ "public", "static", "<", "T", ">", "Future", "<", "T", ">", "submit", "(", "Callable", "<", "T", ">", "task", ",", "String", "message", ")", "{", "logger", ".", "debug", "(", "\"Task \"", "+", "(", "++", "tasks", ")", "+", "\" submitted to shared threa...
Queues up a task and adds a log entry. @param <T> type returned from the submitted task @param task submitted task @param message logged message @return future on which the desired value is retrieved by calling get()
[ "Queues", "up", "a", "task", "and", "adds", "a", "log", "entry", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/ConcurrencyTools.java#L153-L156
31,561
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/uniprot/UniprotToFasta.java
UniprotToFasta.process
public void process( String uniprotDatFileName,String fastaFileName ) throws Exception{ FileReader fr = new FileReader(uniprotDatFileName); BufferedReader br = new BufferedReader(fr); String line = br.readLine(); String id = ""; StringBuffer sequence = new StringBuffer(); ArrayList<ProteinSequence> seqCodingRegionsList = new ArrayList<ProteinSequence>(); int count = 0; HashMap<String,String> uniqueGenes = new HashMap<String,String>(); HashMap<String,String> uniqueSpecies = new HashMap<String,String>(); while(line != null){ if(line.startsWith("ID")){ String[] data = line.split(" "); id = data[3]; }else if(line.startsWith("SQ")){ line = br.readLine(); while(!line.startsWith("//")){ for(int i = 0; i < line.length(); i++){ char aa = line.charAt(i); if((aa >= 'A' && aa <= 'Z') || (aa >= 'a' && aa <= 'z' )){ sequence.append(aa); } } line = br.readLine(); } // System.out.println(">" + id); // System.out.println(sequence.toString()); ProteinSequence seq = new ProteinSequence(sequence.toString() ); seq.setAccession(new AccessionID(id)); seqCodingRegionsList.add(seq); sequence = new StringBuffer(); count++; if(count % 100 == 0) logger.info("Count: ", count); String[] parts = id.split("_"); uniqueGenes.put(parts[0], ""); uniqueSpecies.put(parts[1],""); } line = br.readLine(); } // System.out.println("Unique Genes=" + uniqueGenes.size()); // System.out.println("Unique Species=" + uniqueSpecies.size()); // System.out.println("Total sequences=" + seqCodingRegionsList.size()); FastaWriterHelper.writeProteinSequence(new File(fastaFileName), seqCodingRegionsList); br.close(); fr.close(); // System.out.println(uniqueGenes.keySet()); // System.out.println("===================="); // System.out.println(uniqueSpecies.keySet()); }
java
public void process( String uniprotDatFileName,String fastaFileName ) throws Exception{ FileReader fr = new FileReader(uniprotDatFileName); BufferedReader br = new BufferedReader(fr); String line = br.readLine(); String id = ""; StringBuffer sequence = new StringBuffer(); ArrayList<ProteinSequence> seqCodingRegionsList = new ArrayList<ProteinSequence>(); int count = 0; HashMap<String,String> uniqueGenes = new HashMap<String,String>(); HashMap<String,String> uniqueSpecies = new HashMap<String,String>(); while(line != null){ if(line.startsWith("ID")){ String[] data = line.split(" "); id = data[3]; }else if(line.startsWith("SQ")){ line = br.readLine(); while(!line.startsWith("//")){ for(int i = 0; i < line.length(); i++){ char aa = line.charAt(i); if((aa >= 'A' && aa <= 'Z') || (aa >= 'a' && aa <= 'z' )){ sequence.append(aa); } } line = br.readLine(); } // System.out.println(">" + id); // System.out.println(sequence.toString()); ProteinSequence seq = new ProteinSequence(sequence.toString() ); seq.setAccession(new AccessionID(id)); seqCodingRegionsList.add(seq); sequence = new StringBuffer(); count++; if(count % 100 == 0) logger.info("Count: ", count); String[] parts = id.split("_"); uniqueGenes.put(parts[0], ""); uniqueSpecies.put(parts[1],""); } line = br.readLine(); } // System.out.println("Unique Genes=" + uniqueGenes.size()); // System.out.println("Unique Species=" + uniqueSpecies.size()); // System.out.println("Total sequences=" + seqCodingRegionsList.size()); FastaWriterHelper.writeProteinSequence(new File(fastaFileName), seqCodingRegionsList); br.close(); fr.close(); // System.out.println(uniqueGenes.keySet()); // System.out.println("===================="); // System.out.println(uniqueSpecies.keySet()); }
[ "public", "void", "process", "(", "String", "uniprotDatFileName", ",", "String", "fastaFileName", ")", "throws", "Exception", "{", "FileReader", "fr", "=", "new", "FileReader", "(", "uniprotDatFileName", ")", ";", "BufferedReader", "br", "=", "new", "BufferedReade...
Convert a Uniprot sequence file to a fasta file. Allows you to download all sequence data for a species and convert to fasta to be used in a blast database @param uniprotDatFileName @param fastaFileName @throws Exception
[ "Convert", "a", "Uniprot", "sequence", "file", "to", "a", "fasta", "file", ".", "Allows", "you", "to", "download", "all", "sequence", "data", "for", "a", "species", "and", "convert", "to", "fasta", "to", "be", "used", "in", "a", "blast", "database" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/uniprot/UniprotToFasta.java#L63-L121
31,562
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomIterator.java
AtomIterator.hasNext
@Override public boolean hasNext() { // trying to iterate over an empty structure... if ( group == null) return false; // if there is another group ... if ( current_atom_pos < group.size()-1 ) { return true ; } else { // search through the next groups if they contain an atom if (groupiter != null) { GroupIterator tmp = (GroupIterator) groupiter.clone() ; while (tmp.hasNext()) { Group tmpg = tmp.next() ; if ( tmpg.size() > 0 ) { return true ; } } } else { // just an iterator over one group ... return false ; } } return false ; }
java
@Override public boolean hasNext() { // trying to iterate over an empty structure... if ( group == null) return false; // if there is another group ... if ( current_atom_pos < group.size()-1 ) { return true ; } else { // search through the next groups if they contain an atom if (groupiter != null) { GroupIterator tmp = (GroupIterator) groupiter.clone() ; while (tmp.hasNext()) { Group tmpg = tmp.next() ; if ( tmpg.size() > 0 ) { return true ; } } } else { // just an iterator over one group ... return false ; } } return false ; }
[ "@", "Override", "public", "boolean", "hasNext", "(", ")", "{", "// trying to iterate over an empty structure...", "if", "(", "group", "==", "null", ")", "return", "false", ";", "// if there is another group ...", "if", "(", "current_atom_pos", "<", "group", ".", "s...
Is there a next atom ? @return true if there is an atom after the current one
[ "Is", "there", "a", "next", "atom", "?" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomIterator.java#L111-L140
31,563
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomIterator.java
AtomIterator.next
@Override public Atom next() throws NoSuchElementException { current_atom_pos++ ; if ( current_atom_pos >= group.size() ) { if ( groupiter == null ) { throw new NoSuchElementException("no more atoms found in group!"); } if ( groupiter.hasNext() ) { group = groupiter.next() ; current_atom_pos = -1 ; return next(); } else { throw new NoSuchElementException("no more atoms found in structure!"); } } Atom a ; a = group.getAtom(current_atom_pos); if ( a == null) { logger.error("current_atom_pos {} group {} size: {}", current_atom_pos, group, group.size()); throw new NoSuchElementException("error wile trying to retrieve atom"); } return a ; }
java
@Override public Atom next() throws NoSuchElementException { current_atom_pos++ ; if ( current_atom_pos >= group.size() ) { if ( groupiter == null ) { throw new NoSuchElementException("no more atoms found in group!"); } if ( groupiter.hasNext() ) { group = groupiter.next() ; current_atom_pos = -1 ; return next(); } else { throw new NoSuchElementException("no more atoms found in structure!"); } } Atom a ; a = group.getAtom(current_atom_pos); if ( a == null) { logger.error("current_atom_pos {} group {} size: {}", current_atom_pos, group, group.size()); throw new NoSuchElementException("error wile trying to retrieve atom"); } return a ; }
[ "@", "Override", "public", "Atom", "next", "(", ")", "throws", "NoSuchElementException", "{", "current_atom_pos", "++", ";", "if", "(", "current_atom_pos", ">=", "group", ".", "size", "(", ")", ")", "{", "if", "(", "groupiter", "==", "null", ")", "{", "t...
Return next atom. @return the next Atom @throws NoSuchElementException if there is no atom after the current one
[ "Return", "next", "atom", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomIterator.java#L147-L178
31,564
biojava/biojava
biojava-ws/src/main/java/demo/HmmerDemo.java
HmmerDemo.getUniprot
private static ProteinSequence getUniprot(String uniProtID) throws Exception { AminoAcidCompoundSet set = AminoAcidCompoundSet.getAminoAcidCompoundSet(); UniprotProxySequenceReader<AminoAcidCompound> uniprotSequence = new UniprotProxySequenceReader<AminoAcidCompound>(uniProtID,set); ProteinSequence seq = new ProteinSequence(uniprotSequence); return seq; }
java
private static ProteinSequence getUniprot(String uniProtID) throws Exception { AminoAcidCompoundSet set = AminoAcidCompoundSet.getAminoAcidCompoundSet(); UniprotProxySequenceReader<AminoAcidCompound> uniprotSequence = new UniprotProxySequenceReader<AminoAcidCompound>(uniProtID,set); ProteinSequence seq = new ProteinSequence(uniprotSequence); return seq; }
[ "private", "static", "ProteinSequence", "getUniprot", "(", "String", "uniProtID", ")", "throws", "Exception", "{", "AminoAcidCompoundSet", "set", "=", "AminoAcidCompoundSet", ".", "getAminoAcidCompoundSet", "(", ")", ";", "UniprotProxySequenceReader", "<", "AminoAcidCompo...
Fetch a protein sequence from the UniProt web site @param uniProtID @return a Protein Sequence @throws Exception
[ "Fetch", "a", "protein", "sequence", "from", "the", "UniProt", "web", "site" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/demo/HmmerDemo.java#L86-L94
31,565
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java
SequenceTools.equalLengthSequences
public static boolean equalLengthSequences(ProteinSequence[] sequences) { for (int i=0; i<sequences.length-1; i++) { if (sequences[i]==null) continue; for (int j=i+1; j<sequences.length; j++) { if (sequences[j]==null) continue; if (sequences[i].getLength() == sequences[j].getLength()) return true; } } return false; }
java
public static boolean equalLengthSequences(ProteinSequence[] sequences) { for (int i=0; i<sequences.length-1; i++) { if (sequences[i]==null) continue; for (int j=i+1; j<sequences.length; j++) { if (sequences[j]==null) continue; if (sequences[i].getLength() == sequences[j].getLength()) return true; } } return false; }
[ "public", "static", "boolean", "equalLengthSequences", "(", "ProteinSequence", "[", "]", "sequences", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "sequences", ".", "length", "-", "1", ";", "i", "++", ")", "{", "if", "(", "sequences", "...
A method to check whether an array of sequences contains at least two sequences having an equal length. @param sequences the array of {@link org.biojava.nbio.core.sequence.ProteinSequence} sequences @return true if any two sequences are of an equal length
[ "A", "method", "to", "check", "whether", "an", "array", "of", "sequences", "contains", "at", "least", "two", "sequences", "having", "an", "equal", "length", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/SequenceTools.java#L123-L136
31,566
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/search/io/SearchIO.java
SearchIO.readResults
private void readResults() throws IOException, ParseException { factory.setFile(file); results = factory.createObjects(evalueThreshold); }
java
private void readResults() throws IOException, ParseException { factory.setFile(file); results = factory.createObjects(evalueThreshold); }
[ "private", "void", "readResults", "(", ")", "throws", "IOException", ",", "ParseException", "{", "factory", ".", "setFile", "(", "file", ")", ";", "results", "=", "factory", ".", "createObjects", "(", "evalueThreshold", ")", ";", "}" ]
This method is declared private because it is the default action of constructor when file exists @throws java.io.IOException for file access related issues @throws java.text.ParseException for file format related issues
[ "This", "method", "is", "declared", "private", "because", "it", "is", "the", "default", "action", "of", "constructor", "when", "file", "exists" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/search/io/SearchIO.java#L114-L117
31,567
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.formatExonStructure
public static String formatExonStructure(GeneChromosomePosition chromosomePosition ){ if ( chromosomePosition.getOrientation() == '+') return formatExonStructureForward(chromosomePosition); return formatExonStructureReverse(chromosomePosition); }
java
public static String formatExonStructure(GeneChromosomePosition chromosomePosition ){ if ( chromosomePosition.getOrientation() == '+') return formatExonStructureForward(chromosomePosition); return formatExonStructureReverse(chromosomePosition); }
[ "public", "static", "String", "formatExonStructure", "(", "GeneChromosomePosition", "chromosomePosition", ")", "{", "if", "(", "chromosomePosition", ".", "getOrientation", "(", ")", "==", "'", "'", ")", "return", "formatExonStructureForward", "(", "chromosomePosition", ...
Pretty print the details of a GeneChromosomePosition to a String @param chromosomePosition @return
[ "Pretty", "print", "the", "details", "of", "a", "GeneChromosomePosition", "to", "a", "String" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L63-L67
31,568
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getCDSLength
public static int getCDSLength(GeneChromosomePosition chromPos) { List<Integer> exonStarts = chromPos.getExonStarts(); List<Integer> exonEnds = chromPos.getExonEnds(); int cdsStart = chromPos.getCdsStart(); int cdsEnd = chromPos.getCdsEnd(); int codingLength; if (chromPos.getOrientation().equals('+')) codingLength = ChromosomeMappingTools.getCDSLengthForward(exonStarts, exonEnds, cdsStart, cdsEnd); else codingLength = ChromosomeMappingTools.getCDSLengthReverse(exonStarts, exonEnds, cdsStart, cdsEnd); return codingLength; }
java
public static int getCDSLength(GeneChromosomePosition chromPos) { List<Integer> exonStarts = chromPos.getExonStarts(); List<Integer> exonEnds = chromPos.getExonEnds(); int cdsStart = chromPos.getCdsStart(); int cdsEnd = chromPos.getCdsEnd(); int codingLength; if (chromPos.getOrientation().equals('+')) codingLength = ChromosomeMappingTools.getCDSLengthForward(exonStarts, exonEnds, cdsStart, cdsEnd); else codingLength = ChromosomeMappingTools.getCDSLengthReverse(exonStarts, exonEnds, cdsStart, cdsEnd); return codingLength; }
[ "public", "static", "int", "getCDSLength", "(", "GeneChromosomePosition", "chromPos", ")", "{", "List", "<", "Integer", ">", "exonStarts", "=", "chromPos", ".", "getExonStarts", "(", ")", ";", "List", "<", "Integer", ">", "exonEnds", "=", "chromPos", ".", "g...
Get the length of the CDS in nucleotides. @param chromPos @return length of the CDS in nucleotides.
[ "Get", "the", "length", "of", "the", "CDS", "in", "nucleotides", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L210-L224
31,569
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getChromosomePosForCDScoordinate
public static ChromPos getChromosomePosForCDScoordinate(int cdsNucleotidePosition, GeneChromosomePosition chromPos) { logger.debug(" ? Checking chromosome position for CDS position " + cdsNucleotidePosition); List<Integer> exonStarts = chromPos.getExonStarts(); List<Integer> exonEnds = chromPos.getExonEnds(); logger.debug(" Exons:" + exonStarts.size()); int cdsStart = chromPos.getCdsStart(); int cdsEnd = chromPos.getCdsEnd(); ChromPos chromosomePos = null; if (chromPos.getOrientation().equals('+')) chromosomePos = ChromosomeMappingTools.getChromPosForward(cdsNucleotidePosition, exonStarts, exonEnds, cdsStart, cdsEnd); else chromosomePos = ChromosomeMappingTools.getChromPosReverse(cdsNucleotidePosition, exonStarts, exonEnds, cdsStart, cdsEnd); logger.debug("=> CDS pos " + cdsNucleotidePosition + " for " + chromPos.getGeneName() + " is on chromosome at " + chromosomePos); return chromosomePos; }
java
public static ChromPos getChromosomePosForCDScoordinate(int cdsNucleotidePosition, GeneChromosomePosition chromPos) { logger.debug(" ? Checking chromosome position for CDS position " + cdsNucleotidePosition); List<Integer> exonStarts = chromPos.getExonStarts(); List<Integer> exonEnds = chromPos.getExonEnds(); logger.debug(" Exons:" + exonStarts.size()); int cdsStart = chromPos.getCdsStart(); int cdsEnd = chromPos.getCdsEnd(); ChromPos chromosomePos = null; if (chromPos.getOrientation().equals('+')) chromosomePos = ChromosomeMappingTools.getChromPosForward(cdsNucleotidePosition, exonStarts, exonEnds, cdsStart, cdsEnd); else chromosomePos = ChromosomeMappingTools.getChromPosReverse(cdsNucleotidePosition, exonStarts, exonEnds, cdsStart, cdsEnd); logger.debug("=> CDS pos " + cdsNucleotidePosition + " for " + chromPos.getGeneName() + " is on chromosome at " + chromosomePos); return chromosomePos; }
[ "public", "static", "ChromPos", "getChromosomePosForCDScoordinate", "(", "int", "cdsNucleotidePosition", ",", "GeneChromosomePosition", "chromPos", ")", "{", "logger", ".", "debug", "(", "\" ? Checking chromosome position for CDS position \"", "+", "cdsNucleotidePosition", ")",...
Maps the position of a CDS nucleotide back to the genome @param cdsNucleotidePosition @return a ChromPos object
[ "Maps", "the", "position", "of", "a", "CDS", "nucleotide", "back", "to", "the", "genome" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L232-L256
31,570
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getChromosomalRangesForCDS
public static List<Range<Integer>> getChromosomalRangesForCDS(GeneChromosomePosition chromPos){ if ( chromPos.getOrientation() == '+') return getCDSExonRangesForward(chromPos,CHROMOSOME); return getCDSExonRangesReverse(chromPos,CHROMOSOME); }
java
public static List<Range<Integer>> getChromosomalRangesForCDS(GeneChromosomePosition chromPos){ if ( chromPos.getOrientation() == '+') return getCDSExonRangesForward(chromPos,CHROMOSOME); return getCDSExonRangesReverse(chromPos,CHROMOSOME); }
[ "public", "static", "List", "<", "Range", "<", "Integer", ">", ">", "getChromosomalRangesForCDS", "(", "GeneChromosomePosition", "chromPos", ")", "{", "if", "(", "chromPos", ".", "getOrientation", "(", ")", "==", "'", "'", ")", "return", "getCDSExonRangesForward...
Extracts the boundaries of the coding regions in chromosomal coordinates @param chromPos @return
[ "Extracts", "the", "boundaries", "of", "the", "coding", "regions", "in", "chromosomal", "coordinates" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L588-L592
31,571
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getCDSPosForChromosomeCoordinate
public static int getCDSPosForChromosomeCoordinate(int coordinate, GeneChromosomePosition chromosomePosition) { if ( chromosomePosition.getOrientation() == '+') return getCDSPosForward(coordinate, chromosomePosition.getExonStarts(), chromosomePosition.getExonEnds(), chromosomePosition.getCdsStart(), chromosomePosition.getCdsEnd()); return getCDSPosReverse(coordinate, chromosomePosition.getExonStarts(), chromosomePosition.getExonEnds(), chromosomePosition.getCdsStart(), chromosomePosition.getCdsEnd()); }
java
public static int getCDSPosForChromosomeCoordinate(int coordinate, GeneChromosomePosition chromosomePosition) { if ( chromosomePosition.getOrientation() == '+') return getCDSPosForward(coordinate, chromosomePosition.getExonStarts(), chromosomePosition.getExonEnds(), chromosomePosition.getCdsStart(), chromosomePosition.getCdsEnd()); return getCDSPosReverse(coordinate, chromosomePosition.getExonStarts(), chromosomePosition.getExonEnds(), chromosomePosition.getCdsStart(), chromosomePosition.getCdsEnd()); }
[ "public", "static", "int", "getCDSPosForChromosomeCoordinate", "(", "int", "coordinate", ",", "GeneChromosomePosition", "chromosomePosition", ")", "{", "if", "(", "chromosomePosition", ".", "getOrientation", "(", ")", "==", "'", "'", ")", "return", "getCDSPosForward",...
I have a genomic coordinate, where is it on the mRNA @param coordinate @param chromosomePosition @return
[ "I", "have", "a", "genomic", "coordinate", "where", "is", "it", "on", "the", "mRNA" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L779-L793
31,572
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getCDSPosForward
public static int getCDSPosForward(int chromPos, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd) { // the genetic coordinate is not in a coding region if ( (chromPos < (cdsStart+base) ) || ( chromPos > (cdsEnd+base) ) ) { logger.debug("The "+format(chromPos)+" position is not in a coding region"); return -1; } logger.debug("looking for CDS position for " +format(chromPos)); // map the genetic coordinates of coding region on a stretch of a reverse strand List<Range<Integer>> cdsRegions = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); int codingLength = 0; int lengthExon = 0; for (Range<Integer> range : cdsRegions) { int start = range.lowerEndpoint(); int end = range.upperEndpoint(); lengthExon = end - start; if (start+base <= chromPos && end >= chromPos ) { return codingLength + (chromPos-start); } else { codingLength += lengthExon; } } return -1; }
java
public static int getCDSPosForward(int chromPos, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd) { // the genetic coordinate is not in a coding region if ( (chromPos < (cdsStart+base) ) || ( chromPos > (cdsEnd+base) ) ) { logger.debug("The "+format(chromPos)+" position is not in a coding region"); return -1; } logger.debug("looking for CDS position for " +format(chromPos)); // map the genetic coordinates of coding region on a stretch of a reverse strand List<Range<Integer>> cdsRegions = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); int codingLength = 0; int lengthExon = 0; for (Range<Integer> range : cdsRegions) { int start = range.lowerEndpoint(); int end = range.upperEndpoint(); lengthExon = end - start; if (start+base <= chromPos && end >= chromPos ) { return codingLength + (chromPos-start); } else { codingLength += lengthExon; } } return -1; }
[ "public", "static", "int", "getCDSPosForward", "(", "int", "chromPos", ",", "List", "<", "Integer", ">", "exonStarts", ",", "List", "<", "Integer", ">", "exonEnds", ",", "int", "cdsStart", ",", "int", "cdsEnd", ")", "{", "// the genetic coordinate is not in a co...
Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the forward DNA strand. @param chromPos The genetic coordinate on a chromosome @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions) @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions) @param cdsStart The start position of a coding region @param cdsEnd The end position of a coding region @return the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1) @author Yana Valasatava
[ "Converts", "the", "genetic", "coordinate", "to", "the", "position", "of", "the", "nucleotide", "on", "the", "mRNA", "sequence", "for", "a", "gene", "living", "on", "the", "forward", "DNA", "strand", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L809-L840
31,573
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getCDSPosReverse
public static int getCDSPosReverse(int chromPos, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd) { // the genetic coordinate is not in a coding region if ( (chromPos < (cdsStart+base)) || ( chromPos > (cdsEnd+base) ) ) { logger.debug("The "+format(chromPos)+" position is not in a coding region"); return -1; } logger.debug("looking for CDS position for " +format(chromPos)); // map the genetic coordinate on a stretch of a reverse strand List<Range<Integer>> cdsRegions = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); int codingLength = 0; int lengthExon = 0; for ( int i=cdsRegions.size()-1; i>=0; i-- ) { int start = cdsRegions.get(i).lowerEndpoint(); int end = cdsRegions.get(i).upperEndpoint(); lengthExon = end - start; // +1 offset to be a base 1 if (start+base <= chromPos && end >= chromPos ) { return codingLength + (end-chromPos+1); } else { codingLength += lengthExon; } } return -1; }
java
public static int getCDSPosReverse(int chromPos, List<Integer> exonStarts, List<Integer> exonEnds, int cdsStart, int cdsEnd) { // the genetic coordinate is not in a coding region if ( (chromPos < (cdsStart+base)) || ( chromPos > (cdsEnd+base) ) ) { logger.debug("The "+format(chromPos)+" position is not in a coding region"); return -1; } logger.debug("looking for CDS position for " +format(chromPos)); // map the genetic coordinate on a stretch of a reverse strand List<Range<Integer>> cdsRegions = getCDSRegions(exonStarts, exonEnds, cdsStart, cdsEnd); int codingLength = 0; int lengthExon = 0; for ( int i=cdsRegions.size()-1; i>=0; i-- ) { int start = cdsRegions.get(i).lowerEndpoint(); int end = cdsRegions.get(i).upperEndpoint(); lengthExon = end - start; // +1 offset to be a base 1 if (start+base <= chromPos && end >= chromPos ) { return codingLength + (end-chromPos+1); } else { codingLength += lengthExon; } } return -1; }
[ "public", "static", "int", "getCDSPosReverse", "(", "int", "chromPos", ",", "List", "<", "Integer", ">", "exonStarts", ",", "List", "<", "Integer", ">", "exonEnds", ",", "int", "cdsStart", ",", "int", "cdsEnd", ")", "{", "// the genetic coordinate is not in a co...
Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the reverse DNA strand. @param chromPos The genetic coordinate on a chromosome @param exonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions) @param exonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions) @param cdsStart The start position of a coding region @param cdsEnd The end position of a coding region @return the position of the nucleotide base on the mRNA sequence corresponding to the input genetic coordinate (base 1) @author Yana Valasatava
[ "Converts", "the", "genetic", "coordinate", "to", "the", "position", "of", "the", "nucleotide", "on", "the", "mRNA", "sequence", "for", "a", "gene", "living", "on", "the", "reverse", "DNA", "strand", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L856-L887
31,574
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java
ChromosomeMappingTools.getCDSRegions
public static List<Range<Integer>> getCDSRegions(List<Integer> origExonStarts, List<Integer> origExonEnds, int cdsStart, int cdsEnd) { // remove exons that are fully landed in UTRs List<Integer> exonStarts = new ArrayList<Integer>(origExonStarts); List<Integer> exonEnds = new ArrayList<Integer>(origExonEnds); int j=0; for (int i = 0; i < origExonStarts.size(); i++) { if ( ( origExonEnds.get(i) < cdsStart) || ( origExonStarts.get(i) > cdsEnd) ) { exonStarts.remove(j); exonEnds.remove(j); } else { j++; } } // remove untranslated regions from exons int nExons = exonStarts.size(); exonStarts.remove(0); exonStarts.add(0, cdsStart); exonEnds.remove(nExons-1); exonEnds.add(cdsEnd); List<Range<Integer>> cdsRegion = new ArrayList<Range<Integer>>(); for ( int i=0; i<nExons; i++ ) { Range<Integer> r = Range.closed(exonStarts.get(i), exonEnds.get(i)); cdsRegion.add(r); } return cdsRegion; }
java
public static List<Range<Integer>> getCDSRegions(List<Integer> origExonStarts, List<Integer> origExonEnds, int cdsStart, int cdsEnd) { // remove exons that are fully landed in UTRs List<Integer> exonStarts = new ArrayList<Integer>(origExonStarts); List<Integer> exonEnds = new ArrayList<Integer>(origExonEnds); int j=0; for (int i = 0; i < origExonStarts.size(); i++) { if ( ( origExonEnds.get(i) < cdsStart) || ( origExonStarts.get(i) > cdsEnd) ) { exonStarts.remove(j); exonEnds.remove(j); } else { j++; } } // remove untranslated regions from exons int nExons = exonStarts.size(); exonStarts.remove(0); exonStarts.add(0, cdsStart); exonEnds.remove(nExons-1); exonEnds.add(cdsEnd); List<Range<Integer>> cdsRegion = new ArrayList<Range<Integer>>(); for ( int i=0; i<nExons; i++ ) { Range<Integer> r = Range.closed(exonStarts.get(i), exonEnds.get(i)); cdsRegion.add(r); } return cdsRegion; }
[ "public", "static", "List", "<", "Range", "<", "Integer", ">", ">", "getCDSRegions", "(", "List", "<", "Integer", ">", "origExonStarts", ",", "List", "<", "Integer", ">", "origExonEnds", ",", "int", "cdsStart", ",", "int", "cdsEnd", ")", "{", "// remove ex...
Extracts the exons boundaries in CDS coordinates corresponding to the forward DNA strand. @param origExonStarts The list holding the genetic coordinates pointing to the start positions of the exons (including UTR regions) @param origExonEnds The list holding the genetic coordinates pointing to the end positions of the exons (including UTR regions) @param cdsStart The start position of a coding region @param cdsEnd The end position of a coding region @return the list of genetic positions corresponding to the exons boundaries in CDS coordinates
[ "Extracts", "the", "exons", "boundaries", "in", "CDS", "coordinates", "corresponding", "to", "the", "forward", "DNA", "strand", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/util/ChromosomeMappingTools.java#L899-L929
31,575
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/UncompressInputStream.java
UncompressInputStream.resetbuf
private int resetbuf(int bit_pos) { int pos = bit_pos >> 3; System.arraycopy(data, pos, data, 0, end - pos); end -= pos; return 0; }
java
private int resetbuf(int bit_pos) { int pos = bit_pos >> 3; System.arraycopy(data, pos, data, 0, end - pos); end -= pos; return 0; }
[ "private", "int", "resetbuf", "(", "int", "bit_pos", ")", "{", "int", "pos", "=", "bit_pos", ">>", "3", ";", "System", ".", "arraycopy", "(", "data", ",", "pos", ",", "data", ",", "0", ",", "end", "-", "pos", ")", ";", "end", "-=", "pos", ";", ...
Moves the unread data in the buffer to the beginning and resets the pointers.
[ "Moves", "the", "unread", "data", "in", "the", "buffer", "to", "the", "beginning", "and", "resets", "the", "pointers", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/UncompressInputStream.java#L368-L373
31,576
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathFactory.java
CathFactory.getCathDatabase
public static CathDatabase getCathDatabase(String version) { if (version == null) version = DEFAULT_VERSION; CathDatabase cath = versions.get(version); if (cath == null) { CathInstallation newCath = new CathInstallation(); newCath.setCathVersion(version); cath = newCath; } return cath; }
java
public static CathDatabase getCathDatabase(String version) { if (version == null) version = DEFAULT_VERSION; CathDatabase cath = versions.get(version); if (cath == null) { CathInstallation newCath = new CathInstallation(); newCath.setCathVersion(version); cath = newCath; } return cath; }
[ "public", "static", "CathDatabase", "getCathDatabase", "(", "String", "version", ")", "{", "if", "(", "version", "==", "null", ")", "version", "=", "DEFAULT_VERSION", ";", "CathDatabase", "cath", "=", "versions", ".", "get", "(", "version", ")", ";", "if", ...
Returns a CATH database of the specified version. @param version For example, "3.5.0"
[ "Returns", "a", "CATH", "database", "of", "the", "specified", "version", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/cath/CathFactory.java#L76-L85
31,577
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSuperpositionScorer.java
QuatSuperpositionScorer.calcScores
public static QuatSymmetryScores calcScores(QuatSymmetrySubunits subunits, Matrix4d transformation, List<Integer> permutation) { QuatSymmetryScores scores = new QuatSymmetryScores(); double minTm = Double.MAX_VALUE; double maxTm = Double.MIN_VALUE; double minRmsd = Double.MAX_VALUE; double maxRmsd = Double.MIN_VALUE; double totalSumTm = 0; double totalSumDsq = 0; double totalLength = 0; Point3d t = new Point3d(); List<Point3d[]> traces = subunits.getTraces(); // loop over the Calpha atoms of all subunits for (int i = 0; i < traces.size(); i++) { // in helical systems not all permutations involve all subunit. -1 indicates subunits that should not be permuted. if (permutation.get(i) == -1) { continue; } // get original subunit Point3d[] orig = traces.get(i); totalLength += orig.length; // get permuted subunit Point3d[] perm = traces.get(permutation.get(i)); // calculate TM specific parameters int tmLen = Math.max(orig.length, 17); // don't let d0 get negative with short sequences double d0 = 1.24 * Math.cbrt(tmLen - 15.0) - 1.8; double d0Sq = d0 * d0; double sumTm = 0; double sumDsq = 0; for (int j = 0; j < orig.length; j++) { // transform coordinates of the permuted subunit t.set(perm[j]); transformation.transform(t); double dSq = orig[j].distanceSquared(t); sumTm += 1.0/(1.0 + dSq/d0Sq); sumDsq += dSq; } // scores for individual subunits double sTm = sumTm/tmLen; minTm = Math.min(minTm, sTm); maxTm = Math.max(maxTm, sTm); double sRmsd = Math.sqrt(sumDsq/orig.length); minRmsd = Math.min(minRmsd, sRmsd); maxRmsd = Math.max(maxRmsd, sRmsd); totalSumTm += sumTm; totalSumDsq += sumDsq; } // save scores for individual subunits scores.setMinRmsd(minRmsd); scores.setMaxRmsd(maxRmsd); scores.setMinTm(minTm); scores.setMaxTm(maxTm); // save mean scores over all subunits scores.setTm(totalSumTm/totalLength); scores.setRmsd(Math.sqrt(totalSumDsq/totalLength)); // add intra subunit scores calcIntrasubunitScores(subunits, transformation, permutation, scores); return scores; }
java
public static QuatSymmetryScores calcScores(QuatSymmetrySubunits subunits, Matrix4d transformation, List<Integer> permutation) { QuatSymmetryScores scores = new QuatSymmetryScores(); double minTm = Double.MAX_VALUE; double maxTm = Double.MIN_VALUE; double minRmsd = Double.MAX_VALUE; double maxRmsd = Double.MIN_VALUE; double totalSumTm = 0; double totalSumDsq = 0; double totalLength = 0; Point3d t = new Point3d(); List<Point3d[]> traces = subunits.getTraces(); // loop over the Calpha atoms of all subunits for (int i = 0; i < traces.size(); i++) { // in helical systems not all permutations involve all subunit. -1 indicates subunits that should not be permuted. if (permutation.get(i) == -1) { continue; } // get original subunit Point3d[] orig = traces.get(i); totalLength += orig.length; // get permuted subunit Point3d[] perm = traces.get(permutation.get(i)); // calculate TM specific parameters int tmLen = Math.max(orig.length, 17); // don't let d0 get negative with short sequences double d0 = 1.24 * Math.cbrt(tmLen - 15.0) - 1.8; double d0Sq = d0 * d0; double sumTm = 0; double sumDsq = 0; for (int j = 0; j < orig.length; j++) { // transform coordinates of the permuted subunit t.set(perm[j]); transformation.transform(t); double dSq = orig[j].distanceSquared(t); sumTm += 1.0/(1.0 + dSq/d0Sq); sumDsq += dSq; } // scores for individual subunits double sTm = sumTm/tmLen; minTm = Math.min(minTm, sTm); maxTm = Math.max(maxTm, sTm); double sRmsd = Math.sqrt(sumDsq/orig.length); minRmsd = Math.min(minRmsd, sRmsd); maxRmsd = Math.max(maxRmsd, sRmsd); totalSumTm += sumTm; totalSumDsq += sumDsq; } // save scores for individual subunits scores.setMinRmsd(minRmsd); scores.setMaxRmsd(maxRmsd); scores.setMinTm(minTm); scores.setMaxTm(maxTm); // save mean scores over all subunits scores.setTm(totalSumTm/totalLength); scores.setRmsd(Math.sqrt(totalSumDsq/totalLength)); // add intra subunit scores calcIntrasubunitScores(subunits, transformation, permutation, scores); return scores; }
[ "public", "static", "QuatSymmetryScores", "calcScores", "(", "QuatSymmetrySubunits", "subunits", ",", "Matrix4d", "transformation", ",", "List", "<", "Integer", ">", "permutation", ")", "{", "QuatSymmetryScores", "scores", "=", "new", "QuatSymmetryScores", "(", ")", ...
Returns minimum, mean, and maximum RMSD and TM-Score for two superimposed sets of subunits TM score: Yang Zhang and Jeffrey Skolnick, PROTEINS: Structure, Function, and Bioinformatics 57:702–710 (2004) @param subunits subunits to be scored @param transformation transformation matrix @param permutations permutation that determines which subunits are superposed @return
[ "Returns", "minimum", "mean", "and", "maximum", "RMSD", "and", "TM", "-", "Score", "for", "two", "superimposed", "sets", "of", "subunits" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/QuatSuperpositionScorer.java#L46-L118
31,578
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPPostProcessor.java
AFPPostProcessor.combineRmsd
private static double combineRmsd(int b1, int b2, AFPChain afpChain,Atom[] ca1,Atom[] ca2) { int i; int afpn = 0; int[] afpChainList =afpChain.getAfpChainList(); int[] block2Afp = afpChain.getBlock2Afp(); int[] blockSize = afpChain.getBlockSize(); int[] list = new int[blockSize[b1]+blockSize[b2]]; for(i = block2Afp[b1]; i < block2Afp[b1] + blockSize[b1]; i ++) { list[afpn ++] = afpChainList[i]; } for(i = block2Afp[b2]; i < block2Afp[b2] + blockSize[b2]; i ++) { list[afpn ++] = afpChainList[i]; } double rmsd = AFPChainer.calAfpRmsd(afpn, list,0, afpChain,ca1,ca2); afpChain.setBlock2Afp(block2Afp); afpChain.setBlockSize(blockSize); afpChain.setAfpChainList(afpChainList); return rmsd; }
java
private static double combineRmsd(int b1, int b2, AFPChain afpChain,Atom[] ca1,Atom[] ca2) { int i; int afpn = 0; int[] afpChainList =afpChain.getAfpChainList(); int[] block2Afp = afpChain.getBlock2Afp(); int[] blockSize = afpChain.getBlockSize(); int[] list = new int[blockSize[b1]+blockSize[b2]]; for(i = block2Afp[b1]; i < block2Afp[b1] + blockSize[b1]; i ++) { list[afpn ++] = afpChainList[i]; } for(i = block2Afp[b2]; i < block2Afp[b2] + blockSize[b2]; i ++) { list[afpn ++] = afpChainList[i]; } double rmsd = AFPChainer.calAfpRmsd(afpn, list,0, afpChain,ca1,ca2); afpChain.setBlock2Afp(block2Afp); afpChain.setBlockSize(blockSize); afpChain.setAfpChainList(afpChainList); return rmsd; }
[ "private", "static", "double", "combineRmsd", "(", "int", "b1", ",", "int", "b2", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "{", "int", "i", ";", "int", "afpn", "=", "0", ";", "int", "[", "]", ...
return the rmsd of two blocks
[ "return", "the", "rmsd", "of", "two", "blocks" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPPostProcessor.java#L331-L356
31,579
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java
AbstractProfileProfileAligner.getSubstitutionScore
private int getSubstitutionScore(float[] qv, float[] tv) { float score = 0.0f; for (int q = 0; q < qv.length; q++) { if (qv[q] > 0.0f) { for (int t = 0; t < tv.length; t++) { if (tv[t] > 0.0f) { score += qv[q]*tv[t]*getSubstitutionMatrix().getValue(cslist.get(q), cslist.get(t)); } } } } return Math.round(score); }
java
private int getSubstitutionScore(float[] qv, float[] tv) { float score = 0.0f; for (int q = 0; q < qv.length; q++) { if (qv[q] > 0.0f) { for (int t = 0; t < tv.length; t++) { if (tv[t] > 0.0f) { score += qv[q]*tv[t]*getSubstitutionMatrix().getValue(cslist.get(q), cslist.get(t)); } } } } return Math.round(score); }
[ "private", "int", "getSubstitutionScore", "(", "float", "[", "]", "qv", ",", "float", "[", "]", "tv", ")", "{", "float", "score", "=", "0.0f", ";", "for", "(", "int", "q", "=", "0", ";", "q", "<", "qv", ".", "length", ";", "q", "++", ")", "{", ...
helper method that scores alignment of two column vectors
[ "helper", "method", "that", "scores", "alignment", "of", "two", "column", "vectors" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractProfileProfileAligner.java#L257-L269
31,580
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java
EntityFinder.findUniqueEntities
private static List<EntityInfo> findUniqueEntities(TreeMap<String,EntityInfo> chainIds2entities) { List<EntityInfo> list = new ArrayList<EntityInfo>(); for (EntityInfo cluster:chainIds2entities.values()) { boolean present = false; for (EntityInfo cl:list) { if (cl==cluster) { present = true; break; } } if (!present) list.add(cluster); } return list; }
java
private static List<EntityInfo> findUniqueEntities(TreeMap<String,EntityInfo> chainIds2entities) { List<EntityInfo> list = new ArrayList<EntityInfo>(); for (EntityInfo cluster:chainIds2entities.values()) { boolean present = false; for (EntityInfo cl:list) { if (cl==cluster) { present = true; break; } } if (!present) list.add(cluster); } return list; }
[ "private", "static", "List", "<", "EntityInfo", ">", "findUniqueEntities", "(", "TreeMap", "<", "String", ",", "EntityInfo", ">", "chainIds2entities", ")", "{", "List", "<", "EntityInfo", ">", "list", "=", "new", "ArrayList", "<", "EntityInfo", ">", "(", ")"...
Utility method to obtain a list of unique entities from the chainIds2entities map @return
[ "Utility", "method", "to", "obtain", "a", "list", "of", "unique", "entities", "from", "the", "chainIds2entities", "map" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java#L103-L118
31,581
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java
EntityFinder.createPurelyNonPolyEntities
public static void createPurelyNonPolyEntities(List<List<Chain>> nonPolyModels, List<List<Chain>> waterModels, List<EntityInfo> entities) { if (nonPolyModels.isEmpty()) return; // let's find first the max entity id to assign entity ids to the newly found entities int maxMolId = 0; if (!entities.isEmpty()) { maxMolId = Collections.max(entities, new Comparator<EntityInfo>() { @Override public int compare(EntityInfo o1, EntityInfo o2) { return new Integer(o1.getMolId()).compareTo(o2.getMolId()); } }).getMolId(); } // we go one over the max int molId = maxMolId + 1; if (!nonPolyModels.get(0).isEmpty()) { List<EntityInfo> nonPolyEntities = new ArrayList<>(); for (List<Chain> model:nonPolyModels) { for (Chain c: model) { // we assume there's only 1 group per non-poly chain String molecPdbName = c.getAtomGroup(0).getPDBName(); EntityInfo nonPolyEntity = findNonPolyEntityWithDescription(molecPdbName, nonPolyEntities); if (nonPolyEntity == null) { nonPolyEntity = new EntityInfo(); nonPolyEntity.setDescription(molecPdbName); nonPolyEntity.setType(EntityType.NONPOLYMER); nonPolyEntity.setMolId(molId++); nonPolyEntities.add(nonPolyEntity); } nonPolyEntity.addChain(c); c.setEntityInfo(nonPolyEntity); } } entities.addAll(nonPolyEntities); } if (!waterModels.get(0).isEmpty()) { EntityInfo waterEntity = new EntityInfo(); waterEntity.setType(EntityType.WATER); waterEntity.setDescription("water"); waterEntity.setMolId(molId); for (List<Chain> model:waterModels) { for (Chain waterChain:model) { waterEntity.addChain(waterChain); waterChain.setEntityInfo(waterEntity); } } entities.add(waterEntity); } }
java
public static void createPurelyNonPolyEntities(List<List<Chain>> nonPolyModels, List<List<Chain>> waterModels, List<EntityInfo> entities) { if (nonPolyModels.isEmpty()) return; // let's find first the max entity id to assign entity ids to the newly found entities int maxMolId = 0; if (!entities.isEmpty()) { maxMolId = Collections.max(entities, new Comparator<EntityInfo>() { @Override public int compare(EntityInfo o1, EntityInfo o2) { return new Integer(o1.getMolId()).compareTo(o2.getMolId()); } }).getMolId(); } // we go one over the max int molId = maxMolId + 1; if (!nonPolyModels.get(0).isEmpty()) { List<EntityInfo> nonPolyEntities = new ArrayList<>(); for (List<Chain> model:nonPolyModels) { for (Chain c: model) { // we assume there's only 1 group per non-poly chain String molecPdbName = c.getAtomGroup(0).getPDBName(); EntityInfo nonPolyEntity = findNonPolyEntityWithDescription(molecPdbName, nonPolyEntities); if (nonPolyEntity == null) { nonPolyEntity = new EntityInfo(); nonPolyEntity.setDescription(molecPdbName); nonPolyEntity.setType(EntityType.NONPOLYMER); nonPolyEntity.setMolId(molId++); nonPolyEntities.add(nonPolyEntity); } nonPolyEntity.addChain(c); c.setEntityInfo(nonPolyEntity); } } entities.addAll(nonPolyEntities); } if (!waterModels.get(0).isEmpty()) { EntityInfo waterEntity = new EntityInfo(); waterEntity.setType(EntityType.WATER); waterEntity.setDescription("water"); waterEntity.setMolId(molId); for (List<Chain> model:waterModels) { for (Chain waterChain:model) { waterEntity.addChain(waterChain); waterChain.setEntityInfo(waterEntity); } } entities.add(waterEntity); } }
[ "public", "static", "void", "createPurelyNonPolyEntities", "(", "List", "<", "List", "<", "Chain", ">", ">", "nonPolyModels", ",", "List", "<", "List", "<", "Chain", ">", ">", "waterModels", ",", "List", "<", "EntityInfo", ">", "entities", ")", "{", "if", ...
Given all chains of all models find entities for the nonpolymers and water chains within them, assigning entity ids, types and descriptions to them. The result is written back to the passed entities List. @param nonPolyModels @param waterModels @param entities
[ "Given", "all", "chains", "of", "all", "models", "find", "entities", "for", "the", "nonpolymers", "and", "water", "chains", "within", "them", "assigning", "entity", "ids", "types", "and", "descriptions", "to", "them", ".", "The", "result", "is", "written", "...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java#L127-L185
31,582
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java
EntityFinder.getProteinSequence
private static ProteinSequence getProteinSequence(String str) { try { ProteinSequence s = new ProteinSequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating ProteinSequence",e); } return null; }
java
private static ProteinSequence getProteinSequence(String str) { try { ProteinSequence s = new ProteinSequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating ProteinSequence",e); } return null; }
[ "private", "static", "ProteinSequence", "getProteinSequence", "(", "String", "str", ")", "{", "try", "{", "ProteinSequence", "s", "=", "new", "ProteinSequence", "(", "str", ")", ";", "return", "s", ";", "}", "catch", "(", "CompoundNotFoundException", "e", ")",...
Returns the ProteinSequence or null if one can't be created @param str @return
[ "Returns", "the", "ProteinSequence", "or", "null", "if", "one", "can", "t", "be", "created" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java#L498-L507
31,583
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java
EntityFinder.getDNASequence
private static DNASequence getDNASequence(String str) { try { DNASequence s = new DNASequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating DNASequence ",e); } return null; }
java
private static DNASequence getDNASequence(String str) { try { DNASequence s = new DNASequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating DNASequence ",e); } return null; }
[ "private", "static", "DNASequence", "getDNASequence", "(", "String", "str", ")", "{", "try", "{", "DNASequence", "s", "=", "new", "DNASequence", "(", "str", ")", ";", "return", "s", ";", "}", "catch", "(", "CompoundNotFoundException", "e", ")", "{", "logge...
Returns the DNASequence or null if one can't be created @param str @return
[ "Returns", "the", "DNASequence", "or", "null", "if", "one", "can", "t", "be", "created" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java#L514-L523
31,584
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java
EntityFinder.getRNASequence
private static RNASequence getRNASequence(String str) { try { RNASequence s = new RNASequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating RNASequence ",e); } return null; }
java
private static RNASequence getRNASequence(String str) { try { RNASequence s = new RNASequence(str); return s; } catch (CompoundNotFoundException e) { logger.error("Unexpected error when creating RNASequence ",e); } return null; }
[ "private", "static", "RNASequence", "getRNASequence", "(", "String", "str", ")", "{", "try", "{", "RNASequence", "s", "=", "new", "RNASequence", "(", "str", ")", ";", "return", "s", ";", "}", "catch", "(", "CompoundNotFoundException", "e", ")", "{", "logge...
Returns the RNASequence or null if one can't be created @param str @return
[ "Returns", "the", "RNASequence", "or", "null", "if", "one", "can", "t", "be", "created" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/EntityFinder.java#L530-L539
31,585
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java
SystematicSolver.combineWithTranslation
private void combineWithTranslation(Matrix4d rotation) { rotation.setTranslation(centroid); rotation.mul(rotation, centroidInverse); }
java
private void combineWithTranslation(Matrix4d rotation) { rotation.setTranslation(centroid); rotation.mul(rotation, centroidInverse); }
[ "private", "void", "combineWithTranslation", "(", "Matrix4d", "rotation", ")", "{", "rotation", ".", "setTranslation", "(", "centroid", ")", ";", "rotation", ".", "mul", "(", "rotation", ",", "centroidInverse", ")", ";", "}" ]
Adds translational component to rotation matrix @param rotTrans @param rotation @return
[ "Adds", "translational", "component", "to", "rotation", "matrix" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/SystematicSolver.java#L106-L109
31,586
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.getAxisAngle4d
public AxisAngle4d getAxisAngle4d() { return new AxisAngle4d(rotationAxis.getX(),rotationAxis.getY(),rotationAxis.getZ(),theta); }
java
public AxisAngle4d getAxisAngle4d() { return new AxisAngle4d(rotationAxis.getX(),rotationAxis.getY(),rotationAxis.getZ(),theta); }
[ "public", "AxisAngle4d", "getAxisAngle4d", "(", ")", "{", "return", "new", "AxisAngle4d", "(", "rotationAxis", ".", "getX", "(", ")", ",", "rotationAxis", ".", "getY", "(", ")", ",", "rotationAxis", ".", "getZ", "(", ")", ",", "theta", ")", ";", "}" ]
Returns the rotation axis and angle in a single javax.vecmath.AxisAngle4d object @return
[ "Returns", "the", "rotation", "axis", "and", "angle", "in", "a", "single", "javax", ".", "vecmath", ".", "AxisAngle4d", "object" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L93-L95
31,587
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.getRotationMatrix
public Matrix getRotationMatrix(double theta) { if( rotationAxis == null) { // special case for pure translational axes return Matrix.identity(3, 3); } double x = rotationAxis.getX(); double y = rotationAxis.getY(); double z = rotationAxis.getZ(); double cos = Math.cos(theta); double sin = Math.sin(theta); double com = 1 - cos; return new Matrix(new double[][] { {com*x*x + cos, com*x*y+sin*z, com*x*z+-sin*y}, {com*x*y-sin*z, com*y*y+cos, com*y*z+sin*x}, {com*x*z+sin*y, com*y*z-sin*x, com*z*z+cos}, }); }
java
public Matrix getRotationMatrix(double theta) { if( rotationAxis == null) { // special case for pure translational axes return Matrix.identity(3, 3); } double x = rotationAxis.getX(); double y = rotationAxis.getY(); double z = rotationAxis.getZ(); double cos = Math.cos(theta); double sin = Math.sin(theta); double com = 1 - cos; return new Matrix(new double[][] { {com*x*x + cos, com*x*y+sin*z, com*x*z+-sin*y}, {com*x*y-sin*z, com*y*y+cos, com*y*z+sin*x}, {com*x*z+sin*y, com*y*z-sin*x, com*z*z+cos}, }); }
[ "public", "Matrix", "getRotationMatrix", "(", "double", "theta", ")", "{", "if", "(", "rotationAxis", "==", "null", ")", "{", "// special case for pure translational axes", "return", "Matrix", ".", "identity", "(", "3", ",", "3", ")", ";", "}", "double", "x", ...
Get the rotation matrix corresponding to a rotation about this axis @param theta The amount to rotate @return A 3x3 rotation matrix
[ "Get", "the", "rotation", "matrix", "corresponding", "to", "a", "rotation", "about", "this", "axis" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L187-L203
31,588
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.calculateTranslationalAxis
private void calculateTranslationalAxis(Matrix rotation, Atom translation) { // set axis parallel to translation rotationAxis = Calc.scale(translation, 1./Calc.amount(translation)); // position is undefined rotationPos = null; screwTranslation = translation; otherTranslation = new AtomImpl(); otherTranslation.setCoords(new double[] {0,0,0}); }
java
private void calculateTranslationalAxis(Matrix rotation, Atom translation) { // set axis parallel to translation rotationAxis = Calc.scale(translation, 1./Calc.amount(translation)); // position is undefined rotationPos = null; screwTranslation = translation; otherTranslation = new AtomImpl(); otherTranslation.setCoords(new double[] {0,0,0}); }
[ "private", "void", "calculateTranslationalAxis", "(", "Matrix", "rotation", ",", "Atom", "translation", ")", "{", "// set axis parallel to translation", "rotationAxis", "=", "Calc", ".", "scale", "(", "translation", ",", "1.", "/", "Calc", ".", "amount", "(", "tra...
Handle cases with small angles of rotation @param rotation @param translation
[ "Handle", "cases", "with", "small", "angles", "of", "rotation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L352-L362
31,589
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.getProjectedPoint
public Atom getProjectedPoint(Atom point) { if(rotationPos == null) { // translation only return null; } Atom localPoint = Calc.subtract(point, rotationPos); double dot = Calc.scalarProduct(localPoint, rotationAxis); Atom localProjected = Calc.scale(rotationAxis, dot); Atom projected = Calc.add(localProjected, rotationPos); return projected; }
java
public Atom getProjectedPoint(Atom point) { if(rotationPos == null) { // translation only return null; } Atom localPoint = Calc.subtract(point, rotationPos); double dot = Calc.scalarProduct(localPoint, rotationAxis); Atom localProjected = Calc.scale(rotationAxis, dot); Atom projected = Calc.add(localProjected, rotationPos); return projected; }
[ "public", "Atom", "getProjectedPoint", "(", "Atom", "point", ")", "{", "if", "(", "rotationPos", "==", "null", ")", "{", "// translation only", "return", "null", ";", "}", "Atom", "localPoint", "=", "Calc", ".", "subtract", "(", "point", ",", "rotationPos", ...
Projects a given point onto the axis of rotation @param point @return An atom which lies on the axis, or null if the RotationAxis is purely translational
[ "Projects", "a", "given", "point", "onto", "the", "axis", "of", "rotation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L504-L516
31,590
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.getProjectedDistance
public double getProjectedDistance(Atom point) { Atom projected = getProjectedPoint(point); if( projected == null) { // translation only return Double.NaN; } return Calc.getDistance(point, projected); }
java
public double getProjectedDistance(Atom point) { Atom projected = getProjectedPoint(point); if( projected == null) { // translation only return Double.NaN; } return Calc.getDistance(point, projected); }
[ "public", "double", "getProjectedDistance", "(", "Atom", "point", ")", "{", "Atom", "projected", "=", "getProjectedPoint", "(", "point", ")", ";", "if", "(", "projected", "==", "null", ")", "{", "// translation only", "return", "Double", ".", "NaN", ";", "}"...
Get the distance from a point to the axis of rotation @param point @return The distance to the axis, or NaN if the RotationAxis is purely translational
[ "Get", "the", "distance", "from", "a", "point", "to", "the", "axis", "of", "rotation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L523-L533
31,591
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.getAngle
public static double getAngle(AFPChain afpChain) throws StructureException { if(afpChain.getBlockNum() < 1) { throw new StructureException("No aligned residues"); } Matrix rotation = afpChain.getBlockRotationMatrix()[0]; if(rotation == null) { throw new NullPointerException("AFPChain does not contain a rotation matrix"); } return getAngle(rotation); }
java
public static double getAngle(AFPChain afpChain) throws StructureException { if(afpChain.getBlockNum() < 1) { throw new StructureException("No aligned residues"); } Matrix rotation = afpChain.getBlockRotationMatrix()[0]; if(rotation == null) { throw new NullPointerException("AFPChain does not contain a rotation matrix"); } return getAngle(rotation); }
[ "public", "static", "double", "getAngle", "(", "AFPChain", "afpChain", ")", "throws", "StructureException", "{", "if", "(", "afpChain", ".", "getBlockNum", "(", ")", "<", "1", ")", "{", "throw", "new", "StructureException", "(", "\"No aligned residues\"", ")", ...
Calculate the rotation angle for a structure @param afpChain @return The rotation angle, in radians @throws StructureException If the alignment doesn't contain any blocks @throws NullPointerException If the alignment doesn't have a rotation matrix set
[ "Calculate", "the", "rotation", "angle", "for", "a", "structure" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L561-L571
31,592
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.getAngle
public static double getAngle(Matrix rotation) { double c = (rotation.trace()-1)/2.0; //=cos(theta) // c is sometimes slightly out of the [-1,1] range due to numerical instabilities if( -1-1e-8 < c && c < -1 ) c = -1; if( 1+1e-8 > c && c > 1 ) c = 1; if( -1 > c || c > 1 ) { throw new IllegalArgumentException("Input matrix is not a valid rotation matrix."); } return Math.acos(c); }
java
public static double getAngle(Matrix rotation) { double c = (rotation.trace()-1)/2.0; //=cos(theta) // c is sometimes slightly out of the [-1,1] range due to numerical instabilities if( -1-1e-8 < c && c < -1 ) c = -1; if( 1+1e-8 > c && c > 1 ) c = 1; if( -1 > c || c > 1 ) { throw new IllegalArgumentException("Input matrix is not a valid rotation matrix."); } return Math.acos(c); }
[ "public", "static", "double", "getAngle", "(", "Matrix", "rotation", ")", "{", "double", "c", "=", "(", "rotation", ".", "trace", "(", ")", "-", "1", ")", "/", "2.0", ";", "//=cos(theta)", "// c is sometimes slightly out of the [-1,1] range due to numerical instabil...
Calculate the rotation angle for a given matrix @param rotation Rotation matrix @return The angle, in radians
[ "Calculate", "the", "rotation", "angle", "for", "a", "given", "matrix" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L577-L586
31,593
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java
RotationAxis.getAngle
public static double getAngle(Matrix4d transform) { // Calculate angle double c = (transform.m00 + transform.m11 + transform.m22 - 1)/2.0; //=cos(theta) // c is sometimes slightly out of the [-1,1] range due to numerical instabilities if( -1-1e-8 < c && c < -1 ) c = -1; if( 1+1e-8 > c && c > 1 ) c = 1; if( -1 > c || c > 1 ) { throw new IllegalArgumentException("Input matrix is not a valid rotation matrix."); } return Math.acos(c); }
java
public static double getAngle(Matrix4d transform) { // Calculate angle double c = (transform.m00 + transform.m11 + transform.m22 - 1)/2.0; //=cos(theta) // c is sometimes slightly out of the [-1,1] range due to numerical instabilities if( -1-1e-8 < c && c < -1 ) c = -1; if( 1+1e-8 > c && c > 1 ) c = 1; if( -1 > c || c > 1 ) { throw new IllegalArgumentException("Input matrix is not a valid rotation matrix."); } return Math.acos(c); }
[ "public", "static", "double", "getAngle", "(", "Matrix4d", "transform", ")", "{", "// Calculate angle", "double", "c", "=", "(", "transform", ".", "m00", "+", "transform", ".", "m11", "+", "transform", ".", "m22", "-", "1", ")", "/", "2.0", ";", "//=cos(...
Quickly compute the rotation angle from a rotation matrix. @param transform 4D transformation matrix. Translation components are ignored. @return Angle, from 0 to PI
[ "Quickly", "compute", "the", "rotation", "angle", "from", "a", "rotation", "matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/RotationAxis.java#L601-L611
31,594
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java
AbstractNucleotideCompoundSet.calculateIndirectAmbiguities
@SuppressWarnings("unchecked") protected void calculateIndirectAmbiguities() { Map<NucleotideCompound, List<NucleotideCompound>> equivalentsMap = new HashMap<NucleotideCompound, List<NucleotideCompound>>(); List<NucleotideCompound> ambiguousCompounds = new ArrayList<NucleotideCompound>(); for(NucleotideCompound compound: getAllCompounds()) { if (!compound.isAmbiguous()) { continue; } ambiguousCompounds.add(compound); } for(NucleotideCompound sourceCompound: ambiguousCompounds) { Set<NucleotideCompound> compoundConstituents = sourceCompound.getConstituents(); for(NucleotideCompound targetCompound: ambiguousCompounds) { Set<NucleotideCompound> targetConstituents = targetCompound.getConstituents(); if(targetConstituents.containsAll(compoundConstituents)) { NucleotideCompound lcSourceCompound = toLowerCase(sourceCompound); NucleotideCompound lcTargetCompound = toLowerCase(targetCompound); //equivalentsMap.put(sourceCompound, targetCompound); // equivalentsMap.put(sourceCompound, lcTargetCompound); checkAdd(equivalentsMap, sourceCompound, targetCompound); checkAdd(equivalentsMap, sourceCompound, lcTargetCompound); checkAdd(equivalentsMap,targetCompound,sourceCompound); checkAdd(equivalentsMap, lcTargetCompound, sourceCompound); checkAdd(equivalentsMap, lcSourceCompound, targetCompound); checkAdd(equivalentsMap, lcSourceCompound, lcTargetCompound); } } } //And once it's all done start adding them to the equivalents map for ( NucleotideCompound key: equivalentsMap.keySet()){ List<NucleotideCompound> vals = equivalentsMap.get(key); for (NucleotideCompound value: vals){ addEquivalent((C)key,(C)value); addEquivalent((C)value,(C)key); } } }
java
@SuppressWarnings("unchecked") protected void calculateIndirectAmbiguities() { Map<NucleotideCompound, List<NucleotideCompound>> equivalentsMap = new HashMap<NucleotideCompound, List<NucleotideCompound>>(); List<NucleotideCompound> ambiguousCompounds = new ArrayList<NucleotideCompound>(); for(NucleotideCompound compound: getAllCompounds()) { if (!compound.isAmbiguous()) { continue; } ambiguousCompounds.add(compound); } for(NucleotideCompound sourceCompound: ambiguousCompounds) { Set<NucleotideCompound> compoundConstituents = sourceCompound.getConstituents(); for(NucleotideCompound targetCompound: ambiguousCompounds) { Set<NucleotideCompound> targetConstituents = targetCompound.getConstituents(); if(targetConstituents.containsAll(compoundConstituents)) { NucleotideCompound lcSourceCompound = toLowerCase(sourceCompound); NucleotideCompound lcTargetCompound = toLowerCase(targetCompound); //equivalentsMap.put(sourceCompound, targetCompound); // equivalentsMap.put(sourceCompound, lcTargetCompound); checkAdd(equivalentsMap, sourceCompound, targetCompound); checkAdd(equivalentsMap, sourceCompound, lcTargetCompound); checkAdd(equivalentsMap,targetCompound,sourceCompound); checkAdd(equivalentsMap, lcTargetCompound, sourceCompound); checkAdd(equivalentsMap, lcSourceCompound, targetCompound); checkAdd(equivalentsMap, lcSourceCompound, lcTargetCompound); } } } //And once it's all done start adding them to the equivalents map for ( NucleotideCompound key: equivalentsMap.keySet()){ List<NucleotideCompound> vals = equivalentsMap.get(key); for (NucleotideCompound value: vals){ addEquivalent((C)key,(C)value); addEquivalent((C)value,(C)key); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "calculateIndirectAmbiguities", "(", ")", "{", "Map", "<", "NucleotideCompound", ",", "List", "<", "NucleotideCompound", ">", ">", "equivalentsMap", "=", "new", "HashMap", "<", "NucleotideCompo...
Loops through all known nucleotides and attempts to find which are equivalent to each other. Also takes into account lower casing nucleotides as well as upper-cased ones.
[ "Loops", "through", "all", "known", "nucleotides", "and", "attempts", "to", "find", "which", "are", "equivalent", "to", "each", "other", ".", "Also", "takes", "into", "account", "lower", "casing", "nucleotides", "as", "well", "as", "upper", "-", "cased", "on...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java#L65-L111
31,595
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java
AbstractNucleotideCompoundSet.getAmbiguity
public NucleotideCompound getAmbiguity(NucleotideCompound... compounds) { Set<NucleotideCompound> settedCompounds = new HashSet<NucleotideCompound>(); for(NucleotideCompound compound: compounds) { for(NucleotideCompound subCompound: compound.getConstituents()) { settedCompounds.add(getCompoundForString(subCompound.getBase().toUpperCase())); } } for(NucleotideCompound compound: getAllCompounds()) { if(compound.getConstituents().equals(settedCompounds)) { return compound; } } return null; }
java
public NucleotideCompound getAmbiguity(NucleotideCompound... compounds) { Set<NucleotideCompound> settedCompounds = new HashSet<NucleotideCompound>(); for(NucleotideCompound compound: compounds) { for(NucleotideCompound subCompound: compound.getConstituents()) { settedCompounds.add(getCompoundForString(subCompound.getBase().toUpperCase())); } } for(NucleotideCompound compound: getAllCompounds()) { if(compound.getConstituents().equals(settedCompounds)) { return compound; } } return null; }
[ "public", "NucleotideCompound", "getAmbiguity", "(", "NucleotideCompound", "...", "compounds", ")", "{", "Set", "<", "NucleotideCompound", ">", "settedCompounds", "=", "new", "HashSet", "<", "NucleotideCompound", ">", "(", ")", ";", "for", "(", "NucleotideCompound",...
Calculates the best symbol for a collection of compounds. For example if you gave this method a AC it will return a M which is the ambiguity symbol for these compounds. @param compounds Compounds to calculate ambiguity for @return The ambiguity symbol which represents this set of nucleotides best
[ "Calculates", "the", "best", "symbol", "for", "a", "collection", "of", "compounds", ".", "For", "example", "if", "you", "gave", "this", "method", "a", "AC", "it", "will", "return", "a", "M", "which", "is", "the", "ambiguity", "symbol", "for", "these", "c...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/template/AbstractNucleotideCompoundSet.java#L141-L154
31,596
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java
AFPAlignmentDisplay.getBlockNrForAlignPos
public static int getBlockNrForAlignPos(AFPChain afpChain, int aligPos){ // moved here from DisplayAFP; int blockNum = afpChain.getBlockNum(); int[] optLen = afpChain.getOptLen(); int[][][] optAln = afpChain.getOptAln(); int len = 0; int p1b=0; int p2b=0; for(int i = 0; i < blockNum; i ++) { for(int j = 0; j < optLen[i]; j ++) { int p1 = optAln[i][0][j]; int p2 = optAln[i][1][j]; if (len != 0) { // check for gapped region int lmax = (p1 - p1b - 1)>(p2 - p2b - 1)?(p1 - p1b - 1):(p2 - p2b - 1); for(int k = 0; k < lmax; k ++) { len++; } } p1b = p1; p2b = p2; if ( len >= aligPos) { return i; } len++; } } return blockNum; }
java
public static int getBlockNrForAlignPos(AFPChain afpChain, int aligPos){ // moved here from DisplayAFP; int blockNum = afpChain.getBlockNum(); int[] optLen = afpChain.getOptLen(); int[][][] optAln = afpChain.getOptAln(); int len = 0; int p1b=0; int p2b=0; for(int i = 0; i < blockNum; i ++) { for(int j = 0; j < optLen[i]; j ++) { int p1 = optAln[i][0][j]; int p2 = optAln[i][1][j]; if (len != 0) { // check for gapped region int lmax = (p1 - p1b - 1)>(p2 - p2b - 1)?(p1 - p1b - 1):(p2 - p2b - 1); for(int k = 0; k < lmax; k ++) { len++; } } p1b = p1; p2b = p2; if ( len >= aligPos) { return i; } len++; } } return blockNum; }
[ "public", "static", "int", "getBlockNrForAlignPos", "(", "AFPChain", "afpChain", ",", "int", "aligPos", ")", "{", "// moved here from DisplayAFP;", "int", "blockNum", "=", "afpChain", ".", "getBlockNum", "(", ")", ";", "int", "[", "]", "optLen", "=", "afpChain",...
get the block number for an aligned position @param afpChain @param aligPos @return
[ "get", "the", "block", "number", "for", "an", "aligned", "position" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/AFPAlignmentDisplay.java#L449-L489
31,597
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java
AlternativeAlignment.apairs_from_seed
public void apairs_from_seed(int l,int i, int j){ aligpath = new IndexPair[l]; idx1 = new int[l]; idx2 = new int[l]; for (int x = 0 ; x < l ; x++) { idx1[x]=i+x; idx2[x]=j+x; aligpath[x] = new IndexPair((short)(i+x),(short)(j+x)); } }
java
public void apairs_from_seed(int l,int i, int j){ aligpath = new IndexPair[l]; idx1 = new int[l]; idx2 = new int[l]; for (int x = 0 ; x < l ; x++) { idx1[x]=i+x; idx2[x]=j+x; aligpath[x] = new IndexPair((short)(i+x),(short)(j+x)); } }
[ "public", "void", "apairs_from_seed", "(", "int", "l", ",", "int", "i", ",", "int", "j", ")", "{", "aligpath", "=", "new", "IndexPair", "[", "l", "]", ";", "idx1", "=", "new", "int", "[", "l", "]", ";", "idx2", "=", "new", "int", "[", "l", "]",...
Set apairs according to a seed position. @param l @param i @param j
[ "Set", "apairs", "according", "to", "a", "seed", "position", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java#L242-L251
31,598
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java
AlternativeAlignment.rotateShiftAtoms
private void rotateShiftAtoms(Atom[] ca){ for (int i = 0 ; i < ca.length; i++){ Atom c = ca[i]; Calc.rotate(c,currentRotMatrix); Calc.shift(c,currentTranMatrix); //System.out.println("after " + c); ca[i] = c; } //System.out.println("after " + ca[0]); }
java
private void rotateShiftAtoms(Atom[] ca){ for (int i = 0 ; i < ca.length; i++){ Atom c = ca[i]; Calc.rotate(c,currentRotMatrix); Calc.shift(c,currentTranMatrix); //System.out.println("after " + c); ca[i] = c; } //System.out.println("after " + ca[0]); }
[ "private", "void", "rotateShiftAtoms", "(", "Atom", "[", "]", "ca", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "ca", ".", "length", ";", "i", "++", ")", "{", "Atom", "c", "=", "ca", "[", "i", "]", ";", "Calc", ".", "rotate", ...
rotate and shift atoms with currentRotMatrix and current Tranmatrix @param ca
[ "rotate", "and", "shift", "atoms", "with", "currentRotMatrix", "and", "current", "Tranmatrix" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java#L295-L306
31,599
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java
AlternativeAlignment.count_gaps
private int count_gaps(int[] i1, int[] i2){ int i0 = i1[0]; int j0 = i2[0]; int gaps = 0; for (int i =1 ; i<i1.length;i++ ){ if ( Math.abs(i1[i]-i0) != 1 || ( Math.abs(i2[i]-j0) != 1)){ gaps +=1; } i0 = i1[i]; j0 = i2[i]; } return gaps; }
java
private int count_gaps(int[] i1, int[] i2){ int i0 = i1[0]; int j0 = i2[0]; int gaps = 0; for (int i =1 ; i<i1.length;i++ ){ if ( Math.abs(i1[i]-i0) != 1 || ( Math.abs(i2[i]-j0) != 1)){ gaps +=1; } i0 = i1[i]; j0 = i2[i]; } return gaps; }
[ "private", "int", "count_gaps", "(", "int", "[", "]", "i1", ",", "int", "[", "]", "i2", ")", "{", "int", "i0", "=", "i1", "[", "0", "]", ";", "int", "j0", "=", "i2", "[", "0", "]", ";", "int", "gaps", "=", "0", ";", "for", "(", "int", "i"...
Count the number of gaps in an alignment represented by idx1,idx2. @param i1 @param i2 @return the number of gaps in this alignment
[ "Count", "the", "number", "of", "gaps", "in", "an", "alignment", "represented", "by", "idx1", "idx2", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/AlternativeAlignment.java#L729-L744