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,900
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java
PDBDomainProvider.getDomainNames
@Override public SortedSet<String> getDomainNames(String name) { if ( name.length() < 4) throw new IllegalArgumentException("Can't interpret IDs that are shorter than 4 residues!"); String url = String.format("%srepresentativeDomains?cluster=%s&structureId=%s", base, cutoff, name); return requestRepresentativeDomains(url); }
java
@Override public SortedSet<String> getDomainNames(String name) { if ( name.length() < 4) throw new IllegalArgumentException("Can't interpret IDs that are shorter than 4 residues!"); String url = String.format("%srepresentativeDomains?cluster=%s&structureId=%s", base, cutoff, name); return requestRepresentativeDomains(url); }
[ "@", "Override", "public", "SortedSet", "<", "String", ">", "getDomainNames", "(", "String", "name", ")", "{", "if", "(", "name", ".", "length", "(", ")", "<", "4", ")", "throw", "new", "IllegalArgumentException", "(", "\"Can't interpret IDs that are shorter tha...
Gets a list of domain representatives for a given PDB ID.
[ "Gets", "a", "list", "of", "domain", "representatives", "for", "a", "given", "PDB", "ID", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java#L70-L78
31,901
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java
PDBDomainProvider.getRepresentativeDomains
@Override public SortedSet<String> getRepresentativeDomains() { String url = base + "representativeDomains?cluster="+ cutoff; return requestRepresentativeDomains(url); }
java
@Override public SortedSet<String> getRepresentativeDomains() { String url = base + "representativeDomains?cluster="+ cutoff; return requestRepresentativeDomains(url); }
[ "@", "Override", "public", "SortedSet", "<", "String", ">", "getRepresentativeDomains", "(", ")", "{", "String", "url", "=", "base", "+", "\"representativeDomains?cluster=\"", "+", "cutoff", ";", "return", "requestRepresentativeDomains", "(", "url", ")", ";", "}" ...
Gets a list of all domain representatives
[ "Gets", "a", "list", "of", "all", "domain", "representatives" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java#L82-L86
31,902
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java
PDBDomainProvider.requestRepresentativeDomains
private SortedSet<String> requestRepresentativeDomains(String url) { try { //System.out.println(url); final SortedSet<String> results = new TreeSet<String>(); DefaultHandler handler = new DefaultHandler() { @Override public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException { //System.out.println("Start Element :" + qName); if (qName.equalsIgnoreCase("representative")) { String name = attributes.getValue("name"); results.add(name); } } }; handleRestRequest(url,handler); return results; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } return null; }
java
private SortedSet<String> requestRepresentativeDomains(String url) { try { //System.out.println(url); final SortedSet<String> results = new TreeSet<String>(); DefaultHandler handler = new DefaultHandler() { @Override public void startElement(String uri, String localName,String qName, Attributes attributes) throws SAXException { //System.out.println("Start Element :" + qName); if (qName.equalsIgnoreCase("representative")) { String name = attributes.getValue("name"); results.add(name); } } }; handleRestRequest(url,handler); return results; } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } return null; }
[ "private", "SortedSet", "<", "String", ">", "requestRepresentativeDomains", "(", "String", "url", ")", "{", "try", "{", "//System.out.println(url);", "final", "SortedSet", "<", "String", ">", "results", "=", "new", "TreeSet", "<", "String", ">", "(", ")", ";",...
Handles fetching and parsing XML from representativeDomains requests @param url Eg "http://www.rcsb.org/pdb/rest/representativeDomains" @return The names of all domain representatives
[ "Handles", "fetching", "and", "parsing", "XML", "from", "representativeDomains", "requests" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java#L93-L124
31,903
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java
PDBDomainProvider.handleRestRequest
private static void handleRestRequest(String url, DefaultHandler handler) throws SAXException, IOException, ParserConfigurationException { // Fetch XML stream URL u = new URL(url); InputStream response = URLConnectionTools.getInputStream(u); InputSource xml = new InputSource(response); // Parse XML SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); saxParser.parse(xml, handler); }
java
private static void handleRestRequest(String url, DefaultHandler handler) throws SAXException, IOException, ParserConfigurationException { // Fetch XML stream URL u = new URL(url); InputStream response = URLConnectionTools.getInputStream(u); InputSource xml = new InputSource(response); // Parse XML SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser saxParser = factory.newSAXParser(); saxParser.parse(xml, handler); }
[ "private", "static", "void", "handleRestRequest", "(", "String", "url", ",", "DefaultHandler", "handler", ")", "throws", "SAXException", ",", "IOException", ",", "ParserConfigurationException", "{", "// Fetch XML stream", "URL", "u", "=", "new", "URL", "(", "url", ...
Handles fetching and processing REST requests. The actual XML parsing is handled by the handler, which is also in charge of storing interesting data. @param url REST request @param handler SAX XML parser @throws SAXException @throws IOException @throws ParserConfigurationException
[ "Handles", "fetching", "and", "processing", "REST", "requests", ".", "The", "actual", "XML", "parsing", "is", "handled", "by", "the", "handler", "which", "is", "also", "in", "charge", "of", "storing", "interesting", "data", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/domain/PDBDomainProvider.java#L134-L145
31,904
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java
FragmentJoiner.getDensity
private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{ Atom centroid1 = Calc.getCentroid(ca1subset); Atom centroid2 = Calc.getCentroid(ca2subset); // get Average distance to centroid ... double d1 = 0; double d2 = 0; for ( int i = 0 ; i < ca1subset.length;i++){ double dd1 = Calc.getDistance(centroid1, ca1subset[i]); double dd2 = Calc.getDistance(centroid2, ca2subset[i]); d1 += dd1; d2 += dd2; } double avd1 = d1 / ca1subset.length; double avd2 = d2 / ca2subset.length; return Math.min(avd1,avd2); }
java
private double getDensity(Atom[] ca1subset, Atom[] ca2subset ) throws StructureException{ Atom centroid1 = Calc.getCentroid(ca1subset); Atom centroid2 = Calc.getCentroid(ca2subset); // get Average distance to centroid ... double d1 = 0; double d2 = 0; for ( int i = 0 ; i < ca1subset.length;i++){ double dd1 = Calc.getDistance(centroid1, ca1subset[i]); double dd2 = Calc.getDistance(centroid2, ca2subset[i]); d1 += dd1; d2 += dd2; } double avd1 = d1 / ca1subset.length; double avd2 = d2 / ca2subset.length; return Math.min(avd1,avd2); }
[ "private", "double", "getDensity", "(", "Atom", "[", "]", "ca1subset", ",", "Atom", "[", "]", "ca2subset", ")", "throws", "StructureException", "{", "Atom", "centroid1", "=", "Calc", ".", "getCentroid", "(", "ca1subset", ")", ";", "Atom", "centroid2", "=", ...
this is probably useless @param ca1subset @param ca2subset @return a double @throws StructureException
[ "this", "is", "probably", "useless" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java#L249-L272
31,905
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java
FragmentJoiner.getRMS
public static double getRMS(Atom[] ca1, Atom[]ca2,JointFragments frag) throws StructureException { // now svd ftmp and check if the rms is < X ... AlternativeAlignment ali = new AlternativeAlignment(); ali.apairs_from_idxlst(frag); double rms = 999; int[] idx1 = ali.getIdx1(); int[] idx2 = ali.getIdx2(); Atom[] ca1subset = AlignUtils.getFragmentFromIdxList(ca1, idx1); Atom[] ca2subset = AlignUtils.getFragmentFromIdxList(ca2,idx2); ali.calculateSuperpositionByIdx(ca1,ca2); Matrix rot = ali.getRotationMatrix(); Atom atom = ali.getShift(); for (Atom a : ca2subset) { Calc.rotate(a, rot); Calc.shift(a, atom); } rms = Calc.rmsd(ca1subset,ca2subset); return rms; }
java
public static double getRMS(Atom[] ca1, Atom[]ca2,JointFragments frag) throws StructureException { // now svd ftmp and check if the rms is < X ... AlternativeAlignment ali = new AlternativeAlignment(); ali.apairs_from_idxlst(frag); double rms = 999; int[] idx1 = ali.getIdx1(); int[] idx2 = ali.getIdx2(); Atom[] ca1subset = AlignUtils.getFragmentFromIdxList(ca1, idx1); Atom[] ca2subset = AlignUtils.getFragmentFromIdxList(ca2,idx2); ali.calculateSuperpositionByIdx(ca1,ca2); Matrix rot = ali.getRotationMatrix(); Atom atom = ali.getShift(); for (Atom a : ca2subset) { Calc.rotate(a, rot); Calc.shift(a, atom); } rms = Calc.rmsd(ca1subset,ca2subset); return rms; }
[ "public", "static", "double", "getRMS", "(", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ",", "JointFragments", "frag", ")", "throws", "StructureException", "{", "// now svd ftmp and check if the rms is < X ...", "AlternativeAlignment", "ali", "=", "...
Get the RMS of the JointFragments pair frag @param ca1 the array of all atoms of structure1 @param ca2 the array of all atoms of structure1 @param frag the JointFragments object that contains the list of identical positions @return the rms
[ "Get", "the", "RMS", "of", "the", "JointFragments", "pair", "frag" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/pairwise/FragmentJoiner.java#L296-L322
31,906
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java
Stoichiometry.getComponent
public Stoichiometry getComponent(int i) { return new Stoichiometry(Collections.singletonList(orderedClusters.get(i)),this.strategy,false); }
java
public Stoichiometry getComponent(int i) { return new Stoichiometry(Collections.singletonList(orderedClusters.get(i)),this.strategy,false); }
[ "public", "Stoichiometry", "getComponent", "(", "int", "i", ")", "{", "return", "new", "Stoichiometry", "(", "Collections", ".", "singletonList", "(", "orderedClusters", ".", "get", "(", "i", ")", ")", ",", "this", ".", "strategy", ",", "false", ")", ";", ...
Make a Stoichiometry object that corresponds to a single component. @param i component index @return new {@link Stoichiometry} object.
[ "Make", "a", "Stoichiometry", "object", "that", "corresponds", "to", "a", "single", "component", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java#L264-L266
31,907
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java
Stoichiometry.setStrategy
public void setStrategy(StringOverflowStrategy strategy) { if(strategy==StringOverflowStrategy.CUSTOM) { throw new IllegalArgumentException("Set this strategy by providing a function of the type Function<List<SubunitCluster>,String>."); } if(this.strategy != strategy) { this.strategy = strategy; if(orderedClusters.size()>alphabet.length()) doResetAlphas(); } }
java
public void setStrategy(StringOverflowStrategy strategy) { if(strategy==StringOverflowStrategy.CUSTOM) { throw new IllegalArgumentException("Set this strategy by providing a function of the type Function<List<SubunitCluster>,String>."); } if(this.strategy != strategy) { this.strategy = strategy; if(orderedClusters.size()>alphabet.length()) doResetAlphas(); } }
[ "public", "void", "setStrategy", "(", "StringOverflowStrategy", "strategy", ")", "{", "if", "(", "strategy", "==", "StringOverflowStrategy", ".", "CUSTOM", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Set this strategy by providing a function of the type Fu...
Change string representation of a stoichiometry in case number of clusters exceeds number of letters in the alphabet. This action may invalidate alphas already assigned to the clusters. @param strategy {@link StringOverflowStrategy} used in this stoichiometry to construct human-readable representation in case number of clusters exceeds number of letters in the alphabet.
[ "Change", "string", "representation", "of", "a", "stoichiometry", "in", "case", "number", "of", "clusters", "exceeds", "number", "of", "letters", "in", "the", "alphabet", ".", "This", "action", "may", "invalidate", "alphas", "already", "assigned", "to", "the", ...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java#L285-L295
31,908
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java
Stoichiometry.setCustomStringGenerator
public void setCustomStringGenerator(Function<List<SubunitCluster>,String> customStringGenerator) { this.strategy = StringOverflowStrategy.CUSTOM; this.customStringGenerator = customStringGenerator; }
java
public void setCustomStringGenerator(Function<List<SubunitCluster>,String> customStringGenerator) { this.strategy = StringOverflowStrategy.CUSTOM; this.customStringGenerator = customStringGenerator; }
[ "public", "void", "setCustomStringGenerator", "(", "Function", "<", "List", "<", "SubunitCluster", ">", ",", "String", ">", "customStringGenerator", ")", "{", "this", ".", "strategy", "=", "StringOverflowStrategy", ".", "CUSTOM", ";", "this", ".", "customStringGen...
Let a user-defined function handle the entire string representation of a stoichiometry. @param customStringGenerator A function which accepts a list of subunit clusters and returns a string.
[ "Let", "a", "user", "-", "defined", "function", "handle", "the", "entire", "string", "representation", "of", "a", "stoichiometry", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/core/Stoichiometry.java#L303-L306
31,909
biojava/biojava
biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java
DemoStructureFromFasta.displayStructure
private static void displayStructure(Structure structure, ResidueNumber[] residues) { //Display each structure BiojavaJmol jmol = new BiojavaJmol(); jmol.setStructure(structure); //Highlight non-null atoms jmol.evalString("select *; spacefill off; wireframe off; color chain; backbone 0.4; "); String selectionCmd = buildJmolSelection(residues); jmol.evalString(selectionCmd); jmol.evalString("backbone 1.0; select none;"); }
java
private static void displayStructure(Structure structure, ResidueNumber[] residues) { //Display each structure BiojavaJmol jmol = new BiojavaJmol(); jmol.setStructure(structure); //Highlight non-null atoms jmol.evalString("select *; spacefill off; wireframe off; color chain; backbone 0.4; "); String selectionCmd = buildJmolSelection(residues); jmol.evalString(selectionCmd); jmol.evalString("backbone 1.0; select none;"); }
[ "private", "static", "void", "displayStructure", "(", "Structure", "structure", ",", "ResidueNumber", "[", "]", "residues", ")", "{", "//Display each structure", "BiojavaJmol", "jmol", "=", "new", "BiojavaJmol", "(", ")", ";", "jmol", ".", "setStructure", "(", "...
Displays the given structure and highlights the given residues. @param structure The structure to display @param residues A list of residues to highlight
[ "Displays", "the", "given", "structure", "and", "highlights", "the", "given", "residues", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java#L117-L128
31,910
biojava/biojava
biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java
DemoStructureFromFasta.buildJmolSelection
private static String buildJmolSelection(ResidueNumber[] residues) { StringBuilder cmd = new StringBuilder("select "); for(ResidueNumber res : residues) { if(res != null) { cmd.append(String.format("%d^%s:%s.CA or ", res.getSeqNum(), res.getInsCode()==null?" ":res.getInsCode(), res.getChainName())); } } cmd.append("none;");//easier than removing the railing 'or' return cmd.toString(); }
java
private static String buildJmolSelection(ResidueNumber[] residues) { StringBuilder cmd = new StringBuilder("select "); for(ResidueNumber res : residues) { if(res != null) { cmd.append(String.format("%d^%s:%s.CA or ", res.getSeqNum(), res.getInsCode()==null?" ":res.getInsCode(), res.getChainName())); } } cmd.append("none;");//easier than removing the railing 'or' return cmd.toString(); }
[ "private", "static", "String", "buildJmolSelection", "(", "ResidueNumber", "[", "]", "residues", ")", "{", "StringBuilder", "cmd", "=", "new", "StringBuilder", "(", "\"select \"", ")", ";", "for", "(", "ResidueNumber", "res", ":", "residues", ")", "{", "if", ...
Converts an array of ResidueNumbers into a jMol selection. <p>For example, "select 11^ :A.CA or 12^ :A.CA;" would select the CA atoms of residues 11-12 on chain A. @param residues Residues to include in the selection. Nulls are ignored. @return
[ "Converts", "an", "array", "of", "ResidueNumbers", "into", "a", "jMol", "selection", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/demo/DemoStructureFromFasta.java#L140-L151
31,911
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLConverter.java
AFPChainXMLConverter.toXML
public synchronized static String toXML(AFPChain afpChain, Atom[] ca1, Atom[]ca2) throws IOException{ StringWriter result = new StringWriter(); toXML(afpChain,result,ca1,ca2); return result.toString(); }
java
public synchronized static String toXML(AFPChain afpChain, Atom[] ca1, Atom[]ca2) throws IOException{ StringWriter result = new StringWriter(); toXML(afpChain,result,ca1,ca2); return result.toString(); }
[ "public", "synchronized", "static", "String", "toXML", "(", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "IOException", "{", "StringWriter", "result", "=", "new", "StringWriter", "(", ")", ";", "toXML",...
Convert an afpChain to a simple XML representation @param afpChain @return XML representation of the AFPCHain
[ "Convert", "an", "afpChain", "to", "a", "simple", "XML", "representation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLConverter.java#L44-L48
31,912
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLConverter.java
AFPChainXMLConverter.toXML
public synchronized static void toXML(AFPChain afpChain, StringWriter swriter,Atom[] ca1, Atom[]ca2) throws IOException{ PrintWriter writer = new PrintWriter(swriter); PrettyXMLWriter xml = new PrettyXMLWriter(writer); xml.openTag("AFPChain"); printXMLHeader(xml,afpChain); // that is the initial alignment... // we don't serialize that at the present. //int[] blockResSize = afpChain.getBlockResSize(); //int[][][] blockResList = afpChain.getBlockResList(); // get the alignment blocks int blockNum = afpChain.getBlockNum(); //int[] optLen = afpChain.getOptLen(); //int[] blockSize = afpChain.getBlockSize(); for(int bk = 0; bk < blockNum; bk ++) { xml.openTag("block"); printXMLBlockHeader(xml,afpChain, bk); if ( ca1 == null || ca2 == null) { try { printXMLEQRKnownPositions(xml,afpChain,bk); } catch (StructureException ex ){ throw new IOException(ex.getMessage()); } } else printXMLEQRInferPositions(xml, afpChain,bk,ca1,ca2); printXMLMatrixShift(xml, afpChain, bk); xml.closeTag("block"); } xml.closeTag("AFPChain"); writer.close(); }
java
public synchronized static void toXML(AFPChain afpChain, StringWriter swriter,Atom[] ca1, Atom[]ca2) throws IOException{ PrintWriter writer = new PrintWriter(swriter); PrettyXMLWriter xml = new PrettyXMLWriter(writer); xml.openTag("AFPChain"); printXMLHeader(xml,afpChain); // that is the initial alignment... // we don't serialize that at the present. //int[] blockResSize = afpChain.getBlockResSize(); //int[][][] blockResList = afpChain.getBlockResList(); // get the alignment blocks int blockNum = afpChain.getBlockNum(); //int[] optLen = afpChain.getOptLen(); //int[] blockSize = afpChain.getBlockSize(); for(int bk = 0; bk < blockNum; bk ++) { xml.openTag("block"); printXMLBlockHeader(xml,afpChain, bk); if ( ca1 == null || ca2 == null) { try { printXMLEQRKnownPositions(xml,afpChain,bk); } catch (StructureException ex ){ throw new IOException(ex.getMessage()); } } else printXMLEQRInferPositions(xml, afpChain,bk,ca1,ca2); printXMLMatrixShift(xml, afpChain, bk); xml.closeTag("block"); } xml.closeTag("AFPChain"); writer.close(); }
[ "public", "synchronized", "static", "void", "toXML", "(", "AFPChain", "afpChain", ",", "StringWriter", "swriter", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "IOException", "{", "PrintWriter", "writer", "=", "new", "PrintWriter...
Write the XML representation to a StringWriter @param afpChain @param swriter @throws IOException
[ "Write", "the", "XML", "representation", "to", "a", "StringWriter" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLConverter.java#L56-L102
31,913
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java
NCBIQBlastAlignmentProperties.getAlignmentOptions
@Override public Set<String> getAlignmentOptions() { Set<String> result = new HashSet<String>(); for (BlastAlignmentParameterEnum parameter : param.keySet()) { result.add(parameter.name()); } return result; }
java
@Override public Set<String> getAlignmentOptions() { Set<String> result = new HashSet<String>(); for (BlastAlignmentParameterEnum parameter : param.keySet()) { result.add(parameter.name()); } return result; }
[ "@", "Override", "public", "Set", "<", "String", ">", "getAlignmentOptions", "(", ")", "{", "Set", "<", "String", ">", "result", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "for", "(", "BlastAlignmentParameterEnum", "parameter", ":", "param",...
Gets parameters, which are currently set
[ "Gets", "parameters", "which", "are", "currently", "set" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java#L70-L77
31,914
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java
NCBIQBlastAlignmentProperties.setBlastProgram
public void setBlastProgram(BlastProgramEnum program) { if (BlastProgramEnum.megablast != program) { setAlignmentOption(PROGRAM, program.name()); removeAlignmentOption(MEGABLAST); } else { setAlignmentOption(PROGRAM, BlastProgramEnum.blastn.name()); setAlignmentOption(MEGABLAST, "on"); } }
java
public void setBlastProgram(BlastProgramEnum program) { if (BlastProgramEnum.megablast != program) { setAlignmentOption(PROGRAM, program.name()); removeAlignmentOption(MEGABLAST); } else { setAlignmentOption(PROGRAM, BlastProgramEnum.blastn.name()); setAlignmentOption(MEGABLAST, "on"); } }
[ "public", "void", "setBlastProgram", "(", "BlastProgramEnum", "program", ")", "{", "if", "(", "BlastProgramEnum", ".", "megablast", "!=", "program", ")", "{", "setAlignmentOption", "(", "PROGRAM", ",", "program", ".", "name", "(", ")", ")", ";", "removeAlignme...
Sets the program to be used with blastall @param program : one of blastall programs
[ "Sets", "the", "program", "to", "be", "used", "with", "blastall" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java#L114-L122
31,915
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java
NCBIQBlastAlignmentProperties.getBlastWordSize
public int getBlastWordSize() { if (param.containsKey(WORD_SIZE)) { return Integer.parseInt(getAlignmentOption(WORD_SIZE)); } // return default word size value try { BlastProgramEnum programType = getBlastProgram(); switch (programType) { case blastn: return 11; case megablast: return 28; case blastp: case blastx: case tblastn: case tblastx: return 3; default: throw new UnsupportedOperationException("Blast program " + programType.name() + " is not supported."); } } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Blast program " + getBlastProgram() + " is not supported.", e); } }
java
public int getBlastWordSize() { if (param.containsKey(WORD_SIZE)) { return Integer.parseInt(getAlignmentOption(WORD_SIZE)); } // return default word size value try { BlastProgramEnum programType = getBlastProgram(); switch (programType) { case blastn: return 11; case megablast: return 28; case blastp: case blastx: case tblastn: case tblastx: return 3; default: throw new UnsupportedOperationException("Blast program " + programType.name() + " is not supported."); } } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Blast program " + getBlastProgram() + " is not supported.", e); } }
[ "public", "int", "getBlastWordSize", "(", ")", "{", "if", "(", "param", ".", "containsKey", "(", "WORD_SIZE", ")", ")", "{", "return", "Integer", ".", "parseInt", "(", "getAlignmentOption", "(", "WORD_SIZE", ")", ")", ";", "}", "// return default word size val...
Returns the value of the WORD_SIZE parameter used for this blast run @return int value of WORD_SIZE used by this search @throws IllegalArgumentException when program type is not set and program type is not supported
[ "Returns", "the", "value", "of", "the", "WORD_SIZE", "parameter", "used", "for", "this", "blast", "run" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java#L179-L203
31,916
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java
NCBIQBlastAlignmentProperties.setBlastGapCosts
public void setBlastGapCosts(int gapCreation, int gapExtension) { String gc = Integer.toString(gapCreation); String ge = Integer.toString(gapExtension); setAlignmentOption(GAPCOSTS, gc + "+" + ge); }
java
public void setBlastGapCosts(int gapCreation, int gapExtension) { String gc = Integer.toString(gapCreation); String ge = Integer.toString(gapExtension); setAlignmentOption(GAPCOSTS, gc + "+" + ge); }
[ "public", "void", "setBlastGapCosts", "(", "int", "gapCreation", ",", "int", "gapExtension", ")", "{", "String", "gc", "=", "Integer", ".", "toString", "(", "gapCreation", ")", ";", "String", "ge", "=", "Integer", ".", "toString", "(", "gapExtension", ")", ...
Sets the GAPCOSTS parameter @param gapCreation integer to use as gap creation value @param gapExtension integer to use as gap extension value
[ "Sets", "the", "GAPCOSTS", "parameter" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastAlignmentProperties.java#L266-L270
31,917
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java
CoxInfo.fmtpl
public String fmtpl(String d, int pad) { int length = d.length(); int extra = pad - length; if (extra < 0) { extra = 0; } String v = d; for (int i = 0; i < extra; i++) { v = " " + v; } return v; }
java
public String fmtpl(String d, int pad) { int length = d.length(); int extra = pad - length; if (extra < 0) { extra = 0; } String v = d; for (int i = 0; i < extra; i++) { v = " " + v; } return v; }
[ "public", "String", "fmtpl", "(", "String", "d", ",", "int", "pad", ")", "{", "int", "length", "=", "d", ".", "length", "(", ")", ";", "int", "extra", "=", "pad", "-", "length", ";", "if", "(", "extra", "<", "0", ")", "{", "extra", "=", "0", ...
Pad left a string with spaces @param d @param pad @return
[ "Pad", "left", "a", "string", "with", "spaces" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/cox/CoxInfo.java#L464-L475
31,918
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceMouseListener.java
SequenceMouseListener.getSeqPos
private int getSeqPos(MouseEvent e) { int x = e.getX(); //int y = e.getY(); //float scale = seqScale.getScale(); //int DEFAULT_X_START = SequenceScalePanel.DEFAULT_X_START; float scale = parent.getScale(); coordManager.setScale(scale); int seqpos = coordManager.getSeqPos(x-2); return seqpos ; }
java
private int getSeqPos(MouseEvent e) { int x = e.getX(); //int y = e.getY(); //float scale = seqScale.getScale(); //int DEFAULT_X_START = SequenceScalePanel.DEFAULT_X_START; float scale = parent.getScale(); coordManager.setScale(scale); int seqpos = coordManager.getSeqPos(x-2); return seqpos ; }
[ "private", "int", "getSeqPos", "(", "MouseEvent", "e", ")", "{", "int", "x", "=", "e", ".", "getX", "(", ")", ";", "//int y = e.getY();", "//float scale = seqScale.getScale();", "//int DEFAULT_X_START = SequenceScalePanel.DEFAULT_X_START;", "float", "scale", "=", "paren...
get the sequence position of the current mouse event
[ "get", "the", "sequence", "position", "of", "the", "current", "mouse", "event" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceMouseListener.java#L124-L138
31,919
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.clear
public void clear() { columnLookup.clear(); rowLookup.clear(); data = null; dataGrid.clear(); doubleValues.clear(); System.gc(); }
java
public void clear() { columnLookup.clear(); rowLookup.clear(); data = null; dataGrid.clear(); doubleValues.clear(); System.gc(); }
[ "public", "void", "clear", "(", ")", "{", "columnLookup", ".", "clear", "(", ")", ";", "rowLookup", ".", "clear", "(", ")", ";", "data", "=", "null", ";", "dataGrid", ".", "clear", "(", ")", ";", "doubleValues", ".", "clear", "(", ")", ";", "System...
See if we can free up memory
[ "See", "if", "we", "can", "free", "up", "memory" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L117-L124
31,920
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getCopyWorkSheetSelectedRows
static public WorkSheet getCopyWorkSheetSelectedRows(WorkSheet copyWorkSheet, ArrayList<String> rows) throws Exception { ArrayList<String> columns = copyWorkSheet.getColumns(); WorkSheet workSheet = new WorkSheet(rows, columns); for (String row : rows) { for (String col : columns) { workSheet.addCell(row, col, copyWorkSheet.getCell(row, col)); } } workSheet.setMetaDataColumns(copyWorkSheet.getMetaDataColumns()); workSheet.setMetaDataRows(copyWorkSheet.getMetaDataRows()); return workSheet; }
java
static public WorkSheet getCopyWorkSheetSelectedRows(WorkSheet copyWorkSheet, ArrayList<String> rows) throws Exception { ArrayList<String> columns = copyWorkSheet.getColumns(); WorkSheet workSheet = new WorkSheet(rows, columns); for (String row : rows) { for (String col : columns) { workSheet.addCell(row, col, copyWorkSheet.getCell(row, col)); } } workSheet.setMetaDataColumns(copyWorkSheet.getMetaDataColumns()); workSheet.setMetaDataRows(copyWorkSheet.getMetaDataRows()); return workSheet; }
[ "static", "public", "WorkSheet", "getCopyWorkSheetSelectedRows", "(", "WorkSheet", "copyWorkSheet", ",", "ArrayList", "<", "String", ">", "rows", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">", "columns", "=", "copyWorkSheet", ".", "getColumns", ...
Create a copy of a worksheet. If shuffling of columns or row for testing a way to duplicate original worksheet @param copyWorkSheet @param rows @return @throws Exception
[ "Create", "a", "copy", "of", "a", "worksheet", ".", "If", "shuffling", "of", "columns", "or", "row", "for", "testing", "a", "way", "to", "duplicate", "original", "worksheet" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L171-L186
31,921
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.shuffleColumnsAndThenRows
public void shuffleColumnsAndThenRows(ArrayList<String> columns, ArrayList<String> rows) throws Exception { doubleValues.clear(); for (String column : columns) { //shuffle all values in the column ArrayList<Integer> rowIndex = new ArrayList<Integer>(); for (int i = 0; i < rows.size(); i++) { rowIndex.add(i); } Collections.shuffle(rowIndex); for (int i = 0; i < rows.size(); i++) { String row = rows.get(i); int randomIndex = rowIndex.get(i); String destinationRow = rows.get(randomIndex); String temp = this.getCell(destinationRow, column); String value = this.getCell(row, column); this.addCell(destinationRow, column, value); this.addCell(row, column, temp); } } for (String row : rows) { ArrayList<Integer> columnIndex = new ArrayList<Integer>(); for (int i = 0; i < columns.size(); i++) { columnIndex.add(i); } Collections.shuffle(columnIndex); for (int i = 0; i < columns.size(); i++) { String column = columns.get(i); int randomIndex = columnIndex.get(i); String destinationCol = columns.get(randomIndex); String temp = this.getCell(row, destinationCol); String value = this.getCell(row, column); this.addCell(row, destinationCol, value); this.addCell(row, column, temp); } } }
java
public void shuffleColumnsAndThenRows(ArrayList<String> columns, ArrayList<String> rows) throws Exception { doubleValues.clear(); for (String column : columns) { //shuffle all values in the column ArrayList<Integer> rowIndex = new ArrayList<Integer>(); for (int i = 0; i < rows.size(); i++) { rowIndex.add(i); } Collections.shuffle(rowIndex); for (int i = 0; i < rows.size(); i++) { String row = rows.get(i); int randomIndex = rowIndex.get(i); String destinationRow = rows.get(randomIndex); String temp = this.getCell(destinationRow, column); String value = this.getCell(row, column); this.addCell(destinationRow, column, value); this.addCell(row, column, temp); } } for (String row : rows) { ArrayList<Integer> columnIndex = new ArrayList<Integer>(); for (int i = 0; i < columns.size(); i++) { columnIndex.add(i); } Collections.shuffle(columnIndex); for (int i = 0; i < columns.size(); i++) { String column = columns.get(i); int randomIndex = columnIndex.get(i); String destinationCol = columns.get(randomIndex); String temp = this.getCell(row, destinationCol); String value = this.getCell(row, column); this.addCell(row, destinationCol, value); this.addCell(row, column, temp); } } }
[ "public", "void", "shuffleColumnsAndThenRows", "(", "ArrayList", "<", "String", ">", "columns", ",", "ArrayList", "<", "String", ">", "rows", ")", "throws", "Exception", "{", "doubleValues", ".", "clear", "(", ")", ";", "for", "(", "String", "column", ":", ...
Randomly shuffle the columns and rows. Should be constrained to the same data type if not probably doesn't make any sense. @param columns @param rows @throws Exception
[ "Randomly", "shuffle", "the", "columns", "and", "rows", ".", "Should", "be", "constrained", "to", "the", "same", "data", "type", "if", "not", "probably", "doesn", "t", "make", "any", "sense", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L291-L334
31,922
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.shuffleColumnValues
public void shuffleColumnValues(ArrayList<String> columns) throws Exception { doubleValues.clear(); ArrayList<String> rows = this.getDataRows(); for (String column : columns) { //shuffle all values in the column ArrayList<Integer> rowIndex = new ArrayList<Integer>(); for (int i = 0; i < rows.size(); i++) { rowIndex.add(i); } Collections.shuffle(rowIndex); for (int i = 0; i < rows.size(); i++) { String row = rows.get(i); int randomIndex = rowIndex.get(i); String destinationRow = rows.get(randomIndex); String temp = this.getCell(destinationRow, column); String value = this.getCell(row, column); this.addCell(destinationRow, column, value); this.addCell(row, column, temp); } } }
java
public void shuffleColumnValues(ArrayList<String> columns) throws Exception { doubleValues.clear(); ArrayList<String> rows = this.getDataRows(); for (String column : columns) { //shuffle all values in the column ArrayList<Integer> rowIndex = new ArrayList<Integer>(); for (int i = 0; i < rows.size(); i++) { rowIndex.add(i); } Collections.shuffle(rowIndex); for (int i = 0; i < rows.size(); i++) { String row = rows.get(i); int randomIndex = rowIndex.get(i); String destinationRow = rows.get(randomIndex); String temp = this.getCell(destinationRow, column); String value = this.getCell(row, column); this.addCell(destinationRow, column, value); this.addCell(row, column, temp); } } }
[ "public", "void", "shuffleColumnValues", "(", "ArrayList", "<", "String", ">", "columns", ")", "throws", "Exception", "{", "doubleValues", ".", "clear", "(", ")", ";", "ArrayList", "<", "String", ">", "rows", "=", "this", ".", "getDataRows", "(", ")", ";",...
Need to shuffle column values to allow for randomized testing. The columns in the list will be shuffled together @param columns @throws Exception
[ "Need", "to", "shuffle", "column", "values", "to", "allow", "for", "randomized", "testing", ".", "The", "columns", "in", "the", "list", "will", "be", "shuffled", "together" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L343-L365
31,923
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.shuffleRowValues
public void shuffleRowValues(ArrayList<String> rows) throws Exception { doubleValues.clear(); ArrayList<String> columns = this.getColumns(); for (String row : rows) { ArrayList<Integer> columnIndex = new ArrayList<Integer>(); for (int i = 0; i < columns.size(); i++) { columnIndex.add(i); } Collections.shuffle(columnIndex); for (int i = 0; i < columns.size(); i++) { String column = columns.get(i); int randomIndex = columnIndex.get(i); String destinationCol = columns.get(randomIndex); String temp = this.getCell(row, destinationCol); String value = this.getCell(row, column); this.addCell(row, destinationCol, value); this.addCell(row, column, temp); } } }
java
public void shuffleRowValues(ArrayList<String> rows) throws Exception { doubleValues.clear(); ArrayList<String> columns = this.getColumns(); for (String row : rows) { ArrayList<Integer> columnIndex = new ArrayList<Integer>(); for (int i = 0; i < columns.size(); i++) { columnIndex.add(i); } Collections.shuffle(columnIndex); for (int i = 0; i < columns.size(); i++) { String column = columns.get(i); int randomIndex = columnIndex.get(i); String destinationCol = columns.get(randomIndex); String temp = this.getCell(row, destinationCol); String value = this.getCell(row, column); this.addCell(row, destinationCol, value); this.addCell(row, column, temp); } } }
[ "public", "void", "shuffleRowValues", "(", "ArrayList", "<", "String", ">", "rows", ")", "throws", "Exception", "{", "doubleValues", ".", "clear", "(", ")", ";", "ArrayList", "<", "String", ">", "columns", "=", "this", ".", "getColumns", "(", ")", ";", "...
Need to shuffle rows values to allow for randomized testing. The rows in the list will be shuffled together @param rows @throws Exception
[ "Need", "to", "shuffle", "rows", "values", "to", "allow", "for", "randomized", "testing", ".", "The", "rows", "in", "the", "list", "will", "be", "shuffled", "together" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L374-L396
31,924
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.markMetaDataColumns
public void markMetaDataColumns(ArrayList<String> metaDataColumns) { for (String column : metaDataColumns) { metaDataColumnsHashMap.put(column, column); } }
java
public void markMetaDataColumns(ArrayList<String> metaDataColumns) { for (String column : metaDataColumns) { metaDataColumnsHashMap.put(column, column); } }
[ "public", "void", "markMetaDataColumns", "(", "ArrayList", "<", "String", ">", "metaDataColumns", ")", "{", "for", "(", "String", "column", ":", "metaDataColumns", ")", "{", "metaDataColumnsHashMap", ".", "put", "(", "column", ",", "column", ")", ";", "}", "...
marks columns as containing meta data @param metaDataColumns
[ "marks", "columns", "as", "containing", "meta", "data" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L485-L489
31,925
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.replaceColumnValues
public void replaceColumnValues(String column, HashMap<String, String> values) throws Exception { for (String row : rowLookup.keySet()) { String oldValue = this.getCell(row, column); String newValue = values.get(oldValue); this.addCell(row, column, newValue); } }
java
public void replaceColumnValues(String column, HashMap<String, String> values) throws Exception { for (String row : rowLookup.keySet()) { String oldValue = this.getCell(row, column); String newValue = values.get(oldValue); this.addCell(row, column, newValue); } }
[ "public", "void", "replaceColumnValues", "(", "String", "column", ",", "HashMap", "<", "String", ",", "String", ">", "values", ")", "throws", "Exception", "{", "for", "(", "String", "row", ":", "rowLookup", ".", "keySet", "(", ")", ")", "{", "String", "o...
Change values in a column where 0 = something and 1 = something different @param column @param values @throws Exception
[ "Change", "values", "in", "a", "column", "where", "0", "=", "something", "and", "1", "=", "something", "different" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L618-L625
31,926
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.applyColumnFilter
public void applyColumnFilter(String column, ChangeValue changeValue) throws Exception { for (String row : rowLookup.keySet()) { String oldValue = this.getCell(row, column); String newValue = changeValue.change(oldValue); this.addCell(row, column, newValue); } }
java
public void applyColumnFilter(String column, ChangeValue changeValue) throws Exception { for (String row : rowLookup.keySet()) { String oldValue = this.getCell(row, column); String newValue = changeValue.change(oldValue); this.addCell(row, column, newValue); } }
[ "public", "void", "applyColumnFilter", "(", "String", "column", ",", "ChangeValue", "changeValue", ")", "throws", "Exception", "{", "for", "(", "String", "row", ":", "rowLookup", ".", "keySet", "(", ")", ")", "{", "String", "oldValue", "=", "this", ".", "g...
Apply filter to a column to change values from say numberic to nominal based on some range @param column @param changeValue @throws Exception
[ "Apply", "filter", "to", "a", "column", "to", "change", "values", "from", "say", "numberic", "to", "nominal", "based", "on", "some", "range" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L635-L641
31,927
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.addColumns
public void addColumns(ArrayList<String> columns, String defaultValue) { CompactCharSequence dv = new CompactCharSequence(defaultValue); for (int i = 0; i < data.length; i++) { CompactCharSequence[] row = data[i]; int oldrowlength = data[i].length; data[i] = (CompactCharSequence[]) resizeArray(row, oldrowlength + columns.size()); for (int c = 0; c < columns.size(); c++) { data[i][oldrowlength + c] = dv; } if (i == 0) { for (int c = 0; c < columns.size(); c++) { String column = columns.get(c); data[0][oldrowlength + c] = new CompactCharSequence(column); columnLookup.put(column, new HeaderInfo(oldrowlength + c)); } } } // columnLookup.get("ZNF30"); // int startIndex = columnLookup.size() + 1; // for (String column : columns) { // if(column.equals("ttr")){ // int dummy = 1; // } // columnLookup.put(column, new HeaderInfo(startIndex)); // startIndex++; // } }
java
public void addColumns(ArrayList<String> columns, String defaultValue) { CompactCharSequence dv = new CompactCharSequence(defaultValue); for (int i = 0; i < data.length; i++) { CompactCharSequence[] row = data[i]; int oldrowlength = data[i].length; data[i] = (CompactCharSequence[]) resizeArray(row, oldrowlength + columns.size()); for (int c = 0; c < columns.size(); c++) { data[i][oldrowlength + c] = dv; } if (i == 0) { for (int c = 0; c < columns.size(); c++) { String column = columns.get(c); data[0][oldrowlength + c] = new CompactCharSequence(column); columnLookup.put(column, new HeaderInfo(oldrowlength + c)); } } } // columnLookup.get("ZNF30"); // int startIndex = columnLookup.size() + 1; // for (String column : columns) { // if(column.equals("ttr")){ // int dummy = 1; // } // columnLookup.put(column, new HeaderInfo(startIndex)); // startIndex++; // } }
[ "public", "void", "addColumns", "(", "ArrayList", "<", "String", ">", "columns", ",", "String", "defaultValue", ")", "{", "CompactCharSequence", "dv", "=", "new", "CompactCharSequence", "(", "defaultValue", ")", ";", "for", "(", "int", "i", "=", "0", ";", ...
Add columns to worksheet and set default value @param columns @param defaultValue
[ "Add", "columns", "to", "worksheet", "and", "set", "default", "value" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L660-L689
31,928
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.addRows
public void addRows(ArrayList<String> rows, String defaultValue) { CompactCharSequence dv = new CompactCharSequence(defaultValue); int oldlength = data.length; int numColumns = 0; if (data.length > 0 && data[0] != null) { numColumns = data[0].length; } data = (CompactCharSequence[][]) resizeArray(data, data.length + rows.size()); for (int r = 0; r < rows.size(); r++) { data[oldlength + r] = new CompactCharSequence[numColumns]; for (int c = 0; c < numColumns; c++) { data[oldlength + r][c] = dv; } data[oldlength + r][0] = new CompactCharSequence(rows.get(r)); rowLookup.put(rows.get(r), new HeaderInfo(r + oldlength)); } }
java
public void addRows(ArrayList<String> rows, String defaultValue) { CompactCharSequence dv = new CompactCharSequence(defaultValue); int oldlength = data.length; int numColumns = 0; if (data.length > 0 && data[0] != null) { numColumns = data[0].length; } data = (CompactCharSequence[][]) resizeArray(data, data.length + rows.size()); for (int r = 0; r < rows.size(); r++) { data[oldlength + r] = new CompactCharSequence[numColumns]; for (int c = 0; c < numColumns; c++) { data[oldlength + r][c] = dv; } data[oldlength + r][0] = new CompactCharSequence(rows.get(r)); rowLookup.put(rows.get(r), new HeaderInfo(r + oldlength)); } }
[ "public", "void", "addRows", "(", "ArrayList", "<", "String", ">", "rows", ",", "String", "defaultValue", ")", "{", "CompactCharSequence", "dv", "=", "new", "CompactCharSequence", "(", "defaultValue", ")", ";", "int", "oldlength", "=", "data", ".", "length", ...
Add rows to the worksheet and fill in default value @param rows @param defaultValue
[ "Add", "rows", "to", "the", "worksheet", "and", "fill", "in", "default", "value" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L708-L724
31,929
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.resizeArray
private static Object resizeArray(Object oldArray, int newSize) { int oldSize = java.lang.reflect.Array.getLength(oldArray); Class<?> elementType = oldArray.getClass().getComponentType(); Object newArray = java.lang.reflect.Array.newInstance( elementType, newSize); int preserveLength = Math.min(oldSize, newSize); if (preserveLength > 0) { System.arraycopy(oldArray, 0, newArray, 0, preserveLength); } return newArray; }
java
private static Object resizeArray(Object oldArray, int newSize) { int oldSize = java.lang.reflect.Array.getLength(oldArray); Class<?> elementType = oldArray.getClass().getComponentType(); Object newArray = java.lang.reflect.Array.newInstance( elementType, newSize); int preserveLength = Math.min(oldSize, newSize); if (preserveLength > 0) { System.arraycopy(oldArray, 0, newArray, 0, preserveLength); } return newArray; }
[ "private", "static", "Object", "resizeArray", "(", "Object", "oldArray", ",", "int", "newSize", ")", "{", "int", "oldSize", "=", "java", ".", "lang", ".", "reflect", ".", "Array", ".", "getLength", "(", "oldArray", ")", ";", "Class", "<", "?", ">", "el...
Reallocates an array with a new size, and copies the contents of the old array to the new array. @param oldArray the old array, to be reallocated. @param newSize the new array size. @return A new array with the same contents.
[ "Reallocates", "an", "array", "with", "a", "new", "size", "and", "copies", "the", "contents", "of", "the", "old", "array", "to", "the", "new", "array", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L734-L744
31,930
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.addCell
public void addCell(String row, String col, String value) throws Exception { HeaderInfo rowIndex = rowLookup.get(row); HeaderInfo colIndex = columnLookup.get(col); if (rowIndex == null) { throw new Exception("Row " + row + " not found in worksheet"); } if (colIndex == null) { throw new Exception("Column " + col + " not found in worksheet"); } data[rowIndex.getIndex()][colIndex.getIndex()] = new CompactCharSequence(value); }
java
public void addCell(String row, String col, String value) throws Exception { HeaderInfo rowIndex = rowLookup.get(row); HeaderInfo colIndex = columnLookup.get(col); if (rowIndex == null) { throw new Exception("Row " + row + " not found in worksheet"); } if (colIndex == null) { throw new Exception("Column " + col + " not found in worksheet"); } data[rowIndex.getIndex()][colIndex.getIndex()] = new CompactCharSequence(value); }
[ "public", "void", "addCell", "(", "String", "row", ",", "String", "col", ",", "String", "value", ")", "throws", "Exception", "{", "HeaderInfo", "rowIndex", "=", "rowLookup", ".", "get", "(", "row", ")", ";", "HeaderInfo", "colIndex", "=", "columnLookup", "...
Add data to a cell @param row @param col @param value @throws Exception
[ "Add", "data", "to", "a", "cell" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L754-L766
31,931
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getCell
public String getCell(String row, String col) throws Exception { if (col.equals(this.getIndexColumnName())) { return row; } HeaderInfo rowIndex = rowLookup.get(row); HeaderInfo colIndex = columnLookup.get(col); if (rowIndex == null) { //allow for case insentive search for (String rowtable : rowLookup.keySet()) { if (row.equalsIgnoreCase(rowtable)) { rowIndex = rowLookup.get(rowtable); break; } } if (rowIndex == null) { throw new Exception("Row " + row + " not found in worksheet"); } } if (colIndex == null) { //allow for case insentive search for (String coltable : columnLookup.keySet()) { if (col.equalsIgnoreCase(coltable)) { colIndex = columnLookup.get(coltable); break; } } if (colIndex == null) { throw new Exception("Column " + col + " not found in worksheet"); } } CompactCharSequence ccs = data[rowIndex.getIndex()][colIndex.getIndex()]; if (ccs != null) { return ccs.toString(); } else { return ""; } // return .toString(); }
java
public String getCell(String row, String col) throws Exception { if (col.equals(this.getIndexColumnName())) { return row; } HeaderInfo rowIndex = rowLookup.get(row); HeaderInfo colIndex = columnLookup.get(col); if (rowIndex == null) { //allow for case insentive search for (String rowtable : rowLookup.keySet()) { if (row.equalsIgnoreCase(rowtable)) { rowIndex = rowLookup.get(rowtable); break; } } if (rowIndex == null) { throw new Exception("Row " + row + " not found in worksheet"); } } if (colIndex == null) { //allow for case insentive search for (String coltable : columnLookup.keySet()) { if (col.equalsIgnoreCase(coltable)) { colIndex = columnLookup.get(coltable); break; } } if (colIndex == null) { throw new Exception("Column " + col + " not found in worksheet"); } } CompactCharSequence ccs = data[rowIndex.getIndex()][colIndex.getIndex()]; if (ccs != null) { return ccs.toString(); } else { return ""; } // return .toString(); }
[ "public", "String", "getCell", "(", "String", "row", ",", "String", "col", ")", "throws", "Exception", "{", "if", "(", "col", ".", "equals", "(", "this", ".", "getIndexColumnName", "(", ")", ")", ")", "{", "return", "row", ";", "}", "HeaderInfo", "rowI...
Get cell value @param row @param col @return @throws Exception
[ "Get", "cell", "value" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L865-L905
31,932
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.changeColumnsHeaders
public void changeColumnsHeaders(LinkedHashMap<String, String> newColumnValues) throws Exception { for (String oldColumn : newColumnValues.keySet()) { String newColumn = newColumnValues.get(oldColumn); changeColumnHeader(oldColumn, newColumn); } }
java
public void changeColumnsHeaders(LinkedHashMap<String, String> newColumnValues) throws Exception { for (String oldColumn : newColumnValues.keySet()) { String newColumn = newColumnValues.get(oldColumn); changeColumnHeader(oldColumn, newColumn); } }
[ "public", "void", "changeColumnsHeaders", "(", "LinkedHashMap", "<", "String", ",", "String", ">", "newColumnValues", ")", "throws", "Exception", "{", "for", "(", "String", "oldColumn", ":", "newColumnValues", ".", "keySet", "(", ")", ")", "{", "String", "newC...
Change the columns in the HashMap Key to the name of the value @param newColumnValues @throws Exception
[ "Change", "the", "columns", "in", "the", "HashMap", "Key", "to", "the", "name", "of", "the", "value" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L960-L966
31,933
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getAllColumns
public ArrayList<String> getAllColumns() { ArrayList<String> columns = new ArrayList<String>(); for (String col : columnLookup.keySet()) { columns.add(col); } return columns; }
java
public ArrayList<String> getAllColumns() { ArrayList<String> columns = new ArrayList<String>(); for (String col : columnLookup.keySet()) { columns.add(col); } return columns; }
[ "public", "ArrayList", "<", "String", ">", "getAllColumns", "(", ")", "{", "ArrayList", "<", "String", ">", "columns", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "col", ":", "columnLookup", ".", "keySet", "(", ")"...
Get the list of column names including those that may be hidden @return
[ "Get", "the", "list", "of", "column", "names", "including", "those", "that", "may", "be", "hidden" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1053-L1059
31,934
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getColumns
public ArrayList<String> getColumns() { ArrayList<String> columns = new ArrayList<String>(); for (String col : columnLookup.keySet()) { HeaderInfo hi = columnLookup.get(col); if (!hi.isHide()) { columns.add(col); } } return columns; }
java
public ArrayList<String> getColumns() { ArrayList<String> columns = new ArrayList<String>(); for (String col : columnLookup.keySet()) { HeaderInfo hi = columnLookup.get(col); if (!hi.isHide()) { columns.add(col); } } return columns; }
[ "public", "ArrayList", "<", "String", ">", "getColumns", "(", ")", "{", "ArrayList", "<", "String", ">", "columns", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "col", ":", "columnLookup", ".", "keySet", "(", ")", ...
Get the list of column names. Does not include hidden columns @return
[ "Get", "the", "list", "of", "column", "names", ".", "Does", "not", "include", "hidden", "columns" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1066-L1075
31,935
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getDiscreteColumnValues
public ArrayList<String> getDiscreteColumnValues(String column) throws Exception { HashMap<String, String> hashMapValues = new HashMap<String, String>(); ArrayList<String> values = new ArrayList<String>(); ArrayList<String> rows = getDataRows(); for (String row : rows) { String value = getCell(row, column); if (!hashMapValues.containsKey(value)) { hashMapValues.put(value, value); values.add(value); } } return values; }
java
public ArrayList<String> getDiscreteColumnValues(String column) throws Exception { HashMap<String, String> hashMapValues = new HashMap<String, String>(); ArrayList<String> values = new ArrayList<String>(); ArrayList<String> rows = getDataRows(); for (String row : rows) { String value = getCell(row, column); if (!hashMapValues.containsKey(value)) { hashMapValues.put(value, value); values.add(value); } } return values; }
[ "public", "ArrayList", "<", "String", ">", "getDiscreteColumnValues", "(", "String", "column", ")", "throws", "Exception", "{", "HashMap", "<", "String", ",", "String", ">", "hashMapValues", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")",...
Get back a list of unique values in the column @param column @return @throws Exception
[ "Get", "back", "a", "list", "of", "unique", "values", "in", "the", "column" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1084-L1096
31,936
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getDiscreteRowValues
public ArrayList<String> getDiscreteRowValues(String row) throws Exception { HashMap<String, String> hashMapValues = new HashMap<String, String>(); ArrayList<String> values = new ArrayList<String>(); for (String column : getColumns()) { String value = getCell(row, column); if (!hashMapValues.containsKey(value)) { hashMapValues.put(value, value); values.add(value); } } return values; }
java
public ArrayList<String> getDiscreteRowValues(String row) throws Exception { HashMap<String, String> hashMapValues = new HashMap<String, String>(); ArrayList<String> values = new ArrayList<String>(); for (String column : getColumns()) { String value = getCell(row, column); if (!hashMapValues.containsKey(value)) { hashMapValues.put(value, value); values.add(value); } } return values; }
[ "public", "ArrayList", "<", "String", ">", "getDiscreteRowValues", "(", "String", "row", ")", "throws", "Exception", "{", "HashMap", "<", "String", ",", "String", ">", "hashMapValues", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";"...
Get back a list of unique values in the row @param row @return @throws Exception
[ "Get", "back", "a", "list", "of", "unique", "values", "in", "the", "row" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1105-L1116
31,937
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getAllRows
public ArrayList<String> getAllRows() { ArrayList<String> rows = new ArrayList<String>(); for (String row : rowLookup.keySet()) { rows.add(row); } return rows; }
java
public ArrayList<String> getAllRows() { ArrayList<String> rows = new ArrayList<String>(); for (String row : rowLookup.keySet()) { rows.add(row); } return rows; }
[ "public", "ArrayList", "<", "String", ">", "getAllRows", "(", ")", "{", "ArrayList", "<", "String", ">", "rows", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "row", ":", "rowLookup", ".", "keySet", "(", ")", ")", ...
Get all rows including those that may be hidden @return
[ "Get", "all", "rows", "including", "those", "that", "may", "be", "hidden" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1123-L1130
31,938
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getRows
public ArrayList<String> getRows() { ArrayList<String> rows = new ArrayList<String>(); for (String row : rowLookup.keySet()) { HeaderInfo hi = rowLookup.get(row); if (!hi.isHide()) { rows.add(row); } } return rows; }
java
public ArrayList<String> getRows() { ArrayList<String> rows = new ArrayList<String>(); for (String row : rowLookup.keySet()) { HeaderInfo hi = rowLookup.get(row); if (!hi.isHide()) { rows.add(row); } } return rows; }
[ "public", "ArrayList", "<", "String", ">", "getRows", "(", ")", "{", "ArrayList", "<", "String", ">", "rows", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "row", ":", "rowLookup", ".", "keySet", "(", ")", ")", "...
Get the list of row names. Will exclude hidden values @return
[ "Get", "the", "list", "of", "row", "names", ".", "Will", "exclude", "hidden", "values" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1137-L1146
31,939
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getDataRows
public ArrayList<String> getDataRows() { ArrayList<String> rows = new ArrayList<String>(); for (String row : rowLookup.keySet()) { if (this.isMetaDataRow(row)) { continue; } HeaderInfo hi = rowLookup.get(row); if (!hi.isHide()) { rows.add(row); } } return rows; }
java
public ArrayList<String> getDataRows() { ArrayList<String> rows = new ArrayList<String>(); for (String row : rowLookup.keySet()) { if (this.isMetaDataRow(row)) { continue; } HeaderInfo hi = rowLookup.get(row); if (!hi.isHide()) { rows.add(row); } } return rows; }
[ "public", "ArrayList", "<", "String", ">", "getDataRows", "(", ")", "{", "ArrayList", "<", "String", ">", "rows", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "row", ":", "rowLookup", ".", "keySet", "(", ")", ")",...
Get the list of row names @return
[ "Get", "the", "list", "of", "row", "names" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1153-L1165
31,940
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getLogScale
public WorkSheet getLogScale(double base, double zeroValue) throws Exception { WorkSheet workSheet = new WorkSheet(getRows(), getColumns()); workSheet.setIndexColumnName(this.getIndexColumnName()); ArrayList<String> rows = getRows(); ArrayList<String> columns = getColumns(); for (String row : rows) { for (String col : columns) { if (this.isMetaDataColumn(col) || this.isMetaDataRow(row)) { String value = getCell(row, col); workSheet.addCell(row, col, value); } else { String value = getCell(row, col); try { Double d = Double.parseDouble(value); if (d == 0.0) { d = zeroValue; } else { d = Math.log(d) / Math.log(base); } workSheet.addCell(row, col, d + ""); } catch (Exception e) { workSheet.addCell(row, col, value); } } } } ArrayList<String> metadataRows = this.getMetaDataRows(); ArrayList<String> metadataColumns = this.getMetaDataColumns(); workSheet.setMetaDataColumns(metadataColumns); workSheet.setMetaDataRows(metadataRows); return workSheet; }
java
public WorkSheet getLogScale(double base, double zeroValue) throws Exception { WorkSheet workSheet = new WorkSheet(getRows(), getColumns()); workSheet.setIndexColumnName(this.getIndexColumnName()); ArrayList<String> rows = getRows(); ArrayList<String> columns = getColumns(); for (String row : rows) { for (String col : columns) { if (this.isMetaDataColumn(col) || this.isMetaDataRow(row)) { String value = getCell(row, col); workSheet.addCell(row, col, value); } else { String value = getCell(row, col); try { Double d = Double.parseDouble(value); if (d == 0.0) { d = zeroValue; } else { d = Math.log(d) / Math.log(base); } workSheet.addCell(row, col, d + ""); } catch (Exception e) { workSheet.addCell(row, col, value); } } } } ArrayList<String> metadataRows = this.getMetaDataRows(); ArrayList<String> metadataColumns = this.getMetaDataColumns(); workSheet.setMetaDataColumns(metadataColumns); workSheet.setMetaDataRows(metadataRows); return workSheet; }
[ "public", "WorkSheet", "getLogScale", "(", "double", "base", ",", "double", "zeroValue", ")", "throws", "Exception", "{", "WorkSheet", "workSheet", "=", "new", "WorkSheet", "(", "getRows", "(", ")", ",", "getColumns", "(", ")", ")", ";", "workSheet", ".", ...
Get the log scale of this worksheet @param base @return @throws Exception
[ "Get", "the", "log", "scale", "of", "this", "worksheet" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1187-L1221
31,941
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.swapRowAndColumns
public WorkSheet swapRowAndColumns() throws Exception { WorkSheet swappedWorkSheet = new WorkSheet(getColumns(), getRows()); for (String row : getRows()) { for (String col : getColumns()) { String value = getCell(row, col); swappedWorkSheet.addCell(col, row, value); } } ArrayList<String> metadataRows = this.getMetaDataRows(); ArrayList<String> metadataColumns = this.getMetaDataColumns(); swappedWorkSheet.setMetaDataColumns(metadataRows); swappedWorkSheet.setMetaDataRows(metadataColumns); return swappedWorkSheet; }
java
public WorkSheet swapRowAndColumns() throws Exception { WorkSheet swappedWorkSheet = new WorkSheet(getColumns(), getRows()); for (String row : getRows()) { for (String col : getColumns()) { String value = getCell(row, col); swappedWorkSheet.addCell(col, row, value); } } ArrayList<String> metadataRows = this.getMetaDataRows(); ArrayList<String> metadataColumns = this.getMetaDataColumns(); swappedWorkSheet.setMetaDataColumns(metadataRows); swappedWorkSheet.setMetaDataRows(metadataColumns); return swappedWorkSheet; }
[ "public", "WorkSheet", "swapRowAndColumns", "(", ")", "throws", "Exception", "{", "WorkSheet", "swappedWorkSheet", "=", "new", "WorkSheet", "(", "getColumns", "(", ")", ",", "getRows", "(", ")", ")", ";", "for", "(", "String", "row", ":", "getRows", "(", "...
Swap the row and columns returning a new worksheet @return @throws Exception
[ "Swap", "the", "row", "and", "columns", "returning", "a", "new", "worksheet" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1229-L1244
31,942
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.getAllValuesCompactCharSequence
static CompactCharSequence[][] getAllValuesCompactCharSequence(InputStream is, char delimiter) throws Exception { // FileReader reader = new FileReader(fileName); BufferedReader br = new BufferedReader(new InputStreamReader(is)); ArrayList<CompactCharSequence[]> rows = new ArrayList<CompactCharSequence[]>(); String line = br.readLine(); int numcolumns = -1; while (line != null) { String[] d = line.split(String.valueOf(delimiter)); if (numcolumns == -1) { numcolumns = d.length; } CompactCharSequence[] ccs = new CompactCharSequence[d.length]; for (int i = 0; i < d.length; i++) { ccs[i] = new CompactCharSequence(d[i]); } rows.add(ccs); line = br.readLine(); } br.close(); // reader.close(); CompactCharSequence[][] data = new CompactCharSequence[rows.size()][numcolumns]; for (int i = 0; i < rows.size(); i++) { CompactCharSequence[] row = rows.get(i); for (int j = 0; j < row.length; j++) { // if (row[j].length() > 1 && row[j].charAt(0) == '"') { // System.out.println(row[j]); if (row[j].length() > 2) { row[j] = new CompactCharSequence(row[j].subSequence(1, row[j].length() - 1).toString()); } else { row[j] = new CompactCharSequence(""); } } if (j < row.length && j < data[0].length) { data[i][j] = row[j]; } } } return data; }
java
static CompactCharSequence[][] getAllValuesCompactCharSequence(InputStream is, char delimiter) throws Exception { // FileReader reader = new FileReader(fileName); BufferedReader br = new BufferedReader(new InputStreamReader(is)); ArrayList<CompactCharSequence[]> rows = new ArrayList<CompactCharSequence[]>(); String line = br.readLine(); int numcolumns = -1; while (line != null) { String[] d = line.split(String.valueOf(delimiter)); if (numcolumns == -1) { numcolumns = d.length; } CompactCharSequence[] ccs = new CompactCharSequence[d.length]; for (int i = 0; i < d.length; i++) { ccs[i] = new CompactCharSequence(d[i]); } rows.add(ccs); line = br.readLine(); } br.close(); // reader.close(); CompactCharSequence[][] data = new CompactCharSequence[rows.size()][numcolumns]; for (int i = 0; i < rows.size(); i++) { CompactCharSequence[] row = rows.get(i); for (int j = 0; j < row.length; j++) { // if (row[j].length() > 1 && row[j].charAt(0) == '"') { // System.out.println(row[j]); if (row[j].length() > 2) { row[j] = new CompactCharSequence(row[j].subSequence(1, row[j].length() - 1).toString()); } else { row[j] = new CompactCharSequence(""); } } if (j < row.length && j < data[0].length) { data[i][j] = row[j]; } } } return data; }
[ "static", "CompactCharSequence", "[", "]", "[", "]", "getAllValuesCompactCharSequence", "(", "InputStream", "is", ",", "char", "delimiter", ")", "throws", "Exception", "{", "// FileReader reader = new FileReader(fileName);", "BufferedReader", "br", "=", "new", "BufferedRe...
All support for loading from a jar file @param is @param delimiter @return @throws Exception
[ "All", "support", "for", "loading", "from", "a", "jar", "file" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1259-L1307
31,943
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.unionWorkSheetsRowJoin
static public WorkSheet unionWorkSheetsRowJoin(String w1FileName, String w2FileName, char delimitter, boolean secondSheetMetaData) throws Exception { WorkSheet w1 = WorkSheet.readCSV(w1FileName, delimitter); WorkSheet w2 = WorkSheet.readCSV(w2FileName, delimitter); return unionWorkSheetsRowJoin(w1, w2, secondSheetMetaData); }
java
static public WorkSheet unionWorkSheetsRowJoin(String w1FileName, String w2FileName, char delimitter, boolean secondSheetMetaData) throws Exception { WorkSheet w1 = WorkSheet.readCSV(w1FileName, delimitter); WorkSheet w2 = WorkSheet.readCSV(w2FileName, delimitter); return unionWorkSheetsRowJoin(w1, w2, secondSheetMetaData); }
[ "static", "public", "WorkSheet", "unionWorkSheetsRowJoin", "(", "String", "w1FileName", ",", "String", "w2FileName", ",", "char", "delimitter", ",", "boolean", "secondSheetMetaData", ")", "throws", "Exception", "{", "WorkSheet", "w1", "=", "WorkSheet", ".", "readCSV...
Combine two work sheets where you join based on rows. Rows that are found in one but not the other are removed. If the second sheet is meta data then a meta data column will be added between the two joined columns @param w1FileName @param w2FileName @param delimitter @param secondSheetMetaData @return @throws Exception
[ "Combine", "two", "work", "sheets", "where", "you", "join", "based", "on", "rows", ".", "Rows", "that", "are", "found", "in", "one", "but", "not", "the", "other", "are", "removed", ".", "If", "the", "second", "sheet", "is", "meta", "data", "then", "a",...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1358-L1363
31,944
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.saveCSV
public void saveCSV(String fileName) throws Exception { File f = new File(fileName); File parentFile = f.getParentFile(); if (!parentFile.isDirectory()) { parentFile.mkdirs(); } FileOutputStream file = new FileOutputStream(fileName); BufferedOutputStream bs = new BufferedOutputStream(file); save(bs, ',', false); bs.close(); file.close(); }
java
public void saveCSV(String fileName) throws Exception { File f = new File(fileName); File parentFile = f.getParentFile(); if (!parentFile.isDirectory()) { parentFile.mkdirs(); } FileOutputStream file = new FileOutputStream(fileName); BufferedOutputStream bs = new BufferedOutputStream(file); save(bs, ',', false); bs.close(); file.close(); }
[ "public", "void", "saveCSV", "(", "String", "fileName", ")", "throws", "Exception", "{", "File", "f", "=", "new", "File", "(", "fileName", ")", ";", "File", "parentFile", "=", "f", ".", "getParentFile", "(", ")", ";", "if", "(", "!", "parentFile", ".",...
Save the worksheet as a csv file @param fileName @throws Exception
[ "Save", "the", "worksheet", "as", "a", "csv", "file" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1489-L1500
31,945
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.appendWorkSheetColumns
public void appendWorkSheetColumns(WorkSheet worksheet) throws Exception { ArrayList<String> newColumns = worksheet.getColumns(); this.addColumns(newColumns, ""); ArrayList<String> rows = this.getRows(); for (String row : rows) { for (String col : newColumns) { if (worksheet.isValidRow(row)) { String value = worksheet.getCell(row, col); this.addCell(row, col, value); } } } }
java
public void appendWorkSheetColumns(WorkSheet worksheet) throws Exception { ArrayList<String> newColumns = worksheet.getColumns(); this.addColumns(newColumns, ""); ArrayList<String> rows = this.getRows(); for (String row : rows) { for (String col : newColumns) { if (worksheet.isValidRow(row)) { String value = worksheet.getCell(row, col); this.addCell(row, col, value); } } } }
[ "public", "void", "appendWorkSheetColumns", "(", "WorkSheet", "worksheet", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">", "newColumns", "=", "worksheet", ".", "getColumns", "(", ")", ";", "this", ".", "addColumns", "(", "newColumns", ",", "\...
Add columns from a second worksheet to be joined by common row. If the appended worksheet doesn't contain a row in the master worksheet then default value of "" is used. Rows in the appended worksheet not found in the master worksheet are not added. @param worksheet @throws Exception
[ "Add", "columns", "from", "a", "second", "worksheet", "to", "be", "joined", "by", "common", "row", ".", "If", "the", "appended", "worksheet", "doesn", "t", "contain", "a", "row", "in", "the", "master", "worksheet", "then", "default", "value", "of", "is", ...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1538-L1556
31,946
biojava/biojava
biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java
WorkSheet.appendWorkSheetRows
public void appendWorkSheetRows(WorkSheet worksheet) throws Exception { ArrayList<String> newRows = worksheet.getRows(); this.addRows(newRows, ""); for (String col : this.getColumns()) { if (!worksheet.isValidColumn(col)) { continue; } for (String row : newRows) { if (worksheet.isValidColumn(col)) { String value = worksheet.getCell(row, col); this.addCell(row, col, value); } } } }
java
public void appendWorkSheetRows(WorkSheet worksheet) throws Exception { ArrayList<String> newRows = worksheet.getRows(); this.addRows(newRows, ""); for (String col : this.getColumns()) { if (!worksheet.isValidColumn(col)) { continue; } for (String row : newRows) { if (worksheet.isValidColumn(col)) { String value = worksheet.getCell(row, col); this.addCell(row, col, value); } } } }
[ "public", "void", "appendWorkSheetRows", "(", "WorkSheet", "worksheet", ")", "throws", "Exception", "{", "ArrayList", "<", "String", ">", "newRows", "=", "worksheet", ".", "getRows", "(", ")", ";", "this", ".", "addRows", "(", "newRows", ",", "\"\"", ")", ...
Add rows from a second worksheet to be joined by common column. If the appended worksheet doesn't contain a column in the master worksheet then default value of "" is used. Columns in the appended worksheet not found in the master worksheet are not added. @param worksheet @throws Exception
[ "Add", "rows", "from", "a", "second", "worksheet", "to", "be", "joined", "by", "common", "column", ".", "If", "the", "appended", "worksheet", "doesn", "t", "contain", "a", "column", "in", "the", "master", "worksheet", "then", "default", "value", "of", "is"...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-survival/src/main/java/org/biojava/nbio/survival/data/WorkSheet.java#L1567-L1585
31,947
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java
MmtfActions.readFromFile
public static Structure readFromFile(Path filePath) throws IOException { // Get the reader - this is the bit that people need to implement. MmtfStructureReader mmtfStructureReader = new MmtfStructureReader(); // Do the inflation new StructureDataToAdapter(new GenericDecoder(ReaderUtils.getDataFromFile(filePath)), mmtfStructureReader); // Get the structue return mmtfStructureReader.getStructure(); }
java
public static Structure readFromFile(Path filePath) throws IOException { // Get the reader - this is the bit that people need to implement. MmtfStructureReader mmtfStructureReader = new MmtfStructureReader(); // Do the inflation new StructureDataToAdapter(new GenericDecoder(ReaderUtils.getDataFromFile(filePath)), mmtfStructureReader); // Get the structue return mmtfStructureReader.getStructure(); }
[ "public", "static", "Structure", "readFromFile", "(", "Path", "filePath", ")", "throws", "IOException", "{", "// Get the reader - this is the bit that people need to implement.", "MmtfStructureReader", "mmtfStructureReader", "=", "new", "MmtfStructureReader", "(", ")", ";", "...
Get a Structure object from a mmtf file. @param filePath the mmtf file @return a Structure object relating to the input byte array. @throws IOException
[ "Get", "a", "Structure", "object", "from", "a", "mmtf", "file", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java#L48-L55
31,948
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java
MmtfActions.writeToFile
public static void writeToFile(Structure structure, Path path) throws IOException { // Set up this writer AdapterToStructureData writerToEncoder = new AdapterToStructureData(); // Get the writer - this is what people implement new MmtfStructureWriter(structure, writerToEncoder); // Now write this data to file WriterUtils.writeDataToFile(writerToEncoder, path); }
java
public static void writeToFile(Structure structure, Path path) throws IOException { // Set up this writer AdapterToStructureData writerToEncoder = new AdapterToStructureData(); // Get the writer - this is what people implement new MmtfStructureWriter(structure, writerToEncoder); // Now write this data to file WriterUtils.writeDataToFile(writerToEncoder, path); }
[ "public", "static", "void", "writeToFile", "(", "Structure", "structure", ",", "Path", "path", ")", "throws", "IOException", "{", "// Set up this writer", "AdapterToStructureData", "writerToEncoder", "=", "new", "AdapterToStructureData", "(", ")", ";", "// Get the write...
Write a Structure object to a file. @param structure the Structure to write @param path the file to write @throws IOException
[ "Write", "a", "Structure", "object", "to", "a", "file", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java#L63-L70
31,949
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java
MmtfActions.readFromWeb
public static Structure readFromWeb(String pdbId) throws IOException { // Get the reader - this is the bit that people need to implement. MmtfStructureReader mmtfStructureReader = new MmtfStructureReader(); // Do the inflation new StructureDataToAdapter(new GenericDecoder(ReaderUtils.getDataFromUrl(pdbId)), mmtfStructureReader); // Get the structue return mmtfStructureReader.getStructure(); }
java
public static Structure readFromWeb(String pdbId) throws IOException { // Get the reader - this is the bit that people need to implement. MmtfStructureReader mmtfStructureReader = new MmtfStructureReader(); // Do the inflation new StructureDataToAdapter(new GenericDecoder(ReaderUtils.getDataFromUrl(pdbId)), mmtfStructureReader); // Get the structue return mmtfStructureReader.getStructure(); }
[ "public", "static", "Structure", "readFromWeb", "(", "String", "pdbId", ")", "throws", "IOException", "{", "// Get the reader - this is the bit that people need to implement.", "MmtfStructureReader", "mmtfStructureReader", "=", "new", "MmtfStructureReader", "(", ")", ";", "//...
Get a Biojava structure from the mmtf REST service. @param pdbId the PDB code of the required structure @return a Structure object relating to the input byte array @throws IOException
[ "Get", "a", "Biojava", "structure", "from", "the", "mmtf", "REST", "service", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfActions.java#L95-L102
31,950
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsembleImpl.java
MultipleAlignmentEnsembleImpl.updateDistanceMatrix
public void updateDistanceMatrix() { // Reset the distance Matrix variable distanceMatrix = new ArrayList<Matrix>(); for (int s = 0; s < size(); s++) { Atom[] ca = atomArrays.get(s); Matrix distMat = AlignUtils.getDistanceMatrix(ca, ca); distanceMatrix.add(distMat); } }
java
public void updateDistanceMatrix() { // Reset the distance Matrix variable distanceMatrix = new ArrayList<Matrix>(); for (int s = 0; s < size(); s++) { Atom[] ca = atomArrays.get(s); Matrix distMat = AlignUtils.getDistanceMatrix(ca, ca); distanceMatrix.add(distMat); } }
[ "public", "void", "updateDistanceMatrix", "(", ")", "{", "// Reset the distance Matrix variable", "distanceMatrix", "=", "new", "ArrayList", "<", "Matrix", ">", "(", ")", ";", "for", "(", "int", "s", "=", "0", ";", "s", "<", "size", "(", ")", ";", "s", "...
Force recalculation of the distance matrices.
[ "Force", "recalculation", "of", "the", "distance", "matrices", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/multiple/MultipleAlignmentEnsembleImpl.java#L346-L356
31,951
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java
ProfeatProperties.getComposition
public static double getComposition(ProteinSequence sequence, ATTRIBUTE attribute, GROUPING group) throws Exception{ return new ProfeatPropertiesImpl().getComposition(sequence, attribute, group); }
java
public static double getComposition(ProteinSequence sequence, ATTRIBUTE attribute, GROUPING group) throws Exception{ return new ProfeatPropertiesImpl().getComposition(sequence, attribute, group); }
[ "public", "static", "double", "getComposition", "(", "ProteinSequence", "sequence", ",", "ATTRIBUTE", "attribute", ",", "GROUPING", "group", ")", "throws", "Exception", "{", "return", "new", "ProfeatPropertiesImpl", "(", ")", ".", "getComposition", "(", "sequence", ...
An adaptor method which returns the composition of the specific grouping for the given attribute. @param sequence a protein sequence consisting of non-ambiguous characters only @param attribute one of the seven attributes (Hydrophobicity, Volume, Polarity, Polarizability, Charge, SecondaryStructure or SolventAccessibility) @param group the grouping to be computed @return returns the composition of the specific grouping for the given attribute @throws Exception throws Exception if attribute or group are unknown
[ "An", "adaptor", "method", "which", "returns", "the", "composition", "of", "the", "specific", "grouping", "for", "the", "given", "attribute", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java#L56-L58
31,952
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java
ProfeatProperties.getTransition
public static double getTransition(ProteinSequence sequence, ATTRIBUTE attribute, TRANSITION transition) throws Exception{ return new ProfeatPropertiesImpl().getTransition(sequence, attribute, transition); }
java
public static double getTransition(ProteinSequence sequence, ATTRIBUTE attribute, TRANSITION transition) throws Exception{ return new ProfeatPropertiesImpl().getTransition(sequence, attribute, transition); }
[ "public", "static", "double", "getTransition", "(", "ProteinSequence", "sequence", ",", "ATTRIBUTE", "attribute", ",", "TRANSITION", "transition", ")", "throws", "Exception", "{", "return", "new", "ProfeatPropertiesImpl", "(", ")", ".", "getTransition", "(", "sequen...
An adaptor method which returns the number of transition between the specified groups for the given attribute with respect to the length of sequence. @param sequence a protein sequence consisting of non-ambiguous characters only @param attribute one of the seven attributes (Hydrophobicity, Volume, Polarity, Polarizability, Charge, SecondaryStructure or SolventAccessibility) @param transition the interested transition between the groups @return returns the number of transition between the specified groups for the given attribute with respect to the length of sequence. @throws Exception throws Exception if attribute or group are unknown
[ "An", "adaptor", "method", "which", "returns", "the", "number", "of", "transition", "between", "the", "specified", "groups", "for", "the", "given", "attribute", "with", "respect", "to", "the", "length", "of", "sequence", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java#L94-L96
31,953
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java
AbstractMatrixAligner.getScoreMatrix
@Override public int[][][] getScoreMatrix() { boolean tempStoringScoreMatrix = storingScoreMatrix; if (scores == null) { storingScoreMatrix = true; align(); if (scores == null) { return null; } } int[][][] copy = scores; if (tempStoringScoreMatrix) { copy = new int[scores.length][scores[0].length][]; for (int i = 0; i < copy.length; i++) { for (int j = 0; j < copy[0].length; j++) { copy[i][j] = Arrays.copyOf(scores[i][j], scores[i][j].length); } } } setStoringScoreMatrix(tempStoringScoreMatrix); return copy; }
java
@Override public int[][][] getScoreMatrix() { boolean tempStoringScoreMatrix = storingScoreMatrix; if (scores == null) { storingScoreMatrix = true; align(); if (scores == null) { return null; } } int[][][] copy = scores; if (tempStoringScoreMatrix) { copy = new int[scores.length][scores[0].length][]; for (int i = 0; i < copy.length; i++) { for (int j = 0; j < copy[0].length; j++) { copy[i][j] = Arrays.copyOf(scores[i][j], scores[i][j].length); } } } setStoringScoreMatrix(tempStoringScoreMatrix); return copy; }
[ "@", "Override", "public", "int", "[", "]", "[", "]", "[", "]", "getScoreMatrix", "(", ")", "{", "boolean", "tempStoringScoreMatrix", "=", "storingScoreMatrix", ";", "if", "(", "scores", "==", "null", ")", "{", "storingScoreMatrix", "=", "true", ";", "alig...
methods for MatrixAligner
[ "methods", "for", "MatrixAligner" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java#L188-L209
31,954
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java
AbstractMatrixAligner.getSubstitutionScoreVector
protected int[] getSubstitutionScoreVector(int queryColumn, Subproblem subproblem) { int[] subs = new int[subproblem.getTargetEndIndex() + 1]; if (queryColumn > 0) { for (int y = Math.max(1, subproblem.getTargetStartIndex()); y <= subproblem.getTargetEndIndex(); y++) { subs[y] = getSubstitutionScore(queryColumn, y); } } return subs; }
java
protected int[] getSubstitutionScoreVector(int queryColumn, Subproblem subproblem) { int[] subs = new int[subproblem.getTargetEndIndex() + 1]; if (queryColumn > 0) { for (int y = Math.max(1, subproblem.getTargetStartIndex()); y <= subproblem.getTargetEndIndex(); y++) { subs[y] = getSubstitutionScore(queryColumn, y); } } return subs; }
[ "protected", "int", "[", "]", "getSubstitutionScoreVector", "(", "int", "queryColumn", ",", "Subproblem", "subproblem", ")", "{", "int", "[", "]", "subs", "=", "new", "int", "[", "subproblem", ".", "getTargetEndIndex", "(", ")", "+", "1", "]", ";", "if", ...
Returns score for the alignment of the query column to all target columns @param queryColumn @param subproblem @return
[ "Returns", "score", "for", "the", "alignment", "of", "the", "query", "column", "to", "all", "target", "columns" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java#L382-L390
31,955
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java
AbstractMatrixAligner.reset
protected void reset() { xyMax = new int[] {0, 0}; xyStart = new int[] {0, 0}; scores = null; types = (gapPenalty == null || gapPenalty.getType() == GapPenalty.Type.LINEAR) ? new String[] { null } : new String[] { "Substitution", "Deletion", "Insertion" }; time = -1; profile = null; }
java
protected void reset() { xyMax = new int[] {0, 0}; xyStart = new int[] {0, 0}; scores = null; types = (gapPenalty == null || gapPenalty.getType() == GapPenalty.Type.LINEAR) ? new String[] { null } : new String[] { "Substitution", "Deletion", "Insertion" }; time = -1; profile = null; }
[ "protected", "void", "reset", "(", ")", "{", "xyMax", "=", "new", "int", "[", "]", "{", "0", ",", "0", "}", ";", "xyStart", "=", "new", "int", "[", "]", "{", "0", ",", "0", "}", ";", "scores", "=", "null", ";", "types", "=", "(", "gapPenalty"...
Resets output fields; should be overridden to set max and min
[ "Resets", "output", "fields", ";", "should", "be", "overridden", "to", "set", "max", "and", "min" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/template/AbstractMatrixAligner.java#L395-L403
31,956
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java
UnitQuaternions.angle
public static double angle(Quat4d q) { AxisAngle4d axis = new AxisAngle4d(); axis.set(q); return axis.angle; }
java
public static double angle(Quat4d q) { AxisAngle4d axis = new AxisAngle4d(); axis.set(q); return axis.angle; }
[ "public", "static", "double", "angle", "(", "Quat4d", "q", ")", "{", "AxisAngle4d", "axis", "=", "new", "AxisAngle4d", "(", ")", ";", "axis", ".", "set", "(", "q", ")", ";", "return", "axis", ".", "angle", ";", "}" ]
Calculate the rotation angle component of the input unit quaternion. @param q unit quaternion Quat4d @return the angle in radians of the input quaternion
[ "Calculate", "the", "rotation", "angle", "component", "of", "the", "input", "unit", "quaternion", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java#L134-L138
31,957
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java
UnitQuaternions.relativeOrientation
public static Quat4d relativeOrientation(Point3d[] fixed, Point3d[] moved) { Matrix m = CalcPoint.formMatrix(moved, fixed); // inverse EigenvalueDecomposition eig = m.eig(); double[][] v = eig.getV().getArray(); Quat4d q = new Quat4d(v[1][3], v[2][3], v[3][3], v[0][3]); q.normalize(); q.conjugate(); return q; }
java
public static Quat4d relativeOrientation(Point3d[] fixed, Point3d[] moved) { Matrix m = CalcPoint.formMatrix(moved, fixed); // inverse EigenvalueDecomposition eig = m.eig(); double[][] v = eig.getV().getArray(); Quat4d q = new Quat4d(v[1][3], v[2][3], v[3][3], v[0][3]); q.normalize(); q.conjugate(); return q; }
[ "public", "static", "Quat4d", "relativeOrientation", "(", "Point3d", "[", "]", "fixed", ",", "Point3d", "[", "]", "moved", ")", "{", "Matrix", "m", "=", "CalcPoint", ".", "formMatrix", "(", "moved", ",", "fixed", ")", ";", "// inverse", "EigenvalueDecomposit...
Calculate the relative quaternion orientation of two arrays of points. @param fixed point array, coordinates will not be modified @param moved point array, coordinates will not be modified @return a unit quaternion representing the relative orientation, to rotate moved to bring it to the same orientation as fixed.
[ "Calculate", "the", "relative", "quaternion", "orientation", "of", "two", "arrays", "of", "points", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java#L199-L207
31,958
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java
AbstractLocation.iterator
@Override public Iterator<Location> iterator() { List<Location> list; if(isComplex()) { list = getSubLocations(); } else { list = new ArrayList<Location>(); list.add(this); } return list.iterator(); }
java
@Override public Iterator<Location> iterator() { List<Location> list; if(isComplex()) { list = getSubLocations(); } else { list = new ArrayList<Location>(); list.add(this); } return list.iterator(); }
[ "@", "Override", "public", "Iterator", "<", "Location", ">", "iterator", "(", ")", "{", "List", "<", "Location", ">", "list", ";", "if", "(", "isComplex", "(", ")", ")", "{", "list", "=", "getSubLocations", "(", ")", ";", "}", "else", "{", "list", ...
Iterates through all known sub-locations for this location but does not descend
[ "Iterates", "through", "all", "known", "sub", "-", "locations", "for", "this", "location", "but", "does", "not", "descend" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java#L220-L231
31,959
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java
AbstractLocation.getAllSubLocations
private List<Location> getAllSubLocations(Location location) { List<Location> flatSubLocations = new ArrayList<Location>(); for (Location l : location.getSubLocations()) { if (l.isComplex()) { flatSubLocations.addAll(getAllSubLocations(l)); } else { flatSubLocations.add(l); } } return flatSubLocations; }
java
private List<Location> getAllSubLocations(Location location) { List<Location> flatSubLocations = new ArrayList<Location>(); for (Location l : location.getSubLocations()) { if (l.isComplex()) { flatSubLocations.addAll(getAllSubLocations(l)); } else { flatSubLocations.add(l); } } return flatSubLocations; }
[ "private", "List", "<", "Location", ">", "getAllSubLocations", "(", "Location", "location", ")", "{", "List", "<", "Location", ">", "flatSubLocations", "=", "new", "ArrayList", "<", "Location", ">", "(", ")", ";", "for", "(", "Location", "l", ":", "locatio...
Here to allow for recursion
[ "Here", "to", "allow", "for", "recursion" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java#L247-L258
31,960
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java
AbstractLocation.getSubSequence
@Override public <C extends Compound> Sequence<C> getSubSequence(Sequence<C> sequence) { if(isCircular()) { List<Sequence<C>> sequences = new ArrayList<Sequence<C>>(); for(Location l: this) { sequences.add(l.getSubSequence(sequence)); } return new JoiningSequenceReader<C>(sequence.getCompoundSet(), sequences); } return reverseSequence(sequence.getSubSequence( getStart().getPosition(), getEnd().getPosition())); }
java
@Override public <C extends Compound> Sequence<C> getSubSequence(Sequence<C> sequence) { if(isCircular()) { List<Sequence<C>> sequences = new ArrayList<Sequence<C>>(); for(Location l: this) { sequences.add(l.getSubSequence(sequence)); } return new JoiningSequenceReader<C>(sequence.getCompoundSet(), sequences); } return reverseSequence(sequence.getSubSequence( getStart().getPosition(), getEnd().getPosition())); }
[ "@", "Override", "public", "<", "C", "extends", "Compound", ">", "Sequence", "<", "C", ">", "getSubSequence", "(", "Sequence", "<", "C", ">", "sequence", ")", "{", "if", "(", "isCircular", "(", ")", ")", "{", "List", "<", "Sequence", "<", "C", ">>", ...
If circular this will return the sequence represented by the sub locations joined. If not circular then we get the Sequence for the outer-bounds defined by this location.
[ "If", "circular", "this", "will", "return", "the", "sequence", "represented", "by", "the", "sub", "locations", "joined", ".", "If", "not", "circular", "then", "we", "get", "the", "Sequence", "for", "the", "outer", "-", "bounds", "defined", "by", "this", "l...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java#L311-L322
31,961
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java
AbstractLocation.canComplement
protected <C extends Compound> boolean canComplement(Sequence<C> sequence) { CompoundSet<C> compoundSet = sequence.getCompoundSet(); Compound c = compoundSet.getAllCompounds().iterator().next(); return ComplementCompound.class.isAssignableFrom(c.getClass()); }
java
protected <C extends Compound> boolean canComplement(Sequence<C> sequence) { CompoundSet<C> compoundSet = sequence.getCompoundSet(); Compound c = compoundSet.getAllCompounds().iterator().next(); return ComplementCompound.class.isAssignableFrom(c.getClass()); }
[ "protected", "<", "C", "extends", "Compound", ">", "boolean", "canComplement", "(", "Sequence", "<", "C", ">", "sequence", ")", "{", "CompoundSet", "<", "C", ">", "compoundSet", "=", "sequence", ".", "getCompoundSet", "(", ")", ";", "Compound", "c", "=", ...
Uses the Sequence's CompoundSet to decide if a compound can be assgined to ComplementCompound meaning it can complement
[ "Uses", "the", "Sequence", "s", "CompoundSet", "to", "decide", "if", "a", "compound", "can", "be", "assgined", "to", "ComplementCompound", "meaning", "it", "can", "complement" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java#L363-L367
31,962
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.getRmsd
private static double getRmsd(int focusResn, int[] focusRes1, int[] focusRes2, AFPChain afpChain, Atom[] ca1, Atom[] ca2){ Atom[] tmp1 = new Atom[focusResn]; Atom[] tmp2 = new Atom[focusResn]; for ( int i =0 ; i< focusResn;i++){ tmp1[i] = ca1[focusRes1[i]]; tmp2[i] = (Atom)ca2[focusRes2[i]].clone(); if (tmp1[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]); } if (tmp2[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes2[i]); } //XX //tmp2[i].setParent((Group) ca2[focusRes2[i]].getParent().clone()); } double rmsd = 99; try { rmsd = getRmsd(tmp1,tmp2); } catch (Exception e){ e.printStackTrace(); } return rmsd; }
java
private static double getRmsd(int focusResn, int[] focusRes1, int[] focusRes2, AFPChain afpChain, Atom[] ca1, Atom[] ca2){ Atom[] tmp1 = new Atom[focusResn]; Atom[] tmp2 = new Atom[focusResn]; for ( int i =0 ; i< focusResn;i++){ tmp1[i] = ca1[focusRes1[i]]; tmp2[i] = (Atom)ca2[focusRes2[i]].clone(); if (tmp1[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes1[i]); } if (tmp2[i].getCoords() == null){ System.err.println("tmp1 got null: " +i + " pos: " + focusRes2[i]); } //XX //tmp2[i].setParent((Group) ca2[focusRes2[i]].getParent().clone()); } double rmsd = 99; try { rmsd = getRmsd(tmp1,tmp2); } catch (Exception e){ e.printStackTrace(); } return rmsd; }
[ "private", "static", "double", "getRmsd", "(", "int", "focusResn", ",", "int", "[", "]", "focusRes1", ",", "int", "[", "]", "focusRes2", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "{", "Atom", "[", ...
the the RMSD for the residues defined in the two arrays @param focusResn @param focusRes1 @param focusRes2 @return
[ "the", "the", "RMSD", "for", "the", "residues", "defined", "in", "the", "two", "arrays" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L666-L694
31,963
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java
AFPChainer.getRmsd
private static double getRmsd(Atom[] catmp1, Atom[] catmp2) throws StructureException{ Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(catmp1), Calc.atomsToPoints(catmp2)); Calc.transform(catmp2, trans); // if ( showAlig) { // StructureAlignmentJmol jmol = new StructureAlignmentJmol(); // jmol.setTitle("AFPCHainer: getRmsd" + rmsd); // // Chain c1 = new ChainImpl(); // c1.setName("A"); // for ( Atom a : catmp1){ // c1.addGroup(a.getParent()); // } // // Chain c2 = new ChainImpl(); // c2.setName("B"); // for ( Atom a : catmp2){ // c2.addGroup(a.getParent()); // } // // Structure fake = new StructureImpl(); // fake.setPDBCode("AFPCHainer: getRmsd" + rmsd); // List<Chain> model1 = new ArrayList<Chain>(); // model1.add(c1); // List<Chain> model2 = new ArrayList<Chain>(); // model2.add(c2); // fake.addModel(model1); // fake.addModel(model2); // fake.setNmr(true); // // jmol.setStructure(fake); // jmol.evalString("select *; backbone 0.4; wireframe off; spacefill off; " + // "select not protein and not solvent; spacefill on;"); // jmol.evalString("select */1 ; color red; model 1; "); // // // now show both models again. // jmol.evalString("model 0;"); // } return Calc.rmsd(catmp1,catmp2); }
java
private static double getRmsd(Atom[] catmp1, Atom[] catmp2) throws StructureException{ Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(catmp1), Calc.atomsToPoints(catmp2)); Calc.transform(catmp2, trans); // if ( showAlig) { // StructureAlignmentJmol jmol = new StructureAlignmentJmol(); // jmol.setTitle("AFPCHainer: getRmsd" + rmsd); // // Chain c1 = new ChainImpl(); // c1.setName("A"); // for ( Atom a : catmp1){ // c1.addGroup(a.getParent()); // } // // Chain c2 = new ChainImpl(); // c2.setName("B"); // for ( Atom a : catmp2){ // c2.addGroup(a.getParent()); // } // // Structure fake = new StructureImpl(); // fake.setPDBCode("AFPCHainer: getRmsd" + rmsd); // List<Chain> model1 = new ArrayList<Chain>(); // model1.add(c1); // List<Chain> model2 = new ArrayList<Chain>(); // model2.add(c2); // fake.addModel(model1); // fake.addModel(model2); // fake.setNmr(true); // // jmol.setStructure(fake); // jmol.evalString("select *; backbone 0.4; wireframe off; spacefill off; " + // "select not protein and not solvent; spacefill on;"); // jmol.evalString("select */1 ; color red; model 1; "); // // // now show both models again. // jmol.evalString("model 0;"); // } return Calc.rmsd(catmp1,catmp2); }
[ "private", "static", "double", "getRmsd", "(", "Atom", "[", "]", "catmp1", ",", "Atom", "[", "]", "catmp2", ")", "throws", "StructureException", "{", "Matrix4d", "trans", "=", "SuperPositions", ".", "superpose", "(", "Calc", ".", "atomsToPoints", "(", "catmp...
Calculate the RMSD for two sets of atoms. Rotates the 2nd atom set so make sure this does not cause problems later @param catmp1 @return
[ "Calculate", "the", "RMSD", "for", "two", "sets", "of", "atoms", ".", "Rotates", "the", "2nd", "atom", "set", "so", "make", "sure", "this", "does", "not", "cause", "problems", "later" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/AFPChainer.java#L701-L744
31,964
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/SphereSampler.java
SphereSampler.pind
private static double pind(double ind, double delta, double sigma) { return (sigma == 0) ? ind * delta : Math.sinh(sigma * ind * delta) / sigma; }
java
private static double pind(double ind, double delta, double sigma) { return (sigma == 0) ? ind * delta : Math.sinh(sigma * ind * delta) / sigma; }
[ "private", "static", "double", "pind", "(", "double", "ind", ",", "double", "delta", ",", "double", "sigma", ")", "{", "return", "(", "sigma", "==", "0", ")", "?", "ind", "*", "delta", ":", "Math", ".", "sinh", "(", "sigma", "*", "ind", "*", "delta...
unit sphere.
[ "unit", "sphere", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/SphereSampler.java#L241-L244
31,965
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java
MultipleSequenceAlignment.addAlignedSequence
public void addAlignedSequence(S sequence){ if(length == null){ length = sequence.getLength(); } if(sequence.getLength() != length){ throw new IllegalArgumentException(sequence.getAccession() + " length = " + sequence.getLength() + " not equal to MSA length = " + length); } sequences.add(sequence); }
java
public void addAlignedSequence(S sequence){ if(length == null){ length = sequence.getLength(); } if(sequence.getLength() != length){ throw new IllegalArgumentException(sequence.getAccession() + " length = " + sequence.getLength() + " not equal to MSA length = " + length); } sequences.add(sequence); }
[ "public", "void", "addAlignedSequence", "(", "S", "sequence", ")", "{", "if", "(", "length", "==", "null", ")", "{", "length", "=", "sequence", ".", "getLength", "(", ")", ";", "}", "if", "(", "sequence", ".", "getLength", "(", ")", "!=", "length", "...
A sequence that has been aligned to other sequences will have inserts. @param sequence
[ "A", "sequence", "that", "has", "been", "aligned", "to", "other", "sequences", "will", "have", "inserts", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java#L52-L61
31,966
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java
MultipleSequenceAlignment.getCompoundsAt
@Override public List<C> getCompoundsAt(int alignmentIndex) { List<C> column = new ArrayList<C>(); for (S s : sequences) { column.add(s.getCompoundAt(alignmentIndex)); } return Collections.unmodifiableList(column); }
java
@Override public List<C> getCompoundsAt(int alignmentIndex) { List<C> column = new ArrayList<C>(); for (S s : sequences) { column.add(s.getCompoundAt(alignmentIndex)); } return Collections.unmodifiableList(column); }
[ "@", "Override", "public", "List", "<", "C", ">", "getCompoundsAt", "(", "int", "alignmentIndex", ")", "{", "List", "<", "C", ">", "column", "=", "new", "ArrayList", "<", "C", ">", "(", ")", ";", "for", "(", "S", "s", ":", "sequences", ")", "{", ...
Get a list of compounds at a sequence position @param alignmentIndex @return compounds
[ "Get", "a", "list", "of", "compounds", "at", "a", "sequence", "position" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/MultipleSequenceAlignment.java#L99-L106
31,967
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java
SubstructureIdentifier.getIdentifier
@Override public String getIdentifier() { if (ranges.isEmpty()) return pdbId; return pdbId + "." + ResidueRange.toString(ranges); }
java
@Override public String getIdentifier() { if (ranges.isEmpty()) return pdbId; return pdbId + "." + ResidueRange.toString(ranges); }
[ "@", "Override", "public", "String", "getIdentifier", "(", ")", "{", "if", "(", "ranges", ".", "isEmpty", "(", ")", ")", "return", "pdbId", ";", "return", "pdbId", "+", "\".\"", "+", "ResidueRange", ".", "toString", "(", "ranges", ")", ";", "}" ]
Get the String form of this identifier. This provides the canonical form for a StructureIdentifier and has all the information needed to recreate a particular substructure. Example: 3iek.A_17-28,A_56-294 @return The String form of this identifier
[ "Get", "the", "String", "form", "of", "this", "identifier", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java#L136-L140
31,968
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java
SubunitExtractor.calcAdjustedMinimumSequenceLength
private static int calcAdjustedMinimumSequenceLength( List<Subunit> subunits, int absMinLen, double fraction, int minLen) { int maxLength = Integer.MIN_VALUE; int minLength = Integer.MAX_VALUE; // Extract the length List, the min and the max List<Integer> lengths = new ArrayList<Integer>(); for (int i = 0; i < subunits.size(); i++) { if (subunits.get(i).size() >= absMinLen) { maxLength = Math.max(subunits.get(i).size(), maxLength); minLength = Math.min(subunits.get(i).size(), minLength); lengths.add(subunits.get(i).size()); } } int adjustedMinimumSequenceLength = minLen; if (lengths.size() < 2) return adjustedMinimumSequenceLength; // Calculate the median of the lengths double median = 0; Collections.sort(lengths); if (lengths.size() % 2 == 1) { int middle = (lengths.size() - 1) / 2; median = lengths.get(middle); } else { int middle2 = lengths.size() / 2; int middle1 = middle2 - 1; median = 0.5 * (lengths.get(middle1) + lengths.get(middle2)); } // If the median * fraction is lower than the minLength if (minLength >= median * fraction) { adjustedMinimumSequenceLength = Math.min(minLength, minLen); } return adjustedMinimumSequenceLength; }
java
private static int calcAdjustedMinimumSequenceLength( List<Subunit> subunits, int absMinLen, double fraction, int minLen) { int maxLength = Integer.MIN_VALUE; int minLength = Integer.MAX_VALUE; // Extract the length List, the min and the max List<Integer> lengths = new ArrayList<Integer>(); for (int i = 0; i < subunits.size(); i++) { if (subunits.get(i).size() >= absMinLen) { maxLength = Math.max(subunits.get(i).size(), maxLength); minLength = Math.min(subunits.get(i).size(), minLength); lengths.add(subunits.get(i).size()); } } int adjustedMinimumSequenceLength = minLen; if (lengths.size() < 2) return adjustedMinimumSequenceLength; // Calculate the median of the lengths double median = 0; Collections.sort(lengths); if (lengths.size() % 2 == 1) { int middle = (lengths.size() - 1) / 2; median = lengths.get(middle); } else { int middle2 = lengths.size() / 2; int middle1 = middle2 - 1; median = 0.5 * (lengths.get(middle1) + lengths.get(middle2)); } // If the median * fraction is lower than the minLength if (minLength >= median * fraction) { adjustedMinimumSequenceLength = Math.min(minLength, minLen); } return adjustedMinimumSequenceLength; }
[ "private", "static", "int", "calcAdjustedMinimumSequenceLength", "(", "List", "<", "Subunit", ">", "subunits", ",", "int", "absMinLen", ",", "double", "fraction", ",", "int", "minLen", ")", "{", "int", "maxLength", "=", "Integer", ".", "MIN_VALUE", ";", "int",...
Returns an adapted minimum sequence length. This method ensure that structure that only have short chains are not excluded by the minimumSequenceLength cutoff value. @return adjustedMinimumSequenceLength
[ "Returns", "an", "adapted", "minimum", "sequence", "length", ".", "This", "method", "ensure", "that", "structure", "that", "only", "have", "short", "chains", "are", "not", "excluded", "by", "the", "minimumSequenceLength", "cutoff", "value", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitExtractor.java#L103-L143
31,969
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/Convertor.java
Convertor.convert
public String convert(ProteinSequence sequence){ String convertedSequence = ""; String uppercaseSequence = sequence.getSequenceAsString().toUpperCase(); for(int x = 0; x < uppercaseSequence.length(); x++){ convertedSequence += String.valueOf(convert(uppercaseSequence.charAt(x))); } return convertedSequence; }
java
public String convert(ProteinSequence sequence){ String convertedSequence = ""; String uppercaseSequence = sequence.getSequenceAsString().toUpperCase(); for(int x = 0; x < uppercaseSequence.length(); x++){ convertedSequence += String.valueOf(convert(uppercaseSequence.charAt(x))); } return convertedSequence; }
[ "public", "String", "convert", "(", "ProteinSequence", "sequence", ")", "{", "String", "convertedSequence", "=", "\"\"", ";", "String", "uppercaseSequence", "=", "sequence", ".", "getSequenceAsString", "(", ")", ".", "toUpperCase", "(", ")", ";", "for", "(", "...
Returns the converted sequence. The sequence argument must be a protein sequence consisting of preferably non-ambiguous characters only. Standard amino acids will be converted to '1', '2' or '3' depending on its grouping Non-standard amino acids are simply converted to '0'. @param sequence a protein sequence consisting of preferably non-ambiguous characters only @return the converted sequence
[ "Returns", "the", "converted", "sequence", ".", "The", "sequence", "argument", "must", "be", "a", "protein", "sequence", "consisting", "of", "preferably", "non", "-", "ambiguous", "characters", "only", ".", "Standard", "amino", "acids", "will", "be", "converted"...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/convertor/Convertor.java#L80-L87
31,970
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
SeqRes2AtomAligner.mapSeqresRecords
public void mapSeqresRecords(Chain atomRes, Chain seqRes) { List<Group> seqResGroups = seqRes.getAtomGroups(); List<Group> atmResGroups = atomRes.getAtomGroups(); logger.debug("Comparing ATOM {} ({} groups) to SEQRES {} ({} groups) ", atomRes.getId(), atmResGroups.size(), seqRes.getId(), seqResGroups.size()); List<Group> matchedGroups = trySimpleMatch(seqResGroups, atmResGroups); if ( matchedGroups != null) { // update the new SEQRES list atomRes.setSeqResGroups(matchedGroups); return; } logger.debug("Could not map SEQRES to ATOM records easily, need to align..."); int numAminosSeqres = seqRes.getAtomGroups(GroupType.AMINOACID).size(); int numNucleotidesSeqres = seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size(); if ( numAminosSeqres < 1) { if ( numNucleotidesSeqres > 1) { logger.debug("SEQRES chain {} is a nucleotide chain ({} nucleotides), aligning nucleotides...", seqRes.getId(), numNucleotidesSeqres); alignNucleotideChains(seqRes,atomRes); return; } else { logger.debug("SEQRES chain {} contains {} amino acids and {} nucleotides, ignoring...", seqRes.getId(),numAminosSeqres,numNucleotidesSeqres); return; } } if ( atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) { logger.debug("ATOM chain {} does not contain amino acids, ignoring...", atomRes.getId()); return; } logger.debug("Proceeding to do protein alignment for chain {}", atomRes.getId() ); boolean noMatchFound = alignProteinChains(seqResGroups,atomRes.getAtomGroups()); if ( ! noMatchFound){ atomRes.setSeqResGroups(seqResGroups); } }
java
public void mapSeqresRecords(Chain atomRes, Chain seqRes) { List<Group> seqResGroups = seqRes.getAtomGroups(); List<Group> atmResGroups = atomRes.getAtomGroups(); logger.debug("Comparing ATOM {} ({} groups) to SEQRES {} ({} groups) ", atomRes.getId(), atmResGroups.size(), seqRes.getId(), seqResGroups.size()); List<Group> matchedGroups = trySimpleMatch(seqResGroups, atmResGroups); if ( matchedGroups != null) { // update the new SEQRES list atomRes.setSeqResGroups(matchedGroups); return; } logger.debug("Could not map SEQRES to ATOM records easily, need to align..."); int numAminosSeqres = seqRes.getAtomGroups(GroupType.AMINOACID).size(); int numNucleotidesSeqres = seqRes.getAtomGroups(GroupType.NUCLEOTIDE).size(); if ( numAminosSeqres < 1) { if ( numNucleotidesSeqres > 1) { logger.debug("SEQRES chain {} is a nucleotide chain ({} nucleotides), aligning nucleotides...", seqRes.getId(), numNucleotidesSeqres); alignNucleotideChains(seqRes,atomRes); return; } else { logger.debug("SEQRES chain {} contains {} amino acids and {} nucleotides, ignoring...", seqRes.getId(),numAminosSeqres,numNucleotidesSeqres); return; } } if ( atomRes.getAtomGroups(GroupType.AMINOACID).size() < 1) { logger.debug("ATOM chain {} does not contain amino acids, ignoring...", atomRes.getId()); return; } logger.debug("Proceeding to do protein alignment for chain {}", atomRes.getId() ); boolean noMatchFound = alignProteinChains(seqResGroups,atomRes.getAtomGroups()); if ( ! noMatchFound){ atomRes.setSeqResGroups(seqResGroups); } }
[ "public", "void", "mapSeqresRecords", "(", "Chain", "atomRes", ",", "Chain", "seqRes", ")", "{", "List", "<", "Group", ">", "seqResGroups", "=", "seqRes", ".", "getAtomGroups", "(", ")", ";", "List", "<", "Group", ">", "atmResGroups", "=", "atomRes", ".", ...
Map the seqRes groups to the atomRes chain. Updates the atomRes chain object with the mapped data The seqRes chain should not be needed after this and atomRes should be further used. @param atomRes the chain containing ATOM groups (in atomGroups slot). This chain is modified to contain in its seqresGroups slot the mapped atom groups @param seqRes the chain containing SEQRES groups (in atomGroups slot). This chain is not modified
[ "Map", "the", "seqRes", "groups", "to", "the", "atomRes", "chain", ".", "Updates", "the", "atomRes", "chain", "object", "with", "the", "mapped", "data", "The", "seqRes", "chain", "should", "not", "be", "needed", "after", "this", "and", "atomRes", "should", ...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java#L162-L214
31,971
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
SeqRes2AtomAligner.getFullAtomSequence
public static String getFullAtomSequence(List<Group> groups, Map<Integer, Integer> positionIndex, boolean isNucleotideChain){ StringBuffer sequence = new StringBuffer() ; int seqIndex = 0; // track sequence.length() for ( int i=0 ; i< groups.size(); i++){ Group g = groups.get(i); if ( g instanceof AminoAcid ){ AminoAcid a = (AminoAcid)g; char oneLetter =a.getAminoType(); if ( oneLetter == '?') oneLetter = 'X'; positionIndex.put(seqIndex,i); sequence.append(oneLetter ); seqIndex++; } else { // exclude solvents if ( g.isWater()) continue; // exclude metals if ( g.size() == 1 ) { Atom a = g.getAtom(0); if ( a == null) continue; if (a.getElement().isMetal()) continue; } ChemComp cc = g.getChemComp(); if ( cc == null) { logger.debug("No chem comp available for group {}",g.toString()); // not sure what to do in that case! continue; } if ( ResidueType.lPeptideLinking.equals(cc.getResidueType()) || PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType()) ) { //System.out.println(cc.getOne_letter_code()); String c = cc.getOne_letter_code(); if ( c.equals("?")) { if (isNucleotideChain && PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())) { // the way to represent unknown nucleotides is with 'N', see https://en.wikipedia.org/wiki/Nucleic_acid_notation c = "N"; } else { c = "X"; } } // For some unusual cases the het residue can map to 2 or more standard aas and thus give an // insertion of length >1. // e.g. 1: SUI maps to DG (in 1oew,A) // e.g. 2: NRQ maps to MYG (in 3cfh,A) if (c.length()>1) { logger.info("Group '{}' maps to more than 1 standard aminoacid: {}.", g.toString(), c); } // because of the mapping to more than 1 aminoacid, we have // to loop through it (99% of cases c will have length 1 anyway) for (int cIdx=0;cIdx<c.length();cIdx++) { positionIndex.put(seqIndex,i); sequence.append(c.charAt(cIdx)); seqIndex++; } } else { logger.debug("Group {} is not lPeptideLinked, nor PROTEIN_ONLY, nor POLYNUCLEOTIDE_ONLY",g.toString()); continue; } //sequence.append("X"); } } return sequence.toString(); }
java
public static String getFullAtomSequence(List<Group> groups, Map<Integer, Integer> positionIndex, boolean isNucleotideChain){ StringBuffer sequence = new StringBuffer() ; int seqIndex = 0; // track sequence.length() for ( int i=0 ; i< groups.size(); i++){ Group g = groups.get(i); if ( g instanceof AminoAcid ){ AminoAcid a = (AminoAcid)g; char oneLetter =a.getAminoType(); if ( oneLetter == '?') oneLetter = 'X'; positionIndex.put(seqIndex,i); sequence.append(oneLetter ); seqIndex++; } else { // exclude solvents if ( g.isWater()) continue; // exclude metals if ( g.size() == 1 ) { Atom a = g.getAtom(0); if ( a == null) continue; if (a.getElement().isMetal()) continue; } ChemComp cc = g.getChemComp(); if ( cc == null) { logger.debug("No chem comp available for group {}",g.toString()); // not sure what to do in that case! continue; } if ( ResidueType.lPeptideLinking.equals(cc.getResidueType()) || PolymerType.PROTEIN_ONLY.contains(cc.getPolymerType()) || PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType()) ) { //System.out.println(cc.getOne_letter_code()); String c = cc.getOne_letter_code(); if ( c.equals("?")) { if (isNucleotideChain && PolymerType.POLYNUCLEOTIDE_ONLY.contains(cc.getPolymerType())) { // the way to represent unknown nucleotides is with 'N', see https://en.wikipedia.org/wiki/Nucleic_acid_notation c = "N"; } else { c = "X"; } } // For some unusual cases the het residue can map to 2 or more standard aas and thus give an // insertion of length >1. // e.g. 1: SUI maps to DG (in 1oew,A) // e.g. 2: NRQ maps to MYG (in 3cfh,A) if (c.length()>1) { logger.info("Group '{}' maps to more than 1 standard aminoacid: {}.", g.toString(), c); } // because of the mapping to more than 1 aminoacid, we have // to loop through it (99% of cases c will have length 1 anyway) for (int cIdx=0;cIdx<c.length();cIdx++) { positionIndex.put(seqIndex,i); sequence.append(c.charAt(cIdx)); seqIndex++; } } else { logger.debug("Group {} is not lPeptideLinked, nor PROTEIN_ONLY, nor POLYNUCLEOTIDE_ONLY",g.toString()); continue; } //sequence.append("X"); } } return sequence.toString(); }
[ "public", "static", "String", "getFullAtomSequence", "(", "List", "<", "Group", ">", "groups", ",", "Map", "<", "Integer", ",", "Integer", ">", "positionIndex", ",", "boolean", "isNucleotideChain", ")", "{", "StringBuffer", "sequence", "=", "new", "StringBuffer"...
Returns the full sequence of the Atom records of a parent with X instead of HETATMSs. The advantage of this is that it allows us to also align HETATM groups back to the SEQRES. @param groups the list of groups in a parent @param positionIndex a Map to keep track of which group is at which sequence position @param isNucleotideChain whether the atom groups are predominantly nucleotides (the groups represent a nucleotide chain), if true non-standard nucleotides will be represented with ambiguous letter 'N' instead of 'X', if false all non-standard residues will be 'X' @return string representations
[ "Returns", "the", "full", "sequence", "of", "the", "Atom", "records", "of", "a", "parent", "with", "X", "instead", "of", "HETATMSs", ".", "The", "advantage", "of", "this", "is", "that", "it", "allows", "us", "to", "also", "align", "HETATM", "groups", "ba...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java#L368-L451
31,972
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java
SeqRes2AtomAligner.storeUnAlignedSeqRes
public static void storeUnAlignedSeqRes(Structure structure, List<Chain> seqResChains, boolean headerOnly) { if (headerOnly) { List<Chain> atomChains = new ArrayList<>(); for (Chain seqRes: seqResChains) { // In header-only mode skip ATOM records. // Here we store chains with SEQRES instead of AtomGroups. seqRes.setSeqResGroups(seqRes.getAtomGroups()); seqRes.setAtomGroups(new ArrayList<>()); // clear out the atom groups. atomChains.add(seqRes); } structure.setChains(0, atomChains); } else { for (int i = 0; i < structure.nrModels(); i++) { List<Chain> atomChains = structure.getModel(i); for (Chain seqRes: seqResChains){ Chain atomRes; // Otherwise, we find a chain with AtomGroups // and set this as SEQRES groups. // TODO no idea if new parameter useChainId should be false or true here, used true as a guess - JD 2016-05-09 atomRes = SeqRes2AtomAligner.getMatchingAtomRes(seqRes,atomChains,true); if ( atomRes != null) atomRes.setSeqResGroups(seqRes.getAtomGroups()); else logger.warn("Could not find atom records for chain " + seqRes.getId()); } } } }
java
public static void storeUnAlignedSeqRes(Structure structure, List<Chain> seqResChains, boolean headerOnly) { if (headerOnly) { List<Chain> atomChains = new ArrayList<>(); for (Chain seqRes: seqResChains) { // In header-only mode skip ATOM records. // Here we store chains with SEQRES instead of AtomGroups. seqRes.setSeqResGroups(seqRes.getAtomGroups()); seqRes.setAtomGroups(new ArrayList<>()); // clear out the atom groups. atomChains.add(seqRes); } structure.setChains(0, atomChains); } else { for (int i = 0; i < structure.nrModels(); i++) { List<Chain> atomChains = structure.getModel(i); for (Chain seqRes: seqResChains){ Chain atomRes; // Otherwise, we find a chain with AtomGroups // and set this as SEQRES groups. // TODO no idea if new parameter useChainId should be false or true here, used true as a guess - JD 2016-05-09 atomRes = SeqRes2AtomAligner.getMatchingAtomRes(seqRes,atomChains,true); if ( atomRes != null) atomRes.setSeqResGroups(seqRes.getAtomGroups()); else logger.warn("Could not find atom records for chain " + seqRes.getId()); } } } }
[ "public", "static", "void", "storeUnAlignedSeqRes", "(", "Structure", "structure", ",", "List", "<", "Chain", ">", "seqResChains", ",", "boolean", "headerOnly", ")", "{", "if", "(", "headerOnly", ")", "{", "List", "<", "Chain", ">", "atomChains", "=", "new",...
Storing unaligned SEQRES groups in a Structure. @param structure @param seqResChains
[ "Storing", "unaligned", "SEQRES", "groups", "in", "a", "Structure", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java#L820-L858
31,973
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java
AbstractAlignmentJmol.setAtoms
public void setAtoms(Atom[] atoms){ Structure s = new StructureImpl(); Chain c = new ChainImpl(); c.setId("A"); for (Atom a: atoms){ c.addGroup(a.getGroup()); } s.addChain(c); setStructure(s); }
java
public void setAtoms(Atom[] atoms){ Structure s = new StructureImpl(); Chain c = new ChainImpl(); c.setId("A"); for (Atom a: atoms){ c.addGroup(a.getGroup()); } s.addChain(c); setStructure(s); }
[ "public", "void", "setAtoms", "(", "Atom", "[", "]", "atoms", ")", "{", "Structure", "s", "=", "new", "StructureImpl", "(", ")", ";", "Chain", "c", "=", "new", "ChainImpl", "(", ")", ";", "c", ".", "setId", "(", "\"A\"", ")", ";", "for", "(", "At...
Create and set a new structure from a given atom array. @param atoms
[ "Create", "and", "set", "a", "new", "structure", "from", "a", "given", "atom", "array", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java#L103-L112
31,974
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java
AbstractAlignmentJmol.evalString
public void evalString(String rasmolScript){ if ( jmolPanel == null ){ logger.error("please install Jmol first"); return; } jmolPanel.evalString(rasmolScript); }
java
public void evalString(String rasmolScript){ if ( jmolPanel == null ){ logger.error("please install Jmol first"); return; } jmolPanel.evalString(rasmolScript); }
[ "public", "void", "evalString", "(", "String", "rasmolScript", ")", "{", "if", "(", "jmolPanel", "==", "null", ")", "{", "logger", ".", "error", "(", "\"please install Jmol first\"", ")", ";", "return", ";", "}", "jmolPanel", ".", "evalString", "(", "rasmolS...
Execute a command String in the current Jmol panel. @param rasmolScript
[ "Execute", "a", "command", "String", "in", "the", "current", "Jmol", "panel", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java#L140-L146
31,975
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java
AbstractAlignmentJmol.setStructure
public void setStructure(Structure s) { if (jmolPanel == null){ logger.error("please install Jmol first"); return; } setTitle(s.getPDBCode()); jmolPanel.setStructure(s); // actually this is very simple // just convert the structure to a PDB file //String pdb = s.toPDB(); //System.out.println(s.isNmr()); //System.out.println(pdb); // Jmol could also read the file directly from your file system //viewer.openFile("/Path/To/PDB/1tim.pdb"); //System.out.println(pdb); //jmolPanel.openStringInline(pdb); // send the PDB file to Jmol. // there are also other ways to interact with Jmol, // e.g make it directly // access the biojava structure object, but they require more // code. See the SPICE code repository for how to do this. structure = s; }
java
public void setStructure(Structure s) { if (jmolPanel == null){ logger.error("please install Jmol first"); return; } setTitle(s.getPDBCode()); jmolPanel.setStructure(s); // actually this is very simple // just convert the structure to a PDB file //String pdb = s.toPDB(); //System.out.println(s.isNmr()); //System.out.println(pdb); // Jmol could also read the file directly from your file system //viewer.openFile("/Path/To/PDB/1tim.pdb"); //System.out.println(pdb); //jmolPanel.openStringInline(pdb); // send the PDB file to Jmol. // there are also other ways to interact with Jmol, // e.g make it directly // access the biojava structure object, but they require more // code. See the SPICE code repository for how to do this. structure = s; }
[ "public", "void", "setStructure", "(", "Structure", "s", ")", "{", "if", "(", "jmolPanel", "==", "null", ")", "{", "logger", ".", "error", "(", "\"please install Jmol first\"", ")", ";", "return", ";", "}", "setTitle", "(", "s", ".", "getPDBCode", "(", "...
Set a new Structure to visualize in the AlignmentJmol window. @param s
[ "Set", "a", "new", "Structure", "to", "visualize", "in", "the", "AlignmentJmol", "window", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/AbstractAlignmentJmol.java#L152-L181
31,976
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceCluster.java
StructureInterfaceCluster.getTotalArea
public double getTotalArea() { double area = 0; for (StructureInterface interf:members) { area+=interf.getTotalArea(); } return area/members.size(); }
java
public double getTotalArea() { double area = 0; for (StructureInterface interf:members) { area+=interf.getTotalArea(); } return area/members.size(); }
[ "public", "double", "getTotalArea", "(", ")", "{", "double", "area", "=", "0", ";", "for", "(", "StructureInterface", "interf", ":", "members", ")", "{", "area", "+=", "interf", ".", "getTotalArea", "(", ")", ";", "}", "return", "area", "/", "members", ...
Return the average buried surface area for this interface cluster @return
[ "Return", "the", "average", "buried", "surface", "area", "for", "this", "interface", "cluster" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/contact/StructureInterfaceCluster.java#L70-L76
31,977
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.calculateDsspSecondaryStructure
public static void calculateDsspSecondaryStructure(Structure bioJavaStruct) { SecStrucCalc ssp = new SecStrucCalc(); try{ ssp.calculate(bioJavaStruct, true); } catch(StructureException e) { LOGGER.warn("Could not calculate secondary structure (error {}). Will try to get a DSSP file from the RCSB web server instead.", e.getMessage()); try { DSSPParser.fetch(bioJavaStruct.getPDBCode(), bioJavaStruct, true); //download from PDB the DSSP result } catch(Exception bige){ LOGGER.warn("Could not get a DSSP file from RCSB web server. There will not be secondary structure assignment for this structure ({}). Error: {}", bioJavaStruct.getPDBCode(), bige.getMessage()); } } }
java
public static void calculateDsspSecondaryStructure(Structure bioJavaStruct) { SecStrucCalc ssp = new SecStrucCalc(); try{ ssp.calculate(bioJavaStruct, true); } catch(StructureException e) { LOGGER.warn("Could not calculate secondary structure (error {}). Will try to get a DSSP file from the RCSB web server instead.", e.getMessage()); try { DSSPParser.fetch(bioJavaStruct.getPDBCode(), bioJavaStruct, true); //download from PDB the DSSP result } catch(Exception bige){ LOGGER.warn("Could not get a DSSP file from RCSB web server. There will not be secondary structure assignment for this structure ({}). Error: {}", bioJavaStruct.getPDBCode(), bige.getMessage()); } } }
[ "public", "static", "void", "calculateDsspSecondaryStructure", "(", "Structure", "bioJavaStruct", ")", "{", "SecStrucCalc", "ssp", "=", "new", "SecStrucCalc", "(", ")", ";", "try", "{", "ssp", ".", "calculate", "(", "bioJavaStruct", ",", "true", ")", ";", "}",...
Generate the secondary structure for a Biojava structure object. @param bioJavaStruct the Biojava structure for which it is to be calculate.
[ "Generate", "the", "secondary", "structure", "for", "a", "Biojava", "structure", "object", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L159-L174
31,978
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.getUnitCellAsArray
public static float[] getUnitCellAsArray(PDBCrystallographicInfo xtalInfo) { CrystalCell xtalCell = xtalInfo.getCrystalCell(); if(xtalCell==null){ return null; }else{ float[] inputUnitCell = new float[6]; inputUnitCell[0] = (float) xtalCell.getA(); inputUnitCell[1] = (float) xtalCell.getB(); inputUnitCell[2] = (float) xtalCell.getC(); inputUnitCell[3] = (float) xtalCell.getAlpha(); inputUnitCell[4] = (float) xtalCell.getBeta(); inputUnitCell[5] = (float) xtalCell.getGamma(); return inputUnitCell; } }
java
public static float[] getUnitCellAsArray(PDBCrystallographicInfo xtalInfo) { CrystalCell xtalCell = xtalInfo.getCrystalCell(); if(xtalCell==null){ return null; }else{ float[] inputUnitCell = new float[6]; inputUnitCell[0] = (float) xtalCell.getA(); inputUnitCell[1] = (float) xtalCell.getB(); inputUnitCell[2] = (float) xtalCell.getC(); inputUnitCell[3] = (float) xtalCell.getAlpha(); inputUnitCell[4] = (float) xtalCell.getBeta(); inputUnitCell[5] = (float) xtalCell.getGamma(); return inputUnitCell; } }
[ "public", "static", "float", "[", "]", "getUnitCellAsArray", "(", "PDBCrystallographicInfo", "xtalInfo", ")", "{", "CrystalCell", "xtalCell", "=", "xtalInfo", ".", "getCrystalCell", "(", ")", ";", "if", "(", "xtalCell", "==", "null", ")", "{", "return", "null"...
Get the length six array of the unit cell information. @param xtalInfo the input PDBCrystallographicInfo object @return the length six float array
[ "Get", "the", "length", "six", "array", "of", "the", "unit", "cell", "information", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L195-L209
31,979
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.techniquesToStringArray
public static String[] techniquesToStringArray(Set<ExperimentalTechnique> experimentalTechniques) { if(experimentalTechniques==null){ return new String[0]; } String[] outArray = new String[experimentalTechniques.size()]; int index = 0; for (ExperimentalTechnique experimentalTechnique : experimentalTechniques) { outArray[index] = experimentalTechnique.getName(); index++; } return outArray; }
java
public static String[] techniquesToStringArray(Set<ExperimentalTechnique> experimentalTechniques) { if(experimentalTechniques==null){ return new String[0]; } String[] outArray = new String[experimentalTechniques.size()]; int index = 0; for (ExperimentalTechnique experimentalTechnique : experimentalTechniques) { outArray[index] = experimentalTechnique.getName(); index++; } return outArray; }
[ "public", "static", "String", "[", "]", "techniquesToStringArray", "(", "Set", "<", "ExperimentalTechnique", ">", "experimentalTechniques", ")", "{", "if", "(", "experimentalTechniques", "==", "null", ")", "{", "return", "new", "String", "[", "0", "]", ";", "}...
Converts the set of experimental techniques to an array of strings. @param experimentalTechniques the input set of experimental techniques @return the array of strings describing the methods used.
[ "Converts", "the", "set", "of", "experimental", "techniques", "to", "an", "array", "of", "strings", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L216-L227
31,980
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.dateToIsoString
public static String dateToIsoString(Date inputDate) { DateFormat dateStringFormat = new SimpleDateFormat("yyyy-MM-dd"); return dateStringFormat.format(inputDate); }
java
public static String dateToIsoString(Date inputDate) { DateFormat dateStringFormat = new SimpleDateFormat("yyyy-MM-dd"); return dateStringFormat.format(inputDate); }
[ "public", "static", "String", "dateToIsoString", "(", "Date", "inputDate", ")", "{", "DateFormat", "dateStringFormat", "=", "new", "SimpleDateFormat", "(", "\"yyyy-MM-dd\"", ")", ";", "return", "dateStringFormat", ".", "format", "(", "inputDate", ")", ";", "}" ]
Covert a Date object to ISO time format. @param inputDate The input date object @return the time in ISO time format
[ "Covert", "a", "Date", "object", "to", "ISO", "time", "format", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L234-L237
31,981
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.getTransformMap
public static Map<double[], int[]> getTransformMap(BioAssemblyInfo bioassemblyInfo, Map<String, Integer> chainIdToIndexMap) { Map<Matrix4d, List<Integer>> matMap = new LinkedHashMap<>(); List<BiologicalAssemblyTransformation> transforms = bioassemblyInfo.getTransforms(); for (BiologicalAssemblyTransformation transformation : transforms) { Matrix4d transMatrix = transformation.getTransformationMatrix(); String transChainId = transformation.getChainId(); if (!chainIdToIndexMap.containsKey(transChainId)){ continue; } int chainIndex = chainIdToIndexMap.get(transformation.getChainId()); if(matMap.containsKey(transMatrix)){ matMap.get(transMatrix).add(chainIndex); } else{ List<Integer> chainIdList = new ArrayList<>(); chainIdList.add(chainIndex); matMap.put(transMatrix, chainIdList); } } Map<double[], int[]> outMap = new LinkedHashMap<>(); for (Entry<Matrix4d, List<Integer>> entry : matMap.entrySet()) { outMap.put(convertToDoubleArray(entry.getKey()), CodecUtils.convertToIntArray(entry.getValue())); } return outMap; }
java
public static Map<double[], int[]> getTransformMap(BioAssemblyInfo bioassemblyInfo, Map<String, Integer> chainIdToIndexMap) { Map<Matrix4d, List<Integer>> matMap = new LinkedHashMap<>(); List<BiologicalAssemblyTransformation> transforms = bioassemblyInfo.getTransforms(); for (BiologicalAssemblyTransformation transformation : transforms) { Matrix4d transMatrix = transformation.getTransformationMatrix(); String transChainId = transformation.getChainId(); if (!chainIdToIndexMap.containsKey(transChainId)){ continue; } int chainIndex = chainIdToIndexMap.get(transformation.getChainId()); if(matMap.containsKey(transMatrix)){ matMap.get(transMatrix).add(chainIndex); } else{ List<Integer> chainIdList = new ArrayList<>(); chainIdList.add(chainIndex); matMap.put(transMatrix, chainIdList); } } Map<double[], int[]> outMap = new LinkedHashMap<>(); for (Entry<Matrix4d, List<Integer>> entry : matMap.entrySet()) { outMap.put(convertToDoubleArray(entry.getKey()), CodecUtils.convertToIntArray(entry.getValue())); } return outMap; }
[ "public", "static", "Map", "<", "double", "[", "]", ",", "int", "[", "]", ">", "getTransformMap", "(", "BioAssemblyInfo", "bioassemblyInfo", ",", "Map", "<", "String", ",", "Integer", ">", "chainIdToIndexMap", ")", "{", "Map", "<", "Matrix4d", ",", "List",...
Convert a bioassembly information into a map of transform, chainindices it relates to. @param bioassemblyInfo the bioassembly info object for this structure @param chainIdToIndexMap the map of chain ids to the index that chain corresponds to. @return the bioassembly information (as primitive types).
[ "Convert", "a", "bioassembly", "information", "into", "a", "map", "of", "transform", "chainindices", "it", "relates", "to", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L245-L270
31,982
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.convertToDoubleArray
public static double[] convertToDoubleArray(Matrix4d transformationMatrix) { // Initialise the output array double[] outArray = new double[16]; // Iterate over the matrix for(int i=0; i<4; i++){ for(int j=0; j<4; j++){ // Now set this element outArray[i*4+j] = transformationMatrix.getElement(i,j); } } return outArray; }
java
public static double[] convertToDoubleArray(Matrix4d transformationMatrix) { // Initialise the output array double[] outArray = new double[16]; // Iterate over the matrix for(int i=0; i<4; i++){ for(int j=0; j<4; j++){ // Now set this element outArray[i*4+j] = transformationMatrix.getElement(i,j); } } return outArray; }
[ "public", "static", "double", "[", "]", "convertToDoubleArray", "(", "Matrix4d", "transformationMatrix", ")", "{", "// Initialise the output array", "double", "[", "]", "outArray", "=", "new", "double", "[", "16", "]", ";", "// Iterate over the matrix", "for", "(", ...
Convert a four-d matrix to a double array. Row-packed. @param transformationMatrix the input matrix4d object @return the double array (16 long).
[ "Convert", "a", "four", "-", "d", "matrix", "to", "a", "double", "array", ".", "Row", "-", "packed", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L277-L288
31,983
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.getNumGroups
public static int getNumGroups(Structure structure) { int count = 0; for(int i=0; i<structure.nrModels(); i++) { for(Chain chain : structure.getChains(i)){ count+= chain.getAtomGroups().size(); } } return count; }
java
public static int getNumGroups(Structure structure) { int count = 0; for(int i=0; i<structure.nrModels(); i++) { for(Chain chain : structure.getChains(i)){ count+= chain.getAtomGroups().size(); } } return count; }
[ "public", "static", "int", "getNumGroups", "(", "Structure", "structure", ")", "{", "int", "count", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "structure", ".", "nrModels", "(", ")", ";", "i", "++", ")", "{", "for", "(", "Cha...
Count the total number of groups in the structure @param structure the input structure @return the total number of groups
[ "Count", "the", "total", "number", "of", "groups", "in", "the", "structure" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L295-L303
31,984
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.getAtomsForGroup
public static List<Atom> getAtomsForGroup(Group inputGroup) { Set<Atom> uniqueAtoms = new HashSet<Atom>(); List<Atom> theseAtoms = new ArrayList<Atom>(); for(Atom a: inputGroup.getAtoms()){ theseAtoms.add(a); uniqueAtoms.add(a); } List<Group> altLocs = inputGroup.getAltLocs(); for(Group thisG: altLocs){ for(Atom a: thisG.getAtoms()){ if(uniqueAtoms.contains(a)){ continue; } theseAtoms.add(a); } } return theseAtoms; }
java
public static List<Atom> getAtomsForGroup(Group inputGroup) { Set<Atom> uniqueAtoms = new HashSet<Atom>(); List<Atom> theseAtoms = new ArrayList<Atom>(); for(Atom a: inputGroup.getAtoms()){ theseAtoms.add(a); uniqueAtoms.add(a); } List<Group> altLocs = inputGroup.getAltLocs(); for(Group thisG: altLocs){ for(Atom a: thisG.getAtoms()){ if(uniqueAtoms.contains(a)){ continue; } theseAtoms.add(a); } } return theseAtoms; }
[ "public", "static", "List", "<", "Atom", ">", "getAtomsForGroup", "(", "Group", "inputGroup", ")", "{", "Set", "<", "Atom", ">", "uniqueAtoms", "=", "new", "HashSet", "<", "Atom", ">", "(", ")", ";", "List", "<", "Atom", ">", "theseAtoms", "=", "new", ...
Get a list of atoms for a group. Only add each atom once. @param inputGroup the Biojava Group to consider @return the atoms for the input Biojava Group
[ "Get", "a", "list", "of", "atoms", "for", "a", "group", ".", "Only", "add", "each", "atom", "once", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L311-L328
31,985
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.getNumBondsInGroup
public static int getNumBondsInGroup(List<Atom> atomsInGroup) { int bondCounter = 0; for(Atom atom : atomsInGroup) { if(atom.getBonds()==null){ continue; } for(Bond bond : atom.getBonds()) { // Now set the bonding information. Atom other = bond.getOther(atom); // If both atoms are in the group if (atomsInGroup.indexOf(other)!=-1){ Integer firstBondIndex = atomsInGroup.indexOf(atom); Integer secondBondIndex = atomsInGroup.indexOf(other); // Don't add the same bond twice if (firstBondIndex<secondBondIndex){ bondCounter++; } } } } return bondCounter; }
java
public static int getNumBondsInGroup(List<Atom> atomsInGroup) { int bondCounter = 0; for(Atom atom : atomsInGroup) { if(atom.getBonds()==null){ continue; } for(Bond bond : atom.getBonds()) { // Now set the bonding information. Atom other = bond.getOther(atom); // If both atoms are in the group if (atomsInGroup.indexOf(other)!=-1){ Integer firstBondIndex = atomsInGroup.indexOf(atom); Integer secondBondIndex = atomsInGroup.indexOf(other); // Don't add the same bond twice if (firstBondIndex<secondBondIndex){ bondCounter++; } } } } return bondCounter; }
[ "public", "static", "int", "getNumBondsInGroup", "(", "List", "<", "Atom", ">", "atomsInGroup", ")", "{", "int", "bondCounter", "=", "0", ";", "for", "(", "Atom", "atom", ":", "atomsInGroup", ")", "{", "if", "(", "atom", ".", "getBonds", "(", ")", "=="...
Find the number of bonds in a group @param atomsInGroup the list of atoms in the group @return the number of atoms in the group
[ "Find", "the", "number", "of", "bonds", "in", "a", "group" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L335-L356
31,986
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.getSecStructTypeFromDsspIndex
public static SecStrucType getSecStructTypeFromDsspIndex(int dsspIndex) { String dsspType = DsspType.dsspTypeFromInt(dsspIndex).getDsspType(); for(SecStrucType secStrucType : SecStrucType.values()) { if(dsspType==secStrucType.name) { return secStrucType; } } // Return a null entry. return null; }
java
public static SecStrucType getSecStructTypeFromDsspIndex(int dsspIndex) { String dsspType = DsspType.dsspTypeFromInt(dsspIndex).getDsspType(); for(SecStrucType secStrucType : SecStrucType.values()) { if(dsspType==secStrucType.name) { return secStrucType; } } // Return a null entry. return null; }
[ "public", "static", "SecStrucType", "getSecStructTypeFromDsspIndex", "(", "int", "dsspIndex", ")", "{", "String", "dsspType", "=", "DsspType", ".", "dsspTypeFromInt", "(", "dsspIndex", ")", ".", "getDsspType", "(", ")", ";", "for", "(", "SecStrucType", "secStrucTy...
Set the DSSP type based on a numerical index. @param dsspIndex the integer index of the type to set @return the instance of the SecStrucType object holding this secondary structure type.
[ "Set", "the", "DSSP", "type", "based", "on", "a", "numerical", "index", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L393-L404
31,987
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.getStructureInfo
public static MmtfSummaryDataBean getStructureInfo(Structure structure) { MmtfSummaryDataBean mmtfSummaryDataBean = new MmtfSummaryDataBean(); // Get all the atoms List<Atom> theseAtoms = new ArrayList<>(); List<Chain> allChains = new ArrayList<>(); Map<String, Integer> chainIdToIndexMap = new LinkedHashMap<>(); int chainCounter = 0; int bondCount = 0; mmtfSummaryDataBean.setAllAtoms(theseAtoms); mmtfSummaryDataBean.setAllChains(allChains); mmtfSummaryDataBean.setChainIdToIndexMap(chainIdToIndexMap); for (int i=0; i<structure.nrModels(); i++){ List<Chain> chains = structure.getModel(i); allChains.addAll(chains); for (Chain chain : chains) { String idOne = chain.getId(); if (!chainIdToIndexMap.containsKey(idOne)) { chainIdToIndexMap.put(idOne, chainCounter); } chainCounter++; for (Group g : chain.getAtomGroups()) { for(Atom atom: getAtomsForGroup(g)){ theseAtoms.add(atom); // If both atoms are in the group if (atom.getBonds()!=null){ bondCount+=atom.getBonds().size(); } } } } } // Assumes all bonds are referenced twice mmtfSummaryDataBean.setNumBonds(bondCount/2); return mmtfSummaryDataBean; }
java
public static MmtfSummaryDataBean getStructureInfo(Structure structure) { MmtfSummaryDataBean mmtfSummaryDataBean = new MmtfSummaryDataBean(); // Get all the atoms List<Atom> theseAtoms = new ArrayList<>(); List<Chain> allChains = new ArrayList<>(); Map<String, Integer> chainIdToIndexMap = new LinkedHashMap<>(); int chainCounter = 0; int bondCount = 0; mmtfSummaryDataBean.setAllAtoms(theseAtoms); mmtfSummaryDataBean.setAllChains(allChains); mmtfSummaryDataBean.setChainIdToIndexMap(chainIdToIndexMap); for (int i=0; i<structure.nrModels(); i++){ List<Chain> chains = structure.getModel(i); allChains.addAll(chains); for (Chain chain : chains) { String idOne = chain.getId(); if (!chainIdToIndexMap.containsKey(idOne)) { chainIdToIndexMap.put(idOne, chainCounter); } chainCounter++; for (Group g : chain.getAtomGroups()) { for(Atom atom: getAtomsForGroup(g)){ theseAtoms.add(atom); // If both atoms are in the group if (atom.getBonds()!=null){ bondCount+=atom.getBonds().size(); } } } } } // Assumes all bonds are referenced twice mmtfSummaryDataBean.setNumBonds(bondCount/2); return mmtfSummaryDataBean; }
[ "public", "static", "MmtfSummaryDataBean", "getStructureInfo", "(", "Structure", "structure", ")", "{", "MmtfSummaryDataBean", "mmtfSummaryDataBean", "=", "new", "MmtfSummaryDataBean", "(", ")", ";", "// Get all the atoms", "List", "<", "Atom", ">", "theseAtoms", "=", ...
Get summary information for the structure. @param structure the structure for which to get the information.
[ "Get", "summary", "information", "for", "the", "structure", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L410-L445
31,988
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.insertSeqResGroup
public static void insertSeqResGroup(Chain chain, Group group, int sequenceIndexId) { List<Group> seqResGroups = chain.getSeqResGroups(); addGroupAtId(seqResGroups, group, sequenceIndexId); }
java
public static void insertSeqResGroup(Chain chain, Group group, int sequenceIndexId) { List<Group> seqResGroups = chain.getSeqResGroups(); addGroupAtId(seqResGroups, group, sequenceIndexId); }
[ "public", "static", "void", "insertSeqResGroup", "(", "Chain", "chain", ",", "Group", "group", ",", "int", "sequenceIndexId", ")", "{", "List", "<", "Group", ">", "seqResGroups", "=", "chain", ".", "getSeqResGroups", "(", ")", ";", "addGroupAtId", "(", "seqR...
Insert the group in the given position in the sequence. @param chain the chain to add the seq res group to @param group the group to add @param sequenceIndexId the index to add it in
[ "Insert", "the", "group", "in", "the", "given", "position", "in", "the", "sequence", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L492-L495
31,989
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java
MmtfUtils.addSeqRes
public static void addSeqRes(Chain modelChain, String sequence) { List<Group> seqResGroups = modelChain.getSeqResGroups(); GroupType chainType = getChainType(modelChain.getAtomGroups()); for(int i=0; i<sequence.length(); i++){ char singleLetterCode = sequence.charAt(i); Group group = null; if(seqResGroups.size()<=i){ } else{ group=seqResGroups.get(i); } if(group!=null){ continue; } group = getSeqResGroup(modelChain, singleLetterCode, chainType); addGroupAtId(seqResGroups, group, i); seqResGroups.set(i, group); } }
java
public static void addSeqRes(Chain modelChain, String sequence) { List<Group> seqResGroups = modelChain.getSeqResGroups(); GroupType chainType = getChainType(modelChain.getAtomGroups()); for(int i=0; i<sequence.length(); i++){ char singleLetterCode = sequence.charAt(i); Group group = null; if(seqResGroups.size()<=i){ } else{ group=seqResGroups.get(i); } if(group!=null){ continue; } group = getSeqResGroup(modelChain, singleLetterCode, chainType); addGroupAtId(seqResGroups, group, i); seqResGroups.set(i, group); } }
[ "public", "static", "void", "addSeqRes", "(", "Chain", "modelChain", ",", "String", "sequence", ")", "{", "List", "<", "Group", ">", "seqResGroups", "=", "modelChain", ".", "getSeqResGroups", "(", ")", ";", "GroupType", "chainType", "=", "getChainType", "(", ...
Add the missing groups to the SeqResGroups. @param modelChain the chain to add the information for @param sequence the sequence of the construct
[ "Add", "the", "missing", "groups", "to", "the", "SeqResGroups", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfUtils.java#L502-L520
31,990
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java
GenericInsdcHeaderFormat._write_feature
protected String _write_feature(FeatureInterface<AbstractSequence<C>, C> feature, int record_length) { String location = _insdc_feature_location_string(feature, record_length); String f_type = feature.getType().replace(" ", "_"); StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb,Locale.US); formatter.format(QUALIFIER_INDENT_TMP, f_type); String line = formatter.toString().substring(0, QUALIFIER_INDENT) + _wrap_location(location) + lineSep; formatter.close(); //Now the qualifiers... for(List<Qualifier> qualifiers : feature.getQualifiers().values()) { for(Qualifier q : qualifiers){ line += _write_feature_qualifier(q.getName(), q.getValue(), q.needsQuotes()); } } return line; /* self.handle.write(line) #Now the qualifiers... for key, values in feature.qualifiers.items(): if isinstance(values, list) or isinstance(values, tuple): for value in values: self._write_feature_qualifier(key, value) elif values: #String, int, etc self._write_feature_qualifier(key, values) else: #e.g. a /psuedo entry self._write_feature_qualifier(key) */ }
java
protected String _write_feature(FeatureInterface<AbstractSequence<C>, C> feature, int record_length) { String location = _insdc_feature_location_string(feature, record_length); String f_type = feature.getType().replace(" ", "_"); StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb,Locale.US); formatter.format(QUALIFIER_INDENT_TMP, f_type); String line = formatter.toString().substring(0, QUALIFIER_INDENT) + _wrap_location(location) + lineSep; formatter.close(); //Now the qualifiers... for(List<Qualifier> qualifiers : feature.getQualifiers().values()) { for(Qualifier q : qualifiers){ line += _write_feature_qualifier(q.getName(), q.getValue(), q.needsQuotes()); } } return line; /* self.handle.write(line) #Now the qualifiers... for key, values in feature.qualifiers.items(): if isinstance(values, list) or isinstance(values, tuple): for value in values: self._write_feature_qualifier(key, value) elif values: #String, int, etc self._write_feature_qualifier(key, values) else: #e.g. a /psuedo entry self._write_feature_qualifier(key) */ }
[ "protected", "String", "_write_feature", "(", "FeatureInterface", "<", "AbstractSequence", "<", "C", ">", ",", "C", ">", "feature", ",", "int", "record_length", ")", "{", "String", "location", "=", "_insdc_feature_location_string", "(", "feature", ",", "record_len...
Write a single SeqFeature object to features table. @param feature @param record_length
[ "Write", "a", "single", "SeqFeature", "object", "to", "features", "table", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java#L116-L146
31,991
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java
GenericInsdcHeaderFormat._split_multi_line
protected ArrayList<String> _split_multi_line(String text, int max_len) { // TODO Auto-generated method stub ArrayList<String> output = new ArrayList<String>(); text = text.trim(); if(text.length() <= max_len) { output.add(text); return output; } ArrayList<String> words = new ArrayList<String>(); Collections.addAll(words, text.split("\\s+")); while(!words.isEmpty()) { text = words.remove(0); while(!words.isEmpty() && (text.length() + 1 + words.get(0).length()) <= max_len) { text += " " + words.remove(0); text = text.trim(); } output.add(text); } assert words.isEmpty(); return output; }
java
protected ArrayList<String> _split_multi_line(String text, int max_len) { // TODO Auto-generated method stub ArrayList<String> output = new ArrayList<String>(); text = text.trim(); if(text.length() <= max_len) { output.add(text); return output; } ArrayList<String> words = new ArrayList<String>(); Collections.addAll(words, text.split("\\s+")); while(!words.isEmpty()) { text = words.remove(0); while(!words.isEmpty() && (text.length() + 1 + words.get(0).length()) <= max_len) { text += " " + words.remove(0); text = text.trim(); } output.add(text); } assert words.isEmpty(); return output; }
[ "protected", "ArrayList", "<", "String", ">", "_split_multi_line", "(", "String", "text", ",", "int", "max_len", ")", "{", "// TODO Auto-generated method stub", "ArrayList", "<", "String", ">", "output", "=", "new", "ArrayList", "<", "String", ">", "(", ")", "...
Returns a list of strings. Any single words which are too long get returned as a whole line (e.g. URLs) without an exception or warning. @param text @param max_len
[ "Returns", "a", "list", "of", "strings", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericInsdcHeaderFormat.java#L341-L362
31,992
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/SimpleGapPenalty.java
SimpleGapPenalty.setType
private void setType() { type = (gop == 0) ? GapPenalty.Type.LINEAR : ((gep == 0) ? GapPenalty.Type.CONSTANT : GapPenalty.Type.AFFINE); }
java
private void setType() { type = (gop == 0) ? GapPenalty.Type.LINEAR : ((gep == 0) ? GapPenalty.Type.CONSTANT : GapPenalty.Type.AFFINE); }
[ "private", "void", "setType", "(", ")", "{", "type", "=", "(", "gop", "==", "0", ")", "?", "GapPenalty", ".", "Type", ".", "LINEAR", ":", "(", "(", "gep", "==", "0", ")", "?", "GapPenalty", ".", "Type", ".", "CONSTANT", ":", "GapPenalty", ".", "T...
helper method to set the type given the open and extension penalties
[ "helper", "method", "to", "set", "the", "type", "given", "the", "open", "and", "extension", "penalties" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/SimpleGapPenalty.java#L121-L123
31,993
biojava/biojava
biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ProteinModificationXmlReader.java
ProteinModificationXmlReader.getChildNodes
private static Map<String,List<Node>> getChildNodes(Node parent) { if (parent==null) return Collections.emptyMap(); Map<String,List<Node>> children = new HashMap<String,List<Node>>(); NodeList nodes = parent.getChildNodes(); int nNodes = nodes.getLength(); for (int i=0; i<nNodes; i++) { Node node = nodes.item(i); if (node.getNodeType()!=Node.ELEMENT_NODE) continue; String name = node.getNodeName(); List<Node> namesakes = children.get(name); if (namesakes==null) { namesakes = new ArrayList<Node>(); children.put(name, namesakes); } namesakes.add(node); } return children; }
java
private static Map<String,List<Node>> getChildNodes(Node parent) { if (parent==null) return Collections.emptyMap(); Map<String,List<Node>> children = new HashMap<String,List<Node>>(); NodeList nodes = parent.getChildNodes(); int nNodes = nodes.getLength(); for (int i=0; i<nNodes; i++) { Node node = nodes.item(i); if (node.getNodeType()!=Node.ELEMENT_NODE) continue; String name = node.getNodeName(); List<Node> namesakes = children.get(name); if (namesakes==null) { namesakes = new ArrayList<Node>(); children.put(name, namesakes); } namesakes.add(node); } return children; }
[ "private", "static", "Map", "<", "String", ",", "List", "<", "Node", ">", ">", "getChildNodes", "(", "Node", "parent", ")", "{", "if", "(", "parent", "==", "null", ")", "return", "Collections", ".", "emptyMap", "(", ")", ";", "Map", "<", "String", ",...
Utility method to group child nodes by their names. @param parent parent node. @return Map from name to child nodes.
[ "Utility", "method", "to", "group", "child", "nodes", "by", "their", "names", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-modfinder/src/main/java/org/biojava/nbio/protmod/io/ProteinModificationXmlReader.java#L341-L364
31,994
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java
RNAToAminoAcidTranslator.postProcessCompoundLists
@Override protected void postProcessCompoundLists( List<List<AminoAcidCompound>> compoundLists) { for (List<AminoAcidCompound> compounds : compoundLists) { if (trimStops) { trimStop(compounds); } } }
java
@Override protected void postProcessCompoundLists( List<List<AminoAcidCompound>> compoundLists) { for (List<AminoAcidCompound> compounds : compoundLists) { if (trimStops) { trimStop(compounds); } } }
[ "@", "Override", "protected", "void", "postProcessCompoundLists", "(", "List", "<", "List", "<", "AminoAcidCompound", ">", ">", "compoundLists", ")", "{", "for", "(", "List", "<", "AminoAcidCompound", ">", "compounds", ":", "compoundLists", ")", "{", "if", "("...
Performs the trimming of stop codons and the conversion of a valid start amino acid to M
[ "Performs", "the", "trimming", "of", "stop", "codons", "and", "the", "conversion", "of", "a", "valid", "start", "amino", "acid", "to", "M" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java#L174-L182
31,995
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java
RNAToAminoAcidTranslator.trimStop
protected void trimStop(List<AminoAcidCompound> sequence) { AminoAcidCompound stop = sequence.get(sequence.size() - 1); boolean isStop = false; if (aminoAcidToCodon.containsKey(stop)) { for (Codon c : aminoAcidToCodon.get(stop)) { if (c.isStop()) { isStop = true; break; } } } if (isStop) { sequence.remove(sequence.size() - 1); } }
java
protected void trimStop(List<AminoAcidCompound> sequence) { AminoAcidCompound stop = sequence.get(sequence.size() - 1); boolean isStop = false; if (aminoAcidToCodon.containsKey(stop)) { for (Codon c : aminoAcidToCodon.get(stop)) { if (c.isStop()) { isStop = true; break; } } } if (isStop) { sequence.remove(sequence.size() - 1); } }
[ "protected", "void", "trimStop", "(", "List", "<", "AminoAcidCompound", ">", "sequence", ")", "{", "AminoAcidCompound", "stop", "=", "sequence", ".", "get", "(", "sequence", ".", "size", "(", ")", "-", "1", ")", ";", "boolean", "isStop", "=", "false", ";...
Imperfect code. Checks the last amino acid to see if a codon could have translated a stop for it. Left in for the moment
[ "Imperfect", "code", ".", "Checks", "the", "last", "amino", "acid", "to", "see", "if", "a", "codon", "could", "have", "translated", "a", "stop", "for", "it", ".", "Left", "in", "for", "the", "moment" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/RNAToAminoAcidTranslator.java#L188-L203
31,996
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/ResidueGroup.java
ResidueGroup.combineWith
public void combineWith(List<List<Integer>> alignRes) { for (int i = 0; i < order(); i++) alignRes.get(i).add(residues.get(i)); }
java
public void combineWith(List<List<Integer>> alignRes) { for (int i = 0; i < order(); i++) alignRes.get(i).add(residues.get(i)); }
[ "public", "void", "combineWith", "(", "List", "<", "List", "<", "Integer", ">", ">", "alignRes", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "order", "(", ")", ";", "i", "++", ")", "alignRes", ".", "get", "(", "i", ")", ".", "a...
Combine the ResidueGroup with the alignment block. @param alignRes the alignment block, will be modified.
[ "Combine", "the", "ResidueGroup", "with", "the", "alignment", "block", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/ResidueGroup.java#L110-L113
31,997
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/AllChemCompProvider.java
AllChemCompProvider.downloadFile
public static void downloadFile() throws IOException { initPath(); initServerName(); String localName = getLocalFileName(); String u = serverName + "/" + COMPONENTS_FILE_LOCATION; downloadFileFromRemote(new URL(u), new File(localName)); }
java
public static void downloadFile() throws IOException { initPath(); initServerName(); String localName = getLocalFileName(); String u = serverName + "/" + COMPONENTS_FILE_LOCATION; downloadFileFromRemote(new URL(u), new File(localName)); }
[ "public", "static", "void", "downloadFile", "(", ")", "throws", "IOException", "{", "initPath", "(", ")", ";", "initServerName", "(", ")", ";", "String", "localName", "=", "getLocalFileName", "(", ")", ";", "String", "u", "=", "serverName", "+", "\"/\"", "...
Downloads the components.cif.gz file from the wwPDB site.
[ "Downloads", "the", "components", ".", "cif", ".", "gz", "file", "from", "the", "wwPDB", "site", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/AllChemCompProvider.java#L119-L132
31,998
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/AllChemCompProvider.java
AllChemCompProvider.run
@Override public void run() { long timeS = System.currentTimeMillis(); initPath(); ensureFileExists(); try { loadAllChemComps(); long timeE = System.currentTimeMillis(); logger.debug("Time to init chem comp dictionary: " + (timeE - timeS) / 1000 + " sec."); } catch (IOException e) { logger.error("Could not load chemical components definition file {}. Error: {}", getLocalFileName(), e.getMessage()); } finally { loading.set(false); isInitialized.set(true); } }
java
@Override public void run() { long timeS = System.currentTimeMillis(); initPath(); ensureFileExists(); try { loadAllChemComps(); long timeE = System.currentTimeMillis(); logger.debug("Time to init chem comp dictionary: " + (timeE - timeS) / 1000 + " sec."); } catch (IOException e) { logger.error("Could not load chemical components definition file {}. Error: {}", getLocalFileName(), e.getMessage()); } finally { loading.set(false); isInitialized.set(true); } }
[ "@", "Override", "public", "void", "run", "(", ")", "{", "long", "timeS", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "initPath", "(", ")", ";", "ensureFileExists", "(", ")", ";", "try", "{", "loadAllChemComps", "(", ")", ";", "long", "time...
Do the actual loading of the dictionary in a thread.
[ "Do", "the", "actual", "loading", "of", "the", "dictionary", "in", "a", "thread", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/AllChemCompProvider.java#L222-L244
31,999
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/SequenceFileProxyLoader.java
SequenceFileProxyLoader.init
private boolean init() throws IOException, CompoundNotFoundException { BufferedReader br = new BufferedReader(new FileReader(file)); br.skip(sequenceStartIndex); String sequence = sequenceParser.getSequence(br, sequenceLength); setContents(sequence); br.close(); // close file to prevent too many being open return true; }
java
private boolean init() throws IOException, CompoundNotFoundException { BufferedReader br = new BufferedReader(new FileReader(file)); br.skip(sequenceStartIndex); String sequence = sequenceParser.getSequence(br, sequenceLength); setContents(sequence); br.close(); // close file to prevent too many being open return true; }
[ "private", "boolean", "init", "(", ")", "throws", "IOException", ",", "CompoundNotFoundException", "{", "BufferedReader", "br", "=", "new", "BufferedReader", "(", "new", "FileReader", "(", "file", ")", ")", ";", "br", ".", "skip", "(", "sequenceStartIndex", ")...
Load the sequence @return
[ "Load", "the", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/SequenceFileProxyLoader.java#L100-L109