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,800
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.domainsAvailable
private boolean domainsAvailable() { domainsFileLock.readLock().lock(); logger.trace("LOCK readlock"); try { File f = getDomainFile(); if (!f.exists() || f.length() <= 0 ) return false; // Re-download old copies of "latest" if(updateFrequency != null && requestedVersion == DEFAULT_VERSION ) { long mod = f.lastModified(); // Time of last update Date lastUpdate = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(lastUpdate); cal.add(Calendar.DAY_OF_WEEK, -updateFrequency); long updateTime = cal.getTimeInMillis(); // Check if file predates last update if( mod < updateTime ) { logger.info("{} is out of date.",f); return false; } } return true; } finally { logger.trace("UNLOCK readlock"); domainsFileLock.readLock().unlock(); } }
java
private boolean domainsAvailable() { domainsFileLock.readLock().lock(); logger.trace("LOCK readlock"); try { File f = getDomainFile(); if (!f.exists() || f.length() <= 0 ) return false; // Re-download old copies of "latest" if(updateFrequency != null && requestedVersion == DEFAULT_VERSION ) { long mod = f.lastModified(); // Time of last update Date lastUpdate = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(lastUpdate); cal.add(Calendar.DAY_OF_WEEK, -updateFrequency); long updateTime = cal.getTimeInMillis(); // Check if file predates last update if( mod < updateTime ) { logger.info("{} is out of date.",f); return false; } } return true; } finally { logger.trace("UNLOCK readlock"); domainsFileLock.readLock().unlock(); } }
[ "private", "boolean", "domainsAvailable", "(", ")", "{", "domainsFileLock", ".", "readLock", "(", ")", ".", "lock", "(", ")", ";", "logger", ".", "trace", "(", "\"LOCK readlock\"", ")", ";", "try", "{", "File", "f", "=", "getDomainFile", "(", ")", ";", ...
Checks that the domains file has been downloaded @return
[ "Checks", "that", "the", "domains", "file", "has", "been", "downloaded" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L361-L390
31,801
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.downloadDomains
private void downloadDomains() throws IOException { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); try { URL domainsURL = new URL( url + DOMAINS_PATH + getDomainFilename()); File localFile = getDomainFile(); logger.info("Downloading {} to: {}",domainsURL, localFile); FileDownloadUtils.downloadFile(domainsURL, localFile); } catch (MalformedURLException e) { logger.error("Malformed url: "+ url + DOMAINS_PATH + getDomainFilename(),e); } finally { logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); } }
java
private void downloadDomains() throws IOException { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); try { URL domainsURL = new URL( url + DOMAINS_PATH + getDomainFilename()); File localFile = getDomainFile(); logger.info("Downloading {} to: {}",domainsURL, localFile); FileDownloadUtils.downloadFile(domainsURL, localFile); } catch (MalformedURLException e) { logger.error("Malformed url: "+ url + DOMAINS_PATH + getDomainFilename(),e); } finally { logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); } }
[ "private", "void", "downloadDomains", "(", ")", "throws", "IOException", "{", "domainsFileLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "logger", ".", "trace", "(", "\"LOCK writelock\"", ")", ";", "try", "{", "URL", "domainsURL", "=", "new...
Downloads the domains file, overwriting any existing file @throws IOException
[ "Downloads", "the", "domains", "file", "overwriting", "any", "existing", "file" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L396-L411
31,802
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.parseDomains
private void parseDomains() throws IOException { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); try { EcodParser parser = new EcodParser(getDomainFile()); allDomains = parser.getDomains(); parsedVersion = parser.getVersion(); } finally { logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); } }
java
private void parseDomains() throws IOException { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); try { EcodParser parser = new EcodParser(getDomainFile()); allDomains = parser.getDomains(); parsedVersion = parser.getVersion(); } finally { logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); } }
[ "private", "void", "parseDomains", "(", ")", "throws", "IOException", "{", "domainsFileLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "logger", ".", "trace", "(", "\"LOCK writelock\"", ")", ";", "try", "{", "EcodParser", "parser", "=", "new...
Parses the domains from the local file @throws IOException
[ "Parses", "the", "domains", "from", "the", "local", "file" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L454-L465
31,803
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java
EcodInstallation.indexDomains
private void indexDomains() throws IOException { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); try { if( allDomains == null) { ensureDomainsFileInstalled(); } // Leave enough space for all PDBs as of 2015 domainMap = new HashMap<String, List<EcodDomain>>((int) (150000/.85),.85f); // Index with domainMap for(EcodDomain d : allDomains) { // Get the PDB ID, either directly or from the domain ID String pdbId = d.getPdbId(); if( pdbId == null ) { String ecodId = d.getDomainId(); if( ecodId != null && !ecodId.isEmpty() ) { Matcher match = ECOD_RE.matcher(ecodId); pdbId = match.group(1); } } // Add current domain to the map List<EcodDomain> currDomains; if( domainMap.containsKey(pdbId) ) { currDomains = domainMap.get(pdbId); } else { currDomains = new LinkedList<EcodDomain>(); domainMap.put(pdbId,currDomains); } currDomains.add(d); } } finally { logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); } }
java
private void indexDomains() throws IOException { domainsFileLock.writeLock().lock(); logger.trace("LOCK writelock"); try { if( allDomains == null) { ensureDomainsFileInstalled(); } // Leave enough space for all PDBs as of 2015 domainMap = new HashMap<String, List<EcodDomain>>((int) (150000/.85),.85f); // Index with domainMap for(EcodDomain d : allDomains) { // Get the PDB ID, either directly or from the domain ID String pdbId = d.getPdbId(); if( pdbId == null ) { String ecodId = d.getDomainId(); if( ecodId != null && !ecodId.isEmpty() ) { Matcher match = ECOD_RE.matcher(ecodId); pdbId = match.group(1); } } // Add current domain to the map List<EcodDomain> currDomains; if( domainMap.containsKey(pdbId) ) { currDomains = domainMap.get(pdbId); } else { currDomains = new LinkedList<EcodDomain>(); domainMap.put(pdbId,currDomains); } currDomains.add(d); } } finally { logger.trace("UNLOCK writelock"); domainsFileLock.writeLock().unlock(); } }
[ "private", "void", "indexDomains", "(", ")", "throws", "IOException", "{", "domainsFileLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "logger", ".", "trace", "(", "\"LOCK writelock\"", ")", ";", "try", "{", "if", "(", "allDomains", "==", ...
Populates domainMap from allDomains @throws IOException
[ "Populates", "domainMap", "from", "allDomains" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/ecod/EcodInstallation.java#L471-L509
31,804
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java
AbstractUserArgumentProcessor.runDbSearch
private void runDbSearch(AtomCache cache, String searchFile, String outputFile,int useNrCPUs, StartupParameters params) throws ConfigurationException { System.out.println("will use " + useNrCPUs + " CPUs."); PDBFileReader reader = new PDBFileReader(); Structure structure1 = null ; try { structure1 = reader.getStructure(searchFile); } catch (IOException e) { throw new ConfigurationException("could not parse as PDB file: " + searchFile); } File searchF = new File(searchFile); String name1 = "CUSTOM"; StructureAlignment algorithm = getAlgorithm(); MultiThreadedDBSearch dbSearch = new MultiThreadedDBSearch(name1, structure1, outputFile, algorithm, useNrCPUs, params.isDomainSplit()); dbSearch.setCustomFile1(searchF.getAbsolutePath()); dbSearch.run(); }
java
private void runDbSearch(AtomCache cache, String searchFile, String outputFile,int useNrCPUs, StartupParameters params) throws ConfigurationException { System.out.println("will use " + useNrCPUs + " CPUs."); PDBFileReader reader = new PDBFileReader(); Structure structure1 = null ; try { structure1 = reader.getStructure(searchFile); } catch (IOException e) { throw new ConfigurationException("could not parse as PDB file: " + searchFile); } File searchF = new File(searchFile); String name1 = "CUSTOM"; StructureAlignment algorithm = getAlgorithm(); MultiThreadedDBSearch dbSearch = new MultiThreadedDBSearch(name1, structure1, outputFile, algorithm, useNrCPUs, params.isDomainSplit()); dbSearch.setCustomFile1(searchF.getAbsolutePath()); dbSearch.run(); }
[ "private", "void", "runDbSearch", "(", "AtomCache", "cache", ",", "String", "searchFile", ",", "String", "outputFile", ",", "int", "useNrCPUs", ",", "StartupParameters", "params", ")", "throws", "ConfigurationException", "{", "System", ".", "out", ".", "println", ...
Do a DB search with the input file against representative PDB domains @param cache @param searchFile @param outputFile @throws ConfigurationException
[ "Do", "a", "DB", "search", "with", "the", "input", "file", "against", "representative", "PDB", "domains" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java#L299-L332
31,805
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java
AbstractUserArgumentProcessor.checkWriteFile
private void checkWriteFile( AFPChain afpChain, Atom[] ca1, Atom[] ca2, boolean dbsearch) throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, StructureException { String output = null; if ( params.isOutputPDB()){ if (! GuiWrapper.isGuiModuleInstalled()) { System.err.println("The biojava-structure-gui module is not installed. Please install!"); output = AFPChainXMLConverter.toXML(afpChain,ca1,ca2); } else { Structure tmp = AFPAlignmentDisplay.createArtificalStructure(afpChain, ca1, ca2); output = "TITLE " + afpChain.getAlgorithmName() + " " + afpChain.getVersion() + " "; output += afpChain.getName1() + " vs. " + afpChain.getName2(); output += newline; output += tmp.toPDB(); } } else if ( params.getOutFile() != null) { // output by default is XML // write the XML to a file... output = AFPChainXMLConverter.toXML(afpChain,ca1,ca2); } else if ( params.getSaveOutputDir() != null){ output = AFPChainXMLConverter.toXML(afpChain,ca1,ca2); } // no output requested. if ( output == null) return; String fileName = null; if ( dbsearch ){ if ( params.getSaveOutputDir() != null) { // we currently don't have a naming convention for how to store results for custom files // they will be re-created on the fly if ( afpChain.getName1().startsWith("file:") || afpChain.getName2().startsWith("file:")) return; fileName = params.getSaveOutputDir(); fileName += getAutoFileName(afpChain); } else { return; } // //else { // fileName = getAutoFileName(afpChain); //} } else if ( params.getOutFile() != null) { fileName = params.getOutFile(); } if (fileName == null) { System.err.println("Can't write outputfile. Either provide a filename using -outFile or set -autoOutputFile to true ."); System.exit(1); return; } //System.out.println("writing results to " + fileName + " " + params.getSaveOutputDir()); FileOutputStream out; // declare a file output object PrintStream p; // declare a print stream object // Create a new file output stream out = new FileOutputStream(fileName); // Connect print stream to the output stream p = new PrintStream( out ); p.println (output); p.close(); }
java
private void checkWriteFile( AFPChain afpChain, Atom[] ca1, Atom[] ca2, boolean dbsearch) throws IOException, ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, StructureException { String output = null; if ( params.isOutputPDB()){ if (! GuiWrapper.isGuiModuleInstalled()) { System.err.println("The biojava-structure-gui module is not installed. Please install!"); output = AFPChainXMLConverter.toXML(afpChain,ca1,ca2); } else { Structure tmp = AFPAlignmentDisplay.createArtificalStructure(afpChain, ca1, ca2); output = "TITLE " + afpChain.getAlgorithmName() + " " + afpChain.getVersion() + " "; output += afpChain.getName1() + " vs. " + afpChain.getName2(); output += newline; output += tmp.toPDB(); } } else if ( params.getOutFile() != null) { // output by default is XML // write the XML to a file... output = AFPChainXMLConverter.toXML(afpChain,ca1,ca2); } else if ( params.getSaveOutputDir() != null){ output = AFPChainXMLConverter.toXML(afpChain,ca1,ca2); } // no output requested. if ( output == null) return; String fileName = null; if ( dbsearch ){ if ( params.getSaveOutputDir() != null) { // we currently don't have a naming convention for how to store results for custom files // they will be re-created on the fly if ( afpChain.getName1().startsWith("file:") || afpChain.getName2().startsWith("file:")) return; fileName = params.getSaveOutputDir(); fileName += getAutoFileName(afpChain); } else { return; } // //else { // fileName = getAutoFileName(afpChain); //} } else if ( params.getOutFile() != null) { fileName = params.getOutFile(); } if (fileName == null) { System.err.println("Can't write outputfile. Either provide a filename using -outFile or set -autoOutputFile to true ."); System.exit(1); return; } //System.out.println("writing results to " + fileName + " " + params.getSaveOutputDir()); FileOutputStream out; // declare a file output object PrintStream p; // declare a print stream object // Create a new file output stream out = new FileOutputStream(fileName); // Connect print stream to the output stream p = new PrintStream( out ); p.println (output); p.close(); }
[ "private", "void", "checkWriteFile", "(", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ",", "boolean", "dbsearch", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "NoSuchMethodException", ",", "InvocationT...
check if the result should be written to the local file system @param params2 @param afpChain @param ca1 @param ca2 @throws IOException If an error occurs when writing the afpChain to XML @throws ClassNotFoundException If an error occurs when invoking jmol @throws NoSuchMethodException If an error occurs when invoking jmol @throws InvocationTargetException If an error occurs when invoking jmol @throws IllegalAccessException If an error occurs when invoking jmol @throws StructureException
[ "check", "if", "the", "result", "should", "be", "written", "to", "the", "local", "file", "system" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java#L583-L658
31,806
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java
AbstractUserArgumentProcessor.fixStructureName
private Structure fixStructureName(Structure s, String file) { if ( s.getName() != null && (! s.getName().equals(""))) return s; s.setName(s.getPDBCode()); if ( s.getName() == null || s.getName().equals("")){ File f = new File(file); s.setName(f.getName()); } return s; }
java
private Structure fixStructureName(Structure s, String file) { if ( s.getName() != null && (! s.getName().equals(""))) return s; s.setName(s.getPDBCode()); if ( s.getName() == null || s.getName().equals("")){ File f = new File(file); s.setName(f.getName()); } return s; }
[ "private", "Structure", "fixStructureName", "(", "Structure", "s", ",", "String", "file", ")", "{", "if", "(", "s", ".", "getName", "(", ")", "!=", "null", "&&", "(", "!", "s", ".", "getName", "(", ")", ".", "equals", "(", "\"\"", ")", ")", ")", ...
apply a number of rules to fix the name of the structure if it did not get set during loading. @param s @param file @return
[ "apply", "a", "number", "of", "rules", "to", "fix", "the", "name", "of", "the", "structure", "if", "it", "did", "not", "get", "set", "during", "loading", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/AbstractUserArgumentProcessor.java#L717-L729
31,807
biojava/biojava
biojava-structure/src/main/java/demo/DemoMmtfReader.java
DemoMmtfReader.main
public static void main(String[] args) throws IOException, StructureException { Structure structure = MmtfActions.readFromWeb("4cup"); System.out.println(structure.getChains().size()); }
java
public static void main(String[] args) throws IOException, StructureException { Structure structure = MmtfActions.readFromWeb("4cup"); System.out.println(structure.getChains().size()); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", ",", "StructureException", "{", "Structure", "structure", "=", "MmtfActions", ".", "readFromWeb", "(", "\"4cup\"", ")", ";", "System", ".", "out", ".", "printl...
Main function to run the demo @param args no args to specify @throws IOException @throws StructureException
[ "Main", "function", "to", "run", "the", "demo" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/demo/DemoMmtfReader.java#L42-L45
31,808
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/StructureAlignmentOptimizer.java
StructureAlignmentOptimizer.runOptimization
public void runOptimization(int maxi) throws StructureException{ superimposeBySet(); if ( debug) System.err.println(" initial rmsd " + rmsd); // if (showAlig) // showCurrentAlignment(equLen, equSet, "after initial superimposeBySet Len:" +equLen + " rmsd:" +rmsd); maxKeepStep = 4; keepStep = 0; optimize(maxi); }
java
public void runOptimization(int maxi) throws StructureException{ superimposeBySet(); if ( debug) System.err.println(" initial rmsd " + rmsd); // if (showAlig) // showCurrentAlignment(equLen, equSet, "after initial superimposeBySet Len:" +equLen + " rmsd:" +rmsd); maxKeepStep = 4; keepStep = 0; optimize(maxi); }
[ "public", "void", "runOptimization", "(", "int", "maxi", ")", "throws", "StructureException", "{", "superimposeBySet", "(", ")", ";", "if", "(", "debug", ")", "System", ".", "err", ".", "println", "(", "\" initial rmsd \"", "+", "rmsd", ")", ";", "// ...
run the optimization @param maxi maximum nr. of iterations @throws StructureException
[ "run", "the", "optimization" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/StructureAlignmentOptimizer.java#L199-L211
31,809
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/StructureAlignmentOptimizer.java
StructureAlignmentOptimizer.superimposeBySet
private void superimposeBySet () throws StructureException { //extract the coordinations of equivalent residues Atom[] tmp1 = new Atom[equLen]; Atom[] tmp2 = new Atom[equLen]; int i, r1, r2; for(i = 0; i < equLen; i ++) { r1 = equSet[0][i]; r2 = equSet[1][i]; tmp1[i] = cod1[ r1 ]; tmp2[i] = (Atom)cod2[ r2 ].clone(); // have to be cloned! //tmp2[i] = cod2[ r2 ]; /*try { System.out.println("before superimpos: " + equSet[0][i]+"-"+ equSet[1][i]+ " dist:" + Calc.getDistance(tmp1[i], cod2[equSet[1][i]])); } catch (Exception e){ e.printStackTrace(); }*/ } //superimpose the equivalent residues Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(tmp1), Calc.atomsToPoints(tmp2)); Calc.transform(tmp2, trans); // weird, why does it take the RMSD before the rotation? // the rmsd is only for the subset contained in the tmp arrays. rmsd = Calc.rmsd(tmp1,tmp2); //System.err.println("rmsd after superimpose by set: " + rmsd); //transform structure 2 according to the superimposition of the equivalent residues Calc.transform(cod2, trans); // for(i = 0; i < equLen; i ++) { // try { // System.err.println("after superimpos: " + equSet[0][i]+"-"+ equSet[1][i]+ " dist:" + Calc.getDistance(tmp1[i], cod2[equSet[1][i]])); // } catch (Exception e){ // e.printStackTrace(); // } // } }
java
private void superimposeBySet () throws StructureException { //extract the coordinations of equivalent residues Atom[] tmp1 = new Atom[equLen]; Atom[] tmp2 = new Atom[equLen]; int i, r1, r2; for(i = 0; i < equLen; i ++) { r1 = equSet[0][i]; r2 = equSet[1][i]; tmp1[i] = cod1[ r1 ]; tmp2[i] = (Atom)cod2[ r2 ].clone(); // have to be cloned! //tmp2[i] = cod2[ r2 ]; /*try { System.out.println("before superimpos: " + equSet[0][i]+"-"+ equSet[1][i]+ " dist:" + Calc.getDistance(tmp1[i], cod2[equSet[1][i]])); } catch (Exception e){ e.printStackTrace(); }*/ } //superimpose the equivalent residues Matrix4d trans = SuperPositions.superpose(Calc.atomsToPoints(tmp1), Calc.atomsToPoints(tmp2)); Calc.transform(tmp2, trans); // weird, why does it take the RMSD before the rotation? // the rmsd is only for the subset contained in the tmp arrays. rmsd = Calc.rmsd(tmp1,tmp2); //System.err.println("rmsd after superimpose by set: " + rmsd); //transform structure 2 according to the superimposition of the equivalent residues Calc.transform(cod2, trans); // for(i = 0; i < equLen; i ++) { // try { // System.err.println("after superimpos: " + equSet[0][i]+"-"+ equSet[1][i]+ " dist:" + Calc.getDistance(tmp1[i], cod2[equSet[1][i]])); // } catch (Exception e){ // e.printStackTrace(); // } // } }
[ "private", "void", "superimposeBySet", "(", ")", "throws", "StructureException", "{", "//extract the coordinations of equivalent residues", "Atom", "[", "]", "tmp1", "=", "new", "Atom", "[", "equLen", "]", ";", "Atom", "[", "]", "tmp2", "=", "new", "Atom", "[", ...
superimpose two structures according to the equivalent residues
[ "superimpose", "two", "structures", "according", "to", "the", "equivalent", "residues" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/fatcat/calc/StructureAlignmentOptimizer.java#L235-L284
31,810
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java
PDBBioAssemblyParser.saveMatrix
private void saveMatrix() { for (String chainId : currentChainIDs) { BiologicalAssemblyTransformation transformation = new BiologicalAssemblyTransformation(); transformation.setRotationMatrix(currentMatrix.getArray()); transformation.setTranslation(shift); transformation.setId(String.valueOf(modelNumber)); transformation.setChainId(chainId); transformations.add(transformation); } if (!transformationMap.containsKey(currentBioMolecule)) { BioAssemblyInfo bioAssembly = new BioAssemblyInfo(); bioAssembly.setId(currentBioMolecule); bioAssembly.setTransforms(transformations); transformationMap.put(currentBioMolecule,bioAssembly); } }
java
private void saveMatrix() { for (String chainId : currentChainIDs) { BiologicalAssemblyTransformation transformation = new BiologicalAssemblyTransformation(); transformation.setRotationMatrix(currentMatrix.getArray()); transformation.setTranslation(shift); transformation.setId(String.valueOf(modelNumber)); transformation.setChainId(chainId); transformations.add(transformation); } if (!transformationMap.containsKey(currentBioMolecule)) { BioAssemblyInfo bioAssembly = new BioAssemblyInfo(); bioAssembly.setId(currentBioMolecule); bioAssembly.setTransforms(transformations); transformationMap.put(currentBioMolecule,bioAssembly); } }
[ "private", "void", "saveMatrix", "(", ")", "{", "for", "(", "String", "chainId", ":", "currentChainIDs", ")", "{", "BiologicalAssemblyTransformation", "transformation", "=", "new", "BiologicalAssemblyTransformation", "(", ")", ";", "transformation", ".", "setRotationM...
Saves transformation matrix for the list of current chains
[ "Saves", "transformation", "matrix", "for", "the", "list", "of", "current", "chains" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java#L131-L148
31,811
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java
PDBBioAssemblyParser.setMacromolecularSizes
public void setMacromolecularSizes() { for (BioAssemblyInfo bioAssembly : transformationMap.values()) { bioAssembly.setMacromolecularSize(bioAssembly.getTransforms().size()); } }
java
public void setMacromolecularSizes() { for (BioAssemblyInfo bioAssembly : transformationMap.values()) { bioAssembly.setMacromolecularSize(bioAssembly.getTransforms().size()); } }
[ "public", "void", "setMacromolecularSizes", "(", ")", "{", "for", "(", "BioAssemblyInfo", "bioAssembly", ":", "transformationMap", ".", "values", "(", ")", ")", "{", "bioAssembly", ".", "setMacromolecularSize", "(", "bioAssembly", ".", "getTransforms", "(", ")", ...
Set the macromolecularSize fields of the parsed bioassemblies. This can only be called after the full PDB file has been read so that all the info for all bioassemblies has been gathered. Note that an explicit method to set the field is necessary here because in PDB files the transformations contain only the author chain ids, corresponding to polymeric chains, whilst in mmCIF files the transformations contain all asym ids of both polymers and non-polymers.
[ "Set", "the", "macromolecularSize", "fields", "of", "the", "parsed", "bioassemblies", ".", "This", "can", "only", "be", "called", "after", "the", "full", "PDB", "file", "has", "been", "read", "so", "that", "all", "the", "info", "for", "all", "bioassemblies",...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBBioAssemblyParser.java#L178-L182
31,812
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.parseUniprotXMLString
public static <C extends Compound> UniprotProxySequenceReader<C> parseUniprotXMLString(String xml, CompoundSet<C> compoundSet) { try { Document document = XMLHelper.inputStreamToDocument(new ByteArrayInputStream(xml.getBytes())); return new UniprotProxySequenceReader<C>(document, compoundSet); } catch (Exception e) { logger.error("Exception on xml parse of: {}", xml); } return null; }
java
public static <C extends Compound> UniprotProxySequenceReader<C> parseUniprotXMLString(String xml, CompoundSet<C> compoundSet) { try { Document document = XMLHelper.inputStreamToDocument(new ByteArrayInputStream(xml.getBytes())); return new UniprotProxySequenceReader<C>(document, compoundSet); } catch (Exception e) { logger.error("Exception on xml parse of: {}", xml); } return null; }
[ "public", "static", "<", "C", "extends", "Compound", ">", "UniprotProxySequenceReader", "<", "C", ">", "parseUniprotXMLString", "(", "String", "xml", ",", "CompoundSet", "<", "C", ">", "compoundSet", ")", "{", "try", "{", "Document", "document", "=", "XMLHelpe...
The passed in xml is parsed as a DOM object so we know everything about the protein. If an error occurs throw an exception. We could have a bad uniprot id @param xml @param compoundSet @return UniprotProxySequenceReader @throws Exception
[ "The", "passed", "in", "xml", "is", "parsed", "as", "a", "DOM", "object", "so", "we", "know", "everything", "about", "the", "protein", ".", "If", "an", "error", "occurs", "throw", "an", "exception", ".", "We", "could", "have", "a", "bad", "uniprot", "i...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L128-L136
31,813
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.getAccessions
public ArrayList<AccessionID> getAccessions() throws XPathExpressionException { ArrayList<AccessionID> accessionList = new ArrayList<AccessionID>(); if (uniprotDoc == null) { return accessionList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> keyWordElementList = XMLHelper.selectElements(entryElement, "accession"); for (Element element : keyWordElementList) { AccessionID accessionID = new AccessionID(element.getTextContent(), DataSource.UNIPROT); accessionList.add(accessionID); } return accessionList; }
java
public ArrayList<AccessionID> getAccessions() throws XPathExpressionException { ArrayList<AccessionID> accessionList = new ArrayList<AccessionID>(); if (uniprotDoc == null) { return accessionList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> keyWordElementList = XMLHelper.selectElements(entryElement, "accession"); for (Element element : keyWordElementList) { AccessionID accessionID = new AccessionID(element.getTextContent(), DataSource.UNIPROT); accessionList.add(accessionID); } return accessionList; }
[ "public", "ArrayList", "<", "AccessionID", ">", "getAccessions", "(", ")", "throws", "XPathExpressionException", "{", "ArrayList", "<", "AccessionID", ">", "accessionList", "=", "new", "ArrayList", "<", "AccessionID", ">", "(", ")", ";", "if", "(", "uniprotDoc",...
Pull uniprot accessions associated with this sequence @return @throws XPathExpressionException
[ "Pull", "uniprot", "accessions", "associated", "with", "this", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L346-L360
31,814
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.getProteinAliases
public ArrayList<String> getProteinAliases() throws XPathExpressionException { ArrayList<String> aliasList = new ArrayList<String>(); if (uniprotDoc == null) { return aliasList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); Element proteinElement = XMLHelper.selectSingleElement(entryElement, "protein"); // An alternativeName can contain multiple fullNames and multiple shortNames, so we are careful to catch them all ArrayList<Element> keyWordElementList = XMLHelper.selectElements(proteinElement, "alternativeName"); for (Element element : keyWordElementList) { Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName"); aliasList.add(fullNameElement.getTextContent()); ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName"); for(Element shortNameElement : shortNameElements) { if(null != shortNameElement) { String shortName = shortNameElement.getTextContent(); if(null != shortName && !shortName.trim().isEmpty()) { aliasList.add(shortName); } } } } // recommendedName seems to allow only one fullName, to be on the safe side, we double check for multiple shortNames for the recommendedName keyWordElementList = XMLHelper.selectElements(proteinElement, "recommendedName"); for (Element element : keyWordElementList) { Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName"); aliasList.add(fullNameElement.getTextContent()); ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName"); for(Element shortNameElement : shortNameElements) { if(null != shortNameElement) { String shortName = shortNameElement.getTextContent(); if(null != shortName && !shortName.trim().isEmpty()) { aliasList.add(shortName); } } } } Element cdAntigen = XMLHelper.selectSingleElement(proteinElement, "cdAntigenName"); if(null != cdAntigen) { String cdAntigenName = cdAntigen.getTextContent(); if(null != cdAntigenName && !cdAntigenName.trim().isEmpty()) { aliasList.add(cdAntigenName); } } return aliasList; }
java
public ArrayList<String> getProteinAliases() throws XPathExpressionException { ArrayList<String> aliasList = new ArrayList<String>(); if (uniprotDoc == null) { return aliasList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); Element proteinElement = XMLHelper.selectSingleElement(entryElement, "protein"); // An alternativeName can contain multiple fullNames and multiple shortNames, so we are careful to catch them all ArrayList<Element> keyWordElementList = XMLHelper.selectElements(proteinElement, "alternativeName"); for (Element element : keyWordElementList) { Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName"); aliasList.add(fullNameElement.getTextContent()); ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName"); for(Element shortNameElement : shortNameElements) { if(null != shortNameElement) { String shortName = shortNameElement.getTextContent(); if(null != shortName && !shortName.trim().isEmpty()) { aliasList.add(shortName); } } } } // recommendedName seems to allow only one fullName, to be on the safe side, we double check for multiple shortNames for the recommendedName keyWordElementList = XMLHelper.selectElements(proteinElement, "recommendedName"); for (Element element : keyWordElementList) { Element fullNameElement = XMLHelper.selectSingleElement(element, "fullName"); aliasList.add(fullNameElement.getTextContent()); ArrayList<Element> shortNameElements = XMLHelper.selectElements(element, "shortName"); for(Element shortNameElement : shortNameElements) { if(null != shortNameElement) { String shortName = shortNameElement.getTextContent(); if(null != shortName && !shortName.trim().isEmpty()) { aliasList.add(shortName); } } } } Element cdAntigen = XMLHelper.selectSingleElement(proteinElement, "cdAntigenName"); if(null != cdAntigen) { String cdAntigenName = cdAntigen.getTextContent(); if(null != cdAntigenName && !cdAntigenName.trim().isEmpty()) { aliasList.add(cdAntigenName); } } return aliasList; }
[ "public", "ArrayList", "<", "String", ">", "getProteinAliases", "(", ")", "throws", "XPathExpressionException", "{", "ArrayList", "<", "String", ">", "aliasList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "uniprotDoc", "==", "nul...
Pull uniprot protein aliases associated with this sequence @return @throws XPathExpressionException
[ "Pull", "uniprot", "protein", "aliases", "associated", "with", "this", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L378-L425
31,815
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.getGeneAliases
public ArrayList<String> getGeneAliases() throws XPathExpressionException { ArrayList<String> aliasList = new ArrayList<String>(); if (uniprotDoc == null) { return aliasList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> proteinElements = XMLHelper.selectElements(entryElement, "gene"); for(Element proteinElement : proteinElements) { ArrayList<Element> keyWordElementList = XMLHelper.selectElements(proteinElement, "name"); for (Element element : keyWordElementList) { aliasList.add(element.getTextContent()); } } return aliasList; }
java
public ArrayList<String> getGeneAliases() throws XPathExpressionException { ArrayList<String> aliasList = new ArrayList<String>(); if (uniprotDoc == null) { return aliasList; } Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> proteinElements = XMLHelper.selectElements(entryElement, "gene"); for(Element proteinElement : proteinElements) { ArrayList<Element> keyWordElementList = XMLHelper.selectElements(proteinElement, "name"); for (Element element : keyWordElementList) { aliasList.add(element.getTextContent()); } } return aliasList; }
[ "public", "ArrayList", "<", "String", ">", "getGeneAliases", "(", ")", "throws", "XPathExpressionException", "{", "ArrayList", "<", "String", ">", "aliasList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "uniprotDoc", "==", "null",...
Pull uniprot gene aliases associated with this sequence @return @throws XPathExpressionException
[ "Pull", "uniprot", "gene", "aliases", "associated", "with", "this", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L432-L447
31,816
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.openURLConnection
private static HttpURLConnection openURLConnection(URL url) throws IOException { // This method should be moved to a utility class in BioJava 5.0 final int timeout = 5000; final String useragent = "BioJava"; HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("User-Agent", useragent); conn.setInstanceFollowRedirects(true); conn.setConnectTimeout(timeout); conn.setReadTimeout(timeout); int status = conn.getResponseCode(); while (status == HttpURLConnection.HTTP_MOVED_TEMP || status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_SEE_OTHER) { // Redirect! String newUrl = conn.getHeaderField("Location"); if(newUrl.equals(url.toString())) { throw new IOException("Cyclic redirect detected at "+newUrl); } // Preserve cookies String cookies = conn.getHeaderField("Set-Cookie"); // open the new connection again url = new URL(newUrl); conn.disconnect(); conn = (HttpURLConnection) url.openConnection(); if(cookies != null) { conn.setRequestProperty("Cookie", cookies); } conn.addRequestProperty("User-Agent", useragent); conn.setInstanceFollowRedirects(true); conn.setConnectTimeout(timeout); conn.setReadTimeout(timeout); conn.connect(); status = conn.getResponseCode(); logger.info("Redirecting from {} to {}", url, newUrl); } conn.connect(); return conn; }
java
private static HttpURLConnection openURLConnection(URL url) throws IOException { // This method should be moved to a utility class in BioJava 5.0 final int timeout = 5000; final String useragent = "BioJava"; HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestProperty("User-Agent", useragent); conn.setInstanceFollowRedirects(true); conn.setConnectTimeout(timeout); conn.setReadTimeout(timeout); int status = conn.getResponseCode(); while (status == HttpURLConnection.HTTP_MOVED_TEMP || status == HttpURLConnection.HTTP_MOVED_PERM || status == HttpURLConnection.HTTP_SEE_OTHER) { // Redirect! String newUrl = conn.getHeaderField("Location"); if(newUrl.equals(url.toString())) { throw new IOException("Cyclic redirect detected at "+newUrl); } // Preserve cookies String cookies = conn.getHeaderField("Set-Cookie"); // open the new connection again url = new URL(newUrl); conn.disconnect(); conn = (HttpURLConnection) url.openConnection(); if(cookies != null) { conn.setRequestProperty("Cookie", cookies); } conn.addRequestProperty("User-Agent", useragent); conn.setInstanceFollowRedirects(true); conn.setConnectTimeout(timeout); conn.setReadTimeout(timeout); conn.connect(); status = conn.getResponseCode(); logger.info("Redirecting from {} to {}", url, newUrl); } conn.connect(); return conn; }
[ "private", "static", "HttpURLConnection", "openURLConnection", "(", "URL", "url", ")", "throws", "IOException", "{", "// This method should be moved to a utility class in BioJava 5.0", "final", "int", "timeout", "=", "5000", ";", "final", "String", "useragent", "=", "\"Bi...
Open a URL connection. Follows redirects. @param url @throws IOException
[ "Open", "a", "URL", "connection", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L514-L560
31,817
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.getGeneName
public String getGeneName() { if (uniprotDoc == null) { return ""; } try { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); Element geneElement = XMLHelper.selectSingleElement(entryElement, "gene"); if (geneElement == null) { return ""; } Element nameElement = XMLHelper.selectSingleElement(geneElement, "name"); if (nameElement == null) { return ""; } return nameElement.getTextContent(); } catch (XPathExpressionException e) { logger.error("Problems while parsing gene name in UniProt XML: {}. Gene name will be blank.",e.getMessage()); return ""; } }
java
public String getGeneName() { if (uniprotDoc == null) { return ""; } try { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); Element geneElement = XMLHelper.selectSingleElement(entryElement, "gene"); if (geneElement == null) { return ""; } Element nameElement = XMLHelper.selectSingleElement(geneElement, "name"); if (nameElement == null) { return ""; } return nameElement.getTextContent(); } catch (XPathExpressionException e) { logger.error("Problems while parsing gene name in UniProt XML: {}. Gene name will be blank.",e.getMessage()); return ""; } }
[ "public", "String", "getGeneName", "(", ")", "{", "if", "(", "uniprotDoc", "==", "null", ")", "{", "return", "\"\"", ";", "}", "try", "{", "Element", "uniprotElement", "=", "uniprotDoc", ".", "getDocumentElement", "(", ")", ";", "Element", "entryElement", ...
Get the gene name associated with this sequence. @return
[ "Get", "the", "gene", "name", "associated", "with", "this", "sequence", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L690-L710
31,818
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.getKeyWords
@Override public ArrayList<String> getKeyWords() { ArrayList<String> keyWordsList = new ArrayList<String>(); if (uniprotDoc == null) { return keyWordsList; } try { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> keyWordElementList = XMLHelper.selectElements(entryElement, "keyword"); for (Element element : keyWordElementList) { keyWordsList.add(element.getTextContent()); } } catch (XPathExpressionException e) { logger.error("Problems while parsing keywords in UniProt XML: {}. No keywords will be available.",e.getMessage()); return new ArrayList<String>(); } return keyWordsList; }
java
@Override public ArrayList<String> getKeyWords() { ArrayList<String> keyWordsList = new ArrayList<String>(); if (uniprotDoc == null) { return keyWordsList; } try { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> keyWordElementList = XMLHelper.selectElements(entryElement, "keyword"); for (Element element : keyWordElementList) { keyWordsList.add(element.getTextContent()); } } catch (XPathExpressionException e) { logger.error("Problems while parsing keywords in UniProt XML: {}. No keywords will be available.",e.getMessage()); return new ArrayList<String>(); } return keyWordsList; }
[ "@", "Override", "public", "ArrayList", "<", "String", ">", "getKeyWords", "(", ")", "{", "ArrayList", "<", "String", ">", "keyWordsList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "uniprotDoc", "==", "null", ")", "{", "ret...
Pull UniProt key words which is a mixed bag of words associated with this sequence @return
[ "Pull", "UniProt", "key", "words", "which", "is", "a", "mixed", "bag", "of", "words", "associated", "with", "this", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L743-L763
31,819
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java
UniprotProxySequenceReader.getDatabaseReferences
@Override public LinkedHashMap<String, ArrayList<DBReferenceInfo>> getDatabaseReferences() { LinkedHashMap<String, ArrayList<DBReferenceInfo>> databaseReferencesHashMap = new LinkedHashMap<String, ArrayList<DBReferenceInfo>>(); if (uniprotDoc == null) { return databaseReferencesHashMap; } try { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> dbreferenceElementList = XMLHelper.selectElements(entryElement, "dbReference"); for (Element element : dbreferenceElementList) { String type = element.getAttribute("type"); String id = element.getAttribute("id"); ArrayList<DBReferenceInfo> idlist = databaseReferencesHashMap.get(type); if (idlist == null) { idlist = new ArrayList<DBReferenceInfo>(); databaseReferencesHashMap.put(type, idlist); } DBReferenceInfo dbreferenceInfo = new DBReferenceInfo(type, id); ArrayList<Element> propertyElementList = XMLHelper.selectElements(element, "property"); for (Element propertyElement : propertyElementList) { String propertyType = propertyElement.getAttribute("type"); String propertyValue = propertyElement.getAttribute("value"); dbreferenceInfo.addProperty(propertyType, propertyValue); } idlist.add(dbreferenceInfo); } } catch (XPathExpressionException e) { logger.error("Problems while parsing db references in UniProt XML: {}. No db references will be available.",e.getMessage()); return new LinkedHashMap<String, ArrayList<DBReferenceInfo>>(); } return databaseReferencesHashMap; }
java
@Override public LinkedHashMap<String, ArrayList<DBReferenceInfo>> getDatabaseReferences() { LinkedHashMap<String, ArrayList<DBReferenceInfo>> databaseReferencesHashMap = new LinkedHashMap<String, ArrayList<DBReferenceInfo>>(); if (uniprotDoc == null) { return databaseReferencesHashMap; } try { Element uniprotElement = uniprotDoc.getDocumentElement(); Element entryElement = XMLHelper.selectSingleElement(uniprotElement, "entry"); ArrayList<Element> dbreferenceElementList = XMLHelper.selectElements(entryElement, "dbReference"); for (Element element : dbreferenceElementList) { String type = element.getAttribute("type"); String id = element.getAttribute("id"); ArrayList<DBReferenceInfo> idlist = databaseReferencesHashMap.get(type); if (idlist == null) { idlist = new ArrayList<DBReferenceInfo>(); databaseReferencesHashMap.put(type, idlist); } DBReferenceInfo dbreferenceInfo = new DBReferenceInfo(type, id); ArrayList<Element> propertyElementList = XMLHelper.selectElements(element, "property"); for (Element propertyElement : propertyElementList) { String propertyType = propertyElement.getAttribute("type"); String propertyValue = propertyElement.getAttribute("value"); dbreferenceInfo.addProperty(propertyType, propertyValue); } idlist.add(dbreferenceInfo); } } catch (XPathExpressionException e) { logger.error("Problems while parsing db references in UniProt XML: {}. No db references will be available.",e.getMessage()); return new LinkedHashMap<String, ArrayList<DBReferenceInfo>>(); } return databaseReferencesHashMap; }
[ "@", "Override", "public", "LinkedHashMap", "<", "String", ",", "ArrayList", "<", "DBReferenceInfo", ">", ">", "getDatabaseReferences", "(", ")", "{", "LinkedHashMap", "<", "String", ",", "ArrayList", "<", "DBReferenceInfo", ">", ">", "databaseReferencesHashMap", ...
The Uniprot mappings to other database identifiers for this sequence @return
[ "The", "Uniprot", "mappings", "to", "other", "database", "identifiers", "for", "this", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/loader/UniprotProxySequenceReader.java#L769-L804
31,820
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java
FastaAFPChainConverter.fastaToAfpChain
public static AFPChain fastaToAfpChain(Map<String, ProteinSequence> sequences, Structure structure1, Structure structure2) throws StructureException { if (sequences.size() != 2) { throw new IllegalArgumentException("There must be exactly 2 sequences, but there were " + sequences.size()); } if (structure1 == null || structure2 == null) { throw new IllegalArgumentException("A structure is null"); } List<ProteinSequence> seqs = new ArrayList<ProteinSequence>(); List<String> names = new ArrayList<String>(2); for (Map.Entry<String, ProteinSequence> entry : sequences.entrySet()) { seqs.add(entry.getValue()); names.add(entry.getKey()); } return fastaToAfpChain(seqs.get(0), seqs.get(1), structure1, structure2); }
java
public static AFPChain fastaToAfpChain(Map<String, ProteinSequence> sequences, Structure structure1, Structure structure2) throws StructureException { if (sequences.size() != 2) { throw new IllegalArgumentException("There must be exactly 2 sequences, but there were " + sequences.size()); } if (structure1 == null || structure2 == null) { throw new IllegalArgumentException("A structure is null"); } List<ProteinSequence> seqs = new ArrayList<ProteinSequence>(); List<String> names = new ArrayList<String>(2); for (Map.Entry<String, ProteinSequence> entry : sequences.entrySet()) { seqs.add(entry.getValue()); names.add(entry.getKey()); } return fastaToAfpChain(seqs.get(0), seqs.get(1), structure1, structure2); }
[ "public", "static", "AFPChain", "fastaToAfpChain", "(", "Map", "<", "String", ",", "ProteinSequence", ">", "sequences", ",", "Structure", "structure1", ",", "Structure", "structure2", ")", "throws", "StructureException", "{", "if", "(", "sequences", ".", "size", ...
Uses two sequences each with a corresponding structure to create an AFPChain corresponding to the alignment. Provided only for convenience since FastaReaders return such maps. @param sequences A Map containing exactly two entries from sequence names as Strings to gapped ProteinSequences; the name is ignored @see #fastaToAfpChain(ProteinSequence, ProteinSequence, Structure, Structure) @throws StructureException
[ "Uses", "two", "sequences", "each", "with", "a", "corresponding", "structure", "to", "create", "an", "AFPChain", "corresponding", "to", "the", "alignment", ".", "Provided", "only", "for", "convenience", "since", "FastaReaders", "return", "such", "maps", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java#L228-L247
31,821
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java
FastaAFPChainConverter.fastaToAfpChain
public static AFPChain fastaToAfpChain(SequencePair<Sequence<AminoAcidCompound>, AminoAcidCompound> alignment, Structure structure1, Structure structure2) throws StructureException { List<AlignedSequence<Sequence<AminoAcidCompound>, AminoAcidCompound>> seqs = alignment.getAlignedSequences(); StringBuilder sb1 = new StringBuilder(); for (AminoAcidCompound a : seqs.get(0)) { sb1.append(a.getBase()); } try { ProteinSequence seq1 = new ProteinSequence(sb1.toString()); StringBuilder sb2 = new StringBuilder(); for (AminoAcidCompound a : seqs.get(1)) { sb1.append(a.getBase()); } ProteinSequence seq2 = new ProteinSequence(sb2.toString()); LinkedHashMap<String, ProteinSequence> map = new LinkedHashMap<String, ProteinSequence>(); map.put(structure1.getName(), seq1); map.put(structure2.getName(), seq2); return fastaToAfpChain(map, structure1, structure2); } catch (CompoundNotFoundException e) { logger.error("Unexpected error while creating protein sequences: {}. This is most likely a bug.",e.getMessage()); return null; } }
java
public static AFPChain fastaToAfpChain(SequencePair<Sequence<AminoAcidCompound>, AminoAcidCompound> alignment, Structure structure1, Structure structure2) throws StructureException { List<AlignedSequence<Sequence<AminoAcidCompound>, AminoAcidCompound>> seqs = alignment.getAlignedSequences(); StringBuilder sb1 = new StringBuilder(); for (AminoAcidCompound a : seqs.get(0)) { sb1.append(a.getBase()); } try { ProteinSequence seq1 = new ProteinSequence(sb1.toString()); StringBuilder sb2 = new StringBuilder(); for (AminoAcidCompound a : seqs.get(1)) { sb1.append(a.getBase()); } ProteinSequence seq2 = new ProteinSequence(sb2.toString()); LinkedHashMap<String, ProteinSequence> map = new LinkedHashMap<String, ProteinSequence>(); map.put(structure1.getName(), seq1); map.put(structure2.getName(), seq2); return fastaToAfpChain(map, structure1, structure2); } catch (CompoundNotFoundException e) { logger.error("Unexpected error while creating protein sequences: {}. This is most likely a bug.",e.getMessage()); return null; } }
[ "public", "static", "AFPChain", "fastaToAfpChain", "(", "SequencePair", "<", "Sequence", "<", "AminoAcidCompound", ">", ",", "AminoAcidCompound", ">", "alignment", ",", "Structure", "structure1", ",", "Structure", "structure2", ")", "throws", "StructureException", "{"...
Provided only for convenience. @see #fastaToAfpChain(ProteinSequence, ProteinSequence, Structure, Structure) @throws StructureException
[ "Provided", "only", "for", "convenience", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java#L310-L332
31,822
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java
FastaAFPChainConverter.main
public static void main(String[] args) throws StructureException, IOException { if (args.length != 3) { System.err.println("Usage: FastaAFPChainConverter fasta-file structure-1-name structure-2-name"); return; } File fasta = new File(args[0]); Structure structure1 = StructureTools.getStructure(args[1]); Structure structure2 = StructureTools.getStructure(args[2]); if (structure1 == null) throw new IllegalArgumentException("No structure for " + args[1] + " was found"); if (structure2 == null) throw new IllegalArgumentException("No structure for " + args[2] + " was found"); AFPChain afpChain = fastaFileToAfpChain(fasta, structure1, structure2); String xml = AFPChainXMLConverter.toXML(afpChain); System.out.println(xml); }
java
public static void main(String[] args) throws StructureException, IOException { if (args.length != 3) { System.err.println("Usage: FastaAFPChainConverter fasta-file structure-1-name structure-2-name"); return; } File fasta = new File(args[0]); Structure structure1 = StructureTools.getStructure(args[1]); Structure structure2 = StructureTools.getStructure(args[2]); if (structure1 == null) throw new IllegalArgumentException("No structure for " + args[1] + " was found"); if (structure2 == null) throw new IllegalArgumentException("No structure for " + args[2] + " was found"); AFPChain afpChain = fastaFileToAfpChain(fasta, structure1, structure2); String xml = AFPChainXMLConverter.toXML(afpChain); System.out.println(xml); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "StructureException", ",", "IOException", "{", "if", "(", "args", ".", "length", "!=", "3", ")", "{", "System", ".", "err", ".", "println", "(", "\"Usage: FastaAFPChainConv...
Prints out the XML representation of an AFPChain from a file containing exactly two FASTA sequences. @param args A String array of fasta-file structure-1-name structure-2-name @throws StructureException @throws IOException
[ "Prints", "out", "the", "XML", "representation", "of", "an", "AFPChain", "from", "a", "file", "containing", "exactly", "two", "FASTA", "sequences", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java#L397-L410
31,823
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java
SymbolTable.put
public void put(Key key, Value val) { if (val == null) st.remove(key); else st.put(key, val); }
java
public void put(Key key, Value val) { if (val == null) st.remove(key); else st.put(key, val); }
[ "public", "void", "put", "(", "Key", "key", ",", "Value", "val", ")", "{", "if", "(", "val", "==", "null", ")", "st", ".", "remove", "(", "key", ")", ";", "else", "st", ".", "put", "(", "key", ",", "val", ")", ";", "}" ]
Put key-value pair into the symbol table. Remove key from table if value is null.
[ "Put", "key", "-", "value", "pair", "into", "the", "symbol", "table", ".", "Remove", "key", "from", "table", "if", "value", "is", "null", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java#L79-L82
31,824
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java
SymbolTable.ceil
public Key ceil(Key k) { SortedMap<Key, Value> tail = st.tailMap(k); if (tail.isEmpty()) return null; else return tail.firstKey(); }
java
public Key ceil(Key k) { SortedMap<Key, Value> tail = st.tailMap(k); if (tail.isEmpty()) return null; else return tail.firstKey(); }
[ "public", "Key", "ceil", "(", "Key", "k", ")", "{", "SortedMap", "<", "Key", ",", "Value", ">", "tail", "=", "st", ".", "tailMap", "(", "k", ")", ";", "if", "(", "tail", ".", "isEmpty", "(", ")", ")", "return", "null", ";", "else", "return", "t...
Return the smallest key in the table >= k.
[ "Return", "the", "smallest", "key", "in", "the", "table", ">", "=", "k", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java#L149-L153
31,825
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java
SymbolTable.floor
public Key floor(Key k) { if (st.containsKey(k)) return k; // does not include key if present (!) SortedMap<Key, Value> head = st.headMap(k); if (head.isEmpty()) return null; else return head.lastKey(); }
java
public Key floor(Key k) { if (st.containsKey(k)) return k; // does not include key if present (!) SortedMap<Key, Value> head = st.headMap(k); if (head.isEmpty()) return null; else return head.lastKey(); }
[ "public", "Key", "floor", "(", "Key", "k", ")", "{", "if", "(", "st", ".", "containsKey", "(", "k", ")", ")", "return", "k", ";", "// does not include key if present (!)", "SortedMap", "<", "Key", ",", "Value", ">", "head", "=", "st", ".", "headMap", "...
Return the largest key in the table <= k.
[ "Return", "the", "largest", "key", "in", "the", "table", "<", "=", "k", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/math/SymbolTable.java#L158-L165
31,826
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParser.java
GenericFastaHeaderParser.getHeaderValues
private String[] getHeaderValues(String header) { String[] data = new String[0]; ArrayList<String> values = new ArrayList<String>(); StringBuffer sb = new StringBuffer(); //commented out 1/11/2012 to resolve an issue where headers do contain a length= at the end that are not recognized //if(header.indexOf("length=") != -1){ // data = new String[1]; // int index = header.indexOf("length="); // data[0] = header.substring(0, index).trim(); // logger.debug("accession=" + data[0]); // return data; //} else if (!header.startsWith("PDB:")) { for (int i = 0; i < header.length(); i++) { if (header.charAt(i) == '|') { values.add(sb.toString()); sb.setLength(0);//faster than = new StringBuffer(); } else if (i == header.length() - 1) { sb.append(header.charAt(i)); values.add(sb.toString()); } else { sb.append(header.charAt(i)); } data = new String[values.size()]; values.toArray(data); } } else { data = header.split(" "); } return data; }
java
private String[] getHeaderValues(String header) { String[] data = new String[0]; ArrayList<String> values = new ArrayList<String>(); StringBuffer sb = new StringBuffer(); //commented out 1/11/2012 to resolve an issue where headers do contain a length= at the end that are not recognized //if(header.indexOf("length=") != -1){ // data = new String[1]; // int index = header.indexOf("length="); // data[0] = header.substring(0, index).trim(); // logger.debug("accession=" + data[0]); // return data; //} else if (!header.startsWith("PDB:")) { for (int i = 0; i < header.length(); i++) { if (header.charAt(i) == '|') { values.add(sb.toString()); sb.setLength(0);//faster than = new StringBuffer(); } else if (i == header.length() - 1) { sb.append(header.charAt(i)); values.add(sb.toString()); } else { sb.append(header.charAt(i)); } data = new String[values.size()]; values.toArray(data); } } else { data = header.split(" "); } return data; }
[ "private", "String", "[", "]", "getHeaderValues", "(", "String", "header", ")", "{", "String", "[", "]", "data", "=", "new", "String", "[", "0", "]", ";", "ArrayList", "<", "String", ">", "values", "=", "new", "ArrayList", "<", "String", ">", "(", ")...
Parse out the components where some have a | and others do not @param header @return
[ "Parse", "out", "the", "components", "where", "some", "have", "a", "|", "and", "others", "do", "not" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenericFastaHeaderParser.java#L72-L103
31,827
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java
Alignments.getListFromFutures
static <E> List<E> getListFromFutures(List<Future<E>> futures) { List<E> list = new ArrayList<E>(); for (Future<E> f : futures) { // TODO when added to ConcurrencyTools, log completions and exceptions instead of printing stack traces try { list.add(f.get()); } catch (InterruptedException e) { logger.error("Interrupted Exception: ", e); } catch (ExecutionException e) { logger.error("Execution Exception: ", e); } } return list; }
java
static <E> List<E> getListFromFutures(List<Future<E>> futures) { List<E> list = new ArrayList<E>(); for (Future<E> f : futures) { // TODO when added to ConcurrencyTools, log completions and exceptions instead of printing stack traces try { list.add(f.get()); } catch (InterruptedException e) { logger.error("Interrupted Exception: ", e); } catch (ExecutionException e) { logger.error("Execution Exception: ", e); } } return list; }
[ "static", "<", "E", ">", "List", "<", "E", ">", "getListFromFutures", "(", "List", "<", "Future", "<", "E", ">", ">", "futures", ")", "{", "List", "<", "E", ">", "list", "=", "new", "ArrayList", "<", "E", ">", "(", ")", ";", "for", "(", "Future...
Factory method which retrieves calculated elements from a list of tasks on the concurrent execution queue. @param <E> each task calculates a value of type E @param futures list of tasks @return calculated elements
[ "Factory", "method", "which", "retrieves", "calculated", "elements", "from", "a", "list", "of", "tasks", "on", "the", "concurrent", "execution", "queue", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java#L293-L306
31,828
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java
Alignments.getPairwiseAligner
public static <S extends Sequence<C>, C extends Compound> PairwiseSequenceAligner<S, C> getPairwiseAligner( S query, S target, PairwiseSequenceAlignerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { if (!query.getCompoundSet().equals(target.getCompoundSet())) { throw new IllegalArgumentException("Sequence compound sets must be the same"); } switch (type) { default: case GLOBAL: return new NeedlemanWunsch<S, C>(query, target, gapPenalty, subMatrix); case LOCAL: return new SmithWaterman<S, C>(query, target, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case LOCAL_LINEAR_SPACE: // TODO other alignment options (Myers-Miller, Thompson) throw new UnsupportedOperationException(Alignments.class.getSimpleName() + " does not yet support " + type + " alignment"); } }
java
public static <S extends Sequence<C>, C extends Compound> PairwiseSequenceAligner<S, C> getPairwiseAligner( S query, S target, PairwiseSequenceAlignerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { if (!query.getCompoundSet().equals(target.getCompoundSet())) { throw new IllegalArgumentException("Sequence compound sets must be the same"); } switch (type) { default: case GLOBAL: return new NeedlemanWunsch<S, C>(query, target, gapPenalty, subMatrix); case LOCAL: return new SmithWaterman<S, C>(query, target, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case LOCAL_LINEAR_SPACE: // TODO other alignment options (Myers-Miller, Thompson) throw new UnsupportedOperationException(Alignments.class.getSimpleName() + " does not yet support " + type + " alignment"); } }
[ "public", "static", "<", "S", "extends", "Sequence", "<", "C", ">", ",", "C", "extends", "Compound", ">", "PairwiseSequenceAligner", "<", "S", ",", "C", ">", "getPairwiseAligner", "(", "S", "query", ",", "S", "target", ",", "PairwiseSequenceAlignerType", "ty...
Factory method which constructs a pairwise sequence aligner. @param <S> each {@link Sequence} of an alignment pair is of type S @param <C> each element of an {@link AlignedSequence} is a {@link Compound} of type C @param query the first {@link Sequence} to align @param target the second {@link Sequence} to align @param type chosen type from list of pairwise sequence alignment routines @param gapPenalty the gap penalties used during alignment @param subMatrix the set of substitution scores used during alignment @return pairwise sequence aligner
[ "Factory", "method", "which", "constructs", "a", "pairwise", "sequence", "aligner", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java#L320-L338
31,829
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java
Alignments.getPairwiseScorer
static <S extends Sequence<C>, C extends Compound> PairwiseSequenceScorer<S, C> getPairwiseScorer( S query, S target, PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { switch (type) { default: case GLOBAL: return getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix); case GLOBAL_IDENTITIES: return new FractionalIdentityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix)); case GLOBAL_SIMILARITIES: return new FractionalSimilarityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix)); case LOCAL: return getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix); case LOCAL_IDENTITIES: return new FractionalIdentityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix)); case LOCAL_SIMILARITIES: return new FractionalSimilarityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix)); case KMERS: case WU_MANBER: // TODO other scoring options throw new UnsupportedOperationException(Alignments.class.getSimpleName() + " does not yet support " + type + " scoring"); } }
java
static <S extends Sequence<C>, C extends Compound> PairwiseSequenceScorer<S, C> getPairwiseScorer( S query, S target, PairwiseSequenceScorerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { switch (type) { default: case GLOBAL: return getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix); case GLOBAL_IDENTITIES: return new FractionalIdentityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix)); case GLOBAL_SIMILARITIES: return new FractionalSimilarityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.GLOBAL, gapPenalty, subMatrix)); case LOCAL: return getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix); case LOCAL_IDENTITIES: return new FractionalIdentityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix)); case LOCAL_SIMILARITIES: return new FractionalSimilarityScorer<S, C>(getPairwiseAligner(query, target, PairwiseSequenceAlignerType.LOCAL, gapPenalty, subMatrix)); case KMERS: case WU_MANBER: // TODO other scoring options throw new UnsupportedOperationException(Alignments.class.getSimpleName() + " does not yet support " + type + " scoring"); } }
[ "static", "<", "S", "extends", "Sequence", "<", "C", ">", ",", "C", "extends", "Compound", ">", "PairwiseSequenceScorer", "<", "S", ",", "C", ">", "getPairwiseScorer", "(", "S", "query", ",", "S", "target", ",", "PairwiseSequenceScorerType", "type", ",", "...
Factory method which constructs a pairwise sequence scorer. @param <S> each {@link Sequence} of a pair is of type S @param <C> each element of a {@link Sequence} is a {@link Compound} of type C @param query the first {@link Sequence} to score @param target the second {@link Sequence} to score @param type chosen type from list of pairwise sequence scoring routines @param gapPenalty the gap penalties used during alignment @param subMatrix the set of substitution scores used during alignment @return sequence pair scorer
[ "Factory", "method", "which", "constructs", "a", "pairwise", "sequence", "scorer", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java#L369-L396
31,830
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java
Alignments.getProfileProfileAligner
static <S extends Sequence<C>, C extends Compound> ProfileProfileAligner<S, C> getProfileProfileAligner( Future<ProfilePair<S, C>> profile1, Future<ProfilePair<S, C>> profile2, ProfileProfileAlignerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { switch (type) { default: case GLOBAL: return new SimpleProfileProfileAligner<S, C>(profile1, profile2, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case GLOBAL_CONSENSUS: case LOCAL: case LOCAL_LINEAR_SPACE: case LOCAL_CONSENSUS: // TODO other alignment options (Myers-Miller, consensus, local) throw new UnsupportedOperationException(Alignments.class.getSimpleName() + " does not yet support " + type + " alignment"); } }
java
static <S extends Sequence<C>, C extends Compound> ProfileProfileAligner<S, C> getProfileProfileAligner( Future<ProfilePair<S, C>> profile1, Future<ProfilePair<S, C>> profile2, ProfileProfileAlignerType type, GapPenalty gapPenalty, SubstitutionMatrix<C> subMatrix) { switch (type) { default: case GLOBAL: return new SimpleProfileProfileAligner<S, C>(profile1, profile2, gapPenalty, subMatrix); case GLOBAL_LINEAR_SPACE: case GLOBAL_CONSENSUS: case LOCAL: case LOCAL_LINEAR_SPACE: case LOCAL_CONSENSUS: // TODO other alignment options (Myers-Miller, consensus, local) throw new UnsupportedOperationException(Alignments.class.getSimpleName() + " does not yet support " + type + " alignment"); } }
[ "static", "<", "S", "extends", "Sequence", "<", "C", ">", ",", "C", "extends", "Compound", ">", "ProfileProfileAligner", "<", "S", ",", "C", ">", "getProfileProfileAligner", "(", "Future", "<", "ProfilePair", "<", "S", ",", "C", ">", ">", "profile1", ","...
Factory method which constructs a profile-profile aligner. @param <S> each {@link Sequence} of an alignment profile is of type S @param <C> each element of an {@link AlignedSequence} is a {@link Compound} of type C @param profile1 the first {@link Profile} to align @param profile2 the second {@link Profile} to align @param type chosen type from list of profile-profile alignment routines @param gapPenalty the gap penalties used during alignment @param subMatrix the set of substitution scores used during alignment @return profile-profile aligner
[ "Factory", "method", "which", "constructs", "a", "profile", "-", "profile", "aligner", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/Alignments.java#L440-L456
31,831
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaStructureParser.java
FastaStructureParser.process
public void process() throws IOException, StructureException { if(sequences == null) { // only process once, then return cached values LinkedHashMap<String, ProteinSequence> sequenceMap = reader.process(); sequences = sequenceMap.values().toArray(new ProteinSequence[0]); accessions = new String[sequences.length]; structures = new Structure[sequences.length]; residues = new ResidueNumber[sequences.length][]; // Match each sequence to a series of PDB Residue numbers for(int i=0;i<sequences.length;i++) { accessions[i] = sequences[i].getAccession().getID(); //System.out.println("Fetching "+accession); structures[i] = cache.getStructure(accessions[i]); residues[i] = StructureSequenceMatcher.matchSequenceToStructure(sequences[i], structures[i]); assert( residues[i].length == sequences[i].getLength()); } } }
java
public void process() throws IOException, StructureException { if(sequences == null) { // only process once, then return cached values LinkedHashMap<String, ProteinSequence> sequenceMap = reader.process(); sequences = sequenceMap.values().toArray(new ProteinSequence[0]); accessions = new String[sequences.length]; structures = new Structure[sequences.length]; residues = new ResidueNumber[sequences.length][]; // Match each sequence to a series of PDB Residue numbers for(int i=0;i<sequences.length;i++) { accessions[i] = sequences[i].getAccession().getID(); //System.out.println("Fetching "+accession); structures[i] = cache.getStructure(accessions[i]); residues[i] = StructureSequenceMatcher.matchSequenceToStructure(sequences[i], structures[i]); assert( residues[i].length == sequences[i].getLength()); } } }
[ "public", "void", "process", "(", ")", "throws", "IOException", ",", "StructureException", "{", "if", "(", "sequences", "==", "null", ")", "{", "// only process once, then return cached values", "LinkedHashMap", "<", "String", ",", "ProteinSequence", ">", "sequenceMap...
Parses the fasta file and loads it into memory. Information can be subsequently accessed through {@link #getSequences()}, {@link #getStructures()}, {@link #getResidues()}, and {@link #getAccessions()}. @throws IOException @throws StructureException
[ "Parses", "the", "fasta", "file", "and", "loads", "it", "into", "memory", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaStructureParser.java#L110-L131
31,832
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
FileDownloadUtils.downloadFile
public static void downloadFile(URL url, File destination) throws IOException { int count = 0; int maxTries = 10; int timeout = 60000; //60 sec File tempFile = File.createTempFile(getFilePrefix(destination), "." + getFileExtension(destination)); // Took following recipe from stackoverflow: // http://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java // It seems to be the most efficient way to transfer a file // See: http://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html ReadableByteChannel rbc = null; FileOutputStream fos = null; while (true) { try { URLConnection connection = prepareURLConnection(url.toString(), timeout); connection.connect(); InputStream inputStream = connection.getInputStream(); rbc = Channels.newChannel(inputStream); fos = new FileOutputStream(tempFile); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); break; } catch (SocketTimeoutException e) { if (++count == maxTries) throw e; } finally { if (rbc != null) { rbc.close(); } if (fos != null) { fos.close(); } } } logger.debug("Copying temp file {} to final location {}", tempFile, destination); copy(tempFile, destination); // delete the tmp file tempFile.delete(); }
java
public static void downloadFile(URL url, File destination) throws IOException { int count = 0; int maxTries = 10; int timeout = 60000; //60 sec File tempFile = File.createTempFile(getFilePrefix(destination), "." + getFileExtension(destination)); // Took following recipe from stackoverflow: // http://stackoverflow.com/questions/921262/how-to-download-and-save-a-file-from-internet-using-java // It seems to be the most efficient way to transfer a file // See: http://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html ReadableByteChannel rbc = null; FileOutputStream fos = null; while (true) { try { URLConnection connection = prepareURLConnection(url.toString(), timeout); connection.connect(); InputStream inputStream = connection.getInputStream(); rbc = Channels.newChannel(inputStream); fos = new FileOutputStream(tempFile); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); break; } catch (SocketTimeoutException e) { if (++count == maxTries) throw e; } finally { if (rbc != null) { rbc.close(); } if (fos != null) { fos.close(); } } } logger.debug("Copying temp file {} to final location {}", tempFile, destination); copy(tempFile, destination); // delete the tmp file tempFile.delete(); }
[ "public", "static", "void", "downloadFile", "(", "URL", "url", ",", "File", "destination", ")", "throws", "IOException", "{", "int", "count", "=", "0", ";", "int", "maxTries", "=", "10", ";", "int", "timeout", "=", "60000", ";", "//60 sec", "File", "temp...
Download the content provided at URL url and store the result to a local file, using a temp file to cache the content in case something goes wrong in download @param url @param destination @throws IOException
[ "Download", "the", "content", "provided", "at", "URL", "url", "and", "store", "the", "result", "to", "a", "local", "file", "using", "a", "temp", "file", "to", "cache", "the", "content", "in", "case", "something", "goes", "wrong", "in", "download" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java#L110-L151
31,833
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
FileDownloadUtils.toUnixPath
public static String toUnixPath(String path) { String uPath = path; if (uPath.contains("\\")) { uPath = uPath.replaceAll("\\\\", "/"); } // this should be removed, it's need since "\" is added AtomCache code if (uPath.endsWith("//")) { uPath = uPath.substring(0, uPath.length() - 1); } if (!uPath.endsWith("/")) { uPath = uPath + "/"; } return uPath; }
java
public static String toUnixPath(String path) { String uPath = path; if (uPath.contains("\\")) { uPath = uPath.replaceAll("\\\\", "/"); } // this should be removed, it's need since "\" is added AtomCache code if (uPath.endsWith("//")) { uPath = uPath.substring(0, uPath.length() - 1); } if (!uPath.endsWith("/")) { uPath = uPath + "/"; } return uPath; }
[ "public", "static", "String", "toUnixPath", "(", "String", "path", ")", "{", "String", "uPath", "=", "path", ";", "if", "(", "uPath", ".", "contains", "(", "\"\\\\\"", ")", ")", "{", "uPath", "=", "uPath", ".", "replaceAll", "(", "\"\\\\\\\\\"", ",", "...
Converts path to Unix convention and adds a terminating slash if it was omitted @param path original platform dependent path @return path in Unix convention @author Peter Rose @since 3.2
[ "Converts", "path", "to", "Unix", "convention", "and", "adds", "a", "terminating", "slash", "if", "it", "was", "omitted" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java#L162-L175
31,834
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
FileDownloadUtils.expandUserHome
public static String expandUserHome(String file) { if (file.startsWith("~" + File.separator)) { file = System.getProperty("user.home") + file.substring(1); } return file; }
java
public static String expandUserHome(String file) { if (file.startsWith("~" + File.separator)) { file = System.getProperty("user.home") + file.substring(1); } return file; }
[ "public", "static", "String", "expandUserHome", "(", "String", "file", ")", "{", "if", "(", "file", ".", "startsWith", "(", "\"~\"", "+", "File", ".", "separator", ")", ")", "{", "file", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", "+", ...
Expands ~ in paths to the user's home directory. <p> This does not work for some special cases for paths: Other users' homes (~user/...), and Tilde expansion within the path (/.../~/...) @param file @return
[ "Expands", "~", "in", "paths", "to", "the", "user", "s", "home", "directory", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java#L187-L192
31,835
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java
FileDownloadUtils.deleteDirectory
public static void deleteDirectory(Path dir) throws IOException { if(dir == null || !Files.exists(dir)) return; Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e != null) { throw e; } Files.delete(dir); return FileVisitResult.CONTINUE; } }); }
java
public static void deleteDirectory(Path dir) throws IOException { if(dir == null || !Files.exists(dir)) return; Files.walkFileTree(dir, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException e) throws IOException { if (e != null) { throw e; } Files.delete(dir); return FileVisitResult.CONTINUE; } }); }
[ "public", "static", "void", "deleteDirectory", "(", "Path", "dir", ")", "throws", "IOException", "{", "if", "(", "dir", "==", "null", "||", "!", "Files", ".", "exists", "(", "dir", ")", ")", "return", ";", "Files", ".", "walkFileTree", "(", "dir", ",",...
Recursively delete a folder & contents @param dir directory to delete
[ "Recursively", "delete", "a", "folder", "&", "contents" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java#L255-L274
31,836
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ChemicalComponentDictionary.java
ChemicalComponentDictionary.getParent
public ChemComp getParent(ChemComp c){ if (c.hasParent()){ return dictionary.get(c.getMon_nstd_parent_comp_id()); } return null; }
java
public ChemComp getParent(ChemComp c){ if (c.hasParent()){ return dictionary.get(c.getMon_nstd_parent_comp_id()); } return null; }
[ "public", "ChemComp", "getParent", "(", "ChemComp", "c", ")", "{", "if", "(", "c", ".", "hasParent", "(", ")", ")", "{", "return", "dictionary", ".", "get", "(", "c", ".", "getMon_nstd_parent_comp_id", "(", ")", ")", ";", "}", "return", "null", ";", ...
Get the parent of a component. If component has no parent, return null @param c @return get the parent component or null if ChemComp has no parent.
[ "Get", "the", "parent", "of", "a", "component", ".", "If", "component", "has", "no", "parent", "return", "null" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ChemicalComponentDictionary.java#L102-L108
31,837
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ChemicalComponentDictionary.java
ChemicalComponentDictionary.addChemComp
public void addChemComp(ChemComp comp){ dictionary.put(comp.getId(),comp); String rep = comp.getPdbx_replaces(); if ( (rep != null) && ( ! rep.equals("?"))){ replaces.put(comp.getId(),rep); } String isrep = comp.getPdbx_replaced_by(); if ( (isrep != null) && ( ! isrep.equals("?"))){ isreplacedby.put(comp.getId(),isrep); } }
java
public void addChemComp(ChemComp comp){ dictionary.put(comp.getId(),comp); String rep = comp.getPdbx_replaces(); if ( (rep != null) && ( ! rep.equals("?"))){ replaces.put(comp.getId(),rep); } String isrep = comp.getPdbx_replaced_by(); if ( (isrep != null) && ( ! isrep.equals("?"))){ isreplacedby.put(comp.getId(),isrep); } }
[ "public", "void", "addChemComp", "(", "ChemComp", "comp", ")", "{", "dictionary", ".", "put", "(", "comp", ".", "getId", "(", ")", ",", "comp", ")", ";", "String", "rep", "=", "comp", ".", "getPdbx_replaces", "(", ")", ";", "if", "(", "(", "rep", "...
add a new component to the dictionary @param comp
[ "add", "a", "new", "component", "to", "the", "dictionary" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/ChemicalComponentDictionary.java#L116-L128
31,838
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java
GeneFeatureHelper.loadFastaAddGeneFeaturesFromGeneIDGFF2
static public LinkedHashMap<String, ChromosomeSequence> loadFastaAddGeneFeaturesFromGeneIDGFF2(File fastaSequenceFile, File gffFile) throws Exception { LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); LinkedHashMap<String, ChromosomeSequence> chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GeneIDGFF2Reader.read(gffFile.getAbsolutePath()); addGeneIDGFF2GeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; }
java
static public LinkedHashMap<String, ChromosomeSequence> loadFastaAddGeneFeaturesFromGeneIDGFF2(File fastaSequenceFile, File gffFile) throws Exception { LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile); LinkedHashMap<String, ChromosomeSequence> chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GeneIDGFF2Reader.read(gffFile.getAbsolutePath()); addGeneIDGFF2GeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; }
[ "static", "public", "LinkedHashMap", "<", "String", ",", "ChromosomeSequence", ">", "loadFastaAddGeneFeaturesFromGeneIDGFF2", "(", "File", "fastaSequenceFile", ",", "File", "gffFile", ")", "throws", "Exception", "{", "LinkedHashMap", "<", "String", ",", "DNASequence", ...
Loads Fasta file and GFF2 feature file generated from the geneid prediction algorithm @param fastaSequenceFile @param gffFile @return @throws Exception
[ "Loads", "Fasta", "file", "and", "GFF2", "feature", "file", "generated", "from", "the", "geneid", "prediction", "algorithm" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java#L185-L191
31,839
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java
GeneFeatureHelper.loadFastaAddGeneFeaturesFromGmodGFF3
static public LinkedHashMap<String, ChromosomeSequence> loadFastaAddGeneFeaturesFromGmodGFF3(File fastaSequenceFile, File gffFile,boolean lazyloadsequences) throws Exception { LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile,lazyloadsequences); LinkedHashMap<String, ChromosomeSequence> chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GFF3Reader.read(gffFile.getAbsolutePath()); addGmodGFF3GeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; }
java
static public LinkedHashMap<String, ChromosomeSequence> loadFastaAddGeneFeaturesFromGmodGFF3(File fastaSequenceFile, File gffFile,boolean lazyloadsequences) throws Exception { LinkedHashMap<String, DNASequence> dnaSequenceList = FastaReaderHelper.readFastaDNASequence(fastaSequenceFile,lazyloadsequences); LinkedHashMap<String, ChromosomeSequence> chromosomeSequenceList = GeneFeatureHelper.getChromosomeSequenceFromDNASequence(dnaSequenceList); FeatureList listGenes = GFF3Reader.read(gffFile.getAbsolutePath()); addGmodGFF3GeneFeatures(chromosomeSequenceList, listGenes); return chromosomeSequenceList; }
[ "static", "public", "LinkedHashMap", "<", "String", ",", "ChromosomeSequence", ">", "loadFastaAddGeneFeaturesFromGmodGFF3", "(", "File", "fastaSequenceFile", ",", "File", "gffFile", ",", "boolean", "lazyloadsequences", ")", "throws", "Exception", "{", "LinkedHashMap", "...
Lots of variations in the ontology or descriptors that can be used in GFF3 which requires writing a custom parser to handle a GFF3 generated or used by a specific application. Probably could be abstracted out but for now easier to handle with custom code to deal with gff3 elements that are not included but can be extracted from other data elements. @param fastaSequenceFile @param gffFile @param lazyloadsequences If set to true then the fasta file will be parsed for accession id but sequences will be read from disk when needed to save memory @return @throws Exception
[ "Lots", "of", "variations", "in", "the", "ontology", "or", "descriptors", "that", "can", "be", "used", "in", "GFF3", "which", "requires", "writing", "a", "custom", "parser", "to", "handle", "a", "GFF3", "generated", "or", "used", "by", "a", "specific", "ap...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/GeneFeatureHelper.java#L337-L343
31,840
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java
TwoBitFacade.setChromosome
public void setChromosome(String chr) throws Exception { if ( twoBitParser == null){ } twoBitParser.close(); String[] names = twoBitParser.getSequenceNames(); for(int i=0;i<names.length;i++) { if ( names[i].equalsIgnoreCase(chr) ) { twoBitParser.setCurrentSequence(names[i]); break; } } }
java
public void setChromosome(String chr) throws Exception { if ( twoBitParser == null){ } twoBitParser.close(); String[] names = twoBitParser.getSequenceNames(); for(int i=0;i<names.length;i++) { if ( names[i].equalsIgnoreCase(chr) ) { twoBitParser.setCurrentSequence(names[i]); break; } } }
[ "public", "void", "setChromosome", "(", "String", "chr", ")", "throws", "Exception", "{", "if", "(", "twoBitParser", "==", "null", ")", "{", "}", "twoBitParser", ".", "close", "(", ")", ";", "String", "[", "]", "names", "=", "twoBitParser", ".", "getSequ...
Sets a chromosome for TwoBitParser. @param chr The chromosome name (e.g. chr21)
[ "Sets", "a", "chromosome", "for", "TwoBitParser", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java#L56-L68
31,841
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java
TwoBitFacade.getSequence
public String getSequence(String chromosomeName, int start, int end) throws Exception { twoBitParser.close(); twoBitParser.setCurrentSequence(chromosomeName); return twoBitParser.loadFragment(start,end-start); }
java
public String getSequence(String chromosomeName, int start, int end) throws Exception { twoBitParser.close(); twoBitParser.setCurrentSequence(chromosomeName); return twoBitParser.loadFragment(start,end-start); }
[ "public", "String", "getSequence", "(", "String", "chromosomeName", ",", "int", "start", ",", "int", "end", ")", "throws", "Exception", "{", "twoBitParser", ".", "close", "(", ")", ";", "twoBitParser", ".", "setCurrentSequence", "(", "chromosomeName", ")", ";"...
Extract a sequence from a chromosome, using chromosomal coordinates @param chromosomeName @param start @param end @return the DNASequence from the requested coordinates. @throws Exception
[ "Extract", "a", "sequence", "from", "a", "chromosome", "using", "chromosomal", "coordinates" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/twobit/TwoBitFacade.java#L78-L82
31,842
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/client/StructureName.java
StructureName.compareTo
@Override public int compareTo(StructureName o) { if ( this.equals(o)) return 0; String pdb1 = null; String pdb2 = null; try { pdb1 = this.getPdbId(); } catch (StructureException e) {} try { pdb2 = this.getPdbId(); } catch (StructureException e) {} int comp = 0; // Sort those with PDBIDs before those without if( pdb1 == null ) { if( pdb2 != null) { return 1; // this > o } // both null } else if( pdb2 == null){ return -1; // this < o } else { // neither null comp = pdb1.compareTo(pdb2); } if( comp != 0 ) { return comp; } // break tie with full identifiers pdb1 = this.getIdentifier(); pdb2 = o.getIdentifier(); // Throws NPE for nulls return pdb1.compareTo(pdb2); }
java
@Override public int compareTo(StructureName o) { if ( this.equals(o)) return 0; String pdb1 = null; String pdb2 = null; try { pdb1 = this.getPdbId(); } catch (StructureException e) {} try { pdb2 = this.getPdbId(); } catch (StructureException e) {} int comp = 0; // Sort those with PDBIDs before those without if( pdb1 == null ) { if( pdb2 != null) { return 1; // this > o } // both null } else if( pdb2 == null){ return -1; // this < o } else { // neither null comp = pdb1.compareTo(pdb2); } if( comp != 0 ) { return comp; } // break tie with full identifiers pdb1 = this.getIdentifier(); pdb2 = o.getIdentifier(); // Throws NPE for nulls return pdb1.compareTo(pdb2); }
[ "@", "Override", "public", "int", "compareTo", "(", "StructureName", "o", ")", "{", "if", "(", "this", ".", "equals", "(", "o", ")", ")", "return", "0", ";", "String", "pdb1", "=", "null", ";", "String", "pdb2", "=", "null", ";", "try", "{", "pdb1"...
Orders identifiers lexicographically by PDB ID and then full Identifier
[ "Orders", "identifiers", "lexicographically", "by", "PDB", "ID", "and", "then", "full", "Identifier" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/client/StructureName.java#L570-L608
31,843
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java
FileConvert.printPDBConnections
private String printPDBConnections(){ StringBuilder str = new StringBuilder(); for (Chain c:structure.getChains()) { for (Group g:c.getAtomGroups()) { for (Atom a:g.getAtoms()) { if (a.getBonds()!=null) { for (Bond b:a.getBonds()) { //7890123456789012345678901234567890123456789012345678901234567890 str.append(String.format("CONECT%5d%5d "+newline, b.getAtomA().getPDBserial(), b.getAtomB().getPDBserial())); } } } } } return str.toString(); }
java
private String printPDBConnections(){ StringBuilder str = new StringBuilder(); for (Chain c:structure.getChains()) { for (Group g:c.getAtomGroups()) { for (Atom a:g.getAtoms()) { if (a.getBonds()!=null) { for (Bond b:a.getBonds()) { //7890123456789012345678901234567890123456789012345678901234567890 str.append(String.format("CONECT%5d%5d "+newline, b.getAtomA().getPDBserial(), b.getAtomB().getPDBserial())); } } } } } return str.toString(); }
[ "private", "String", "printPDBConnections", "(", ")", "{", "StringBuilder", "str", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Chain", "c", ":", "structure", ".", "getChains", "(", ")", ")", "{", "for", "(", "Group", "g", ":", "c", ".", ...
Prints the connections in PDB style Rewritten since 5.0 to use {@link Bond}s Will produce strictly one CONECT record per bond (won't group several bonds in one line)
[ "Prints", "the", "connections", "in", "PDB", "style" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java#L117-L134
31,844
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java
FileConvert.toPDB
public static String toPDB(Atom a){ StringBuffer w = new StringBuffer(); toPDB(a,w); return w.toString(); }
java
public static String toPDB(Atom a){ StringBuffer w = new StringBuffer(); toPDB(a,w); return w.toString(); }
[ "public", "static", "String", "toPDB", "(", "Atom", "a", ")", "{", "StringBuffer", "w", "=", "new", "StringBuffer", "(", ")", ";", "toPDB", "(", "a", ",", "w", ")", ";", "return", "w", ".", "toString", "(", ")", ";", "}" ]
Prints the content of an Atom object as a PDB formatted line. @param a @return
[ "Prints", "the", "content", "of", "an", "Atom", "object", "as", "a", "PDB", "formatted", "line", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java#L303-L310
31,845
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java
FileConvert.toPDB
public static String toPDB(Chain chain){ StringBuffer w = new StringBuffer(); int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h); toPDB(g,w); } return w.toString(); }
java
public static String toPDB(Chain chain){ StringBuffer w = new StringBuffer(); int nrGroups = chain.getAtomLength(); for ( int h=0; h<nrGroups;h++){ Group g= chain.getAtomGroup(h); toPDB(g,w); } return w.toString(); }
[ "public", "static", "String", "toPDB", "(", "Chain", "chain", ")", "{", "StringBuffer", "w", "=", "new", "StringBuffer", "(", ")", ";", "int", "nrGroups", "=", "chain", ".", "getAtomLength", "(", ")", ";", "for", "(", "int", "h", "=", "0", ";", "h", ...
Convert a Chain object to PDB representation @param chain @return
[ "Convert", "a", "Chain", "object", "to", "PDB", "representation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java#L327-L342
31,846
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java
FileConvert.toPDB
public static String toPDB(Group g){ StringBuffer w = new StringBuffer(); toPDB(g,w); return w.toString(); }
java
public static String toPDB(Group g){ StringBuffer w = new StringBuffer(); toPDB(g,w); return w.toString(); }
[ "public", "static", "String", "toPDB", "(", "Group", "g", ")", "{", "StringBuffer", "w", "=", "new", "StringBuffer", "(", ")", ";", "toPDB", "(", "g", ",", "w", ")", ";", "return", "w", ".", "toString", "(", ")", ";", "}" ]
Convert a Group object to PDB representation @param g @return
[ "Convert", "a", "Group", "object", "to", "PDB", "representation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java#L350-L354
31,847
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java
FileConvert.hasInsertionCode
private static boolean hasInsertionCode(String pdbserial) { try { Integer.parseInt(pdbserial) ; } catch (NumberFormatException e) { return true ; } return false ; }
java
private static boolean hasInsertionCode(String pdbserial) { try { Integer.parseInt(pdbserial) ; } catch (NumberFormatException e) { return true ; } return false ; }
[ "private", "static", "boolean", "hasInsertionCode", "(", "String", "pdbserial", ")", "{", "try", "{", "Integer", ".", "parseInt", "(", "pdbserial", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "true", ";", "}", "return", "...
test if pdbserial has an insertion code
[ "test", "if", "pdbserial", "has", "an", "insertion", "code" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FileConvert.java#L464-L471
31,848
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java
MMCIFFileTools.toSingleLoopLineMmCifString
private static String toSingleLoopLineMmCifString(Object record, Field[] fields, int[] sizes) { StringBuilder str = new StringBuilder(); Class<?> c = record.getClass(); if(fields == null) fields = getFields(c); if (sizes.length!=fields.length) throw new IllegalArgumentException("The given sizes of fields differ from the number of declared fields"); int i = -1; for (Field f : fields) { i++; f.setAccessible(true); try { Object obj = f.get(record); String val; if (obj==null) { logger.debug("Field {} is null, will write it out as {}",f.getName(),MMCIF_MISSING_VALUE); val = MMCIF_MISSING_VALUE; } else { val = (String) obj; } str.append(String.format("%-"+sizes[i]+"s ", addMmCifQuoting(val))); } catch (IllegalAccessException e) { logger.warn("Field {} is inaccessible", f.getName()); continue; } catch (ClassCastException e) { logger.warn("Could not cast value to String for field {}",f.getName()); continue; } } str.append(newline); return str.toString(); }
java
private static String toSingleLoopLineMmCifString(Object record, Field[] fields, int[] sizes) { StringBuilder str = new StringBuilder(); Class<?> c = record.getClass(); if(fields == null) fields = getFields(c); if (sizes.length!=fields.length) throw new IllegalArgumentException("The given sizes of fields differ from the number of declared fields"); int i = -1; for (Field f : fields) { i++; f.setAccessible(true); try { Object obj = f.get(record); String val; if (obj==null) { logger.debug("Field {} is null, will write it out as {}",f.getName(),MMCIF_MISSING_VALUE); val = MMCIF_MISSING_VALUE; } else { val = (String) obj; } str.append(String.format("%-"+sizes[i]+"s ", addMmCifQuoting(val))); } catch (IllegalAccessException e) { logger.warn("Field {} is inaccessible", f.getName()); continue; } catch (ClassCastException e) { logger.warn("Could not cast value to String for field {}",f.getName()); continue; } } str.append(newline); return str.toString(); }
[ "private", "static", "String", "toSingleLoopLineMmCifString", "(", "Object", "record", ",", "Field", "[", "]", "fields", ",", "int", "[", "]", "sizes", ")", "{", "StringBuilder", "str", "=", "new", "StringBuilder", "(", ")", ";", "Class", "<", "?", ">", ...
Given a mmCIF bean produces a String representing it in mmCIF loop format as a single record line @param record @param fields Set of fields for the record. If null, will be calculated from the class of the record @param sizes the size of each of the fields @return
[ "Given", "a", "mmCIF", "bean", "produces", "a", "String", "representing", "it", "in", "mmCIF", "loop", "format", "as", "a", "single", "record", "line" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java#L235-L278
31,849
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java
MMCIFFileTools.getFieldSizes
private static <T> int[] getFieldSizes(List<T> list, Field[] fields) { if (list.isEmpty()) throw new IllegalArgumentException("List of beans is empty!"); if(fields == null) fields = getFields(list.get(0).getClass()); int[] sizes = new int [fields.length]; for (T a:list) { int i = -1; for (Field f : fields) { i++; f.setAccessible(true); try { Object obj = f.get(a); int length; if (obj==null) { length = MMCIF_MISSING_VALUE.length(); } else { String val = (String) obj; length = addMmCifQuoting(val).length(); } if (length>sizes[i]) sizes[i] = length; } catch (IllegalAccessException e) { logger.warn("Field {} is inaccessible", f.getName()); continue; } catch (ClassCastException e) { logger.warn("Could not cast value to String for field {}",f.getName()); continue; } } } return sizes; }
java
private static <T> int[] getFieldSizes(List<T> list, Field[] fields) { if (list.isEmpty()) throw new IllegalArgumentException("List of beans is empty!"); if(fields == null) fields = getFields(list.get(0).getClass()); int[] sizes = new int [fields.length]; for (T a:list) { int i = -1; for (Field f : fields) { i++; f.setAccessible(true); try { Object obj = f.get(a); int length; if (obj==null) { length = MMCIF_MISSING_VALUE.length(); } else { String val = (String) obj; length = addMmCifQuoting(val).length(); } if (length>sizes[i]) sizes[i] = length; } catch (IllegalAccessException e) { logger.warn("Field {} is inaccessible", f.getName()); continue; } catch (ClassCastException e) { logger.warn("Could not cast value to String for field {}",f.getName()); continue; } } } return sizes; }
[ "private", "static", "<", "T", ">", "int", "[", "]", "getFieldSizes", "(", "List", "<", "T", ">", "list", ",", "Field", "[", "]", "fields", ")", "{", "if", "(", "list", ".", "isEmpty", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", ...
Finds the max length of each of the String values contained in each of the fields of the given list of beans. Useful for producing mmCIF loop data that is aligned for all columns. @param list list of objects. All objects should have the same class. @param fields Set of fields for the record. If null, will be calculated from the class of the first record @return @see #toMMCIF(List, Class)
[ "Finds", "the", "max", "length", "of", "each", "of", "the", "String", "values", "contained", "in", "each", "of", "the", "fields", "of", "the", "given", "list", "of", "beans", ".", "Useful", "for", "producing", "mmCIF", "loop", "data", "that", "is", "alig...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java#L518-L557
31,850
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java
MMCIFFileTools.getMaxStringLength
private static int getMaxStringLength(String[] names) { int size = 0; for(String s : names) { if(s.length()>size) { size = s.length(); } } return size; }
java
private static int getMaxStringLength(String[] names) { int size = 0; for(String s : names) { if(s.length()>size) { size = s.length(); } } return size; }
[ "private", "static", "int", "getMaxStringLength", "(", "String", "[", "]", "names", ")", "{", "int", "size", "=", "0", ";", "for", "(", "String", "s", ":", "names", ")", "{", "if", "(", "s", ".", "length", "(", ")", ">", "size", ")", "{", "size",...
Finds the max length of a list of strings Useful for producing mmCIF single-record data that is aligned for all values. @param names @return @see #toMMCIF(String, Object)
[ "Finds", "the", "max", "length", "of", "a", "list", "of", "strings", "Useful", "for", "producing", "mmCIF", "single", "-", "record", "data", "that", "is", "aligned", "for", "all", "values", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java#L566-L574
31,851
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/HasResultXMLConverter.java
HasResultXMLConverter.toXML
public String toXML(boolean hasResult) throws IOException{ StringWriter swriter = new StringWriter(); PrintWriter writer = new PrintWriter(swriter); PrettyXMLWriter xml = new PrettyXMLWriter(writer); xml.openTag("alignment"); xml.attribute("hasResult", String.valueOf(hasResult)); xml.closeTag("alignment"); xml.close(); return swriter.toString(); }
java
public String toXML(boolean hasResult) throws IOException{ StringWriter swriter = new StringWriter(); PrintWriter writer = new PrintWriter(swriter); PrettyXMLWriter xml = new PrettyXMLWriter(writer); xml.openTag("alignment"); xml.attribute("hasResult", String.valueOf(hasResult)); xml.closeTag("alignment"); xml.close(); return swriter.toString(); }
[ "public", "String", "toXML", "(", "boolean", "hasResult", ")", "throws", "IOException", "{", "StringWriter", "swriter", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "swriter", ")", ";", "PrettyXMLWriter", ...
return flag if the server has a result @param hasResult @return flag if there is a result
[ "return", "flag", "if", "the", "server", "has", "a", "result" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/HasResultXMLConverter.java#L54-L65
31,852
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java
CeSymmResult.getRepeatsID
public List<StructureIdentifier> getRepeatsID() throws StructureException { if (!isRefined()) return null; List<StructureIdentifier> repeats = new ArrayList<StructureIdentifier>( numRepeats); String pdbId = structureId.toCanonical().getPdbId(); Block align = multipleAlignment.getBlocks().get(0); for (int su = 0; su < numRepeats; su++) { // Get the start and end residues of the repeat ResidueNumber res1 = atoms[align.getStartResidue(su)].getGroup() .getResidueNumber(); ResidueNumber res2 = atoms[align.getFinalResidue(su)].getGroup() .getResidueNumber(); ResidueRange range = new ResidueRange(res1.getChainName(), res1, res2); StructureIdentifier id = new SubstructureIdentifier(pdbId, Arrays.asList(range)); repeats.add(id); } return repeats; }
java
public List<StructureIdentifier> getRepeatsID() throws StructureException { if (!isRefined()) return null; List<StructureIdentifier> repeats = new ArrayList<StructureIdentifier>( numRepeats); String pdbId = structureId.toCanonical().getPdbId(); Block align = multipleAlignment.getBlocks().get(0); for (int su = 0; su < numRepeats; su++) { // Get the start and end residues of the repeat ResidueNumber res1 = atoms[align.getStartResidue(su)].getGroup() .getResidueNumber(); ResidueNumber res2 = atoms[align.getFinalResidue(su)].getGroup() .getResidueNumber(); ResidueRange range = new ResidueRange(res1.getChainName(), res1, res2); StructureIdentifier id = new SubstructureIdentifier(pdbId, Arrays.asList(range)); repeats.add(id); } return repeats; }
[ "public", "List", "<", "StructureIdentifier", ">", "getRepeatsID", "(", ")", "throws", "StructureException", "{", "if", "(", "!", "isRefined", "(", ")", ")", "return", "null", ";", "List", "<", "StructureIdentifier", ">", "repeats", "=", "new", "ArrayList", ...
Return the symmetric repeats as structure identifiers, if the result is symmetric and it was refined, return null otherwise. @return List of StructureIdentifiers or null if not defined @throws StructureException
[ "Return", "the", "symmetric", "repeats", "as", "structure", "identifiers", "if", "the", "result", "is", "symmetric", "and", "it", "was", "refined", "return", "null", "otherwise", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java#L103-L128
31,853
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java
CeSymmResult.getReason
public String getReason() { // Cases: // 1. Asymmetric because insignificant self-alignment (1itb.A_1-100) double tm = selfAlignment.getTMScore(); if (tm < params.getUnrefinedScoreThreshold()) { return String.format("Insignificant self-alignment (TM=%.2f)", tm); } // 2. Asymmetric because order detector returned 1 if (numRepeats == 1) { return String.format( "Order detector found asymmetric alignment (TM=%.2f)", tm); } // Check that the user requested refinement if (params.getRefineMethod() != RefineMethod.NOT_REFINED) { // 3. Asymmetric because refinement failed if (!refined) { return "Refinement failed"; } tm = multipleAlignment .getScore(MultipleAlignmentScorer.AVGTM_SCORE); // 4. Asymmetric because refinement & optimization were not // significant if (!isSignificant()) { return String.format( "Refinement was not significant (TM=%.2f)", tm); } } else { // 4. Not refined, but result was not significant if (!isSignificant()) { return String .format("Result was not significant (TM=%.2f)", tm); } } String hierarchical = ""; if (axes.getNumLevels() > 1) { hierarchical = String.format("; Contains %d levels of symmetry", axes.getNumLevels()); } // 5. Symmetric. // a. Open. Give # repeats (1n0r.A) if (axes.getElementaryAxis(0).getSymmType() == SymmetryType.OPEN) { return String.format("Contains %d open repeats (TM=%.2f)%s", getNumRepeats(), tm, hierarchical); } // b. Closed, non-hierarchical (1itb.A) // c. Closed, heirarchical (4gcr) return String.format("Significant (TM=%.2f)%s", tm, hierarchical); }
java
public String getReason() { // Cases: // 1. Asymmetric because insignificant self-alignment (1itb.A_1-100) double tm = selfAlignment.getTMScore(); if (tm < params.getUnrefinedScoreThreshold()) { return String.format("Insignificant self-alignment (TM=%.2f)", tm); } // 2. Asymmetric because order detector returned 1 if (numRepeats == 1) { return String.format( "Order detector found asymmetric alignment (TM=%.2f)", tm); } // Check that the user requested refinement if (params.getRefineMethod() != RefineMethod.NOT_REFINED) { // 3. Asymmetric because refinement failed if (!refined) { return "Refinement failed"; } tm = multipleAlignment .getScore(MultipleAlignmentScorer.AVGTM_SCORE); // 4. Asymmetric because refinement & optimization were not // significant if (!isSignificant()) { return String.format( "Refinement was not significant (TM=%.2f)", tm); } } else { // 4. Not refined, but result was not significant if (!isSignificant()) { return String .format("Result was not significant (TM=%.2f)", tm); } } String hierarchical = ""; if (axes.getNumLevels() > 1) { hierarchical = String.format("; Contains %d levels of symmetry", axes.getNumLevels()); } // 5. Symmetric. // a. Open. Give # repeats (1n0r.A) if (axes.getElementaryAxis(0).getSymmType() == SymmetryType.OPEN) { return String.format("Contains %d open repeats (TM=%.2f)%s", getNumRepeats(), tm, hierarchical); } // b. Closed, non-hierarchical (1itb.A) // c. Closed, heirarchical (4gcr) return String.format("Significant (TM=%.2f)%s", tm, hierarchical); }
[ "public", "String", "getReason", "(", ")", "{", "// Cases:", "// 1. Asymmetric because insignificant self-alignment (1itb.A_1-100)", "double", "tm", "=", "selfAlignment", ".", "getTMScore", "(", ")", ";", "if", "(", "tm", "<", "params", ".", "getUnrefinedScoreThreshold"...
Return a String describing the reasons for the CE-Symm final decision in this particular result. @return String decision reason
[ "Return", "a", "String", "describing", "the", "reasons", "for", "the", "CE", "-", "Symm", "final", "decision", "in", "this", "particular", "result", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/CeSymmResult.java#L252-L301
31,854
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java
SequenceFunctionRefiner.initializeEligible
private static List<Integer> initializeEligible(Map<Integer, Integer> alignment, Map<Integer, Double> scores, List<Integer> eligible, int k, NavigableSet<Integer> forwardLoops, NavigableSet<Integer> backwardLoops) { // Eligible if: // 1. score(x)>0 // 2. f^K-1(x) is defined // 3. score(f^K-1(x))>0 // 4. For all y, score(y)==0 implies sign(f^K-1(x)-y) == sign(x-f(y) ) // 5. Not in a loop of length less than k // Assume all residues are eligible to start if(eligible == null) { eligible = new LinkedList<Integer>(alignment.keySet()); } // Precalculate f^K-1(x) // Map<Integer, Integer> alignK1 = AlignmentTools.applyAlignment(alignment, k-1); Map<Integer, Integer> alignK1 = applyAlignmentAndCheckCycles(alignment, k - 1, eligible); // Remove ineligible residues Iterator<Integer> eligibleIt = eligible.iterator(); while(eligibleIt.hasNext()) { Integer res = eligibleIt.next(); // 2. f^K-1(x) is defined if(!alignK1.containsKey(res)) { eligibleIt.remove(); continue; } Integer k1 = alignK1.get(res); if(k1 == null) { eligibleIt.remove(); continue; } // 1. score(x)>0 Double score = scores.get(res); if(score == null || score <= 0.0) { eligibleIt.remove(); // res is in a loop. Add it to the proper set if(res <= alignment.get(res)) { //forward forwardLoops.add(res); } else { //backward backwardLoops.add(res); } continue; } // 3. score(f^K-1(x))>0 Double scoreK1 = scores.get(k1); if(scoreK1 == null || scoreK1 <= 0.0) { eligibleIt.remove(); continue; } } // Now that loops are up-to-date, check for loop crossings eligibleIt = eligible.iterator(); while(eligibleIt.hasNext()) { Integer res = eligibleIt.next(); //4. For all y, score(y)==0 implies sign(f^K-1(x)-y) == sign(x-f(y) ) //Test equivalent: All loop edges should be properly ordered wrt edge f^k-1(x) -> x Integer src = alignK1.get(res); if( src < res ) { //forward // get interval [a,b) containing res Integer a = forwardLoops.floor(src); Integer b = forwardLoops.higher(src); // Ineligible unless f(a) < res < f(b) if(a != null && alignment.get(a) > res ) { eligibleIt.remove(); continue; } if(b != null && alignment.get(b) < res ) { eligibleIt.remove(); continue; } } } return eligible; }
java
private static List<Integer> initializeEligible(Map<Integer, Integer> alignment, Map<Integer, Double> scores, List<Integer> eligible, int k, NavigableSet<Integer> forwardLoops, NavigableSet<Integer> backwardLoops) { // Eligible if: // 1. score(x)>0 // 2. f^K-1(x) is defined // 3. score(f^K-1(x))>0 // 4. For all y, score(y)==0 implies sign(f^K-1(x)-y) == sign(x-f(y) ) // 5. Not in a loop of length less than k // Assume all residues are eligible to start if(eligible == null) { eligible = new LinkedList<Integer>(alignment.keySet()); } // Precalculate f^K-1(x) // Map<Integer, Integer> alignK1 = AlignmentTools.applyAlignment(alignment, k-1); Map<Integer, Integer> alignK1 = applyAlignmentAndCheckCycles(alignment, k - 1, eligible); // Remove ineligible residues Iterator<Integer> eligibleIt = eligible.iterator(); while(eligibleIt.hasNext()) { Integer res = eligibleIt.next(); // 2. f^K-1(x) is defined if(!alignK1.containsKey(res)) { eligibleIt.remove(); continue; } Integer k1 = alignK1.get(res); if(k1 == null) { eligibleIt.remove(); continue; } // 1. score(x)>0 Double score = scores.get(res); if(score == null || score <= 0.0) { eligibleIt.remove(); // res is in a loop. Add it to the proper set if(res <= alignment.get(res)) { //forward forwardLoops.add(res); } else { //backward backwardLoops.add(res); } continue; } // 3. score(f^K-1(x))>0 Double scoreK1 = scores.get(k1); if(scoreK1 == null || scoreK1 <= 0.0) { eligibleIt.remove(); continue; } } // Now that loops are up-to-date, check for loop crossings eligibleIt = eligible.iterator(); while(eligibleIt.hasNext()) { Integer res = eligibleIt.next(); //4. For all y, score(y)==0 implies sign(f^K-1(x)-y) == sign(x-f(y) ) //Test equivalent: All loop edges should be properly ordered wrt edge f^k-1(x) -> x Integer src = alignK1.get(res); if( src < res ) { //forward // get interval [a,b) containing res Integer a = forwardLoops.floor(src); Integer b = forwardLoops.higher(src); // Ineligible unless f(a) < res < f(b) if(a != null && alignment.get(a) > res ) { eligibleIt.remove(); continue; } if(b != null && alignment.get(b) < res ) { eligibleIt.remove(); continue; } } } return eligible; }
[ "private", "static", "List", "<", "Integer", ">", "initializeEligible", "(", "Map", "<", "Integer", ",", "Integer", ">", "alignment", ",", "Map", "<", "Integer", ",", "Double", ">", "scores", ",", "List", "<", "Integer", ">", "eligible", ",", "int", "k",...
Helper method to initialize eligible residues. Eligible if: 1. score(x)>0 2. f^K-1(x) is defined 3. score(f^K-1(x))>0 4. For all y, score(y)==0 implies sign(f^K-1(x)-y) == sign(x-f(y) ) @param alignment The alignment with respect to which to calculate eligibility @param scores An up-to-date map from residues to their scores @param eligible Starting list of eligible residues. If null will be generated. @param k @param backwardLoops @param forwardLoops @return eligible after modification
[ "Helper", "method", "to", "initialize", "eligible", "residues", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java#L232-L320
31,855
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java
SequenceFunctionRefiner.initializeScores
private static Map<Integer, Double> initializeScores(Map<Integer, Integer> alignment, Map<Integer, Double> scores, int k) { if(scores == null) { scores = new HashMap<Integer, Double>(alignment.size()); } else { scores.clear(); } Map<Integer,Integer> alignK = AlignmentTools.applyAlignment(alignment, k); // calculate input range int maxPre = Integer.MIN_VALUE; int minPre = Integer.MAX_VALUE; for(Integer pre : alignment.keySet()) { if(pre>maxPre) maxPre = pre; if(pre<minPre) minPre = pre; } for(Integer pre : alignment.keySet()) { Integer image = alignK.get(pre); // Use the absolute error score, |x - f^k(x)| double score = scoreAbsError(pre,image,minPre,maxPre); scores.put(pre, score); } return scores; }
java
private static Map<Integer, Double> initializeScores(Map<Integer, Integer> alignment, Map<Integer, Double> scores, int k) { if(scores == null) { scores = new HashMap<Integer, Double>(alignment.size()); } else { scores.clear(); } Map<Integer,Integer> alignK = AlignmentTools.applyAlignment(alignment, k); // calculate input range int maxPre = Integer.MIN_VALUE; int minPre = Integer.MAX_VALUE; for(Integer pre : alignment.keySet()) { if(pre>maxPre) maxPre = pre; if(pre<minPre) minPre = pre; } for(Integer pre : alignment.keySet()) { Integer image = alignK.get(pre); // Use the absolute error score, |x - f^k(x)| double score = scoreAbsError(pre,image,minPre,maxPre); scores.put(pre, score); } return scores; }
[ "private", "static", "Map", "<", "Integer", ",", "Double", ">", "initializeScores", "(", "Map", "<", "Integer", ",", "Integer", ">", "alignment", ",", "Map", "<", "Integer", ",", "Double", ">", "scores", ",", "int", "k", ")", "{", "if", "(", "scores", ...
Calculates all scores for an alignment @param alignment @param scores A mapping from residues to scores, which will be updated or created if null @return scores
[ "Calculates", "all", "scores", "for", "an", "alignment" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java#L372-L397
31,856
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java
SequenceFunctionRefiner.partitionAFPchain
private static AFPChain partitionAFPchain(AFPChain afpChain, Atom[] ca1, Atom[] ca2, int order) throws StructureException{ int[][][] newAlgn = new int[order][][]; int repeatLen = afpChain.getOptLength()/order; //Extract all the residues considered in the first chain of the alignment List<Integer> alignedRes = new ArrayList<Integer>(); for (int su=0; su<afpChain.getBlockNum(); su++){ for (int i=0; i<afpChain.getOptLen()[su]; i++){ alignedRes.add(afpChain.getOptAln()[su][0][i]); } } //Build the new alignment for (int su=0; su<order; su++){ newAlgn[su] = new int[2][]; newAlgn[su][0] = new int[repeatLen]; newAlgn[su][1] = new int[repeatLen]; for (int i=0; i<repeatLen; i++){ newAlgn[su][0][i] = alignedRes.get(repeatLen*su+i); newAlgn[su][1][i] = alignedRes.get( (repeatLen*(su+1)+i)%alignedRes.size()); } } return AlignmentTools.replaceOptAln(newAlgn, afpChain, ca1, ca2); }
java
private static AFPChain partitionAFPchain(AFPChain afpChain, Atom[] ca1, Atom[] ca2, int order) throws StructureException{ int[][][] newAlgn = new int[order][][]; int repeatLen = afpChain.getOptLength()/order; //Extract all the residues considered in the first chain of the alignment List<Integer> alignedRes = new ArrayList<Integer>(); for (int su=0; su<afpChain.getBlockNum(); su++){ for (int i=0; i<afpChain.getOptLen()[su]; i++){ alignedRes.add(afpChain.getOptAln()[su][0][i]); } } //Build the new alignment for (int su=0; su<order; su++){ newAlgn[su] = new int[2][]; newAlgn[su][0] = new int[repeatLen]; newAlgn[su][1] = new int[repeatLen]; for (int i=0; i<repeatLen; i++){ newAlgn[su][0][i] = alignedRes.get(repeatLen*su+i); newAlgn[su][1][i] = alignedRes.get( (repeatLen*(su+1)+i)%alignedRes.size()); } } return AlignmentTools.replaceOptAln(newAlgn, afpChain, ca1, ca2); }
[ "private", "static", "AFPChain", "partitionAFPchain", "(", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ",", "int", "order", ")", "throws", "StructureException", "{", "int", "[", "]", "[", "]", "[", "]", "newAlgn", ...
Partitions an afpChain alignment into order blocks of aligned residues. @param afpChain @param ca1 @param ca2 @param order @return @throws StructureException
[ "Partitions", "an", "afpChain", "alignment", "into", "order", "blocks", "of", "aligned", "residues", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SequenceFunctionRefiner.java#L440-L467
31,857
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java
SubstitutionMatrixHelper.getAminoAcidMatrix
private static SubstitutionMatrix<AminoAcidCompound> getAminoAcidMatrix(String file) { if (!aminoAcidMatrices.containsKey(file)) { aminoAcidMatrices.put(file, new SimpleSubstitutionMatrix<AminoAcidCompound>( AminoAcidCompoundSet.getAminoAcidCompoundSet(), getReader(file), file)); } return aminoAcidMatrices.get(file); }
java
private static SubstitutionMatrix<AminoAcidCompound> getAminoAcidMatrix(String file) { if (!aminoAcidMatrices.containsKey(file)) { aminoAcidMatrices.put(file, new SimpleSubstitutionMatrix<AminoAcidCompound>( AminoAcidCompoundSet.getAminoAcidCompoundSet(), getReader(file), file)); } return aminoAcidMatrices.get(file); }
[ "private", "static", "SubstitutionMatrix", "<", "AminoAcidCompound", ">", "getAminoAcidMatrix", "(", "String", "file", ")", "{", "if", "(", "!", "aminoAcidMatrices", ".", "containsKey", "(", "file", ")", ")", "{", "aminoAcidMatrices", ".", "put", "(", "file", ...
reads in an amino acid substitution matrix, if necessary
[ "reads", "in", "an", "amino", "acid", "substitution", "matrix", "if", "necessary" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java#L252-L258
31,858
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java
SubstitutionMatrixHelper.getNucleotideMatrix
private static SubstitutionMatrix<NucleotideCompound> getNucleotideMatrix(String file) { if (!nucleotideMatrices.containsKey(file)) { nucleotideMatrices.put(file, new SimpleSubstitutionMatrix<NucleotideCompound>( AmbiguityDNACompoundSet.getDNACompoundSet(), getReader(file), file)); } return nucleotideMatrices.get(file); }
java
private static SubstitutionMatrix<NucleotideCompound> getNucleotideMatrix(String file) { if (!nucleotideMatrices.containsKey(file)) { nucleotideMatrices.put(file, new SimpleSubstitutionMatrix<NucleotideCompound>( AmbiguityDNACompoundSet.getDNACompoundSet(), getReader(file), file)); } return nucleotideMatrices.get(file); }
[ "private", "static", "SubstitutionMatrix", "<", "NucleotideCompound", ">", "getNucleotideMatrix", "(", "String", "file", ")", "{", "if", "(", "!", "nucleotideMatrices", ".", "containsKey", "(", "file", ")", ")", "{", "nucleotideMatrices", ".", "put", "(", "file"...
reads in a nucleotide substitution matrix, if necessary
[ "reads", "in", "a", "nucleotide", "substitution", "matrix", "if", "necessary" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java#L261-L267
31,859
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java
SubstitutionMatrixHelper.getReader
private static InputStreamReader getReader(String file) { String resourcePathPrefix = "matrices/"; return new InputStreamReader(SubstitutionMatrixHelper.class.getResourceAsStream(String.format("/%s.txt", resourcePathPrefix+file))); }
java
private static InputStreamReader getReader(String file) { String resourcePathPrefix = "matrices/"; return new InputStreamReader(SubstitutionMatrixHelper.class.getResourceAsStream(String.format("/%s.txt", resourcePathPrefix+file))); }
[ "private", "static", "InputStreamReader", "getReader", "(", "String", "file", ")", "{", "String", "resourcePathPrefix", "=", "\"matrices/\"", ";", "return", "new", "InputStreamReader", "(", "SubstitutionMatrixHelper", ".", "class", ".", "getResourceAsStream", "(", "St...
reads in a substitution matrix from a resource file
[ "reads", "in", "a", "substitution", "matrix", "from", "a", "resource", "file" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/alignment/matrices/SubstitutionMatrixHelper.java#L270-L274
31,860
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.getNewGroup
private Group getNewGroup(String recordName,Character aminoCode1, String aminoCode3) { Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(aminoCode3); if ( g != null && !g.getChemComp().isEmpty()) return g; Group group; if (aminoCode1 == null || StructureTools.UNKNOWN_GROUP_LABEL == aminoCode1 ){ group = new HetatomImpl(); } else if(StructureTools.isNucleotide(aminoCode3)) { // it is a nucleotide NucleotideImpl nu = new NucleotideImpl(); group = nu; } else { AminoAcidImpl aa = new AminoAcidImpl() ; aa.setAminoType(aminoCode1); group = aa ; } // System.out.println("new resNum type: "+ resNum.getType() ); return group ; }
java
private Group getNewGroup(String recordName,Character aminoCode1, String aminoCode3) { Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(aminoCode3); if ( g != null && !g.getChemComp().isEmpty()) return g; Group group; if (aminoCode1 == null || StructureTools.UNKNOWN_GROUP_LABEL == aminoCode1 ){ group = new HetatomImpl(); } else if(StructureTools.isNucleotide(aminoCode3)) { // it is a nucleotide NucleotideImpl nu = new NucleotideImpl(); group = nu; } else { AminoAcidImpl aa = new AminoAcidImpl() ; aa.setAminoType(aminoCode1); group = aa ; } // System.out.println("new resNum type: "+ resNum.getType() ); return group ; }
[ "private", "Group", "getNewGroup", "(", "String", "recordName", ",", "Character", "aminoCode1", ",", "String", "aminoCode3", ")", "{", "Group", "g", "=", "ChemCompGroupFactory", ".", "getGroupFromChemCompDictionary", "(", "aminoCode3", ")", ";", "if", "(", "g", ...
initiate new resNum, either Hetatom, Nucleotide, or AminoAcid
[ "initiate", "new", "resNum", "either", "Hetatom", "Nucleotide", "or", "AminoAcid" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L302-L326
31,861
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.pdb_JRNL_Handler
private void pdb_JRNL_Handler(String line) { //add the strings to the journalLines //the actual JournalArticle is then built when the whole entry is being //finalized with triggerEndFileChecks() //JRNL TITL NMR SOLUTION STRUCTURE OF RECOMBINANT TICK 1TAP 10 if (line.substring(line.length() - 8, line.length() - 4).equals(pdbId)) { //trim off the trailing PDB id from legacy files. //are we really trying to still cater for these museum pieces? logger.debug("trimming legacy PDB id from end of JRNL section line"); line = line.substring(0, line.length() - 8); journalLines.add(line); } else { journalLines.add(line); } }
java
private void pdb_JRNL_Handler(String line) { //add the strings to the journalLines //the actual JournalArticle is then built when the whole entry is being //finalized with triggerEndFileChecks() //JRNL TITL NMR SOLUTION STRUCTURE OF RECOMBINANT TICK 1TAP 10 if (line.substring(line.length() - 8, line.length() - 4).equals(pdbId)) { //trim off the trailing PDB id from legacy files. //are we really trying to still cater for these museum pieces? logger.debug("trimming legacy PDB id from end of JRNL section line"); line = line.substring(0, line.length() - 8); journalLines.add(line); } else { journalLines.add(line); } }
[ "private", "void", "pdb_JRNL_Handler", "(", "String", "line", ")", "{", "//add the strings to the journalLines", "//the actual JournalArticle is then built when the whole entry is being", "//finalized with triggerEndFileChecks()", "//JRNL TITL NMR SOLUTION STRUCTURE OF RECOMBINANT TIC...
JRNL handler. The JRNL record contains the primary literature citation that describes the experiment which resulted in the deposited coordinate set. There is at most one JRNL reference per entry. If there is no primary reference, then there is no JRNL reference. Other references are given in REMARK 1. Record Format <pre> COLUMNS DATA TYPE FIELD DEFINITION ----------------------------------------------------------------------- 1 - 6 Record name "JRNL " 13 - 70 LString text See Details below. </pre>
[ "JRNL", "handler", ".", "The", "JRNL", "record", "contains", "the", "primary", "literature", "citation", "that", "describes", "the", "experiment", "which", "resulted", "in", "the", "deposited", "coordinate", "set", ".", "There", "is", "at", "most", "one", "JRN...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L881-L897
31,862
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.pdb_SOURCE_Handler
private void pdb_SOURCE_Handler(String line) { // works in the same way as the pdb_COMPND_Handler. String continuationNr = line.substring(9, 10).trim(); logger.debug("current continuationNo is " + continuationNr); logger.debug("previousContinuationField is " + previousContinuationField); logger.debug("current continuationField is " + continuationField); logger.debug("current continuationString is " + continuationString); logger.debug("current compound is " + current_compound); // following the docs, the last valid character should be 79, chop off the rest if (line.length() > 79) { line = line.substring(0, 79); } line = line.substring(10, line.length()); logger.debug("LINE: >" + line + "<"); String[] fieldList = line.split("\\s+"); if (!fieldList[0].equals("") && sourceFieldValues.contains(fieldList[0])) { // System.out.println("[PDBFileParser.pdb_COMPND_Handler] Setting continuationField to '" + fieldList[0] + "'"); continuationField = fieldList[0]; if (previousContinuationField.equals("")) { previousContinuationField = continuationField; } } else if ((fieldList.length > 1) && ( sourceFieldValues.contains(fieldList[1]))) { // System.out.println("[PDBFileParser.pdb_COMPND_Handler] Setting continuationField to '" + fieldList[1] + "'"); continuationField = fieldList[1]; if (previousContinuationField.equals("")) { previousContinuationField = continuationField; } } else { if (continuationNr.equals("")) { logger.debug("looks like an old PDB file"); continuationField = "MOLECULE:"; if (previousContinuationField.equals("")) { previousContinuationField = continuationField; } } } line = line.replace(continuationField, "").trim(); StringTokenizer compndTokens = new StringTokenizer(line); // System.out.println("PDBFileParser.pdb_COMPND_Handler: Tokenizing '" + line + "'"); while (compndTokens.hasMoreTokens()) { String token = compndTokens.nextToken(); if (previousContinuationField.equals("")) { // System.out.println("previousContinuationField is empty. Setting to : " + continuationField); previousContinuationField = continuationField; } if (previousContinuationField.equals(continuationField) && sourceFieldValues.contains(continuationField)) { logger.debug("Still in field " + continuationField); continuationString = continuationString.concat(token + " "); logger.debug("continuationString = " + continuationString); } if (!continuationField.equals(previousContinuationField)) { if (continuationString.equals("")) { continuationString = token; } else { sourceValueSetter(previousContinuationField, continuationString); previousContinuationField = continuationField; continuationString = token + " "; } } else if (ignoreCompndFieldValues.contains(token)) { // this field shall be ignored //continuationField = token; } } if (isLastSourceLine) { // final line in the section - finish off the compound // System.out.println("[pdb_SOURCE_Handler] Final SOURCE line - Finishing off final MolID header."); sourceValueSetter(continuationField, continuationString); continuationString = ""; //compounds.add(current_compound); } }
java
private void pdb_SOURCE_Handler(String line) { // works in the same way as the pdb_COMPND_Handler. String continuationNr = line.substring(9, 10).trim(); logger.debug("current continuationNo is " + continuationNr); logger.debug("previousContinuationField is " + previousContinuationField); logger.debug("current continuationField is " + continuationField); logger.debug("current continuationString is " + continuationString); logger.debug("current compound is " + current_compound); // following the docs, the last valid character should be 79, chop off the rest if (line.length() > 79) { line = line.substring(0, 79); } line = line.substring(10, line.length()); logger.debug("LINE: >" + line + "<"); String[] fieldList = line.split("\\s+"); if (!fieldList[0].equals("") && sourceFieldValues.contains(fieldList[0])) { // System.out.println("[PDBFileParser.pdb_COMPND_Handler] Setting continuationField to '" + fieldList[0] + "'"); continuationField = fieldList[0]; if (previousContinuationField.equals("")) { previousContinuationField = continuationField; } } else if ((fieldList.length > 1) && ( sourceFieldValues.contains(fieldList[1]))) { // System.out.println("[PDBFileParser.pdb_COMPND_Handler] Setting continuationField to '" + fieldList[1] + "'"); continuationField = fieldList[1]; if (previousContinuationField.equals("")) { previousContinuationField = continuationField; } } else { if (continuationNr.equals("")) { logger.debug("looks like an old PDB file"); continuationField = "MOLECULE:"; if (previousContinuationField.equals("")) { previousContinuationField = continuationField; } } } line = line.replace(continuationField, "").trim(); StringTokenizer compndTokens = new StringTokenizer(line); // System.out.println("PDBFileParser.pdb_COMPND_Handler: Tokenizing '" + line + "'"); while (compndTokens.hasMoreTokens()) { String token = compndTokens.nextToken(); if (previousContinuationField.equals("")) { // System.out.println("previousContinuationField is empty. Setting to : " + continuationField); previousContinuationField = continuationField; } if (previousContinuationField.equals(continuationField) && sourceFieldValues.contains(continuationField)) { logger.debug("Still in field " + continuationField); continuationString = continuationString.concat(token + " "); logger.debug("continuationString = " + continuationString); } if (!continuationField.equals(previousContinuationField)) { if (continuationString.equals("")) { continuationString = token; } else { sourceValueSetter(previousContinuationField, continuationString); previousContinuationField = continuationField; continuationString = token + " "; } } else if (ignoreCompndFieldValues.contains(token)) { // this field shall be ignored //continuationField = token; } } if (isLastSourceLine) { // final line in the section - finish off the compound // System.out.println("[pdb_SOURCE_Handler] Final SOURCE line - Finishing off final MolID header."); sourceValueSetter(continuationField, continuationString); continuationString = ""; //compounds.add(current_compound); } }
[ "private", "void", "pdb_SOURCE_Handler", "(", "String", "line", ")", "{", "// works in the same way as the pdb_COMPND_Handler.", "String", "continuationNr", "=", "line", ".", "substring", "(", "9", ",", "10", ")", ".", "trim", "(", ")", ";", "logger", ".", "debu...
Handler for SOURCE Record format The SOURCE record specifies the biological and/or chemical source of each biological molecule in the entry. Sources are described by both the common name and the scientific name, e.g., genus and species. Strain and/or cell-line for immortalized cells are given when they help to uniquely identify the biological entity studied. Record Format <pre> COLUMNS DATA TYPE FIELD DEFINITION ------------------------------------------------------------------------------- 1 - 6 Record name "SOURCE" 9 - 10 Continuation continuation Allows concatenation of multiple records. 11 - 70 Specification srcName Identifies the source of the macromolecule in list a token: value format. </pre> @param line the line to be parsed
[ "Handler", "for", "SOURCE", "Record", "format" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L1133-L1239
31,863
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.pdb_REMARK_Handler
private void pdb_REMARK_Handler(String line) { if ( line == null || line.length() < 11) return; if (line.startsWith("REMARK 800")) { pdb_REMARK_800_Handler(line); } else if ( line.startsWith("REMARK 350")){ if ( params.isParseBioAssembly()) { if (bioAssemblyParser == null){ bioAssemblyParser = new PDBBioAssemblyParser(); } bioAssemblyParser.pdb_REMARK_350_Handler(line); } // REMARK 3 (for R free) // note: if more than 1 value present (occurring in hybrid experimental technique entries, e.g. 3ins, 4n9m) // then last one encountered will be taken } else if (line.startsWith("REMARK 3 FREE R VALUE")) { // Rfree annotation is not very consistent in PDB format, it varies depending on the software // Here we follow this strategy: // a) take the '(NO CUTOFF)' value if the only one available (shelx software, e.g. 1x7q) // b) don't take it if also a line without '(NO CUTOFF)' is present (CNX software, e.g. 3lak) Pattern pR = Pattern.compile("^REMARK 3 FREE R VALUE\\s+(?:\\(NO CUTOFF\\))?\\s+:\\s+(\\d?\\.\\d+).*"); Matcher mR = pR.matcher(line); if (mR.matches()) { try { rfreeNoCutoffLine = Float.parseFloat(mR.group(1)); } catch (NumberFormatException e) { logger.info("Rfree value "+mR.group(1)+" does not look like a number, will ignore it"); } } pR = Pattern.compile("^REMARK 3 FREE R VALUE\\s+:\\s+(\\d?\\.\\d+).*"); mR = pR.matcher(line); if (mR.matches()) { try { rfreeStandardLine = Float.parseFloat(mR.group(1)); } catch (NumberFormatException e) { logger.info("Rfree value '{}' does not look like a number, will ignore it", mR.group(1)); } } // REMARK 3 RESOLUTION (contains more info than REMARK 2, for instance multiple resolutions in hybrid experimental technique entries) // note: if more than 1 value present (occurring in hybrid experimental technique entries, e.g. 3ins, 4n9m) // then last one encountered will be taken } else if (line.startsWith("REMARK 3 RESOLUTION RANGE HIGH")){ Pattern pR = Pattern.compile("^REMARK 3 RESOLUTION RANGE HIGH \\(ANGSTROMS\\) :\\s+(\\d+\\.\\d+).*"); Matcher mR = pR.matcher(line); if (mR.matches()) { try { float res = Float.parseFloat(mR.group(1)); if (pdbHeader.getResolution()!=PDBHeader.DEFAULT_RESOLUTION) { logger.warn("More than 1 resolution value present, will use last one {} and discard previous {} " ,mR.group(1), String.format("%4.2f",pdbHeader.getResolution())); } pdbHeader.setResolution(res); } catch (NumberFormatException e) { logger.info("Could not parse resolution '{}', ignoring it",mR.group(1)); } } } }
java
private void pdb_REMARK_Handler(String line) { if ( line == null || line.length() < 11) return; if (line.startsWith("REMARK 800")) { pdb_REMARK_800_Handler(line); } else if ( line.startsWith("REMARK 350")){ if ( params.isParseBioAssembly()) { if (bioAssemblyParser == null){ bioAssemblyParser = new PDBBioAssemblyParser(); } bioAssemblyParser.pdb_REMARK_350_Handler(line); } // REMARK 3 (for R free) // note: if more than 1 value present (occurring in hybrid experimental technique entries, e.g. 3ins, 4n9m) // then last one encountered will be taken } else if (line.startsWith("REMARK 3 FREE R VALUE")) { // Rfree annotation is not very consistent in PDB format, it varies depending on the software // Here we follow this strategy: // a) take the '(NO CUTOFF)' value if the only one available (shelx software, e.g. 1x7q) // b) don't take it if also a line without '(NO CUTOFF)' is present (CNX software, e.g. 3lak) Pattern pR = Pattern.compile("^REMARK 3 FREE R VALUE\\s+(?:\\(NO CUTOFF\\))?\\s+:\\s+(\\d?\\.\\d+).*"); Matcher mR = pR.matcher(line); if (mR.matches()) { try { rfreeNoCutoffLine = Float.parseFloat(mR.group(1)); } catch (NumberFormatException e) { logger.info("Rfree value "+mR.group(1)+" does not look like a number, will ignore it"); } } pR = Pattern.compile("^REMARK 3 FREE R VALUE\\s+:\\s+(\\d?\\.\\d+).*"); mR = pR.matcher(line); if (mR.matches()) { try { rfreeStandardLine = Float.parseFloat(mR.group(1)); } catch (NumberFormatException e) { logger.info("Rfree value '{}' does not look like a number, will ignore it", mR.group(1)); } } // REMARK 3 RESOLUTION (contains more info than REMARK 2, for instance multiple resolutions in hybrid experimental technique entries) // note: if more than 1 value present (occurring in hybrid experimental technique entries, e.g. 3ins, 4n9m) // then last one encountered will be taken } else if (line.startsWith("REMARK 3 RESOLUTION RANGE HIGH")){ Pattern pR = Pattern.compile("^REMARK 3 RESOLUTION RANGE HIGH \\(ANGSTROMS\\) :\\s+(\\d+\\.\\d+).*"); Matcher mR = pR.matcher(line); if (mR.matches()) { try { float res = Float.parseFloat(mR.group(1)); if (pdbHeader.getResolution()!=PDBHeader.DEFAULT_RESOLUTION) { logger.warn("More than 1 resolution value present, will use last one {} and discard previous {} " ,mR.group(1), String.format("%4.2f",pdbHeader.getResolution())); } pdbHeader.setResolution(res); } catch (NumberFormatException e) { logger.info("Could not parse resolution '{}', ignoring it",mR.group(1)); } } } }
[ "private", "void", "pdb_REMARK_Handler", "(", "String", "line", ")", "{", "if", "(", "line", "==", "null", "||", "line", ".", "length", "(", ")", "<", "11", ")", "return", ";", "if", "(", "line", ".", "startsWith", "(", "\"REMARK 800\"", ")", ")", "{...
Handler for REMARK lines
[ "Handler", "for", "REMARK", "lines" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L1336-L1405
31,864
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.conect_helper
private Integer conect_helper (String line,int start,int end) { if (line.length() < end) return null; String sbond = line.substring(start,end).trim(); int bond = -1 ; Integer b = null ; if ( ! sbond.equals("")) { bond = Integer.parseInt(sbond); b = new Integer(bond); } return b ; }
java
private Integer conect_helper (String line,int start,int end) { if (line.length() < end) return null; String sbond = line.substring(start,end).trim(); int bond = -1 ; Integer b = null ; if ( ! sbond.equals("")) { bond = Integer.parseInt(sbond); b = new Integer(bond); } return b ; }
[ "private", "Integer", "conect_helper", "(", "String", "line", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "line", ".", "length", "(", ")", "<", "end", ")", "return", "null", ";", "String", "sbond", "=", "line", ".", "substring", "(",...
safes repeating a few lines ...
[ "safes", "repeating", "a", "few", "lines", "..." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L2004-L2017
31,865
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.pdb_SSBOND_Handler
private void pdb_SSBOND_Handler(String line){ if (params.isHeaderOnly()) return; if (line.length()<36) { logger.info("SSBOND line has length under 36. Ignoring it."); return; } String chain1 = line.substring(15,16); String seqNum1 = line.substring(17,21).trim(); String icode1 = line.substring(21,22); String chain2 = line.substring(29,30); String seqNum2 = line.substring(31,35).trim(); String icode2 = line.substring(35,36); if (line.length()>=72) { String symop1 = line.substring(59, 65).trim(); String symop2 = line.substring(66, 72).trim(); // until we implement proper treatment of symmetry in biojava #220, we can't deal with sym-related parteners properly, skipping them if (!symop1.equals("") && !symop2.equals("") && // in case the field is missing (!symop1.equals("1555") || !symop2.equals("1555")) ) { logger.info("Skipping ss bond between groups {} and {} belonging to different symmetry partners, because it is not supported yet", seqNum1+icode1, seqNum2+icode2); return; } } if (icode1.equals(" ")) icode1 = ""; if (icode2.equals(" ")) icode2 = ""; SSBondImpl ssbond = new SSBondImpl(); ssbond.setChainID1(chain1); ssbond.setResnum1(seqNum1); ssbond.setChainID2(chain2); ssbond.setResnum2(seqNum2); ssbond.setInsCode1(icode1); ssbond.setInsCode2(icode2); ssbonds.add(ssbond); }
java
private void pdb_SSBOND_Handler(String line){ if (params.isHeaderOnly()) return; if (line.length()<36) { logger.info("SSBOND line has length under 36. Ignoring it."); return; } String chain1 = line.substring(15,16); String seqNum1 = line.substring(17,21).trim(); String icode1 = line.substring(21,22); String chain2 = line.substring(29,30); String seqNum2 = line.substring(31,35).trim(); String icode2 = line.substring(35,36); if (line.length()>=72) { String symop1 = line.substring(59, 65).trim(); String symop2 = line.substring(66, 72).trim(); // until we implement proper treatment of symmetry in biojava #220, we can't deal with sym-related parteners properly, skipping them if (!symop1.equals("") && !symop2.equals("") && // in case the field is missing (!symop1.equals("1555") || !symop2.equals("1555")) ) { logger.info("Skipping ss bond between groups {} and {} belonging to different symmetry partners, because it is not supported yet", seqNum1+icode1, seqNum2+icode2); return; } } if (icode1.equals(" ")) icode1 = ""; if (icode2.equals(" ")) icode2 = ""; SSBondImpl ssbond = new SSBondImpl(); ssbond.setChainID1(chain1); ssbond.setResnum1(seqNum1); ssbond.setChainID2(chain2); ssbond.setResnum2(seqNum2); ssbond.setInsCode1(icode1); ssbond.setInsCode2(icode2); ssbonds.add(ssbond); }
[ "private", "void", "pdb_SSBOND_Handler", "(", "String", "line", ")", "{", "if", "(", "params", ".", "isHeaderOnly", "(", ")", ")", "return", ";", "if", "(", "line", ".", "length", "(", ")", "<", "36", ")", "{", "logger", ".", "info", "(", "\"SSBOND l...
Process the disulfide bond info provided by an SSBOND record <pre> COLUMNS DATA TYPE FIELD DEFINITION ------------------------------------------------------------------- 1 - 6 Record name "SSBOND" 8 - 10 Integer serNum Serial number. 12 - 14 LString(3) "CYS" Residue name. 16 Character chainID1 Chain identifier. 18 - 21 Integer seqNum1 Residue sequence number. 22 AChar icode1 Insertion code. 26 - 28 LString(3) "CYS" Residue name. 30 Character chainID2 Chain identifier. 32 - 35 Integer seqNum2 Residue sequence number. 36 AChar icode2 Insertion code. 60 - 65 SymOP sym1 Symmetry oper for 1st resid 67 - 72 SymOP sym2 Symmetry oper for 2nd resid </pre>
[ "Process", "the", "disulfide", "bond", "info", "provided", "by", "an", "SSBOND", "record" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L2214-L2256
31,866
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.isKnownChain
private static Chain isKnownChain(String chainID, List<Chain> chains){ for (int i = 0; i< chains.size();i++){ Chain testchain = chains.get(i); if (chainID.equals(testchain.getName())) { return testchain; } } return null; }
java
private static Chain isKnownChain(String chainID, List<Chain> chains){ for (int i = 0; i< chains.size();i++){ Chain testchain = chains.get(i); if (chainID.equals(testchain.getName())) { return testchain; } } return null; }
[ "private", "static", "Chain", "isKnownChain", "(", "String", "chainID", ",", "List", "<", "Chain", ">", "chains", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chains", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Chain", "test...
Finds in the given list of chains the first one that has as name the given chainID. If no such Chain can be found it returns null.
[ "Finds", "in", "the", "given", "list", "of", "chains", "the", "first", "one", "that", "has", "as", "name", "the", "given", "chainID", ".", "If", "no", "such", "Chain", "can", "be", "found", "it", "returns", "null", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L2514-L2524
31,867
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.makeCompounds
private void makeCompounds(List<String> compoundList, List<String> sourceList) { // System.out.println("[makeCompounds] making compounds from compoundLines"); for (String line : compoundList) { if (compoundList.indexOf(line) + 1 == compoundList.size()) { // System.out.println("[makeCompounds] Final line in compoundLines."); isLastCompndLine = true; } pdb_COMPND_Handler(line); } // System.out.println("[makeCompounds] adding sources to compounds from sourceLines"); // since we're starting again from the first compound, reset it here if ( entities.size() == 0){ current_compound = new EntityInfo(); } else { current_compound = entities.get(0); } for (String line : sourceList) { if (sourceList.indexOf(line) + 1 == sourceList.size()) { // System.out.println("[makeCompounds] Final line in sourceLines."); isLastSourceLine = true; } pdb_SOURCE_Handler(line); } }
java
private void makeCompounds(List<String> compoundList, List<String> sourceList) { // System.out.println("[makeCompounds] making compounds from compoundLines"); for (String line : compoundList) { if (compoundList.indexOf(line) + 1 == compoundList.size()) { // System.out.println("[makeCompounds] Final line in compoundLines."); isLastCompndLine = true; } pdb_COMPND_Handler(line); } // System.out.println("[makeCompounds] adding sources to compounds from sourceLines"); // since we're starting again from the first compound, reset it here if ( entities.size() == 0){ current_compound = new EntityInfo(); } else { current_compound = entities.get(0); } for (String line : sourceList) { if (sourceList.indexOf(line) + 1 == sourceList.size()) { // System.out.println("[makeCompounds] Final line in sourceLines."); isLastSourceLine = true; } pdb_SOURCE_Handler(line); } }
[ "private", "void", "makeCompounds", "(", "List", "<", "String", ">", "compoundList", ",", "List", "<", "String", ">", "sourceList", ")", "{", "//\t\tSystem.out.println(\"[makeCompounds] making compounds from compoundLines\");", "for", "(", "String", "line", ":", "compou...
This is the new method for building the COMPND and SOURCE records. Now each method is self-contained. @author Jules Jacobsen @param compoundList @param sourceList
[ "This", "is", "the", "new", "method", "for", "building", "the", "COMPND", "and", "SOURCE", "records", ".", "Now", "each", "method", "is", "self", "-", "contained", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L2731-L2758
31,868
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.findChains
private static List<List<Chain>> findChains(String chainName, List<List<Chain>> polyModels) { List<List<Chain>> models = new ArrayList<>(); for (List<Chain> chains:polyModels) { List<Chain> matchingChains = new ArrayList<>(); models.add(matchingChains); for (Chain c:chains) { if (c.getName().equals(chainName)) { matchingChains.add(c); } } } return models; }
java
private static List<List<Chain>> findChains(String chainName, List<List<Chain>> polyModels) { List<List<Chain>> models = new ArrayList<>(); for (List<Chain> chains:polyModels) { List<Chain> matchingChains = new ArrayList<>(); models.add(matchingChains); for (Chain c:chains) { if (c.getName().equals(chainName)) { matchingChains.add(c); } } } return models; }
[ "private", "static", "List", "<", "List", "<", "Chain", ">", ">", "findChains", "(", "String", "chainName", ",", "List", "<", "List", "<", "Chain", ">", ">", "polyModels", ")", "{", "List", "<", "List", "<", "Chain", ">>", "models", "=", "new", "Arra...
Gets all chains with given chainName from given models list @param chainName @param polyModels @return
[ "Gets", "all", "chains", "with", "given", "chainName", "from", "given", "models", "list" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L2968-L2981
31,869
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.assignAsymIds
private void assignAsymIds(List<List<Chain>> polys, List<List<Chain>> nonPolys, List<List<Chain>> waters) { for (int i=0; i<polys.size(); i++) { String asymId = "A"; for (Chain poly:polys.get(i)) { poly.setId(asymId); asymId = getNextAsymId(asymId); } for (Chain nonPoly:nonPolys.get(i)) { nonPoly.setId(asymId); asymId = getNextAsymId(asymId); } for (Chain water:waters.get(i)) { water.setId(asymId); asymId = getNextAsymId(asymId); } } }
java
private void assignAsymIds(List<List<Chain>> polys, List<List<Chain>> nonPolys, List<List<Chain>> waters) { for (int i=0; i<polys.size(); i++) { String asymId = "A"; for (Chain poly:polys.get(i)) { poly.setId(asymId); asymId = getNextAsymId(asymId); } for (Chain nonPoly:nonPolys.get(i)) { nonPoly.setId(asymId); asymId = getNextAsymId(asymId); } for (Chain water:waters.get(i)) { water.setId(asymId); asymId = getNextAsymId(asymId); } } }
[ "private", "void", "assignAsymIds", "(", "List", "<", "List", "<", "Chain", ">", ">", "polys", ",", "List", "<", "List", "<", "Chain", ">", ">", "nonPolys", ",", "List", "<", "List", "<", "Chain", ">", ">", "waters", ")", "{", "for", "(", "int", ...
Assign asym ids following the rules used by the PDB to assign asym ids in mmCIF files @param polys @param nonPolys @param waters
[ "Assign", "asym", "ids", "following", "the", "rules", "used", "by", "the", "PDB", "to", "assign", "asym", "ids", "in", "mmCIF", "files" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L3047-L3065
31,870
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java
PDBFileParser.linkSitesToGroups
private void linkSitesToGroups() { //System.out.println("LINK SITES TO GROUPS:" + siteToResidueMap.keySet().size()); //link the map of siteIds : <ResidueNumber> with the sites by using ResidueNumber to get the correct group back. //the return list if ( siteMap == null || siteToResidueMap == null){ logger.info("Sites can not be linked to residues!"); return; } List<Site> sites = null; //check that there are chains with which to associate the groups if (structure.getChains().isEmpty()) { sites = new ArrayList<Site>(siteMap.values()); logger.info("No chains to link Site Groups with - Sites will not be present in the Structure"); return; } //check that the keys in the siteMap and SiteToResidueMap are equal if (! siteMap.keySet().equals(siteToResidueMap.keySet())) { logger.info("Not all sites have been properly described in the PDB " + pdbId + " header - some Sites will not be present in the Structure"); logger.debug(siteMap.keySet() + " | " + siteToResidueMap.keySet()); //return; } //so we have chains - associate the siteResidues-related groups with the ones //already in in the chains for (String key : siteMap.keySet()) { Site currentSite = siteMap.get(key); List<ResidueNumber> linkedGroups = siteToResidueMap.get(key); if ( linkedGroups == null) continue; for (ResidueNumber residueNumber : linkedGroups) { String pdbCode = residueNumber.toString(); String chain = residueNumber.getChainName(); // System.out.println("chain: '" + chain + "'"); // String resNum = resNum.getSeqNum().toString(); // System.out.println("resNum: '" + resNum + "'"); Group linkedGroup = null; try { //TODO: implement findGroup(ResidueNumber resNum) linkedGroup = structure.findGroup(chain, pdbCode); } catch (StructureException ex) { logger.info("Can't find group " + pdbCode + " in chain " + chain + " in order to link up SITE records (PDB ID " + pdbId +")"); continue; } // System.out.println("Adding group: " + linkedGroup.getSeqNum() + " to site " + site.getSiteID()); currentSite.getGroups().add(linkedGroup); } } //System.out.println("SITEMAP: " + siteMap); sites = new ArrayList<Site>(siteMap.values()); structure.setSites(sites); //System.out.println("STRUCTURE SITES: " + structure.getSites().size()); // for (Site site : structure.getSites()) { // System.out.println(site); // } // System.out.println("Linked Site Groups with Chains"); }
java
private void linkSitesToGroups() { //System.out.println("LINK SITES TO GROUPS:" + siteToResidueMap.keySet().size()); //link the map of siteIds : <ResidueNumber> with the sites by using ResidueNumber to get the correct group back. //the return list if ( siteMap == null || siteToResidueMap == null){ logger.info("Sites can not be linked to residues!"); return; } List<Site> sites = null; //check that there are chains with which to associate the groups if (structure.getChains().isEmpty()) { sites = new ArrayList<Site>(siteMap.values()); logger.info("No chains to link Site Groups with - Sites will not be present in the Structure"); return; } //check that the keys in the siteMap and SiteToResidueMap are equal if (! siteMap.keySet().equals(siteToResidueMap.keySet())) { logger.info("Not all sites have been properly described in the PDB " + pdbId + " header - some Sites will not be present in the Structure"); logger.debug(siteMap.keySet() + " | " + siteToResidueMap.keySet()); //return; } //so we have chains - associate the siteResidues-related groups with the ones //already in in the chains for (String key : siteMap.keySet()) { Site currentSite = siteMap.get(key); List<ResidueNumber> linkedGroups = siteToResidueMap.get(key); if ( linkedGroups == null) continue; for (ResidueNumber residueNumber : linkedGroups) { String pdbCode = residueNumber.toString(); String chain = residueNumber.getChainName(); // System.out.println("chain: '" + chain + "'"); // String resNum = resNum.getSeqNum().toString(); // System.out.println("resNum: '" + resNum + "'"); Group linkedGroup = null; try { //TODO: implement findGroup(ResidueNumber resNum) linkedGroup = structure.findGroup(chain, pdbCode); } catch (StructureException ex) { logger.info("Can't find group " + pdbCode + " in chain " + chain + " in order to link up SITE records (PDB ID " + pdbId +")"); continue; } // System.out.println("Adding group: " + linkedGroup.getSeqNum() + " to site " + site.getSiteID()); currentSite.getGroups().add(linkedGroup); } } //System.out.println("SITEMAP: " + siteMap); sites = new ArrayList<Site>(siteMap.values()); structure.setSites(sites); //System.out.println("STRUCTURE SITES: " + structure.getSites().size()); // for (Site site : structure.getSites()) { // System.out.println(site); // } // System.out.println("Linked Site Groups with Chains"); }
[ "private", "void", "linkSitesToGroups", "(", ")", "{", "//System.out.println(\"LINK SITES TO GROUPS:\" + siteToResidueMap.keySet().size());", "//link the map of siteIds : <ResidueNumber> with the sites by using ResidueNumber to get the correct group back.", "//the return list", "if", "(", "sit...
Links the Sites in the siteMap to the Groups in the Structure via the siteToResidueMap ResidueNumber. @author Jules Jacobsen @return
[ "Links", "the", "Sites", "in", "the", "siteMap", "to", "the", "Groups", "in", "the", "Structure", "via", "the", "siteToResidueMap", "ResidueNumber", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/PDBFileParser.java#L3239-L3306
31,871
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java
TranscriptionEngine.translate
public Sequence<AminoAcidCompound> translate( Sequence<NucleotideCompound> dna) { Map<Frame, Sequence<AminoAcidCompound>> trans = multipleFrameTranslation( dna, Frame.ONE); return trans.get(Frame.ONE); }
java
public Sequence<AminoAcidCompound> translate( Sequence<NucleotideCompound> dna) { Map<Frame, Sequence<AminoAcidCompound>> trans = multipleFrameTranslation( dna, Frame.ONE); return trans.get(Frame.ONE); }
[ "public", "Sequence", "<", "AminoAcidCompound", ">", "translate", "(", "Sequence", "<", "NucleotideCompound", ">", "dna", ")", "{", "Map", "<", "Frame", ",", "Sequence", "<", "AminoAcidCompound", ">", ">", "trans", "=", "multipleFrameTranslation", "(", "dna", ...
Quick method to let you go from a CDS to a Peptide quickly. It assumes you are translating only in the first frame @param dna The CDS to translate @return The Protein Sequence
[ "Quick", "method", "to", "let", "you", "go", "from", "a", "CDS", "to", "a", "Peptide", "quickly", ".", "It", "assumes", "you", "are", "translating", "only", "in", "the", "first", "frame" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java#L109-L114
31,872
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java
TranscriptionEngine.multipleFrameTranslation
public Map<Frame, Sequence<AminoAcidCompound>> multipleFrameTranslation( Sequence<NucleotideCompound> dna, Frame... frames) { Map<Frame, Sequence<AminoAcidCompound>> results = new EnumMap<Frame, Sequence<AminoAcidCompound>>( Frame.class); for (Frame frame : frames) { Sequence<NucleotideCompound> rna = getDnaRnaTranslator() .createSequence(dna, frame); Sequence<AminoAcidCompound> peptide = getRnaAminoAcidTranslator() .createSequence(rna); results.put(frame, peptide); } return results; }
java
public Map<Frame, Sequence<AminoAcidCompound>> multipleFrameTranslation( Sequence<NucleotideCompound> dna, Frame... frames) { Map<Frame, Sequence<AminoAcidCompound>> results = new EnumMap<Frame, Sequence<AminoAcidCompound>>( Frame.class); for (Frame frame : frames) { Sequence<NucleotideCompound> rna = getDnaRnaTranslator() .createSequence(dna, frame); Sequence<AminoAcidCompound> peptide = getRnaAminoAcidTranslator() .createSequence(rna); results.put(frame, peptide); } return results; }
[ "public", "Map", "<", "Frame", ",", "Sequence", "<", "AminoAcidCompound", ">", ">", "multipleFrameTranslation", "(", "Sequence", "<", "NucleotideCompound", ">", "dna", ",", "Frame", "...", "frames", ")", "{", "Map", "<", "Frame", ",", "Sequence", "<", "Amino...
A way of translating DNA in a number of frames @param dna The CDS to translate @param frames The Frames to translate in @return All generated protein sequences in the given frames. Can have null entries
[ "A", "way", "of", "translating", "DNA", "in", "a", "number", "of", "frames" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/transcription/TranscriptionEngine.java#L126-L138
31,873
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java
SubunitCluster.isIdenticalTo
public boolean isIdenticalTo(SubunitCluster other) { String thisSequence = this.subunits.get(this.representative) .getProteinSequenceString(); String otherSequence = other.subunits.get(other.representative) .getProteinSequenceString(); return thisSequence.equals(otherSequence); }
java
public boolean isIdenticalTo(SubunitCluster other) { String thisSequence = this.subunits.get(this.representative) .getProteinSequenceString(); String otherSequence = other.subunits.get(other.representative) .getProteinSequenceString(); return thisSequence.equals(otherSequence); }
[ "public", "boolean", "isIdenticalTo", "(", "SubunitCluster", "other", ")", "{", "String", "thisSequence", "=", "this", ".", "subunits", ".", "get", "(", "this", ".", "representative", ")", ".", "getProteinSequenceString", "(", ")", ";", "String", "otherSequence"...
Tells whether the other SubunitCluster contains exactly the same Subunit. This is checked by String equality of their residue one-letter sequences. @param other SubunitCluster @return true if the SubunitClusters are identical, false otherwise
[ "Tells", "whether", "the", "other", "SubunitCluster", "contains", "exactly", "the", "same", "Subunit", ".", "This", "is", "checked", "by", "String", "equality", "of", "their", "residue", "one", "-", "letter", "sequences", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/cluster/SubunitCluster.java#L174-L180
31,874
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIAlignmentProgressListener.java
GUIAlignmentProgressListener.actionPerformed
@Override public void actionPerformed(ActionEvent evt) { //System.out.println("stopping!"); logStatus("terminating"); logStatus(" Total alignments processed: " + alignmentsProcessed); stopButton.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); progressBar.setIndeterminate(true); progressBar.setStringPainted(false); System.out.println("terminating jobs"); farmJob.terminate(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); progressBar.setIndeterminate(false); }
java
@Override public void actionPerformed(ActionEvent evt) { //System.out.println("stopping!"); logStatus("terminating"); logStatus(" Total alignments processed: " + alignmentsProcessed); stopButton.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); progressBar.setIndeterminate(true); progressBar.setStringPainted(false); System.out.println("terminating jobs"); farmJob.terminate(); setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); progressBar.setIndeterminate(false); }
[ "@", "Override", "public", "void", "actionPerformed", "(", "ActionEvent", "evt", ")", "{", "//System.out.println(\"stopping!\");", "logStatus", "(", "\"terminating\"", ")", ";", "logStatus", "(", "\" Total alignments processed: \"", "+", "alignmentsProcessed", ")", ";", ...
Invoked when the user presses the stop button.
[ "Invoked", "when", "the", "user", "presses", "the", "stop", "button", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIAlignmentProgressListener.java#L96-L113
31,875
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java
OptimalCECPMain.permuteArray
private static <T> void permuteArray(T[] arr, int cp) { // Allow negative cp points for convenience. if(cp == 0) { return; } if(cp < 0) { cp = arr.length+cp; } if(cp < 0 || cp >= arr.length) { throw new ArrayIndexOutOfBoundsException( "Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" ); } List<T> temp = new ArrayList<T>(cp); // shift residues left for(int i=0;i<cp;i++) { temp.add(arr[i]); } for(int j=cp;j<arr.length;j++) { arr[j-cp]=arr[j]; } for(int i=0;i<cp;i++) { arr[arr.length-cp+i] = temp.get(i); } }
java
private static <T> void permuteArray(T[] arr, int cp) { // Allow negative cp points for convenience. if(cp == 0) { return; } if(cp < 0) { cp = arr.length+cp; } if(cp < 0 || cp >= arr.length) { throw new ArrayIndexOutOfBoundsException( "Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" ); } List<T> temp = new ArrayList<T>(cp); // shift residues left for(int i=0;i<cp;i++) { temp.add(arr[i]); } for(int j=cp;j<arr.length;j++) { arr[j-cp]=arr[j]; } for(int i=0;i<cp;i++) { arr[arr.length-cp+i] = temp.get(i); } }
[ "private", "static", "<", "T", ">", "void", "permuteArray", "(", "T", "[", "]", "arr", ",", "int", "cp", ")", "{", "// Allow negative cp points for convenience.", "if", "(", "cp", "==", "0", ")", "{", "return", ";", "}", "if", "(", "cp", "<", "0", ")...
Circularly permutes arr in place. <p>Similar to {@link Collections#rotate(List, int)} but with reversed direction. Perhaps it would be more efficient to use the Collections version? @param <T> @param arr The array to be permuted @param cp The number of residues to shift leftward, or equivalently, the index of the first element after the permutation point.
[ "Circularly", "permutes", "arr", "in", "place", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java#L116-L141
31,876
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java
OptimalCECPMain.permuteAFPChain
private static void permuteAFPChain(AFPChain afpChain, int cp) { int ca2len = afpChain.getCa2Length(); //fix up cp to be positive if(cp == 0) { return; } if(cp < 0) { cp = ca2len+cp; } if(cp < 0 || cp >= ca2len) { throw new ArrayIndexOutOfBoundsException( "Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" ); } // Fix up optAln permuteOptAln(afpChain,cp); if(afpChain.getBlockNum() > 1) afpChain.setSequentialAlignment(false); // fix up matrices // ca1 corresponds to row indices, while ca2 corresponds to column indices. afpChain.setDistanceMatrix(permuteMatrix(afpChain.getDistanceMatrix(),0,-cp)); // this is square, so permute both afpChain.setDisTable2(permuteMatrix(afpChain.getDisTable2(),-cp,-cp)); //TODO fix up other AFP parameters? }
java
private static void permuteAFPChain(AFPChain afpChain, int cp) { int ca2len = afpChain.getCa2Length(); //fix up cp to be positive if(cp == 0) { return; } if(cp < 0) { cp = ca2len+cp; } if(cp < 0 || cp >= ca2len) { throw new ArrayIndexOutOfBoundsException( "Permutation point ("+cp+") must be between -ca2.length and ca2.length-1" ); } // Fix up optAln permuteOptAln(afpChain,cp); if(afpChain.getBlockNum() > 1) afpChain.setSequentialAlignment(false); // fix up matrices // ca1 corresponds to row indices, while ca2 corresponds to column indices. afpChain.setDistanceMatrix(permuteMatrix(afpChain.getDistanceMatrix(),0,-cp)); // this is square, so permute both afpChain.setDisTable2(permuteMatrix(afpChain.getDisTable2(),-cp,-cp)); //TODO fix up other AFP parameters? }
[ "private", "static", "void", "permuteAFPChain", "(", "AFPChain", "afpChain", ",", "int", "cp", ")", "{", "int", "ca2len", "=", "afpChain", ".", "getCa2Length", "(", ")", ";", "//fix up cp to be positive", "if", "(", "cp", "==", "0", ")", "{", "return", ";"...
Permute the second protein of afpChain by the specified number of residues. @param afpChain Input alignment @param cp Amount leftwards (or rightward, if negative) to shift the @return A new alignment equivalent to afpChain after the permutations
[ "Permute", "the", "second", "protein", "of", "afpChain", "by", "the", "specified", "number", "of", "residues", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/ce/OptimalCECPMain.java#L217-L246
31,877
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java
MultipleAlignmentCoordManager.getSeqPos
public int getSeqPos(int aligSeq, Point p) { int x = p.x - DEFAULT_X_SPACE - DEFAULT_LEGEND_SIZE; int y = p.y - DEFAULT_Y_SPACE ; y -= (DEFAULT_LINE_SEPARATION * aligSeq) - DEFAULT_CHAR_SIZE; int lineNr = y / DEFAULT_Y_STEP; int linePos = x / DEFAULT_CHAR_SIZE; return lineNr * DEFAULT_LINE_LENGTH + linePos ; }
java
public int getSeqPos(int aligSeq, Point p) { int x = p.x - DEFAULT_X_SPACE - DEFAULT_LEGEND_SIZE; int y = p.y - DEFAULT_Y_SPACE ; y -= (DEFAULT_LINE_SEPARATION * aligSeq) - DEFAULT_CHAR_SIZE; int lineNr = y / DEFAULT_Y_STEP; int linePos = x / DEFAULT_CHAR_SIZE; return lineNr * DEFAULT_LINE_LENGTH + linePos ; }
[ "public", "int", "getSeqPos", "(", "int", "aligSeq", ",", "Point", "p", ")", "{", "int", "x", "=", "p", ".", "x", "-", "DEFAULT_X_SPACE", "-", "DEFAULT_LEGEND_SIZE", ";", "int", "y", "=", "p", ".", "y", "-", "DEFAULT_Y_SPACE", ";", "y", "-=", "(", ...
Convert from an X position in the JPanel to the position in the sequence alignment. @param aligSeq sequence number @param p point on panel @return the sequence position for a point on the Panel
[ "Convert", "from", "an", "X", "position", "in", "the", "JPanel", "to", "the", "position", "in", "the", "sequence", "alignment", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java#L125-L136
31,878
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java
MultipleAlignmentCoordManager.getPanelPos
public Point getPanelPos(int structure, int pos) { Point p = new Point(); int lineNr = pos / DEFAULT_LINE_LENGTH; int linePos = pos % DEFAULT_LINE_LENGTH; int x = linePos * DEFAULT_CHAR_SIZE + DEFAULT_X_SPACE + DEFAULT_LEGEND_SIZE; int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE; y += DEFAULT_LINE_SEPARATION * structure; p.setLocation(x, y); return p; }
java
public Point getPanelPos(int structure, int pos) { Point p = new Point(); int lineNr = pos / DEFAULT_LINE_LENGTH; int linePos = pos % DEFAULT_LINE_LENGTH; int x = linePos * DEFAULT_CHAR_SIZE + DEFAULT_X_SPACE + DEFAULT_LEGEND_SIZE; int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE; y += DEFAULT_LINE_SEPARATION * structure; p.setLocation(x, y); return p; }
[ "public", "Point", "getPanelPos", "(", "int", "structure", ",", "int", "pos", ")", "{", "Point", "p", "=", "new", "Point", "(", ")", ";", "int", "lineNr", "=", "pos", "/", "DEFAULT_LINE_LENGTH", ";", "int", "linePos", "=", "pos", "%", "DEFAULT_LINE_LENGT...
Get the X position on the Panel of a particular sequence position. @param structure index of the structure for the sequence position. @param pos sequence position, the aligned position index @return the point on a panel for a sequence position
[ "Get", "the", "X", "position", "on", "the", "Panel", "of", "a", "particular", "sequence", "position", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java#L145-L159
31,879
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java
MultipleAlignmentCoordManager.getAligSeq
public int getAligSeq(Point point) { for (int pos=0; pos<alignmentSize; pos++){ int i = getSeqPos(pos, point); Point t = getPanelPos(pos,i); if ( Math.abs(t.x - point.x) <= DEFAULT_CHAR_SIZE && Math.abs(t.y-point.y) < DEFAULT_CHAR_SIZE ) return pos; } return -1; }
java
public int getAligSeq(Point point) { for (int pos=0; pos<alignmentSize; pos++){ int i = getSeqPos(pos, point); Point t = getPanelPos(pos,i); if ( Math.abs(t.x - point.x) <= DEFAULT_CHAR_SIZE && Math.abs(t.y-point.y) < DEFAULT_CHAR_SIZE ) return pos; } return -1; }
[ "public", "int", "getAligSeq", "(", "Point", "point", ")", "{", "for", "(", "int", "pos", "=", "0", ";", "pos", "<", "alignmentSize", ";", "pos", "++", ")", "{", "int", "i", "=", "getSeqPos", "(", "pos", ",", "point", ")", ";", "Point", "t", "=",...
Returns the index of the structure, for a given point in the Panel. Returns -1 if not over a position in the sequence alignment. @param point x and y coordinates in the panel @return which structure a point on the panel corresponds to
[ "Returns", "the", "index", "of", "the", "structure", "for", "a", "given", "point", "in", "the", "Panel", ".", "Returns", "-", "1", "if", "not", "over", "a", "position", "in", "the", "sequence", "alignment", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/aligpanel/MultipleAlignmentCoordManager.java#L167-L177
31,880
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java
DBRef.toPDB
@Override public String toPDB(){ StringBuffer buf = new StringBuffer(); toPDB(buf); return buf.toString(); }
java
@Override public String toPDB(){ StringBuffer buf = new StringBuffer(); toPDB(buf); return buf.toString(); }
[ "@", "Override", "public", "String", "toPDB", "(", ")", "{", "StringBuffer", "buf", "=", "new", "StringBuffer", "(", ")", ";", "toPDB", "(", "buf", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Convert the DBRef object to a DBREF record as it is used in PDB files @return a PDB - DBREF formatted line
[ "Convert", "the", "DBRef", "object", "to", "a", "DBREF", "record", "as", "it", "is", "used", "in", "PDB", "files" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java#L113-L120
31,881
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java
DBRef.toPDB
@Override public void toPDB(StringBuffer buf){ Formatter formatter = new Formatter(new StringBuilder(),Locale.UK); // DBREF 3ETA A 990 1295 UNP P06213 INSR_HUMAN 1017 1322 // DBREF 3EH2 A 2 767 UNP P53992 SC24C_HUMAN 329 1094 // DBREF 3EH2 A 2 767 UNP P53992 SC24C_HUMAN 329 1094 // DBREF 3ETA A 990 1295 UNP P06213 INSR_HUMAN 1017 1322 formatter.format("DBREF %4s %1s %4d%1s %4d%1s %-6s %-8s %-12s%6d%1c%6d%1c ", idCode, chainName,seqbegin,insertBegin,seqEnd,insertEnd, database,dbAccession,dbIdCode, dbSeqBegin,idbnsBegin,dbSeqEnd,idbnsEnd ); buf.append(formatter.toString()); formatter.close(); }
java
@Override public void toPDB(StringBuffer buf){ Formatter formatter = new Formatter(new StringBuilder(),Locale.UK); // DBREF 3ETA A 990 1295 UNP P06213 INSR_HUMAN 1017 1322 // DBREF 3EH2 A 2 767 UNP P53992 SC24C_HUMAN 329 1094 // DBREF 3EH2 A 2 767 UNP P53992 SC24C_HUMAN 329 1094 // DBREF 3ETA A 990 1295 UNP P06213 INSR_HUMAN 1017 1322 formatter.format("DBREF %4s %1s %4d%1s %4d%1s %-6s %-8s %-12s%6d%1c%6d%1c ", idCode, chainName,seqbegin,insertBegin,seqEnd,insertEnd, database,dbAccession,dbIdCode, dbSeqBegin,idbnsBegin,dbSeqEnd,idbnsEnd ); buf.append(formatter.toString()); formatter.close(); }
[ "@", "Override", "public", "void", "toPDB", "(", "StringBuffer", "buf", ")", "{", "Formatter", "formatter", "=", "new", "Formatter", "(", "new", "StringBuilder", "(", ")", ",", "Locale", ".", "UK", ")", ";", "// DBREF 3ETA A 990 1295 UNP P06213 INS...
Append the PDB representation of this DBRef to the provided StringBuffer @param buf the StringBuffer to write to.
[ "Append", "the", "PDB", "representation", "of", "this", "DBRef", "to", "the", "provided", "StringBuffer" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/DBRef.java#L126-L142
31,882
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java
DisplayAFP.getPDBresnum
public static final List<String> getPDBresnum(int aligPos, AFPChain afpChain, Atom[] ca){ List<String> lst = new ArrayList<String>(); if ( aligPos > 1) { System.err.println("multiple alignments not supported yet!"); return lst; } int blockNum = afpChain.getBlockNum(); int[] optLen = afpChain.getOptLen(); int[][][] optAln = afpChain.getOptAln(); if ( optLen == null) return lst; for(int bk = 0; bk < blockNum; bk ++) { for ( int i=0;i< optLen[bk];i++){ int pos = optAln[bk][aligPos][i]; if ( pos < ca.length) { String pdbInfo = JmolTools.getPdbInfo(ca[pos]); //lst.add(ca1[pos].getParent().getPDBCode()); lst.add(pdbInfo); } } } return lst; }
java
public static final List<String> getPDBresnum(int aligPos, AFPChain afpChain, Atom[] ca){ List<String> lst = new ArrayList<String>(); if ( aligPos > 1) { System.err.println("multiple alignments not supported yet!"); return lst; } int blockNum = afpChain.getBlockNum(); int[] optLen = afpChain.getOptLen(); int[][][] optAln = afpChain.getOptAln(); if ( optLen == null) return lst; for(int bk = 0; bk < blockNum; bk ++) { for ( int i=0;i< optLen[bk];i++){ int pos = optAln[bk][aligPos][i]; if ( pos < ca.length) { String pdbInfo = JmolTools.getPdbInfo(ca[pos]); //lst.add(ca1[pos].getParent().getPDBCode()); lst.add(pdbInfo); } } } return lst; }
[ "public", "static", "final", "List", "<", "String", ">", "getPDBresnum", "(", "int", "aligPos", ",", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca", ")", "{", "List", "<", "String", ">", "lst", "=", "new", "ArrayList", "<", "String", ">", "(", "...
Return a list of pdb Strings corresponding to the aligned positions of the molecule. Only supports a pairwise alignment with the AFPChain DS. @param aligPos @param afpChain @param ca
[ "Return", "a", "list", "of", "pdb", "Strings", "corresponding", "to", "the", "aligned", "positions", "of", "the", "molecule", ".", "Only", "supports", "a", "pairwise", "alignment", "with", "the", "AFPChain", "DS", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java#L109-L137
31,883
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java
DisplayAFP.getAtomForAligPos
public static final Atom getAtomForAligPos(AFPChain afpChain,int chainNr, int aligPos, Atom[] ca , boolean getPrevious ) throws StructureException{ int[] optLen = afpChain.getOptLen(); // int[][][] optAln = afpChain.getOptAln(); if ( optLen == null) return null; if (chainNr < 0 || chainNr > 1){ throw new StructureException("So far only pairwise alignments are supported, but you requested results for alinged chain nr " + chainNr); } //if ( afpChain.getAlgorithmName().startsWith("jFatCat")){ /// for FatCat algorithms... int capos = getUngappedFatCatPos(afpChain, chainNr, aligPos); if ( capos < 0) { capos = getNextFatCatPos(afpChain, chainNr, aligPos,getPrevious); //System.out.println(" got next" + capos + " for " + chainNr + " alignedPos: " + aligPos); } else { //System.out.println("got aligned fatcat position: " + capos + " " + chainNr + " for alig pos: " + aligPos); } if ( capos < 0) { System.err.println("could not match position " + aligPos + " in chain " + chainNr +". Returing null..."); return null; } if ( capos > ca.length){ System.err.println("Atom array "+ chainNr + " does not have " + capos +" atoms. Returning null."); return null; } return ca[capos]; //} // // // int ungappedPos = getUngappedPos(afpChain, aligPos); // System.out.println("getAtomForAligPOs " + aligPos + " " + ungappedPos ); // return ca[ungappedPos]; // // if ( ungappedPos >= optAln[bk][chainNr].length) // return null; // int pos = optAln[bk][chainNr][ungappedPos]; // if ( pos > ca.length) // return null; // return ca[pos]; }
java
public static final Atom getAtomForAligPos(AFPChain afpChain,int chainNr, int aligPos, Atom[] ca , boolean getPrevious ) throws StructureException{ int[] optLen = afpChain.getOptLen(); // int[][][] optAln = afpChain.getOptAln(); if ( optLen == null) return null; if (chainNr < 0 || chainNr > 1){ throw new StructureException("So far only pairwise alignments are supported, but you requested results for alinged chain nr " + chainNr); } //if ( afpChain.getAlgorithmName().startsWith("jFatCat")){ /// for FatCat algorithms... int capos = getUngappedFatCatPos(afpChain, chainNr, aligPos); if ( capos < 0) { capos = getNextFatCatPos(afpChain, chainNr, aligPos,getPrevious); //System.out.println(" got next" + capos + " for " + chainNr + " alignedPos: " + aligPos); } else { //System.out.println("got aligned fatcat position: " + capos + " " + chainNr + " for alig pos: " + aligPos); } if ( capos < 0) { System.err.println("could not match position " + aligPos + " in chain " + chainNr +". Returing null..."); return null; } if ( capos > ca.length){ System.err.println("Atom array "+ chainNr + " does not have " + capos +" atoms. Returning null."); return null; } return ca[capos]; //} // // // int ungappedPos = getUngappedPos(afpChain, aligPos); // System.out.println("getAtomForAligPOs " + aligPos + " " + ungappedPos ); // return ca[ungappedPos]; // // if ( ungappedPos >= optAln[bk][chainNr].length) // return null; // int pos = optAln[bk][chainNr][ungappedPos]; // if ( pos > ca.length) // return null; // return ca[pos]; }
[ "public", "static", "final", "Atom", "getAtomForAligPos", "(", "AFPChain", "afpChain", ",", "int", "chainNr", ",", "int", "aligPos", ",", "Atom", "[", "]", "ca", ",", "boolean", "getPrevious", ")", "throws", "StructureException", "{", "int", "[", "]", "optLe...
Return the atom at alignment position aligPos. at the present only works with block 0 @param chainNr the number of the aligned pair. 0... first chain, 1... second chain. @param afpChain an afpChain object @param aligPos position on the alignment @param getPrevious gives the previous position if false, gives the next posible atom @return a CA atom that is at a particular position of the alignment
[ "Return", "the", "atom", "at", "alignment", "position", "aligPos", ".", "at", "the", "present", "only", "works", "with", "block", "0" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java#L148-L195
31,884
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java
DisplayAFP.getAtomArray
public static final Atom[] getAtomArray(Atom[] ca,List<Group> hetatms ) throws StructureException{ List<Atom> atoms = new ArrayList<Atom>(); Collections.addAll(atoms, ca); logger.debug("got {} hetatoms", hetatms.size()); // we only add atom nr 1, since the getAlignedStructure method actually adds the parent group, and not the atoms... for (Group g : hetatms){ if (g.size() < 1) continue; //if (debug) // System.out.println("adding group " + g); Atom a = g.getAtom(0); //if (debug) // System.out.println(a); a.setGroup(g); atoms.add(a); } Atom[] arr = atoms.toArray(new Atom[atoms.size()]); return arr; }
java
public static final Atom[] getAtomArray(Atom[] ca,List<Group> hetatms ) throws StructureException{ List<Atom> atoms = new ArrayList<Atom>(); Collections.addAll(atoms, ca); logger.debug("got {} hetatoms", hetatms.size()); // we only add atom nr 1, since the getAlignedStructure method actually adds the parent group, and not the atoms... for (Group g : hetatms){ if (g.size() < 1) continue; //if (debug) // System.out.println("adding group " + g); Atom a = g.getAtom(0); //if (debug) // System.out.println(a); a.setGroup(g); atoms.add(a); } Atom[] arr = atoms.toArray(new Atom[atoms.size()]); return arr; }
[ "public", "static", "final", "Atom", "[", "]", "getAtomArray", "(", "Atom", "[", "]", "ca", ",", "List", "<", "Group", ">", "hetatms", ")", "throws", "StructureException", "{", "List", "<", "Atom", ">", "atoms", "=", "new", "ArrayList", "<", "Atom", ">...
Returns the first atom for each group @param ca @param hetatms @return @throws StructureException
[ "Returns", "the", "first", "atom", "for", "each", "group" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java#L409-L431
31,885
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java
DisplayAFP.createArtificalStructure
public static Structure createArtificalStructure(AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException{ if ( afpChain.getNrEQR() < 1){ return AlignmentTools.getAlignedStructure(ca1, ca2); } Group[] twistedGroups = AlignmentTools.prepareGroupsForDisplay(afpChain,ca1, ca2); List<Atom> twistedAs = new ArrayList<Atom>(); for ( Group g: twistedGroups){ if ( g == null ) continue; if ( g.size() < 1) continue; Atom a = g.getAtom(0); twistedAs.add(a); } Atom[] twistedAtoms = twistedAs.toArray(new Atom[twistedAs.size()]); List<Group> hetatms = StructureTools.getUnalignedGroups(ca1); List<Group> hetatms2 = StructureTools.getUnalignedGroups(ca2); Atom[] arr1 = DisplayAFP.getAtomArray(ca1, hetatms); Atom[] arr2 = DisplayAFP.getAtomArray(twistedAtoms, hetatms2); Structure artificial = AlignmentTools.getAlignedStructure(arr1,arr2); return artificial; }
java
public static Structure createArtificalStructure(AFPChain afpChain, Atom[] ca1, Atom[] ca2) throws StructureException{ if ( afpChain.getNrEQR() < 1){ return AlignmentTools.getAlignedStructure(ca1, ca2); } Group[] twistedGroups = AlignmentTools.prepareGroupsForDisplay(afpChain,ca1, ca2); List<Atom> twistedAs = new ArrayList<Atom>(); for ( Group g: twistedGroups){ if ( g == null ) continue; if ( g.size() < 1) continue; Atom a = g.getAtom(0); twistedAs.add(a); } Atom[] twistedAtoms = twistedAs.toArray(new Atom[twistedAs.size()]); List<Group> hetatms = StructureTools.getUnalignedGroups(ca1); List<Group> hetatms2 = StructureTools.getUnalignedGroups(ca2); Atom[] arr1 = DisplayAFP.getAtomArray(ca1, hetatms); Atom[] arr2 = DisplayAFP.getAtomArray(twistedAtoms, hetatms2); Structure artificial = AlignmentTools.getAlignedStructure(arr1,arr2); return artificial; }
[ "public", "static", "Structure", "createArtificalStructure", "(", "AFPChain", "afpChain", ",", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ")", "throws", "StructureException", "{", "if", "(", "afpChain", ".", "getNrEQR", "(", ")", "<", "1", ")",...
Create a "fake" Structure objects that contains the two sets of atoms aligned on top of each other. @param afpChain the container of the alignment @param ca1 atoms for protein 1 @param ca2 atoms for protein 2 @return a protein structure with 2 models. @throws StructureException
[ "Create", "a", "fake", "Structure", "objects", "that", "contains", "the", "two", "sets", "of", "atoms", "aligned", "on", "top", "of", "each", "other", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/DisplayAFP.java#L553-L583
31,886
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/HmmerResult.java
HmmerResult.getOverlapLength
public int getOverlapLength(HmmerResult other){ int overlap = 0; for ( HmmerDomain d1 : getDomains()){ for (HmmerDomain d2 : other.getDomains()){ overlap += getOverlap(d1, d2); } } return overlap; }
java
public int getOverlapLength(HmmerResult other){ int overlap = 0; for ( HmmerDomain d1 : getDomains()){ for (HmmerDomain d2 : other.getDomains()){ overlap += getOverlap(d1, d2); } } return overlap; }
[ "public", "int", "getOverlapLength", "(", "HmmerResult", "other", ")", "{", "int", "overlap", "=", "0", ";", "for", "(", "HmmerDomain", "d1", ":", "getDomains", "(", ")", ")", "{", "for", "(", "HmmerDomain", "d2", ":", "other", ".", "getDomains", "(", ...
Get the overlap between two HmmerResult objects @param other @return 0 if no overlap, otherwise the length of the overlap
[ "Get", "the", "overlap", "between", "two", "HmmerResult", "objects" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/HmmerResult.java#L154-L164
31,887
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java
DownloadChemCompProvider.getPath
public static File getPath(){ if (path==null) { UserConfiguration config = new UserConfiguration(); path = new File(config.getCacheFilePath()); } return path; }
java
public static File getPath(){ if (path==null) { UserConfiguration config = new UserConfiguration(); path = new File(config.getCacheFilePath()); } return path; }
[ "public", "static", "File", "getPath", "(", ")", "{", "if", "(", "path", "==", "null", ")", "{", "UserConfiguration", "config", "=", "new", "UserConfiguration", "(", ")", ";", "path", "=", "new", "File", "(", "config", ".", "getCacheFilePath", "(", ")", ...
Get this provider's cache path @return
[ "Get", "this", "provider", "s", "cache", "path" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java#L122-L128
31,888
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java
DownloadChemCompProvider.checkDoFirstInstall
public void checkDoFirstInstall(){ if ( ! downloadAll ) { return; } // this makes sure there is a file separator between every component, // if path has a trailing file separator or not, it will work for both cases File dir = new File(getPath(), CHEM_COMP_CACHE_DIRECTORY); File f = new File(dir, "components.cif.gz"); if ( ! f.exists()) { downloadAllDefinitions(); } else { // file exists.. did it get extracted? FilenameFilter filter =new FilenameFilter() { @Override public boolean accept(File dir, String file) { return file.endsWith(".cif.gz"); } }; String[] files = dir.list(filter); if ( files.length < 500) { // not all did get unpacked try { split(); } catch (IOException e) { logger.error("Could not split file {} into individual chemical component files. Error: {}", f.toString(), e.getMessage()); } } } }
java
public void checkDoFirstInstall(){ if ( ! downloadAll ) { return; } // this makes sure there is a file separator between every component, // if path has a trailing file separator or not, it will work for both cases File dir = new File(getPath(), CHEM_COMP_CACHE_DIRECTORY); File f = new File(dir, "components.cif.gz"); if ( ! f.exists()) { downloadAllDefinitions(); } else { // file exists.. did it get extracted? FilenameFilter filter =new FilenameFilter() { @Override public boolean accept(File dir, String file) { return file.endsWith(".cif.gz"); } }; String[] files = dir.list(filter); if ( files.length < 500) { // not all did get unpacked try { split(); } catch (IOException e) { logger.error("Could not split file {} into individual chemical component files. Error: {}", f.toString(), e.getMessage()); } } } }
[ "public", "void", "checkDoFirstInstall", "(", ")", "{", "if", "(", "!", "downloadAll", ")", "{", "return", ";", "}", "// this makes sure there is a file separator between every component,", "// if path has a trailing file separator or not, it will work for both cases", "File", "d...
Checks if the chemical components already have been installed into the PDB directory. If not, will download the chemical components definitions file and split it up into small subfiles.
[ "Checks", "if", "the", "chemical", "components", "already", "have", "been", "installed", "into", "the", "PDB", "directory", ".", "If", "not", "will", "download", "the", "chemical", "components", "definitions", "file", "and", "split", "it", "up", "into", "small...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java#L135-L172
31,889
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java
DownloadChemCompProvider.writeID
private void writeID(String contents, String currentID) throws IOException{ String localName = getLocalFileName(currentID); try ( PrintWriter pw = new PrintWriter(new GZIPOutputStream(new FileOutputStream(localName))) ) { pw.print(contents); pw.flush(); } }
java
private void writeID(String contents, String currentID) throws IOException{ String localName = getLocalFileName(currentID); try ( PrintWriter pw = new PrintWriter(new GZIPOutputStream(new FileOutputStream(localName))) ) { pw.print(contents); pw.flush(); } }
[ "private", "void", "writeID", "(", "String", "contents", ",", "String", "currentID", ")", "throws", "IOException", "{", "String", "localName", "=", "getLocalFileName", "(", "currentID", ")", ";", "try", "(", "PrintWriter", "pw", "=", "new", "PrintWriter", "(",...
Output chemical contents to a file @param contents File contents @param currentID Chemical ID, used to determine the filename @throws IOException
[ "Output", "chemical", "contents", "to", "a", "file" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/DownloadChemCompProvider.java#L227-L236
31,890
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java
CrystalTransform.isEquivalent
public boolean isEquivalent(CrystalTransform other) { Matrix4d mul = new Matrix4d(); mul.mul(this.matTransform,other.matTransform); if (mul.epsilonEquals(IDENTITY, 0.0001)) { return true; } return false; }
java
public boolean isEquivalent(CrystalTransform other) { Matrix4d mul = new Matrix4d(); mul.mul(this.matTransform,other.matTransform); if (mul.epsilonEquals(IDENTITY, 0.0001)) { return true; } return false; }
[ "public", "boolean", "isEquivalent", "(", "CrystalTransform", "other", ")", "{", "Matrix4d", "mul", "=", "new", "Matrix4d", "(", ")", ";", "mul", ".", "mul", "(", "this", ".", "matTransform", ",", "other", ".", "matTransform", ")", ";", "if", "(", "mul",...
Returns true if the given CrystalTransform is equivalent to this one. Two crystal transforms are equivalent if one is the inverse of the other, i.e. their transformation matrices multiplication is equal to the identity. @param other @return
[ "Returns", "true", "if", "the", "given", "CrystalTransform", "is", "equivalent", "to", "this", "one", ".", "Two", "crystal", "transforms", "are", "equivalent", "if", "one", "is", "the", "inverse", "of", "the", "other", "i", ".", "e", ".", "their", "transfo...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java#L146-L154
31,891
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java
CrystalTransform.toXYZString
public String toXYZString() { StringBuilder str = new StringBuilder(); for(int i=0;i<3;i++) { //for each row boolean emptyRow = true; double coef; // TODO work with rational numbers // X coef = matTransform.getElement(i, 0); // Three cases for coef: zero, one, non-one if(abs(coef) > 1e-6 ) { // Non-zero if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1 if( coef < 0 ) { str.append("-"); } } else { str.append(formatCoef(coef)); str.append("*"); } str.append("x"); emptyRow = false; } // Y coef = matTransform.getElement(i, 1); if(abs(coef) > 1e-6 ) { // Non-zero if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1 if( coef < 0 ) { str.append("-"); } else if( !emptyRow ) { str.append("+"); } } else { if( !emptyRow && coef > 0) { str.append("+"); } str.append(formatCoef(coef)); str.append("*"); } str.append("y"); emptyRow = false; } // Z coef = matTransform.getElement(i, 2); if(abs(coef) > 1e-6 ) { // Non-zero if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1 if( coef < 0 ) { str.append("-"); } else if( !emptyRow ) { str.append("+"); } } else { if( !emptyRow && coef > 0) { str.append("+"); } str.append(formatCoef(coef)); str.append("*"); } str.append("z"); emptyRow = false; } // Intercept coef = matTransform.getElement(i, 3); if(abs(coef) > 1e-6 ) { // Non-zero if( !emptyRow && coef > 0) { str.append("+"); } str.append(formatCoef(coef)); } if(i<2) { str.append(","); } } return str.toString(); }
java
public String toXYZString() { StringBuilder str = new StringBuilder(); for(int i=0;i<3;i++) { //for each row boolean emptyRow = true; double coef; // TODO work with rational numbers // X coef = matTransform.getElement(i, 0); // Three cases for coef: zero, one, non-one if(abs(coef) > 1e-6 ) { // Non-zero if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1 if( coef < 0 ) { str.append("-"); } } else { str.append(formatCoef(coef)); str.append("*"); } str.append("x"); emptyRow = false; } // Y coef = matTransform.getElement(i, 1); if(abs(coef) > 1e-6 ) { // Non-zero if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1 if( coef < 0 ) { str.append("-"); } else if( !emptyRow ) { str.append("+"); } } else { if( !emptyRow && coef > 0) { str.append("+"); } str.append(formatCoef(coef)); str.append("*"); } str.append("y"); emptyRow = false; } // Z coef = matTransform.getElement(i, 2); if(abs(coef) > 1e-6 ) { // Non-zero if( abs( abs(coef)-1 ) < 1e-6 ) { // +/- 1 if( coef < 0 ) { str.append("-"); } else if( !emptyRow ) { str.append("+"); } } else { if( !emptyRow && coef > 0) { str.append("+"); } str.append(formatCoef(coef)); str.append("*"); } str.append("z"); emptyRow = false; } // Intercept coef = matTransform.getElement(i, 3); if(abs(coef) > 1e-6 ) { // Non-zero if( !emptyRow && coef > 0) { str.append("+"); } str.append(formatCoef(coef)); } if(i<2) { str.append(","); } } return str.toString(); }
[ "public", "String", "toXYZString", "(", ")", "{", "StringBuilder", "str", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "i", "++", ")", "{", "//for each row", "boolean", "emptyRow", "=", "true"...
Expresses this transformation in terms of x,y,z fractional coordinates. Examples: @return
[ "Expresses", "this", "transformation", "in", "terms", "of", "x", "y", "z", "fractional", "coordinates", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java#L340-L425
31,892
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java
CrystalTransform.formatCoef
private String formatCoef(double coef) { double tol = 1e-6; // rounding tolerance // zero case if( Math.abs(coef) < tol) { return "0"; } // integer case long num = Math.round(coef); if( Math.abs(num - coef) < tol) { return Long.toString(num); } // Other small cases for(int denom = 2; denom < 12; denom++ ) { num = Math.round(coef*denom); if( num - coef*denom < tol ) { return String.format("%d/%d",num, denom); } } // Give up and use floating point; return String.format("%.3f", coef); }
java
private String formatCoef(double coef) { double tol = 1e-6; // rounding tolerance // zero case if( Math.abs(coef) < tol) { return "0"; } // integer case long num = Math.round(coef); if( Math.abs(num - coef) < tol) { return Long.toString(num); } // Other small cases for(int denom = 2; denom < 12; denom++ ) { num = Math.round(coef*denom); if( num - coef*denom < tol ) { return String.format("%d/%d",num, denom); } } // Give up and use floating point; return String.format("%.3f", coef); }
[ "private", "String", "formatCoef", "(", "double", "coef", ")", "{", "double", "tol", "=", "1e-6", ";", "// rounding tolerance", "// zero case", "if", "(", "Math", ".", "abs", "(", "coef", ")", "<", "tol", ")", "{", "return", "\"0\"", ";", "}", "// intege...
helper function to format simple fractions into rationals @param coef @return
[ "helper", "function", "to", "format", "simple", "fractions", "into", "rationals" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java#L431-L455
31,893
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java
RotationAxisAligner.getGeometicCenterTransformation
@Override public Matrix4d getGeometicCenterTransformation() { run(); Matrix4d geometricCentered = new Matrix4d(reverseTransformationMatrix); geometricCentered.setTranslation(new Vector3d(getGeometricCenter())); return geometricCentered; }
java
@Override public Matrix4d getGeometicCenterTransformation() { run(); Matrix4d geometricCentered = new Matrix4d(reverseTransformationMatrix); geometricCentered.setTranslation(new Vector3d(getGeometricCenter())); return geometricCentered; }
[ "@", "Override", "public", "Matrix4d", "getGeometicCenterTransformation", "(", ")", "{", "run", "(", ")", ";", "Matrix4d", "geometricCentered", "=", "new", "Matrix4d", "(", "reverseTransformationMatrix", ")", ";", "geometricCentered", ".", "setTranslation", "(", "ne...
Returns a transformation matrix transform polyhedra for Cn structures. The center in this matrix is the geometric center, rather then the centroid. In Cn structures those are usually not the same. @return
[ "Returns", "a", "transformation", "matrix", "transform", "polyhedra", "for", "Cn", "structures", ".", "The", "center", "in", "this", "matrix", "is", "the", "geometric", "center", "rather", "then", "the", "centroid", ".", "In", "Cn", "structures", "those", "are...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java#L148-L156
31,894
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java
RotationAxisAligner.getGeometricCenter
@Override public Point3d getGeometricCenter() { run(); Point3d geometricCenter = new Point3d(); Vector3d translation = new Vector3d(); reverseTransformationMatrix.get(translation); // calculate adjustment around z-axis and transform adjustment to // original coordinate frame with the reverse transformation if (rotationGroup.getPointGroup().startsWith("C")) { Vector3d corr = new Vector3d(0,0, minBoundary.z+getDimension().z); reverseTransformationMatrix.transform(corr); geometricCenter.set(corr); } geometricCenter.add(translation); return geometricCenter; }
java
@Override public Point3d getGeometricCenter() { run(); Point3d geometricCenter = new Point3d(); Vector3d translation = new Vector3d(); reverseTransformationMatrix.get(translation); // calculate adjustment around z-axis and transform adjustment to // original coordinate frame with the reverse transformation if (rotationGroup.getPointGroup().startsWith("C")) { Vector3d corr = new Vector3d(0,0, minBoundary.z+getDimension().z); reverseTransformationMatrix.transform(corr); geometricCenter.set(corr); } geometricCenter.add(translation); return geometricCenter; }
[ "@", "Override", "public", "Point3d", "getGeometricCenter", "(", ")", "{", "run", "(", ")", ";", "Point3d", "geometricCenter", "=", "new", "Point3d", "(", ")", ";", "Vector3d", "translation", "=", "new", "Vector3d", "(", ")", ";", "reverseTransformationMatrix"...
Returns the geometric center of polyhedron. In the case of the Cn point group, the centroid and geometric center are usually not identical. @return
[ "Returns", "the", "geometric", "center", "of", "polyhedron", ".", "In", "the", "case", "of", "the", "Cn", "point", "group", "the", "centroid", "and", "geometric", "center", "are", "usually", "not", "identical", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java#L164-L182
31,895
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java
RotationAxisAligner.alignAxes
private Matrix4d alignAxes(Vector3d[] axisVectors, Vector3d[] referenceVectors) { Matrix4d m1 = new Matrix4d(); AxisAngle4d a = new AxisAngle4d(); Vector3d axis = new Vector3d(); // calculate rotation matrix to rotate refPoints[0] into coordPoints[0] Vector3d v1 = new Vector3d(axisVectors[0]); Vector3d v2 = new Vector3d(referenceVectors[0]); double dot = v1.dot(v2); if (Math.abs(dot) < 0.999) { axis.cross(v1,v2); axis.normalize(); a.set(axis, v1.angle(v2)); m1.set(a); // make sure matrix element m33 is 1.0. It's 0 on Linux. m1.setElement(3, 3, 1.0); } else if (dot > 0) { // parallel axis, nothing to do -> identity matrix m1.setIdentity(); } else if (dot < 0) { // anti-parallel axis, flip around x-axis m1.set(flipX()); } // apply transformation matrix to all refPoints m1.transform(axisVectors[0]); m1.transform(axisVectors[1]); // calculate rotation matrix to rotate refPoints[1] into coordPoints[1] v1 = new Vector3d(axisVectors[1]); v2 = new Vector3d(referenceVectors[1]); Matrix4d m2 = new Matrix4d(); dot = v1.dot(v2); if (Math.abs(dot) < 0.999) { axis.cross(v1,v2); axis.normalize(); a.set(axis, v1.angle(v2)); m2.set(a); // make sure matrix element m33 is 1.0. It's 0 on Linux. m2.setElement(3, 3, 1.0); } else if (dot > 0) { // parallel axis, nothing to do -> identity matrix m2.setIdentity(); } else if (dot < 0) { // anti-parallel axis, flip around z-axis m2.set(flipZ()); } // apply transformation matrix to all refPoints m2.transform(axisVectors[0]); m2.transform(axisVectors[1]); // combine the two rotation matrices m2.mul(m1); // the RMSD should be close to zero Point3d[] axes = new Point3d[2]; axes[0] = new Point3d(axisVectors[0]); axes[1] = new Point3d(axisVectors[1]); Point3d[] ref = new Point3d[2]; ref[0] = new Point3d(referenceVectors[0]); ref[1] = new Point3d(referenceVectors[1]); if (CalcPoint.rmsd(axes, ref) > 0.1) { logger.warn("AxisTransformation: axes alignment is off. RMSD: " + CalcPoint.rmsd(axes, ref)); } return m2; }
java
private Matrix4d alignAxes(Vector3d[] axisVectors, Vector3d[] referenceVectors) { Matrix4d m1 = new Matrix4d(); AxisAngle4d a = new AxisAngle4d(); Vector3d axis = new Vector3d(); // calculate rotation matrix to rotate refPoints[0] into coordPoints[0] Vector3d v1 = new Vector3d(axisVectors[0]); Vector3d v2 = new Vector3d(referenceVectors[0]); double dot = v1.dot(v2); if (Math.abs(dot) < 0.999) { axis.cross(v1,v2); axis.normalize(); a.set(axis, v1.angle(v2)); m1.set(a); // make sure matrix element m33 is 1.0. It's 0 on Linux. m1.setElement(3, 3, 1.0); } else if (dot > 0) { // parallel axis, nothing to do -> identity matrix m1.setIdentity(); } else if (dot < 0) { // anti-parallel axis, flip around x-axis m1.set(flipX()); } // apply transformation matrix to all refPoints m1.transform(axisVectors[0]); m1.transform(axisVectors[1]); // calculate rotation matrix to rotate refPoints[1] into coordPoints[1] v1 = new Vector3d(axisVectors[1]); v2 = new Vector3d(referenceVectors[1]); Matrix4d m2 = new Matrix4d(); dot = v1.dot(v2); if (Math.abs(dot) < 0.999) { axis.cross(v1,v2); axis.normalize(); a.set(axis, v1.angle(v2)); m2.set(a); // make sure matrix element m33 is 1.0. It's 0 on Linux. m2.setElement(3, 3, 1.0); } else if (dot > 0) { // parallel axis, nothing to do -> identity matrix m2.setIdentity(); } else if (dot < 0) { // anti-parallel axis, flip around z-axis m2.set(flipZ()); } // apply transformation matrix to all refPoints m2.transform(axisVectors[0]); m2.transform(axisVectors[1]); // combine the two rotation matrices m2.mul(m1); // the RMSD should be close to zero Point3d[] axes = new Point3d[2]; axes[0] = new Point3d(axisVectors[0]); axes[1] = new Point3d(axisVectors[1]); Point3d[] ref = new Point3d[2]; ref[0] = new Point3d(referenceVectors[0]); ref[1] = new Point3d(referenceVectors[1]); if (CalcPoint.rmsd(axes, ref) > 0.1) { logger.warn("AxisTransformation: axes alignment is off. RMSD: " + CalcPoint.rmsd(axes, ref)); } return m2; }
[ "private", "Matrix4d", "alignAxes", "(", "Vector3d", "[", "]", "axisVectors", ",", "Vector3d", "[", "]", "referenceVectors", ")", "{", "Matrix4d", "m1", "=", "new", "Matrix4d", "(", ")", ";", "AxisAngle4d", "a", "=", "new", "AxisAngle4d", "(", ")", ";", ...
Returns a transformation matrix that rotates refPoints to match coordPoints @param refPoints the points to be aligned @param referenceVectors @return
[ "Returns", "a", "transformation", "matrix", "that", "rotates", "refPoints", "to", "match", "coordPoints" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java#L410-L478
31,896
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java
RotationAxisAligner.refineReferenceVector
private void refineReferenceVector() { referenceVector = new Vector3d(Y_AXIS); if (rotationGroup.getPointGroup().startsWith("C")) { referenceVector = getReferenceAxisCylicWithSubunitAlignment(); } else if (rotationGroup.getPointGroup().startsWith("D")) { referenceVector = getReferenceAxisDihedralWithSubunitAlignment(); } referenceVector = orthogonalize(principalRotationVector, referenceVector); }
java
private void refineReferenceVector() { referenceVector = new Vector3d(Y_AXIS); if (rotationGroup.getPointGroup().startsWith("C")) { referenceVector = getReferenceAxisCylicWithSubunitAlignment(); } else if (rotationGroup.getPointGroup().startsWith("D")) { referenceVector = getReferenceAxisDihedralWithSubunitAlignment(); } referenceVector = orthogonalize(principalRotationVector, referenceVector); }
[ "private", "void", "refineReferenceVector", "(", ")", "{", "referenceVector", "=", "new", "Vector3d", "(", "Y_AXIS", ")", ";", "if", "(", "rotationGroup", ".", "getPointGroup", "(", ")", ".", "startsWith", "(", "\"C\"", ")", ")", "{", "referenceVector", "=",...
Returns a normalized vector that represents a minor rotation axis, except for Cn, this represents an axis orthogonal to the principal axis. @return minor rotation axis
[ "Returns", "a", "normalized", "vector", "that", "represents", "a", "minor", "rotation", "axis", "except", "for", "Cn", "this", "represents", "an", "axis", "orthogonal", "to", "the", "principal", "axis", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java#L702-L711
31,897
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java
RotationAxisAligner.getReferenceAxisCylicWithSubunitAlignment
private Vector3d getReferenceAxisCylicWithSubunitAlignment() { if (rotationGroup.getPointGroup().equals("C2")) { return referenceVector; } // find subunit that extends the most in the xy-plane List<List<Integer>> orbits = getOrbitsByXYWidth(); // get the last orbit which is the widest List<Integer> widestOrbit = orbits.get(orbits.size()-1); List<Point3d> centers = subunits.getCenters(); int subunit = widestOrbit.get(0); // calculate reference vector Vector3d refAxis = new Vector3d(); refAxis.sub(centers.get(subunit), subunits.getCentroid()); refAxis.normalize(); return refAxis; }
java
private Vector3d getReferenceAxisCylicWithSubunitAlignment() { if (rotationGroup.getPointGroup().equals("C2")) { return referenceVector; } // find subunit that extends the most in the xy-plane List<List<Integer>> orbits = getOrbitsByXYWidth(); // get the last orbit which is the widest List<Integer> widestOrbit = orbits.get(orbits.size()-1); List<Point3d> centers = subunits.getCenters(); int subunit = widestOrbit.get(0); // calculate reference vector Vector3d refAxis = new Vector3d(); refAxis.sub(centers.get(subunit), subunits.getCentroid()); refAxis.normalize(); return refAxis; }
[ "private", "Vector3d", "getReferenceAxisCylicWithSubunitAlignment", "(", ")", "{", "if", "(", "rotationGroup", ".", "getPointGroup", "(", ")", ".", "equals", "(", "\"C2\"", ")", ")", "{", "return", "referenceVector", ";", "}", "// find subunit that extends the most in...
Returns a reference vector for the alignment of Cn structures. @return reference vector
[ "Returns", "a", "reference", "vector", "for", "the", "alignment", "of", "Cn", "structures", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/axis/RotationAxisAligner.java#L767-L784
31,898
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java
NCBIQBlastService.init
private void init(String svcUrl) { try { serviceUrl = new URL(svcUrl); } catch (MalformedURLException e) { throw new RuntimeException("It looks like the URL for remote NCBI BLAST service (" + svcUrl + ") is wrong. Cause: " + e.getMessage(), e); } }
java
private void init(String svcUrl) { try { serviceUrl = new URL(svcUrl); } catch (MalformedURLException e) { throw new RuntimeException("It looks like the URL for remote NCBI BLAST service (" + svcUrl + ") is wrong. Cause: " + e.getMessage(), e); } }
[ "private", "void", "init", "(", "String", "svcUrl", ")", "{", "try", "{", "serviceUrl", "=", "new", "URL", "(", "svcUrl", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "\"It looks like the URL f...
Initialize the serviceUrl data member @throws MalformedURLException on invalid URL
[ "Initialize", "the", "serviceUrl", "data", "member" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java#L99-L106
31,899
biojava/biojava
biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java
NCBIQBlastService.setQBlastServiceProperties
private URLConnection setQBlastServiceProperties(URLConnection conn) { conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestProperty("User-Agent", "Biojava/NCBIQBlastService"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-length", "200"); return conn; }
java
private URLConnection setQBlastServiceProperties(URLConnection conn) { conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestProperty("User-Agent", "Biojava/NCBIQBlastService"); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestProperty("Content-type", "application/x-www-form-urlencoded"); conn.setRequestProperty("Content-length", "200"); return conn; }
[ "private", "URLConnection", "setQBlastServiceProperties", "(", "URLConnection", "conn", ")", "{", "conn", ".", "setDoOutput", "(", "true", ")", ";", "conn", ".", "setUseCaches", "(", "false", ")", ";", "conn", ".", "setRequestProperty", "(", "\"User-Agent\"", ",...
Sets properties for given URLConnection @param conn URLConnection to set properties for @return given object after setting properties
[ "Sets", "properties", "for", "given", "URLConnection" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-ws/src/main/java/org/biojava/nbio/ws/alignment/qblast/NCBIQBlastService.java#L377-L385