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
32,000
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java
StructurePairAligner.main
public static void main(String[] args) throws Exception { // UPDATE THE FOLLOWING LINES TO MATCH YOUR SETUP PDBFileReader pdbr = new PDBFileReader(); pdbr.setPath("/Users/andreas/WORK/PDB/"); // String pdb1 = "1crl"; // String pdb2 = "1ede"; String pdb1 = "1buz"; String pdb2 = "1ali"; String outputfile = "/tmp/alig_" + pdb1 + "_" + pdb2 + ".pdb"; // NO NEED TO DO CHANGE ANYTHING BELOW HERE... StructurePairAligner sc = new StructurePairAligner(); // step1 : read molecules logger.info("aligning {} vs. {}", pdb1, pdb2); Structure s1 = pdbr.getStructureById(pdb1); Structure s2 = pdbr.getStructureById(pdb2); // step 2 : do the calculations sc.align(s1, s2); AlternativeAlignment[] aligs = sc.getAlignments(); // cluster similar results together ClusterAltAligs.cluster(aligs); // print the result: // the AlternativeAlignment object gives also access to rotation // matrices / shift vectors. for (AlternativeAlignment aa : aligs) { logger.info("Alternative Alignment: ", aa); } // convert AlternativeAlignemnt 1 to PDB file, so it can be opened with // a viewer (e.g. Jmol, Rasmol) if (aligs.length > 0) { AlternativeAlignment aa1 = aligs[0]; String pdbstr = aa1.toPDB(s1, s2); logger.info("writing alignment to {}", outputfile); FileOutputStream out = new FileOutputStream(outputfile); PrintStream p = new PrintStream(out); p.println(pdbstr); p.close(); out.close(); } // display the alignment in Jmol // only will work if Jmol is in the Classpath if (aligs.length > 0) { if (!GuiWrapper.isGuiModuleInstalled()) { logger.error("Could not find structure-gui modules in classpath, please install first!"); } } }
java
public static void main(String[] args) throws Exception { // UPDATE THE FOLLOWING LINES TO MATCH YOUR SETUP PDBFileReader pdbr = new PDBFileReader(); pdbr.setPath("/Users/andreas/WORK/PDB/"); // String pdb1 = "1crl"; // String pdb2 = "1ede"; String pdb1 = "1buz"; String pdb2 = "1ali"; String outputfile = "/tmp/alig_" + pdb1 + "_" + pdb2 + ".pdb"; // NO NEED TO DO CHANGE ANYTHING BELOW HERE... StructurePairAligner sc = new StructurePairAligner(); // step1 : read molecules logger.info("aligning {} vs. {}", pdb1, pdb2); Structure s1 = pdbr.getStructureById(pdb1); Structure s2 = pdbr.getStructureById(pdb2); // step 2 : do the calculations sc.align(s1, s2); AlternativeAlignment[] aligs = sc.getAlignments(); // cluster similar results together ClusterAltAligs.cluster(aligs); // print the result: // the AlternativeAlignment object gives also access to rotation // matrices / shift vectors. for (AlternativeAlignment aa : aligs) { logger.info("Alternative Alignment: ", aa); } // convert AlternativeAlignemnt 1 to PDB file, so it can be opened with // a viewer (e.g. Jmol, Rasmol) if (aligs.length > 0) { AlternativeAlignment aa1 = aligs[0]; String pdbstr = aa1.toPDB(s1, s2); logger.info("writing alignment to {}", outputfile); FileOutputStream out = new FileOutputStream(outputfile); PrintStream p = new PrintStream(out); p.println(pdbstr); p.close(); out.close(); } // display the alignment in Jmol // only will work if Jmol is in the Classpath if (aligs.length > 0) { if (!GuiWrapper.isGuiModuleInstalled()) { logger.error("Could not find structure-gui modules in classpath, please install first!"); } } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "Exception", "{", "// UPDATE THE FOLLOWING LINES TO MATCH YOUR SETUP", "PDBFileReader", "pdbr", "=", "new", "PDBFileReader", "(", ")", ";", "pdbr", ".", "setPath", "(", "\"/Users/a...
example usage of this class @param args
[ "example", "usage", "of", "this", "class" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java#L169-L236
32,001
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java
StructurePairAligner.align
public void align(Structure s1, Structure s2) throws StructureException { align(s1, s2, params); }
java
public void align(Structure s1, Structure s2) throws StructureException { align(s1, s2, params); }
[ "public", "void", "align", "(", "Structure", "s1", ",", "Structure", "s2", ")", "throws", "StructureException", "{", "align", "(", "s1", ",", "s2", ",", "params", ")", ";", "}" ]
Calculate the alignment between the two full structures with default parameters @param s1 @param s2 @throws StructureException
[ "Calculate", "the", "alignment", "between", "the", "two", "full", "structures", "with", "default", "parameters" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java#L306-L309
32,002
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java
StructurePairAligner.align
public void align(Structure s1, Structure s2, StrucAligParameters params) throws StructureException { // step 1 convert the structures to Atom Arrays Atom[] ca1 = getAlignmentAtoms(s1); Atom[] ca2 = getAlignmentAtoms(s2); notifyStartingAlignment(s1.getName(), ca1, s2.getName(), ca2); align(ca1, ca2, params); }
java
public void align(Structure s1, Structure s2, StrucAligParameters params) throws StructureException { // step 1 convert the structures to Atom Arrays Atom[] ca1 = getAlignmentAtoms(s1); Atom[] ca2 = getAlignmentAtoms(s2); notifyStartingAlignment(s1.getName(), ca1, s2.getName(), ca2); align(ca1, ca2, params); }
[ "public", "void", "align", "(", "Structure", "s1", ",", "Structure", "s2", ",", "StrucAligParameters", "params", ")", "throws", "StructureException", "{", "// step 1 convert the structures to Atom Arrays", "Atom", "[", "]", "ca1", "=", "getAlignmentAtoms", "(", "s1", ...
Calculate the alignment between the two full structures with user provided parameters @param s1 @param s2 @param params @throws StructureException
[ "Calculate", "the", "alignment", "between", "the", "two", "full", "structures", "with", "user", "provided", "parameters" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java#L320-L329
32,003
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java
StructurePairAligner.align
public void align(Structure s1, String chainId1, Structure s2, String chainId2) throws StructureException { align(s1, chainId1, s2, chainId2, params); }
java
public void align(Structure s1, String chainId1, Structure s2, String chainId2) throws StructureException { align(s1, chainId1, s2, chainId2, params); }
[ "public", "void", "align", "(", "Structure", "s1", ",", "String", "chainId1", ",", "Structure", "s2", ",", "String", "chainId2", ")", "throws", "StructureException", "{", "align", "(", "s1", ",", "chainId1", ",", "s2", ",", "chainId2", ",", "params", ")", ...
Align two chains from the structures. Uses default parameters. @param s1 @param chainId1 @param s2 @param chainId2
[ "Align", "two", "chains", "from", "the", "structures", ".", "Uses", "default", "parameters", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java#L339-L342
32,004
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java
StructurePairAligner.align
public void align(Structure s1, String chainId1, Structure s2, String chainId2, StrucAligParameters params) throws StructureException { reset(); this.params = params; Chain c1 = s1.getPolyChainByPDB(chainId1); Chain c2 = s2.getPolyChainByPDB(chainId2); Structure s3 = new StructureImpl(); s3.addChain(c1); Structure s4 = new StructureImpl(); s4.addChain(c2); Atom[] ca1 = getAlignmentAtoms(s3); Atom[] ca2 = getAlignmentAtoms(s4); notifyStartingAlignment(s1.getName(), ca1, s2.getName(), ca2); align(ca1, ca2, params); }
java
public void align(Structure s1, String chainId1, Structure s2, String chainId2, StrucAligParameters params) throws StructureException { reset(); this.params = params; Chain c1 = s1.getPolyChainByPDB(chainId1); Chain c2 = s2.getPolyChainByPDB(chainId2); Structure s3 = new StructureImpl(); s3.addChain(c1); Structure s4 = new StructureImpl(); s4.addChain(c2); Atom[] ca1 = getAlignmentAtoms(s3); Atom[] ca2 = getAlignmentAtoms(s4); notifyStartingAlignment(s1.getName(), ca1, s2.getName(), ca2); align(ca1, ca2, params); }
[ "public", "void", "align", "(", "Structure", "s1", ",", "String", "chainId1", ",", "Structure", "s2", ",", "String", "chainId2", ",", "StrucAligParameters", "params", ")", "throws", "StructureException", "{", "reset", "(", ")", ";", "this", ".", "params", "=...
Aligns two chains from the structures using user provided parameters. @param s1 @param chainId1 @param s2 @param chainId2 @param params @throws StructureException
[ "Aligns", "two", "chains", "from", "the", "structures", "using", "user", "provided", "parameters", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/StructurePairAligner.java#L354-L374
32,005
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolPanel.java
JmolPanel.jmolColorByChain
public void jmolColorByChain(){ String script = "function color_by_chain(objtype, color_list) {"+ String.format("%n") + ""+ String.format("%n") + " if (color_list) {"+ String.format("%n") + " if (color_list.type == \"string\") {"+ String.format("%n") + " color_list = color_list.split(\",\").trim();"+ String.format("%n") + " }"+ String.format("%n") + " } else {"+ String.format("%n") + " color_list = [\"104BA9\",\"AA00A2\",\"C9F600\",\"FFA200\",\"284A7E\",\"7F207B\",\"9FB82E\",\"BF8B30\",\"052D6E\",\"6E0069\",\"83A000\",\"A66A00\",\"447BD4\",\"D435CD\",\"D8FA3F\",\"FFBA40\",\"6A93D4\",\"D460CF\",\"E1FA71\",\"FFCC73\"];"+ String.format("%n") + " }"+ String.format("%n") + " var cmd2 = \"\";"+ String.format("%n") + " if (!objtype) {"+ String.format("%n") + " var type_list = [ \"backbone\",\"cartoon\",\"dots\",\"halo\",\"label\",\"meshribbon\",\"polyhedra\",\"rocket\",\"star\",\"strand\",\"strut\",\"trace\"];"+ String.format("%n") + " cmd2 = \"color \" + type_list.join(\" none; color \") + \" none;\";"+ String.format("%n") + " objtype = \"atoms\";"+ String.format("%n") + " }"+ String.format("%n") + " var chain_list = script(\"show chain\").trim().lines;"+ String.format("%n") + " var chain_count = chain_list.length;"+ String.format("%n") + " var color_count = color_list.length;"+ String.format("%n") + " var sel = {selected};"+ String.format("%n") + " var cmds = \"\";"+ String.format("%n") + " for (var chain_number=1; chain_number<=chain_count; chain_number++) {"+ String.format("%n") + " // remember, Jmol arrays start with 1, but % can return 0"+ String.format("%n") + " cmds += \"select sel and :\" + chain_list[chain_number] + \";color \" + objtype + \" [x\" + color_list[(chain_number-1) % color_count + 1] + \"];\" + cmd2;"+ String.format("%n") + " }"+ String.format("%n") + " script INLINE @{cmds + \"select sel\"}"+ String.format("%n") + "}"; executeCmd(script); }
java
public void jmolColorByChain(){ String script = "function color_by_chain(objtype, color_list) {"+ String.format("%n") + ""+ String.format("%n") + " if (color_list) {"+ String.format("%n") + " if (color_list.type == \"string\") {"+ String.format("%n") + " color_list = color_list.split(\",\").trim();"+ String.format("%n") + " }"+ String.format("%n") + " } else {"+ String.format("%n") + " color_list = [\"104BA9\",\"AA00A2\",\"C9F600\",\"FFA200\",\"284A7E\",\"7F207B\",\"9FB82E\",\"BF8B30\",\"052D6E\",\"6E0069\",\"83A000\",\"A66A00\",\"447BD4\",\"D435CD\",\"D8FA3F\",\"FFBA40\",\"6A93D4\",\"D460CF\",\"E1FA71\",\"FFCC73\"];"+ String.format("%n") + " }"+ String.format("%n") + " var cmd2 = \"\";"+ String.format("%n") + " if (!objtype) {"+ String.format("%n") + " var type_list = [ \"backbone\",\"cartoon\",\"dots\",\"halo\",\"label\",\"meshribbon\",\"polyhedra\",\"rocket\",\"star\",\"strand\",\"strut\",\"trace\"];"+ String.format("%n") + " cmd2 = \"color \" + type_list.join(\" none; color \") + \" none;\";"+ String.format("%n") + " objtype = \"atoms\";"+ String.format("%n") + " }"+ String.format("%n") + " var chain_list = script(\"show chain\").trim().lines;"+ String.format("%n") + " var chain_count = chain_list.length;"+ String.format("%n") + " var color_count = color_list.length;"+ String.format("%n") + " var sel = {selected};"+ String.format("%n") + " var cmds = \"\";"+ String.format("%n") + " for (var chain_number=1; chain_number<=chain_count; chain_number++) {"+ String.format("%n") + " // remember, Jmol arrays start with 1, but % can return 0"+ String.format("%n") + " cmds += \"select sel and :\" + chain_list[chain_number] + \";color \" + objtype + \" [x\" + color_list[(chain_number-1) % color_count + 1] + \"];\" + cmd2;"+ String.format("%n") + " }"+ String.format("%n") + " script INLINE @{cmds + \"select sel\"}"+ String.format("%n") + "}"; executeCmd(script); }
[ "public", "void", "jmolColorByChain", "(", ")", "{", "String", "script", "=", "\"function color_by_chain(objtype, color_list) {\"", "+", "String", ".", "format", "(", "\"%n\"", ")", "+", "\"\"", "+", "String", ".", "format", "(", "\"%n\"", ")", "+", "\"\t\t if (...
assign a custom color to the Jmol chains command.
[ "assign", "a", "custom", "color", "to", "the", "Jmol", "chains", "command", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/jmol/JmolPanel.java#L172-L209
32,006
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java
AminoAcidCompoundSet.addAmbiguousEquivalents
private void addAmbiguousEquivalents(String one, String two, String either) { Set<AminoAcidCompound> equivalents; AminoAcidCompound cOne, cTwo, cEither; equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne = aminoAcidCompoundCache.get(one)); equivalents.add(cTwo = aminoAcidCompoundCache.get(two)); equivalents.add(cEither = aminoAcidCompoundCache.get(either)); equivalentsCache.put(cEither, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne); equivalents.add(cEither); equivalentsCache.put(cOne, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cTwo); equivalents.add(cEither); equivalentsCache.put(cTwo, equivalents); }
java
private void addAmbiguousEquivalents(String one, String two, String either) { Set<AminoAcidCompound> equivalents; AminoAcidCompound cOne, cTwo, cEither; equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne = aminoAcidCompoundCache.get(one)); equivalents.add(cTwo = aminoAcidCompoundCache.get(two)); equivalents.add(cEither = aminoAcidCompoundCache.get(either)); equivalentsCache.put(cEither, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cOne); equivalents.add(cEither); equivalentsCache.put(cOne, equivalents); equivalents = new HashSet<AminoAcidCompound>(); equivalents.add(cTwo); equivalents.add(cEither); equivalentsCache.put(cTwo, equivalents); }
[ "private", "void", "addAmbiguousEquivalents", "(", "String", "one", ",", "String", "two", ",", "String", "either", ")", "{", "Set", "<", "AminoAcidCompound", ">", "equivalents", ";", "AminoAcidCompound", "cOne", ",", "cTwo", ",", "cEither", ";", "equivalents", ...
helper method to initialize the equivalent sets for 2 amino acid compounds and their ambiguity compound
[ "helper", "method", "to", "initialize", "the", "equivalent", "sets", "for", "2", "amino", "acid", "compounds", "and", "their", "ambiguity", "compound" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/compound/AminoAcidCompoundSet.java#L171-L190
32,007
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.getNewGroup
private Group getNewGroup(String recordName,Character aminoCode1, long seq_id,String groupCode3) { Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(groupCode3); if ( g != null && !g.getChemComp().isEmpty()) { if ( g instanceof AminoAcidImpl) { AminoAcidImpl aa = (AminoAcidImpl) g; aa.setId(seq_id); } else if ( g instanceof NucleotideImpl) { NucleotideImpl nuc = (NucleotideImpl) g; nuc.setId(seq_id); } else if ( g instanceof HetatomImpl) { HetatomImpl het = (HetatomImpl)g; het.setId(seq_id); } return g; } Group group; if ( recordName.equals("ATOM") ) { if (StructureTools.isNucleotide(groupCode3)) { // it is a nucleotide NucleotideImpl nu = new NucleotideImpl(); group = nu; nu.setId(seq_id); } else if (aminoCode1==null || aminoCode1 == StructureTools.UNKNOWN_GROUP_LABEL){ HetatomImpl h = new HetatomImpl(); h.setId(seq_id); group = h; } else { AminoAcidImpl aa = new AminoAcidImpl() ; aa.setAminoType(aminoCode1); aa.setId(seq_id); group = aa ; } } else { if (StructureTools.isNucleotide(groupCode3)) { // it is a nucleotide NucleotideImpl nu = new NucleotideImpl(); group = nu; nu.setId(seq_id); } else if (aminoCode1 != null ) { AminoAcidImpl aa = new AminoAcidImpl() ; aa.setAminoType(aminoCode1); aa.setId(seq_id); group = aa ; } else { HetatomImpl h = new HetatomImpl(); h.setId(seq_id); group = h; } } return group ; }
java
private Group getNewGroup(String recordName,Character aminoCode1, long seq_id,String groupCode3) { Group g = ChemCompGroupFactory.getGroupFromChemCompDictionary(groupCode3); if ( g != null && !g.getChemComp().isEmpty()) { if ( g instanceof AminoAcidImpl) { AminoAcidImpl aa = (AminoAcidImpl) g; aa.setId(seq_id); } else if ( g instanceof NucleotideImpl) { NucleotideImpl nuc = (NucleotideImpl) g; nuc.setId(seq_id); } else if ( g instanceof HetatomImpl) { HetatomImpl het = (HetatomImpl)g; het.setId(seq_id); } return g; } Group group; if ( recordName.equals("ATOM") ) { if (StructureTools.isNucleotide(groupCode3)) { // it is a nucleotide NucleotideImpl nu = new NucleotideImpl(); group = nu; nu.setId(seq_id); } else if (aminoCode1==null || aminoCode1 == StructureTools.UNKNOWN_GROUP_LABEL){ HetatomImpl h = new HetatomImpl(); h.setId(seq_id); group = h; } else { AminoAcidImpl aa = new AminoAcidImpl() ; aa.setAminoType(aminoCode1); aa.setId(seq_id); group = aa ; } } else { if (StructureTools.isNucleotide(groupCode3)) { // it is a nucleotide NucleotideImpl nu = new NucleotideImpl(); group = nu; nu.setId(seq_id); } else if (aminoCode1 != null ) { AminoAcidImpl aa = new AminoAcidImpl() ; aa.setAminoType(aminoCode1); aa.setId(seq_id); group = aa ; } else { HetatomImpl h = new HetatomImpl(); h.setId(seq_id); group = h; } } return group ; }
[ "private", "Group", "getNewGroup", "(", "String", "recordName", ",", "Character", "aminoCode1", ",", "long", "seq_id", ",", "String", "groupCode3", ")", "{", "Group", "g", "=", "ChemCompGroupFactory", ".", "getGroupFromChemCompDictionary", "(", "groupCode3", ")", ...
initiate new group, either Hetatom, Nucleotide, or AminoAcid
[ "initiate", "new", "group", "either", "Hetatom", "Nucleotide", "or", "AminoAcid" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L250-L308
32,008
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.isKnownChain
private static Chain isKnownChain(String asymId, List<Chain> chains){ for (int i = 0; i< chains.size();i++){ Chain testchain = chains.get(i); //System.out.println("comparing chainID >"+chainID+"< against testchain " + i+" >" +testchain.getName()+"<"); if (asymId.equals(testchain.getId())) { //System.out.println("chain "+ chainID+" already known ..."); return testchain; } } return null; }
java
private static Chain isKnownChain(String asymId, List<Chain> chains){ for (int i = 0; i< chains.size();i++){ Chain testchain = chains.get(i); //System.out.println("comparing chainID >"+chainID+"< against testchain " + i+" >" +testchain.getName()+"<"); if (asymId.equals(testchain.getId())) { //System.out.println("chain "+ chainID+" already known ..."); return testchain; } } return null; }
[ "private", "static", "Chain", "isKnownChain", "(", "String", "asymId", ",", "List", "<", "Chain", ">", "chains", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "chains", ".", "size", "(", ")", ";", "i", "++", ")", "{", "Chain", "testc...
Test if the given asymId is already present in the list of chains given. If yes, returns the chain otherwise returns null.
[ "Test", "if", "the", "given", "asymId", "is", "already", "present", "in", "the", "list", "of", "chains", "given", ".", "If", "yes", "returns", "the", "chain", "otherwise", "returns", "null", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L314-L326
32,009
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.convertAtom
private Atom convertAtom(AtomSite atom){ Atom a = new AtomImpl(); a.setPDBserial(Integer.parseInt(atom.getId())); a.setName(atom.getLabel_atom_id()); double x = Double.parseDouble (atom.getCartn_x()); double y = Double.parseDouble (atom.getCartn_y()); double z = Double.parseDouble (atom.getCartn_z()); a.setX(x); a.setY(y); a.setZ(z); float occupancy = Float.parseFloat (atom.getOccupancy()); a.setOccupancy(occupancy); float temp = Float.parseFloat (atom.getB_iso_or_equiv()); a.setTempFactor(temp); String alt = atom.getLabel_alt_id(); if (( alt != null ) && ( alt.length() > 0) && (! alt.equals("."))){ a.setAltLoc(new Character(alt.charAt(0))); } else { a.setAltLoc(new Character(' ')); } Element element = Element.R; try { element = Element.valueOfIgnoreCase(atom.getType_symbol()); } catch (IllegalArgumentException e) { logger.info("Element {} was not recognised as a BioJava-known element, the element will be represented as the generic element {}", atom.getType_symbol(), Element.R.name()); } a.setElement(element); return a; }
java
private Atom convertAtom(AtomSite atom){ Atom a = new AtomImpl(); a.setPDBserial(Integer.parseInt(atom.getId())); a.setName(atom.getLabel_atom_id()); double x = Double.parseDouble (atom.getCartn_x()); double y = Double.parseDouble (atom.getCartn_y()); double z = Double.parseDouble (atom.getCartn_z()); a.setX(x); a.setY(y); a.setZ(z); float occupancy = Float.parseFloat (atom.getOccupancy()); a.setOccupancy(occupancy); float temp = Float.parseFloat (atom.getB_iso_or_equiv()); a.setTempFactor(temp); String alt = atom.getLabel_alt_id(); if (( alt != null ) && ( alt.length() > 0) && (! alt.equals("."))){ a.setAltLoc(new Character(alt.charAt(0))); } else { a.setAltLoc(new Character(' ')); } Element element = Element.R; try { element = Element.valueOfIgnoreCase(atom.getType_symbol()); } catch (IllegalArgumentException e) { logger.info("Element {} was not recognised as a BioJava-known element, the element will be represented as the generic element {}", atom.getType_symbol(), Element.R.name()); } a.setElement(element); return a; }
[ "private", "Atom", "convertAtom", "(", "AtomSite", "atom", ")", "{", "Atom", "a", "=", "new", "AtomImpl", "(", ")", ";", "a", ".", "setPDBserial", "(", "Integer", ".", "parseInt", "(", "atom", ".", "getId", "(", ")", ")", ")", ";", "a", ".", "setNa...
Convert a mmCIF AtomSite object to a BioJava Atom object @param atom the mmmcif AtomSite record @return an Atom
[ "Convert", "a", "mmCIF", "AtomSite", "object", "to", "a", "BioJava", "Atom", "object" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L549-L587
32,010
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.documentStart
@Override public void documentStart() { structure = new StructureImpl(); currentChain = null; currentGroup = null; currentNmrModelNumber = null; //atomCount = 0; allModels = new ArrayList<List<Chain>>(); currentModel = new ArrayList<Chain>(); entities = new ArrayList<Entity>(); entityPolys = new ArrayList<>(); strucRefs = new ArrayList<StructRef>(); seqResChains = new ArrayList<Chain>(); entityChains = new ArrayList<Chain>(); structAsyms = new ArrayList<StructAsym>(); asymId2entityId = new HashMap<String,String>(); asymId2authorId = new HashMap<>(); structOpers = new ArrayList<PdbxStructOperList>(); strucAssemblies = new ArrayList<PdbxStructAssembly>(); strucAssemblyGens = new ArrayList<PdbxStructAssemblyGen>(); entitySrcGens = new ArrayList<EntitySrcGen>(); entitySrcNats = new ArrayList<EntitySrcNat>(); entitySrcSyns = new ArrayList<EntitySrcSyn>(); structConn = new ArrayList<StructConn>(); structNcsOper = new ArrayList<StructNcsOper>(); sequenceDifs = new ArrayList<StructRefSeqDif>(); structSiteGens = new ArrayList<StructSiteGen>(); }
java
@Override public void documentStart() { structure = new StructureImpl(); currentChain = null; currentGroup = null; currentNmrModelNumber = null; //atomCount = 0; allModels = new ArrayList<List<Chain>>(); currentModel = new ArrayList<Chain>(); entities = new ArrayList<Entity>(); entityPolys = new ArrayList<>(); strucRefs = new ArrayList<StructRef>(); seqResChains = new ArrayList<Chain>(); entityChains = new ArrayList<Chain>(); structAsyms = new ArrayList<StructAsym>(); asymId2entityId = new HashMap<String,String>(); asymId2authorId = new HashMap<>(); structOpers = new ArrayList<PdbxStructOperList>(); strucAssemblies = new ArrayList<PdbxStructAssembly>(); strucAssemblyGens = new ArrayList<PdbxStructAssemblyGen>(); entitySrcGens = new ArrayList<EntitySrcGen>(); entitySrcNats = new ArrayList<EntitySrcNat>(); entitySrcSyns = new ArrayList<EntitySrcSyn>(); structConn = new ArrayList<StructConn>(); structNcsOper = new ArrayList<StructNcsOper>(); sequenceDifs = new ArrayList<StructRefSeqDif>(); structSiteGens = new ArrayList<StructSiteGen>(); }
[ "@", "Override", "public", "void", "documentStart", "(", ")", "{", "structure", "=", "new", "StructureImpl", "(", ")", ";", "currentChain", "=", "null", ";", "currentGroup", "=", "null", ";", "currentNmrModelNumber", "=", "null", ";", "//atomCount \t\t= 0;",...
Start the parsing
[ "Start", "the", "parsing" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L652-L682
32,011
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.addAncilliaryEntityData
private void addAncilliaryEntityData(StructAsym asym, int entityId, Entity entity, EntityInfo entityInfo) { // Loop through each of the entity types and add the corresponding data // We're assuming if data is duplicated between sources it is consistent // This is a potentially huge assumption... for (EntitySrcGen esg : entitySrcGens) { if (! esg.getEntity_id().equals(asym.getEntity_id())) continue; addInformationFromESG(esg, entityId, entityInfo); } for (EntitySrcNat esn : entitySrcNats) { if (! esn.getEntity_id().equals(asym.getEntity_id())) continue; addInformationFromESN(esn, entityId, entityInfo); } for (EntitySrcSyn ess : entitySrcSyns) { if (! ess.getEntity_id().equals(asym.getEntity_id())) continue; addInfoFromESS(ess, entityId, entityInfo); } }
java
private void addAncilliaryEntityData(StructAsym asym, int entityId, Entity entity, EntityInfo entityInfo) { // Loop through each of the entity types and add the corresponding data // We're assuming if data is duplicated between sources it is consistent // This is a potentially huge assumption... for (EntitySrcGen esg : entitySrcGens) { if (! esg.getEntity_id().equals(asym.getEntity_id())) continue; addInformationFromESG(esg, entityId, entityInfo); } for (EntitySrcNat esn : entitySrcNats) { if (! esn.getEntity_id().equals(asym.getEntity_id())) continue; addInformationFromESN(esn, entityId, entityInfo); } for (EntitySrcSyn ess : entitySrcSyns) { if (! ess.getEntity_id().equals(asym.getEntity_id())) continue; addInfoFromESS(ess, entityId, entityInfo); } }
[ "private", "void", "addAncilliaryEntityData", "(", "StructAsym", "asym", ",", "int", "entityId", ",", "Entity", "entity", ",", "EntityInfo", "entityInfo", ")", "{", "// Loop through each of the entity types and add the corresponding data", "// We're assuming if data is duplicated...
Add any extra information to the entity information. @param asym @param entityId @param entity @param entityInfo
[ "Add", "any", "extra", "information", "to", "the", "entity", "information", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L1160-L1188
32,012
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.addInformationFromESG
private void addInformationFromESG(EntitySrcGen entitySrcInfo, int entityId, EntityInfo c) { c.setAtcc(entitySrcInfo.getPdbx_gene_src_atcc()); c.setCell(entitySrcInfo.getPdbx_gene_src_cell()); c.setOrganismCommon(entitySrcInfo.getGene_src_common_name()); c.setOrganismScientific(entitySrcInfo.getPdbx_gene_src_scientific_name()); c.setOrganismTaxId(entitySrcInfo.getPdbx_gene_src_ncbi_taxonomy_id()); c.setExpressionSystemTaxId(entitySrcInfo.getPdbx_host_org_ncbi_taxonomy_id()); c.setExpressionSystem(entitySrcInfo.getPdbx_host_org_scientific_name()); }
java
private void addInformationFromESG(EntitySrcGen entitySrcInfo, int entityId, EntityInfo c) { c.setAtcc(entitySrcInfo.getPdbx_gene_src_atcc()); c.setCell(entitySrcInfo.getPdbx_gene_src_cell()); c.setOrganismCommon(entitySrcInfo.getGene_src_common_name()); c.setOrganismScientific(entitySrcInfo.getPdbx_gene_src_scientific_name()); c.setOrganismTaxId(entitySrcInfo.getPdbx_gene_src_ncbi_taxonomy_id()); c.setExpressionSystemTaxId(entitySrcInfo.getPdbx_host_org_ncbi_taxonomy_id()); c.setExpressionSystem(entitySrcInfo.getPdbx_host_org_scientific_name()); }
[ "private", "void", "addInformationFromESG", "(", "EntitySrcGen", "entitySrcInfo", ",", "int", "entityId", ",", "EntityInfo", "c", ")", "{", "c", ".", "setAtcc", "(", "entitySrcInfo", ".", "getPdbx_gene_src_atcc", "(", ")", ")", ";", "c", ".", "setCell", "(", ...
Add the information from an ESG to a compound. @param entitySrcInfo @param entityId @param c
[ "Add", "the", "information", "from", "an", "ESG", "to", "a", "compound", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L1196-L1204
32,013
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.addInformationFromESN
private void addInformationFromESN(EntitySrcNat esn, int eId, EntityInfo c) { c.setAtcc(esn.getPdbx_atcc()); c.setCell(esn.getPdbx_cell()); c.setOrganismCommon(esn.getCommon_name()); c.setOrganismScientific(esn.getPdbx_organism_scientific()); c.setOrganismTaxId(esn.getPdbx_ncbi_taxonomy_id()); }
java
private void addInformationFromESN(EntitySrcNat esn, int eId, EntityInfo c) { c.setAtcc(esn.getPdbx_atcc()); c.setCell(esn.getPdbx_cell()); c.setOrganismCommon(esn.getCommon_name()); c.setOrganismScientific(esn.getPdbx_organism_scientific()); c.setOrganismTaxId(esn.getPdbx_ncbi_taxonomy_id()); }
[ "private", "void", "addInformationFromESN", "(", "EntitySrcNat", "esn", ",", "int", "eId", ",", "EntityInfo", "c", ")", "{", "c", ".", "setAtcc", "(", "esn", ".", "getPdbx_atcc", "(", ")", ")", ";", "c", ".", "setCell", "(", "esn", ".", "getPdbx_cell", ...
Add the information to entity info from ESN. @param esn @param eId @param c
[ "Add", "the", "information", "to", "entity", "info", "from", "ESN", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L1212-L1220
32,014
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.addInfoFromESS
private void addInfoFromESS(EntitySrcSyn ess, int eId, EntityInfo c) { c.setOrganismCommon(ess.getOrganism_common_name()); c.setOrganismScientific(ess.getOrganism_scientific()); c.setOrganismTaxId(ess.getNcbi_taxonomy_id()); }
java
private void addInfoFromESS(EntitySrcSyn ess, int eId, EntityInfo c) { c.setOrganismCommon(ess.getOrganism_common_name()); c.setOrganismScientific(ess.getOrganism_scientific()); c.setOrganismTaxId(ess.getNcbi_taxonomy_id()); }
[ "private", "void", "addInfoFromESS", "(", "EntitySrcSyn", "ess", ",", "int", "eId", ",", "EntityInfo", "c", ")", "{", "c", ".", "setOrganismCommon", "(", "ess", ".", "getOrganism_common_name", "(", ")", ")", ";", "c", ".", "setOrganismScientific", "(", "ess"...
Add the information from ESS to Entity info. @param ess @param eId @param c
[ "Add", "the", "information", "from", "ESS", "to", "Entity", "info", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L1227-L1232
32,015
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java
SimpleMMcifConsumer.addSites
private void addSites() { List<Site> sites = structure.getSites(); if (sites == null) sites = new ArrayList<Site>(); for (StructSiteGen siteGen : structSiteGens) { // For each StructSiteGen, find the residues involved, if they exist then String site_id = siteGen.getSite_id(); // multiple could be in same site. if (site_id == null) site_id = ""; String comp_id = siteGen.getLabel_comp_id(); // PDBName // Assumption: the author chain ID and residue number for the site is consistent with the original // author chain id and residue numbers. String asymId = siteGen.getLabel_asym_id(); // chain name String authId = siteGen.getAuth_asym_id(); // chain Id String auth_seq_id = siteGen.getAuth_seq_id(); // Res num String insCode = siteGen.getPdbx_auth_ins_code(); if ( insCode != null && insCode.equals("?")) insCode = null; // Look for asymID = chainID and seqID = seq_ID. Check that comp_id matches the resname. Group g = null; try { Chain chain = structure.getChain(asymId); if (null != chain) { try { Character insChar = null; if (null != insCode && insCode.length() > 0) insChar = insCode.charAt(0); g = chain.getGroupByPDB(new ResidueNumber(null, Integer.parseInt(auth_seq_id), insChar)); } catch (NumberFormatException e) { logger.warn("Could not lookup residue : " + authId + auth_seq_id); } } } catch (StructureException e) { logger.warn("Problem finding residue in site entry " + siteGen.getSite_id() + " - " + e.getMessage(), e.getMessage()); } if (g != null) { // 2. find the site_id, if not existing, create anew. Site site = null; for (Site asite: sites) { if (site_id.equals(asite.getSiteID())) site = asite; } boolean addSite = false; // 3. add this residue to the site. if (site == null) { addSite = true; site = new Site(); site.setSiteID(site_id); } List<Group> groups = site.getGroups(); if (groups == null) groups = new ArrayList<Group>(); // Check the self-consistency of the residue reference from auth_seq_id and chain_id if (!comp_id.equals(g.getPDBName())) { logger.warn("comp_id doesn't match the residue at " + authId + " " + auth_seq_id + " - skipping"); } else { groups.add(g); site.setGroups(groups); } if (addSite) sites.add(site); } } structure.setSites(sites); }
java
private void addSites() { List<Site> sites = structure.getSites(); if (sites == null) sites = new ArrayList<Site>(); for (StructSiteGen siteGen : structSiteGens) { // For each StructSiteGen, find the residues involved, if they exist then String site_id = siteGen.getSite_id(); // multiple could be in same site. if (site_id == null) site_id = ""; String comp_id = siteGen.getLabel_comp_id(); // PDBName // Assumption: the author chain ID and residue number for the site is consistent with the original // author chain id and residue numbers. String asymId = siteGen.getLabel_asym_id(); // chain name String authId = siteGen.getAuth_asym_id(); // chain Id String auth_seq_id = siteGen.getAuth_seq_id(); // Res num String insCode = siteGen.getPdbx_auth_ins_code(); if ( insCode != null && insCode.equals("?")) insCode = null; // Look for asymID = chainID and seqID = seq_ID. Check that comp_id matches the resname. Group g = null; try { Chain chain = structure.getChain(asymId); if (null != chain) { try { Character insChar = null; if (null != insCode && insCode.length() > 0) insChar = insCode.charAt(0); g = chain.getGroupByPDB(new ResidueNumber(null, Integer.parseInt(auth_seq_id), insChar)); } catch (NumberFormatException e) { logger.warn("Could not lookup residue : " + authId + auth_seq_id); } } } catch (StructureException e) { logger.warn("Problem finding residue in site entry " + siteGen.getSite_id() + " - " + e.getMessage(), e.getMessage()); } if (g != null) { // 2. find the site_id, if not existing, create anew. Site site = null; for (Site asite: sites) { if (site_id.equals(asite.getSiteID())) site = asite; } boolean addSite = false; // 3. add this residue to the site. if (site == null) { addSite = true; site = new Site(); site.setSiteID(site_id); } List<Group> groups = site.getGroups(); if (groups == null) groups = new ArrayList<Group>(); // Check the self-consistency of the residue reference from auth_seq_id and chain_id if (!comp_id.equals(g.getPDBName())) { logger.warn("comp_id doesn't match the residue at " + authId + " " + auth_seq_id + " - skipping"); } else { groups.add(g); site.setGroups(groups); } if (addSite) sites.add(site); } } structure.setSites(sites); }
[ "private", "void", "addSites", "(", ")", "{", "List", "<", "Site", ">", "sites", "=", "structure", ".", "getSites", "(", ")", ";", "if", "(", "sites", "==", "null", ")", "sites", "=", "new", "ArrayList", "<", "Site", ">", "(", ")", ";", "for", "(...
Build sites in a BioJava Structure using the original author chain id & residue numbers. Sites are built from struct_site_gen records that have been parsed.
[ "Build", "sites", "in", "a", "BioJava", "Structure", "using", "the", "original", "author", "chain", "id", "&", "residue", "numbers", ".", "Sites", "are", "built", "from", "struct_site_gen", "records", "that", "have", "been", "parsed", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/SimpleMMcifConsumer.java#L2097-L2166
32,016
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/JMatrixPanel.java
JMatrixPanel.drawPairs
public void drawPairs(Graphics g){ if ( aligs == null) return; int nr = aligs.length; Graphics2D g2D = (Graphics2D)g; Stroke oldStroke = g2D.getStroke(); g2D.setStroke(stroke); Color color; float hue; int width = Math.round(scale); int w2 = width / 2 ; for (int i = 0; i < aligs.length; i++) { AlternativeAlignment a = aligs[i]; int[] idx1 = a.getIdx1(); int[] idx2 = a.getIdx2(); int xold = -1; int yold = -1; boolean start = true; if ( (selectedAlignmentPos != -1 ) && ( selectedAlignmentPos == i)){ color = Color.white; } else { hue = i * (1/ (float)nr); color = Color.getHSBColor(hue,1.0f,1.0f); } g.setColor(color); for (int j = 0; j < idx1.length; j++) { int x1 = Math.round(idx1[j]*scale) ; int y1 = Math.round(idx2[j]*scale) ; if ( ! start){ //g.drawLine(xold+1,yold,x1+1,y1); //g2D.draw(new Line2D.Double(xold,yold,x1,y1)); g.fillRect(xold,yold,2,2); } else { g.fillRect(x1,y1, w2, w2); start =false; } xold = x1; yold = y1; } if ( ! start) g.fillRect(xold,yold,w2,w2); } g2D.setStroke(oldStroke); }
java
public void drawPairs(Graphics g){ if ( aligs == null) return; int nr = aligs.length; Graphics2D g2D = (Graphics2D)g; Stroke oldStroke = g2D.getStroke(); g2D.setStroke(stroke); Color color; float hue; int width = Math.round(scale); int w2 = width / 2 ; for (int i = 0; i < aligs.length; i++) { AlternativeAlignment a = aligs[i]; int[] idx1 = a.getIdx1(); int[] idx2 = a.getIdx2(); int xold = -1; int yold = -1; boolean start = true; if ( (selectedAlignmentPos != -1 ) && ( selectedAlignmentPos == i)){ color = Color.white; } else { hue = i * (1/ (float)nr); color = Color.getHSBColor(hue,1.0f,1.0f); } g.setColor(color); for (int j = 0; j < idx1.length; j++) { int x1 = Math.round(idx1[j]*scale) ; int y1 = Math.round(idx2[j]*scale) ; if ( ! start){ //g.drawLine(xold+1,yold,x1+1,y1); //g2D.draw(new Line2D.Double(xold,yold,x1,y1)); g.fillRect(xold,yold,2,2); } else { g.fillRect(x1,y1, w2, w2); start =false; } xold = x1; yold = y1; } if ( ! start) g.fillRect(xold,yold,w2,w2); } g2D.setStroke(oldStroke); }
[ "public", "void", "drawPairs", "(", "Graphics", "g", ")", "{", "if", "(", "aligs", "==", "null", ")", "return", ";", "int", "nr", "=", "aligs", ".", "length", ";", "Graphics2D", "g2D", "=", "(", "Graphics2D", ")", "g", ";", "Stroke", "oldStroke", "="...
draw alternative alignments @param g
[ "draw", "alternative", "alignments" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/JMatrixPanel.java#L176-L234
32,017
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/JMatrixPanel.java
JMatrixPanel.drawBoxes
public void drawBoxes(Graphics g){ if ( fragmentPairs == null ) return; g.setColor(Color.yellow); for (int i = 0; i < fragmentPairs.length; i++) { FragmentPair fp =fragmentPairs[i]; int xp = fp.getPos1(); int yp = fp.getPos2(); int width = Math.round(scale); g.drawRect(Math.round(xp*scale),Math.round(yp*scale),width, width); } }
java
public void drawBoxes(Graphics g){ if ( fragmentPairs == null ) return; g.setColor(Color.yellow); for (int i = 0; i < fragmentPairs.length; i++) { FragmentPair fp =fragmentPairs[i]; int xp = fp.getPos1(); int yp = fp.getPos2(); int width = Math.round(scale); g.drawRect(Math.round(xp*scale),Math.round(yp*scale),width, width); } }
[ "public", "void", "drawBoxes", "(", "Graphics", "g", ")", "{", "if", "(", "fragmentPairs", "==", "null", ")", "return", ";", "g", ".", "setColor", "(", "Color", ".", "yellow", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "fragmentPair...
draw high scoring fragments that are used for the initial alignment seed selection @param g
[ "draw", "high", "scoring", "fragments", "that", "are", "used", "for", "the", "initial", "alignment", "seed", "selection" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/JMatrixPanel.java#L242-L259
32,018
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/JMatrixPanel.java
JMatrixPanel.drawDistances
public void drawDistances(Graphics g1){ Graphics2D g = (Graphics2D)g1; int c = matrix.getRowDimension(); int d = matrix.getColumnDimension(); float scale = getScale(); int width = Math.round(scale); for (int i = 0; i < c; i++) { int ipaint = Math.round(i*scale); for (int j = 0; j < d; j++) { double val = matrix.get(i,j); int jpaint = Math.round(j*scale); Color color = cellColor.getColor(val); g.setColor(color); g.fillRect(ipaint,jpaint,width,width); } } }
java
public void drawDistances(Graphics g1){ Graphics2D g = (Graphics2D)g1; int c = matrix.getRowDimension(); int d = matrix.getColumnDimension(); float scale = getScale(); int width = Math.round(scale); for (int i = 0; i < c; i++) { int ipaint = Math.round(i*scale); for (int j = 0; j < d; j++) { double val = matrix.get(i,j); int jpaint = Math.round(j*scale); Color color = cellColor.getColor(val); g.setColor(color); g.fillRect(ipaint,jpaint,width,width); } } }
[ "public", "void", "drawDistances", "(", "Graphics", "g1", ")", "{", "Graphics2D", "g", "=", "(", "Graphics2D", ")", "g1", ";", "int", "c", "=", "matrix", ".", "getRowDimension", "(", ")", ";", "int", "d", "=", "matrix", ".", "getColumnDimension", "(", ...
For each element in matrix, draw it as a colored square or pixel. The color of a matrix element with value x is specified as - H: 1-x/scalevalue - S: saturation - B: 1-x/scalevalue @param g1
[ "For", "each", "element", "in", "matrix", "draw", "it", "as", "a", "colored", "square", "or", "pixel", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/JMatrixPanel.java#L271-L296
32,019
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.ABITraceInit
private void ABITraceInit(BufferedInputStream bis) throws IOException{ byte[] bytes = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int b; while ((b = bis.read()) >= 0) { baos.write(b); } bis.close(); baos.close(); bytes = baos.toByteArray(); initData(bytes); }
java
private void ABITraceInit(BufferedInputStream bis) throws IOException{ byte[] bytes = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int b; while ((b = bis.read()) >= 0) { baos.write(b); } bis.close(); baos.close(); bytes = baos.toByteArray(); initData(bytes); }
[ "private", "void", "ABITraceInit", "(", "BufferedInputStream", "bis", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "null", ";", "ByteArrayOutputStream", "baos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "int", "b", ";", "while",...
Helper method for constructors @param bis - BufferedInputStream @throws IOException if there is a problem reading from the BufferedInputStream
[ "Helper", "method", "for", "constructors" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L112-L123
32,020
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.getTrace
public int[] getTrace (String base) throws CompoundNotFoundException { if (base.equals("A")) { return A; } else if (base.equals("C")) { return C; } else if (base.equals("G")) { return G; } else if (base.equals("T")) { return T; } else { throw new CompoundNotFoundException("Don't know base: " + base); } }
java
public int[] getTrace (String base) throws CompoundNotFoundException { if (base.equals("A")) { return A; } else if (base.equals("C")) { return C; } else if (base.equals("G")) { return G; } else if (base.equals("T")) { return T; } else { throw new CompoundNotFoundException("Don't know base: " + base); } }
[ "public", "int", "[", "]", "getTrace", "(", "String", "base", ")", "throws", "CompoundNotFoundException", "{", "if", "(", "base", ".", "equals", "(", "\"A\"", ")", ")", "{", "return", "A", ";", "}", "else", "if", "(", "base", ".", "equals", "(", "\"C...
Returns one of the four traces - all of the y-coordinate values, each of which correspond to a single x-coordinate relative to the position in the array, so that if element 4 in the array is 972, then x is 4 and y is 972 for that point. @param base - the DNA String to retrieve the trace values for @return an array of ints giving the entire trace for that base @throws CompoundNotFoundException if the base is not valid
[ "Returns", "one", "of", "the", "four", "traces", "-", "all", "of", "the", "y", "-", "coordinate", "values", "each", "of", "which", "correspond", "to", "a", "single", "x", "-", "coordinate", "relative", "to", "the", "position", "in", "the", "array", "so",...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L193-L205
32,021
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.calculateScale
private double calculateScale(int height) { double newScale = 0.0; double max = (double) getMaximum(); double ht = (double) height; newScale = ((ht - 50.0)) / max; return newScale; }
java
private double calculateScale(int height) { double newScale = 0.0; double max = (double) getMaximum(); double ht = (double) height; newScale = ((ht - 50.0)) / max; return newScale; }
[ "private", "double", "calculateScale", "(", "int", "height", ")", "{", "double", "newScale", "=", "0.0", ";", "double", "max", "=", "(", "double", ")", "getMaximum", "(", ")", ";", "double", "ht", "=", "(", "double", ")", "height", ";", "newScale", "="...
Returns the scaling factor necessary to allow all of the traces to fit vertically into the specified space. @param height - required height in pixels @return - scaling factor
[ "Returns", "the", "scaling", "factor", "necessary", "to", "allow", "all", "of", "the", "traces", "to", "fit", "vertically", "into", "the", "specified", "space", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L322-L328
32,022
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.getMaximum
private int getMaximum() { int max = 0; for (int x = 0; x <= T.length - 1; x++) { if (T[x] > max) max = T[x]; if (A[x] > max) max = A[x]; if (C[x] > max) max = C[x]; if (G[x] > max) max = G[x]; } return max; }
java
private int getMaximum() { int max = 0; for (int x = 0; x <= T.length - 1; x++) { if (T[x] > max) max = T[x]; if (A[x] > max) max = A[x]; if (C[x] > max) max = C[x]; if (G[x] > max) max = G[x]; } return max; }
[ "private", "int", "getMaximum", "(", ")", "{", "int", "max", "=", "0", ";", "for", "(", "int", "x", "=", "0", ";", "x", "<=", "T", ".", "length", "-", "1", ";", "x", "++", ")", "{", "if", "(", "T", "[", "x", "]", ">", "max", ")", "max", ...
Get the maximum height of any of the traces. The data is persisted for performance in the event of multiple calls, but it initialized lazily. @return - maximum height of any of the traces
[ "Get", "the", "maximum", "height", "of", "any", "of", "the", "traces", ".", "The", "data", "is", "persisted", "for", "performance", "in", "the", "event", "of", "multiple", "calls", "but", "it", "initialized", "lazily", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L336-L345
32,023
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.initData
private void initData(byte[] fileData) { traceData = fileData; if (isABI()) { setIndex(); setBasecalls(); setQcalls(); setSeq(); setTraces(); } else throw new IllegalArgumentException("Not a valid ABI file."); }
java
private void initData(byte[] fileData) { traceData = fileData; if (isABI()) { setIndex(); setBasecalls(); setQcalls(); setSeq(); setTraces(); } else throw new IllegalArgumentException("Not a valid ABI file."); }
[ "private", "void", "initData", "(", "byte", "[", "]", "fileData", ")", "{", "traceData", "=", "fileData", ";", "if", "(", "isABI", "(", ")", ")", "{", "setIndex", "(", ")", ";", "setBasecalls", "(", ")", ";", "setQcalls", "(", ")", ";", "setSeq", "...
Initialize all of the data fields for this object. @param fileData - data for object @throws IllegalArgumentException which will propagate to all of the constructors.
[ "Initialize", "all", "of", "the", "data", "fields", "for", "this", "object", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L353-L362
32,024
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.setTraces
private void setTraces() { int pointers[] = new int[4]; //alphabetical, 0=A, 1=C, 2=G, 3=T int datas[] = new int[4]; char order[] = new char[4]; datas[0] = DATA9; datas[1] = DATA10; datas[2] = DATA11; datas[3] = DATA12; for (int i = 0; i <= 3; i++) { order[i] = (char) traceData[FWO + i]; } for (int i = 0; i <= 3; i++) { switch (order[i]) { case 'A': case 'a': pointers[0] = datas[i]; break; case 'C': case 'c': pointers[1] = datas[i]; break; case 'G': case 'g': pointers[2] = datas[i]; break; case 'T': case 't': pointers[3] = datas[i]; break; default: throw new IllegalArgumentException("Trace contains illegal values."); } } A = new int[traceLength]; C = new int[traceLength]; G = new int[traceLength]; T = new int[traceLength]; for (int i = 0; i <= 3; i++) { byte[] qq = new byte[traceLength * 2]; getSubArray(qq, pointers[i]); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(qq)); for (int x = 0; x <= traceLength - 1; x++) { try { if (i == 0) A[x] = (int) dis.readShort(); if (i == 1) C[x] = (int) dis.readShort(); if (i == 2) G[x] = (int) dis.readShort(); if (i == 3) T[x] = (int) dis.readShort(); } catch (IOException e)//This shouldn't happen. If it does something must be seriously wrong. { throw new IllegalStateException("Unexpected IOException encountered while manipulating internal streams."); } } } return; }
java
private void setTraces() { int pointers[] = new int[4]; //alphabetical, 0=A, 1=C, 2=G, 3=T int datas[] = new int[4]; char order[] = new char[4]; datas[0] = DATA9; datas[1] = DATA10; datas[2] = DATA11; datas[3] = DATA12; for (int i = 0; i <= 3; i++) { order[i] = (char) traceData[FWO + i]; } for (int i = 0; i <= 3; i++) { switch (order[i]) { case 'A': case 'a': pointers[0] = datas[i]; break; case 'C': case 'c': pointers[1] = datas[i]; break; case 'G': case 'g': pointers[2] = datas[i]; break; case 'T': case 't': pointers[3] = datas[i]; break; default: throw new IllegalArgumentException("Trace contains illegal values."); } } A = new int[traceLength]; C = new int[traceLength]; G = new int[traceLength]; T = new int[traceLength]; for (int i = 0; i <= 3; i++) { byte[] qq = new byte[traceLength * 2]; getSubArray(qq, pointers[i]); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(qq)); for (int x = 0; x <= traceLength - 1; x++) { try { if (i == 0) A[x] = (int) dis.readShort(); if (i == 1) C[x] = (int) dis.readShort(); if (i == 2) G[x] = (int) dis.readShort(); if (i == 3) T[x] = (int) dis.readShort(); } catch (IOException e)//This shouldn't happen. If it does something must be seriously wrong. { throw new IllegalStateException("Unexpected IOException encountered while manipulating internal streams."); } } } return; }
[ "private", "void", "setTraces", "(", ")", "{", "int", "pointers", "[", "]", "=", "new", "int", "[", "4", "]", ";", "//alphabetical, 0=A, 1=C, 2=G, 3=T", "int", "datas", "[", "]", "=", "new", "int", "[", "4", "]", ";", "char", "order", "[", "]", "=", ...
Shuffle the pointers to point to the proper spots in the trace, then load the traces into their arrays.
[ "Shuffle", "the", "pointers", "to", "point", "to", "the", "proper", "spots", "in", "the", "trace", "then", "load", "the", "traces", "into", "their", "arrays", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L368-L427
32,025
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.setSeq
private void setSeq() { char tempseq[] = new char[seqLength]; for (int x = 0; x <= seqLength - 1; ++x) { tempseq[x] = (char) traceData[PBAS2 + x]; } sequence = new String(tempseq); }
java
private void setSeq() { char tempseq[] = new char[seqLength]; for (int x = 0; x <= seqLength - 1; ++x) { tempseq[x] = (char) traceData[PBAS2 + x]; } sequence = new String(tempseq); }
[ "private", "void", "setSeq", "(", ")", "{", "char", "tempseq", "[", "]", "=", "new", "char", "[", "seqLength", "]", ";", "for", "(", "int", "x", "=", "0", ";", "x", "<=", "seqLength", "-", "1", ";", "++", "x", ")", "{", "tempseq", "[", "x", "...
Fetch the sequence from the trace data.
[ "Fetch", "the", "sequence", "from", "the", "trace", "data", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L432-L438
32,026
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.setQcalls
private void setQcalls() { qCalls = new int[seqLength]; byte[] qq = new byte[seqLength]; getSubArray(qq, PCON); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(qq)); for (int i = 0; i <= seqLength - 1; ++i) { try { qCalls[i] = (int) dis.readByte(); } catch (IOException e)//This shouldn't happen. If it does something must be seriously wrong. { throw new IllegalStateException("Unexpected IOException encountered while manipulating internal streams."); } } }
java
private void setQcalls() { qCalls = new int[seqLength]; byte[] qq = new byte[seqLength]; getSubArray(qq, PCON); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(qq)); for (int i = 0; i <= seqLength - 1; ++i) { try { qCalls[i] = (int) dis.readByte(); } catch (IOException e)//This shouldn't happen. If it does something must be seriously wrong. { throw new IllegalStateException("Unexpected IOException encountered while manipulating internal streams."); } } }
[ "private", "void", "setQcalls", "(", ")", "{", "qCalls", "=", "new", "int", "[", "seqLength", "]", ";", "byte", "[", "]", "qq", "=", "new", "byte", "[", "seqLength", "]", ";", "getSubArray", "(", "qq", ",", "PCON", ")", ";", "DataInputStream", "dis",...
Fetch the quality calls from the trace data.
[ "Fetch", "the", "quality", "calls", "from", "the", "trace", "data", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L443-L456
32,027
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.setBasecalls
private void setBasecalls() { baseCalls = new int[seqLength]; byte[] qq = new byte[seqLength * 2]; getSubArray(qq, PLOC); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(qq)); for (int i = 0; i <= seqLength - 1; ++i) { try { baseCalls[i] = (int) dis.readShort(); } catch (IOException e)//This shouldn't happen. If it does something must be seriously wrong. { throw new IllegalStateException("Unexpected IOException encountered while manipulating internal streams."); } } }
java
private void setBasecalls() { baseCalls = new int[seqLength]; byte[] qq = new byte[seqLength * 2]; getSubArray(qq, PLOC); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(qq)); for (int i = 0; i <= seqLength - 1; ++i) { try { baseCalls[i] = (int) dis.readShort(); } catch (IOException e)//This shouldn't happen. If it does something must be seriously wrong. { throw new IllegalStateException("Unexpected IOException encountered while manipulating internal streams."); } } }
[ "private", "void", "setBasecalls", "(", ")", "{", "baseCalls", "=", "new", "int", "[", "seqLength", "]", ";", "byte", "[", "]", "qq", "=", "new", "byte", "[", "seqLength", "*", "2", "]", ";", "getSubArray", "(", "qq", ",", "PLOC", ")", ";", "DataIn...
Fetch the basecalls from the trace data.
[ "Fetch", "the", "basecalls", "from", "the", "trace", "data", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L461-L474
32,028
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.setIndex
private void setIndex() { int DataCounter, PBASCounter, PLOCCounter, PCONCounter, NumRecords, indexBase; byte[] RecNameArray = new byte[4]; String RecName; DataCounter = 0; PBASCounter = 0; PLOCCounter = 0; PCONCounter = 0; indexBase = getIntAt(absIndexBase + macJunk); NumRecords = getIntAt(absIndexBase - 8 + macJunk); for (int record = 0; record <= NumRecords - 1; record++) { getSubArray(RecNameArray, (indexBase + (record * 28))); RecName = new String(RecNameArray); if (RecName.equals("FWO_")) FWO = indexBase + (record * 28) + 20; if (RecName.equals("DATA")) { ++DataCounter; if (DataCounter == 9) DATA9 = indexBase + (record * 28) + 20; if (DataCounter == 10) DATA10 = indexBase + (record * 28) + 20; if (DataCounter == 11) DATA11 = indexBase + (record * 28) + 20; if (DataCounter == 12) DATA12 = indexBase + (record * 28) + 20; } if (RecName.equals("PBAS")) { ++PBASCounter; if (PBASCounter == 2) PBAS2 = indexBase + (record * 28) + 20; } if (RecName.equals("PLOC")) { ++PLOCCounter; if (PLOCCounter == 2) PLOC = indexBase + (record * 28) + 20; } if (RecName.equals("PCON")) { ++PCONCounter; if (PCONCounter == 2) PCON = indexBase + (record * 28) + 20; } } //next record traceLength = getIntAt(DATA12 - 8); seqLength = getIntAt(PBAS2 - 4); PLOC = getIntAt(PLOC) + macJunk; DATA9 = getIntAt(DATA9) + macJunk; DATA10 = getIntAt(DATA10) + macJunk; DATA11 = getIntAt(DATA11) + macJunk; DATA12 = getIntAt(DATA12) + macJunk; PBAS2 = getIntAt(PBAS2) + macJunk; PCON = getIntAt(PCON) + macJunk; }
java
private void setIndex() { int DataCounter, PBASCounter, PLOCCounter, PCONCounter, NumRecords, indexBase; byte[] RecNameArray = new byte[4]; String RecName; DataCounter = 0; PBASCounter = 0; PLOCCounter = 0; PCONCounter = 0; indexBase = getIntAt(absIndexBase + macJunk); NumRecords = getIntAt(absIndexBase - 8 + macJunk); for (int record = 0; record <= NumRecords - 1; record++) { getSubArray(RecNameArray, (indexBase + (record * 28))); RecName = new String(RecNameArray); if (RecName.equals("FWO_")) FWO = indexBase + (record * 28) + 20; if (RecName.equals("DATA")) { ++DataCounter; if (DataCounter == 9) DATA9 = indexBase + (record * 28) + 20; if (DataCounter == 10) DATA10 = indexBase + (record * 28) + 20; if (DataCounter == 11) DATA11 = indexBase + (record * 28) + 20; if (DataCounter == 12) DATA12 = indexBase + (record * 28) + 20; } if (RecName.equals("PBAS")) { ++PBASCounter; if (PBASCounter == 2) PBAS2 = indexBase + (record * 28) + 20; } if (RecName.equals("PLOC")) { ++PLOCCounter; if (PLOCCounter == 2) PLOC = indexBase + (record * 28) + 20; } if (RecName.equals("PCON")) { ++PCONCounter; if (PCONCounter == 2) PCON = indexBase + (record * 28) + 20; } } //next record traceLength = getIntAt(DATA12 - 8); seqLength = getIntAt(PBAS2 - 4); PLOC = getIntAt(PLOC) + macJunk; DATA9 = getIntAt(DATA9) + macJunk; DATA10 = getIntAt(DATA10) + macJunk; DATA11 = getIntAt(DATA11) + macJunk; DATA12 = getIntAt(DATA12) + macJunk; PBAS2 = getIntAt(PBAS2) + macJunk; PCON = getIntAt(PCON) + macJunk; }
[ "private", "void", "setIndex", "(", ")", "{", "int", "DataCounter", ",", "PBASCounter", ",", "PLOCCounter", ",", "PCONCounter", ",", "NumRecords", ",", "indexBase", ";", "byte", "[", "]", "RecNameArray", "=", "new", "byte", "[", "4", "]", ";", "String", ...
Sets up all of the initial pointers to the important records in TraceData.
[ "Sets", "up", "all", "of", "the", "initial", "pointers", "to", "the", "important", "records", "in", "TraceData", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L479-L534
32,029
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.getSubArray
private void getSubArray(byte[] b, int traceDataOffset) { for (int x = 0; x <= b.length - 1; x++) { b[x] = traceData[traceDataOffset + x]; } }
java
private void getSubArray(byte[] b, int traceDataOffset) { for (int x = 0; x <= b.length - 1; x++) { b[x] = traceData[traceDataOffset + x]; } }
[ "private", "void", "getSubArray", "(", "byte", "[", "]", "b", ",", "int", "traceDataOffset", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<=", "b", ".", "length", "-", "1", ";", "x", "++", ")", "{", "b", "[", "x", "]", "=", "traceDa...
A utility method which fills array b with data from the trace starting at traceDataOffset. @param b - trace byte array @param traceDataOffset - starting point
[ "A", "utility", "method", "which", "fills", "array", "b", "with", "data", "from", "the", "trace", "starting", "at", "traceDataOffset", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L562-L566
32,030
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java
ABITrace.isABI
private boolean isABI() { char ABI[] = new char[4]; for (int i = 0; i <= 2; i++) { ABI[i] = (char) traceData[i]; } if (ABI[0] == 'A' && (ABI[1] == 'B' && ABI[2] == 'I')) { return true; } else { for (int i = 128; i <= 130; i++) { ABI[i-128] = (char) traceData[i]; } if (ABI[0] == 'A' && (ABI[1] == 'B' && ABI[2] == 'I')) { macJunk = 128; return true; } else return false; } }
java
private boolean isABI() { char ABI[] = new char[4]; for (int i = 0; i <= 2; i++) { ABI[i] = (char) traceData[i]; } if (ABI[0] == 'A' && (ABI[1] == 'B' && ABI[2] == 'I')) { return true; } else { for (int i = 128; i <= 130; i++) { ABI[i-128] = (char) traceData[i]; } if (ABI[0] == 'A' && (ABI[1] == 'B' && ABI[2] == 'I')) { macJunk = 128; return true; } else return false; } }
[ "private", "boolean", "isABI", "(", ")", "{", "char", "ABI", "[", "]", "=", "new", "char", "[", "4", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<=", "2", ";", "i", "++", ")", "{", "ABI", "[", "i", "]", "=", "(", "char", ")", ...
Test to see if the file is ABI format by checking to see that the first three bytes are "ABI". Also handle the special case where 128 bytes were prepended to the file due to binary FTP from an older macintosh system. @return - if format of ABI file is correct
[ "Test", "to", "see", "if", "the", "file", "is", "ABI", "format", "by", "checking", "to", "see", "that", "the", "first", "three", "bytes", "are", "ABI", ".", "Also", "handle", "the", "special", "case", "where", "128", "bytes", "were", "prepended", "to", ...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/ABITrace.java#L575-L593
32,031
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java
GeneNamesParser.main
public static void main(String[] args) { try { List<GeneName> geneNames = getGeneNames(); logger.info("got {} gene names", geneNames.size()); for ( GeneName g : geneNames){ if ( g.getApprovedSymbol().equals("FOLH1")) logger.info("Gene Name: {}", g); } // and returns a list of beans that contains key-value pairs for each gene name } catch (Exception e) { // TODO Auto-generated catch block logger.error("Exception: ", e); } }
java
public static void main(String[] args) { try { List<GeneName> geneNames = getGeneNames(); logger.info("got {} gene names", geneNames.size()); for ( GeneName g : geneNames){ if ( g.getApprovedSymbol().equals("FOLH1")) logger.info("Gene Name: {}", g); } // and returns a list of beans that contains key-value pairs for each gene name } catch (Exception e) { // TODO Auto-generated catch block logger.error("Exception: ", e); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "try", "{", "List", "<", "GeneName", ">", "geneNames", "=", "getGeneNames", "(", ")", ";", "logger", ".", "info", "(", "\"got {} gene names\"", ",", "geneNames", ".", "size", ...
parses a file from the genenames website @param args
[ "parses", "a", "file", "from", "the", "genenames", "website" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java#L55-L74
32,032
biojava/biojava
biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java
GeneNamesParser.getGeneNames
public static List<GeneName> getGeneNames(InputStream inStream) throws IOException{ ArrayList<GeneName> geneNames = new ArrayList<GeneName>(); BufferedReader reader = new BufferedReader(new InputStreamReader(inStream)); // skip reading first line (it is the legend) String line = reader.readLine(); while ((line = reader.readLine()) != null) { // process line... //System.out.println(Arrays.toString(line.split("\t"))); GeneName geneName = getGeneName(line); if ( geneName != null) geneNames.add(geneName); //System.out.println(geneName); } // since this is a large list, let's free up unused space... geneNames.trimToSize(); return geneNames; }
java
public static List<GeneName> getGeneNames(InputStream inStream) throws IOException{ ArrayList<GeneName> geneNames = new ArrayList<GeneName>(); BufferedReader reader = new BufferedReader(new InputStreamReader(inStream)); // skip reading first line (it is the legend) String line = reader.readLine(); while ((line = reader.readLine()) != null) { // process line... //System.out.println(Arrays.toString(line.split("\t"))); GeneName geneName = getGeneName(line); if ( geneName != null) geneNames.add(geneName); //System.out.println(geneName); } // since this is a large list, let's free up unused space... geneNames.trimToSize(); return geneNames; }
[ "public", "static", "List", "<", "GeneName", ">", "getGeneNames", "(", "InputStream", "inStream", ")", "throws", "IOException", "{", "ArrayList", "<", "GeneName", ">", "geneNames", "=", "new", "ArrayList", "<", "GeneName", ">", "(", ")", ";", "BufferedReader",...
Get a list of GeneNames from an input stream. @param inStream @return list of geneNames @throws IOException
[ "Get", "a", "list", "of", "GeneNames", "from", "an", "input", "stream", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-genome/src/main/java/org/biojava/nbio/genome/parsers/genename/GeneNamesParser.java#L93-L115
32,033
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.addIntronsUsingExons
public void addIntronsUsingExons() throws Exception { if (intronAdded) { //going to assume introns are correct return; } if (exonSequenceList.size() == 0) { return; } ExonComparator exonComparator = new ExonComparator(); //sort based on start position and sense; Collections.sort(exonSequenceList, exonComparator); int shift = -1; if (getStrand() == Strand.NEGATIVE) { shift = 1; } //ExonSequence firstExonSequence = exonSequenceList.get(0); int intronIndex = 1; // if (firstExonSequence.getBioBegin().intValue() != getBioBegin().intValue()) { // this.addIntron(new AccessionID(this.getAccession().getID() + "-" + "intron" + intronIndex), getBioBegin(), firstExonSequence.getBioBegin() + shift); // intronIndex++; // } for (int i = 0; i < exonSequenceList.size() - 1; i++) { ExonSequence exon1 = exonSequenceList.get(i); ExonSequence exon2 = exonSequenceList.get(i + 1); this.addIntron(new AccessionID(this.getAccession().getID() + "-" + "intron" + intronIndex), exon1.getBioEnd() - shift, exon2.getBioBegin() + shift); intronIndex++; } // ExonSequence lastExonSequence = exonSequenceList.get(exonSequenceList.size() - 1); // if (lastExonSequence.getBioEnd().intValue() != getBioEnd().intValue()) { // this.addIntron(new AccessionID(this.getAccession().getID() + "-" + "intron" + intronIndex), lastExonSequence.getBioEnd() - shift, getBioEnd()); // intronIndex++; // } // log.severe("Add in support for building introns based on added exons"); }
java
public void addIntronsUsingExons() throws Exception { if (intronAdded) { //going to assume introns are correct return; } if (exonSequenceList.size() == 0) { return; } ExonComparator exonComparator = new ExonComparator(); //sort based on start position and sense; Collections.sort(exonSequenceList, exonComparator); int shift = -1; if (getStrand() == Strand.NEGATIVE) { shift = 1; } //ExonSequence firstExonSequence = exonSequenceList.get(0); int intronIndex = 1; // if (firstExonSequence.getBioBegin().intValue() != getBioBegin().intValue()) { // this.addIntron(new AccessionID(this.getAccession().getID() + "-" + "intron" + intronIndex), getBioBegin(), firstExonSequence.getBioBegin() + shift); // intronIndex++; // } for (int i = 0; i < exonSequenceList.size() - 1; i++) { ExonSequence exon1 = exonSequenceList.get(i); ExonSequence exon2 = exonSequenceList.get(i + 1); this.addIntron(new AccessionID(this.getAccession().getID() + "-" + "intron" + intronIndex), exon1.getBioEnd() - shift, exon2.getBioBegin() + shift); intronIndex++; } // ExonSequence lastExonSequence = exonSequenceList.get(exonSequenceList.size() - 1); // if (lastExonSequence.getBioEnd().intValue() != getBioEnd().intValue()) { // this.addIntron(new AccessionID(this.getAccession().getID() + "-" + "intron" + intronIndex), lastExonSequence.getBioEnd() - shift, getBioEnd()); // intronIndex++; // } // log.severe("Add in support for building introns based on added exons"); }
[ "public", "void", "addIntronsUsingExons", "(", ")", "throws", "Exception", "{", "if", "(", "intronAdded", ")", "{", "//going to assume introns are correct", "return", ";", "}", "if", "(", "exonSequenceList", ".", "size", "(", ")", "==", "0", ")", "{", "return"...
Once everything has been added to the gene sequence where you might have added exon sequences only then you can infer the intron sequences and add them. You may also have the case where you only added one or more TranscriptSequences and from that you can infer the exon sequences and intron sequences. Currently not implement
[ "Once", "everything", "has", "been", "added", "to", "the", "gene", "sequence", "where", "you", "might", "have", "added", "exon", "sequences", "only", "then", "you", "can", "infer", "the", "intron", "sequences", "and", "add", "them", ".", "You", "may", "als...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L96-L131
32,034
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.addTranscript
public TranscriptSequence addTranscript(AccessionID accession, int begin, int end) throws Exception { if (transcriptSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } TranscriptSequence transcriptSequence = new TranscriptSequence(this, begin, end); transcriptSequence.setAccession(accession); transcriptSequenceHashMap.put(accession.getID(), transcriptSequence); return transcriptSequence; }
java
public TranscriptSequence addTranscript(AccessionID accession, int begin, int end) throws Exception { if (transcriptSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } TranscriptSequence transcriptSequence = new TranscriptSequence(this, begin, end); transcriptSequence.setAccession(accession); transcriptSequenceHashMap.put(accession.getID(), transcriptSequence); return transcriptSequence; }
[ "public", "TranscriptSequence", "addTranscript", "(", "AccessionID", "accession", ",", "int", "begin", ",", "int", "end", ")", "throws", "Exception", "{", "if", "(", "transcriptSequenceHashMap", ".", "containsKey", "(", "accession", ".", "getID", "(", ")", ")", ...
Add a transcription sequence to a gene which describes a ProteinSequence @param accession @param begin @param end @return transcript sequence @throws Exception If the accession id is already used
[ "Add", "a", "transcription", "sequence", "to", "a", "gene", "which", "describes", "a", "ProteinSequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L184-L192
32,035
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.removeIntron
public IntronSequence removeIntron(String accession) { for (IntronSequence intronSequence : intronSequenceList) { if (intronSequence.getAccession().getID().equals(accession)) { intronSequenceList.remove(intronSequence); intronSequenceHashMap.remove(accession); return intronSequence; } } return null; }
java
public IntronSequence removeIntron(String accession) { for (IntronSequence intronSequence : intronSequenceList) { if (intronSequence.getAccession().getID().equals(accession)) { intronSequenceList.remove(intronSequence); intronSequenceHashMap.remove(accession); return intronSequence; } } return null; }
[ "public", "IntronSequence", "removeIntron", "(", "String", "accession", ")", "{", "for", "(", "IntronSequence", "intronSequence", ":", "intronSequenceList", ")", "{", "if", "(", "intronSequence", ".", "getAccession", "(", ")", ".", "getID", "(", ")", ".", "equ...
Remove the intron by accession @param accession @return intron sequence
[ "Remove", "the", "intron", "by", "accession" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L199-L208
32,036
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.addIntron
public IntronSequence addIntron(AccessionID accession, int begin, int end) throws Exception { if (intronSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } intronAdded = true; IntronSequence intronSequence = new IntronSequence(this, begin, end); // working off the assumption that intron frame is always 0 or doesn't matter and same sense as parent intronSequence.setAccession(accession); intronSequenceList.add(intronSequence); intronSequenceHashMap.put(accession.getID(), intronSequence); return intronSequence; }
java
public IntronSequence addIntron(AccessionID accession, int begin, int end) throws Exception { if (intronSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } intronAdded = true; IntronSequence intronSequence = new IntronSequence(this, begin, end); // working off the assumption that intron frame is always 0 or doesn't matter and same sense as parent intronSequence.setAccession(accession); intronSequenceList.add(intronSequence); intronSequenceHashMap.put(accession.getID(), intronSequence); return intronSequence; }
[ "public", "IntronSequence", "addIntron", "(", "AccessionID", "accession", ",", "int", "begin", ",", "int", "end", ")", "throws", "Exception", "{", "if", "(", "intronSequenceHashMap", ".", "containsKey", "(", "accession", ".", "getID", "(", ")", ")", ")", "{"...
Add an Intron Currently used to mark an IntronSequence as a feature @param accession @param begin @param end @return intron sequence
[ "Add", "an", "Intron", "Currently", "used", "to", "mark", "an", "IntronSequence", "as", "a", "feature" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L217-L227
32,037
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.removeExon
public ExonSequence removeExon(String accession) { for (ExonSequence exonSequence : exonSequenceList) { if (exonSequence.getAccession().getID().equals(accession)) { exonSequenceList.remove(exonSequence); exonSequenceHashMap.remove(accession); // we now have a new gap which creates an intron intronSequenceList.clear(); intronSequenceHashMap.clear(); intronAdded = false; try{ addIntronsUsingExons(); } catch(Exception e){ logger.error("Remove Exon validate() error " + e.getMessage()); } return exonSequence; } } return null; }
java
public ExonSequence removeExon(String accession) { for (ExonSequence exonSequence : exonSequenceList) { if (exonSequence.getAccession().getID().equals(accession)) { exonSequenceList.remove(exonSequence); exonSequenceHashMap.remove(accession); // we now have a new gap which creates an intron intronSequenceList.clear(); intronSequenceHashMap.clear(); intronAdded = false; try{ addIntronsUsingExons(); } catch(Exception e){ logger.error("Remove Exon validate() error " + e.getMessage()); } return exonSequence; } } return null; }
[ "public", "ExonSequence", "removeExon", "(", "String", "accession", ")", "{", "for", "(", "ExonSequence", "exonSequence", ":", "exonSequenceList", ")", "{", "if", "(", "exonSequence", ".", "getAccession", "(", ")", ".", "getID", "(", ")", ".", "equals", "(",...
Remove the exon sequence @param accession @return exon sequence
[ "Remove", "the", "exon", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L234-L252
32,038
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.addExon
public ExonSequence addExon(AccessionID accession, int begin, int end) throws Exception { if (exonSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } ExonSequence exonSequence = new ExonSequence(this, begin, end); //sense should be the same as parent exonSequence.setAccession(accession); exonSequenceList.add(exonSequence); exonSequenceHashMap.put(accession.getID(), exonSequence); return exonSequence; }
java
public ExonSequence addExon(AccessionID accession, int begin, int end) throws Exception { if (exonSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } ExonSequence exonSequence = new ExonSequence(this, begin, end); //sense should be the same as parent exonSequence.setAccession(accession); exonSequenceList.add(exonSequence); exonSequenceHashMap.put(accession.getID(), exonSequence); return exonSequence; }
[ "public", "ExonSequence", "addExon", "(", "AccessionID", "accession", ",", "int", "begin", ",", "int", "end", ")", "throws", "Exception", "{", "if", "(", "exonSequenceHashMap", ".", "containsKey", "(", "accession", ".", "getID", "(", ")", ")", ")", "{", "t...
Add an ExonSequence mainly used to mark as a feature @param accession @param begin @param end @return exon sequence
[ "Add", "an", "ExonSequence", "mainly", "used", "to", "mark", "as", "a", "feature" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L261-L271
32,039
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java
GeneSequence.getSequence5PrimeTo3Prime
public DNASequence getSequence5PrimeTo3Prime() { String sequence = getSequenceAsString(this.getBioBegin(), this.getBioEnd(), this.getStrand()); if (getStrand() == Strand.NEGATIVE) { //need to take complement of sequence because it is negative and we are returning the gene sequence from the opposite strand StringBuilder b = new StringBuilder(getLength()); CompoundSet<NucleotideCompound> compoundSet = this.getCompoundSet(); for (int i = 0; i < sequence.length(); i++) { String nucleotide = String.valueOf(sequence.charAt(i)); NucleotideCompound nucleotideCompound = compoundSet.getCompoundForString(nucleotide); b.append(nucleotideCompound.getComplement().getShortName()); } sequence = b.toString(); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sequence.toUpperCase()); } catch (CompoundNotFoundException e) { // this should not happen, the sequence is DNA originally, if it does, there's a bug somewhere logger.error("Could not create new DNA sequence in getSequence5PrimeTo3Prime(). Error: {}",e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; }
java
public DNASequence getSequence5PrimeTo3Prime() { String sequence = getSequenceAsString(this.getBioBegin(), this.getBioEnd(), this.getStrand()); if (getStrand() == Strand.NEGATIVE) { //need to take complement of sequence because it is negative and we are returning the gene sequence from the opposite strand StringBuilder b = new StringBuilder(getLength()); CompoundSet<NucleotideCompound> compoundSet = this.getCompoundSet(); for (int i = 0; i < sequence.length(); i++) { String nucleotide = String.valueOf(sequence.charAt(i)); NucleotideCompound nucleotideCompound = compoundSet.getCompoundForString(nucleotide); b.append(nucleotideCompound.getComplement().getShortName()); } sequence = b.toString(); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sequence.toUpperCase()); } catch (CompoundNotFoundException e) { // this should not happen, the sequence is DNA originally, if it does, there's a bug somewhere logger.error("Could not create new DNA sequence in getSequence5PrimeTo3Prime(). Error: {}",e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; }
[ "public", "DNASequence", "getSequence5PrimeTo3Prime", "(", ")", "{", "String", "sequence", "=", "getSequenceAsString", "(", "this", ".", "getBioBegin", "(", ")", ",", "this", ".", "getBioEnd", "(", ")", ",", "this", ".", "getStrand", "(", ")", ")", ";", "i...
Try to give method clarity where you want a DNASequence coding in the 5' to 3' direction Returns the DNASequence representative of the 5' and 3' reading based on strand @return dna sequence
[ "Try", "to", "give", "method", "clarity", "where", "you", "want", "a", "DNASequence", "coding", "in", "the", "5", "to", "3", "direction", "Returns", "the", "DNASequence", "representative", "of", "the", "5", "and", "3", "reading", "based", "on", "strand" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/GeneSequence.java#L294-L316
32,040
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java
PDBHeader.toPDB
@Override public void toPDB(StringBuffer buf){ // 1 2 3 4 5 6 7 //01234567890123456789012345678901234567890123456789012345678901234567890123456789 //HEADER COMPLEX (SERINE PROTEASE/INHIBITORS) 06-FEB-98 1A4W //TITLE CRYSTAL STRUCTURES OF THROMBIN WITH THIAZOLE-CONTAINING //TITLE 2 INHIBITORS: PROBES OF THE S1' BINDING SITE printHeader(buf); printTitle(buf); printExpdata(buf); printAuthors(buf); printResolution(buf); }
java
@Override public void toPDB(StringBuffer buf){ // 1 2 3 4 5 6 7 //01234567890123456789012345678901234567890123456789012345678901234567890123456789 //HEADER COMPLEX (SERINE PROTEASE/INHIBITORS) 06-FEB-98 1A4W //TITLE CRYSTAL STRUCTURES OF THROMBIN WITH THIAZOLE-CONTAINING //TITLE 2 INHIBITORS: PROBES OF THE S1' BINDING SITE printHeader(buf); printTitle(buf); printExpdata(buf); printAuthors(buf); printResolution(buf); }
[ "@", "Override", "public", "void", "toPDB", "(", "StringBuffer", "buf", ")", "{", "// 1 2 3 4 5 6 7", "//01234567890123456789012345678901234567890123456789012345678901234567890123456789", "//HEADER COMPLEX (SERINE PROTEASE/INHIBITOR...
Appends a PDB representation of the PDB header to the provided StringBuffer @param buf
[ "Appends", "a", "PDB", "representation", "of", "the", "PDB", "header", "to", "the", "provided", "StringBuffer" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java#L151-L165
32,041
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java
PDBHeader.setExperimentalTechnique
public boolean setExperimentalTechnique(String techniqueStr) { ExperimentalTechnique et = ExperimentalTechnique.getByName(techniqueStr); if (et==null) return false; if (techniques==null) { techniques = EnumSet.of(et); return true; } else { return techniques.add(et); } }
java
public boolean setExperimentalTechnique(String techniqueStr) { ExperimentalTechnique et = ExperimentalTechnique.getByName(techniqueStr); if (et==null) return false; if (techniques==null) { techniques = EnumSet.of(et); return true; } else { return techniques.add(et); } }
[ "public", "boolean", "setExperimentalTechnique", "(", "String", "techniqueStr", ")", "{", "ExperimentalTechnique", "et", "=", "ExperimentalTechnique", ".", "getByName", "(", "techniqueStr", ")", ";", "if", "(", "et", "==", "null", ")", "return", "false", ";", "i...
Adds the experimental technique to the set of experimental techniques of this header. Note that if input is not a recognised technique string then no errors will be produced but false will be returned @param techniqueStr @return true if the input corresponds to a recognised technique string (see {@link ExperimentalTechnique}) and it was not already present in the current set of ExperimentalTechniques
[ "Adds", "the", "experimental", "technique", "to", "the", "set", "of", "experimental", "techniques", "of", "this", "header", ".", "Note", "that", "if", "input", "is", "not", "a", "recognised", "technique", "string", "then", "no", "errors", "will", "be", "prod...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/PDBHeader.java#L511-L524
32,042
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/ChargeAdder.java
ChargeAdder.addCharges
public static void addCharges(Structure structure) { // Loop through the models for(int i=0; i<structure.nrModels(); i++){ for(Chain c: structure.getChains(i)){ for(Group g: c.getAtomGroups()){ ChemComp thisChemComp = ChemCompGroupFactory.getChemComp(g.getPDBName()); List<ChemCompAtom> chemAtoms = thisChemComp.getAtoms(); for(ChemCompAtom chemCompAtom : chemAtoms) { Atom atom = g.getAtom(chemCompAtom.getAtom_id()); String stringCharge = chemCompAtom.getCharge(); short shortCharge = 0; if (stringCharge!=null){ if(!stringCharge.equals("?")){ try{ shortCharge = Short.parseShort(stringCharge); } catch(NumberFormatException e){ logger.warn("Number format exception. Parsing '"+stringCharge+"' to short"); } } else{ logger.warn("? charge on atom "+chemCompAtom.getAtom_id()+" in group "+thisChemComp.getId()); } } else{ logger.warn("Null charge on atom "+chemCompAtom.getAtom_id()+" in group "+thisChemComp.getId()); } if(atom!=null){ atom.setCharge(shortCharge); } // Now do the same for alt locs for (Group altLoc : g.getAltLocs()) { Atom altAtom = altLoc.getAtom(chemCompAtom.getAtom_id()); if(altAtom!=null){ altAtom.setCharge(shortCharge); } } } } } } }
java
public static void addCharges(Structure structure) { // Loop through the models for(int i=0; i<structure.nrModels(); i++){ for(Chain c: structure.getChains(i)){ for(Group g: c.getAtomGroups()){ ChemComp thisChemComp = ChemCompGroupFactory.getChemComp(g.getPDBName()); List<ChemCompAtom> chemAtoms = thisChemComp.getAtoms(); for(ChemCompAtom chemCompAtom : chemAtoms) { Atom atom = g.getAtom(chemCompAtom.getAtom_id()); String stringCharge = chemCompAtom.getCharge(); short shortCharge = 0; if (stringCharge!=null){ if(!stringCharge.equals("?")){ try{ shortCharge = Short.parseShort(stringCharge); } catch(NumberFormatException e){ logger.warn("Number format exception. Parsing '"+stringCharge+"' to short"); } } else{ logger.warn("? charge on atom "+chemCompAtom.getAtom_id()+" in group "+thisChemComp.getId()); } } else{ logger.warn("Null charge on atom "+chemCompAtom.getAtom_id()+" in group "+thisChemComp.getId()); } if(atom!=null){ atom.setCharge(shortCharge); } // Now do the same for alt locs for (Group altLoc : g.getAltLocs()) { Atom altAtom = altLoc.getAtom(chemCompAtom.getAtom_id()); if(altAtom!=null){ altAtom.setCharge(shortCharge); } } } } } } }
[ "public", "static", "void", "addCharges", "(", "Structure", "structure", ")", "{", "// Loop through the models", "for", "(", "int", "i", "=", "0", ";", "i", "<", "structure", ".", "nrModels", "(", ")", ";", "i", "++", ")", "{", "for", "(", "Chain", "c"...
Function to add the charges to a given structure.
[ "Function", "to", "add", "the", "charges", "to", "a", "given", "structure", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/ChargeAdder.java#L49-L91
32,043
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java
SymmOptimizer.updateMultipleAlignment
private void updateMultipleAlignment() throws StructureException, RefinerFailedException { msa.clear(); // Override the alignment with the new information Block b = msa.getBlock(0); b.setAlignRes(block); repeatCore = b.getCoreLength(); if (repeatCore < 1) throw new RefinerFailedException( "Optimization converged to length 0"); SymmetryTools.updateSymmetryTransformation(axes, msa); }
java
private void updateMultipleAlignment() throws StructureException, RefinerFailedException { msa.clear(); // Override the alignment with the new information Block b = msa.getBlock(0); b.setAlignRes(block); repeatCore = b.getCoreLength(); if (repeatCore < 1) throw new RefinerFailedException( "Optimization converged to length 0"); SymmetryTools.updateSymmetryTransformation(axes, msa); }
[ "private", "void", "updateMultipleAlignment", "(", ")", "throws", "StructureException", ",", "RefinerFailedException", "{", "msa", ".", "clear", "(", ")", ";", "// Override the alignment with the new information", "Block", "b", "=", "msa", ".", "getBlock", "(", "0", ...
This method translates the internal data structures to a MultipleAlignment of the repeats in order to use the methods to score MultipleAlignments. @throws StructureException @throws RefinerFailedException
[ "This", "method", "translates", "the", "internal", "data", "structures", "to", "a", "MultipleAlignment", "of", "the", "repeats", "in", "order", "to", "use", "the", "methods", "to", "score", "MultipleAlignments", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java#L341-L355
32,044
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java
SymmOptimizer.shrinkBlock
private boolean shrinkBlock() throws StructureException, RefinerFailedException { // Let shrink moves only if the repeat is larger enough if (repeatCore <= Lmin) return false; // Select column by maximum distance updateMultipleAlignment(); Matrix residueDistances = MultipleAlignmentTools .getAverageResidueDistances(msa); double maxDist = Double.MIN_VALUE; double[] colDistances = new double[length]; int res = 0; for (int col = 0; col < length; col++) { int normalize = 0; for (int s = 0; s < order; s++) { if (residueDistances.get(s, col) != -1) { colDistances[col] += residueDistances.get(s, col); normalize++; } } colDistances[col] /= normalize; if (colDistances[col] > maxDist) { // geometric distribution if (rnd.nextDouble() > 0.5) { maxDist = colDistances[col]; res = col; } } } for (int su = 0; su < order; su++) { Integer residue = block.get(su).get(res); block.get(su).remove(res); if (residue != null) freePool.add(residue); Collections.sort(freePool); } length--; checkGaps(); return true; }
java
private boolean shrinkBlock() throws StructureException, RefinerFailedException { // Let shrink moves only if the repeat is larger enough if (repeatCore <= Lmin) return false; // Select column by maximum distance updateMultipleAlignment(); Matrix residueDistances = MultipleAlignmentTools .getAverageResidueDistances(msa); double maxDist = Double.MIN_VALUE; double[] colDistances = new double[length]; int res = 0; for (int col = 0; col < length; col++) { int normalize = 0; for (int s = 0; s < order; s++) { if (residueDistances.get(s, col) != -1) { colDistances[col] += residueDistances.get(s, col); normalize++; } } colDistances[col] /= normalize; if (colDistances[col] > maxDist) { // geometric distribution if (rnd.nextDouble() > 0.5) { maxDist = colDistances[col]; res = col; } } } for (int su = 0; su < order; su++) { Integer residue = block.get(su).get(res); block.get(su).remove(res); if (residue != null) freePool.add(residue); Collections.sort(freePool); } length--; checkGaps(); return true; }
[ "private", "boolean", "shrinkBlock", "(", ")", "throws", "StructureException", ",", "RefinerFailedException", "{", "// Let shrink moves only if the repeat is larger enough", "if", "(", "repeatCore", "<=", "Lmin", ")", "return", "false", ";", "// Select column by maximum dista...
Deletes an alignment column at a randomly selected position. @throws StructureException @throws RefinerFailedException
[ "Deletes", "an", "alignment", "column", "at", "a", "randomly", "selected", "position", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java#L775-L818
32,045
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java
SymmOptimizer.saveHistory
private void saveHistory(String folder) throws IOException { String name = msa.getStructureIdentifier(0).getIdentifier(); FileWriter writer = new FileWriter(folder + name + "-symm_opt.csv"); writer.append("Step,Time,RepeatLength,RMSD,TMscore,MCscore\n"); for (int i = 0; i < lengthHistory.size(); i++) { writer.append(i * saveStep + ","); writer.append(timeHistory.get(i) + ","); writer.append(lengthHistory.get(i) + ","); writer.append(rmsdHistory.get(i) + ","); writer.append(tmScoreHistory.get(i) + ","); writer.append(mcScoreHistory.get(i) + "\n"); } writer.flush(); writer.close(); }
java
private void saveHistory(String folder) throws IOException { String name = msa.getStructureIdentifier(0).getIdentifier(); FileWriter writer = new FileWriter(folder + name + "-symm_opt.csv"); writer.append("Step,Time,RepeatLength,RMSD,TMscore,MCscore\n"); for (int i = 0; i < lengthHistory.size(); i++) { writer.append(i * saveStep + ","); writer.append(timeHistory.get(i) + ","); writer.append(lengthHistory.get(i) + ","); writer.append(rmsdHistory.get(i) + ","); writer.append(tmScoreHistory.get(i) + ","); writer.append(mcScoreHistory.get(i) + "\n"); } writer.flush(); writer.close(); }
[ "private", "void", "saveHistory", "(", "String", "folder", ")", "throws", "IOException", "{", "String", "name", "=", "msa", ".", "getStructureIdentifier", "(", "0", ")", ".", "getIdentifier", "(", ")", ";", "FileWriter", "writer", "=", "new", "FileWriter", "...
Save the evolution of the optimization process as a csv file.
[ "Save", "the", "evolution", "of", "the", "optimization", "process", "as", "a", "csv", "file", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/internal/SymmOptimizer.java#L837-L855
32,046
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureWriter.java
MmtfStructureWriter.addBonds
private void addBonds(Atom atom, List<Atom> atomsInGroup, List<Atom> allAtoms) { if(atom.getBonds()==null){ return; } for(Bond bond : atom.getBonds()) { // Now set the bonding information. Atom other = bond.getOther(atom); // If both atoms are in the group if (atomsInGroup.indexOf(other)!=-1){ Integer firstBondIndex = atomsInGroup.indexOf(atom); Integer secondBondIndex = atomsInGroup.indexOf(other); // Don't add the same bond twice if(firstBondIndex>secondBondIndex){ int bondOrder = bond.getBondOrder(); mmtfDecoderInterface.setGroupBond(firstBondIndex, secondBondIndex, bondOrder); } } // Otherwise it's an inter group bond - so add it here else { Integer firstBondIndex = allAtoms.indexOf(atom); Integer secondBondIndex = allAtoms.indexOf(other); if(firstBondIndex>secondBondIndex){ // Don't add the same bond twice int bondOrder = bond.getBondOrder(); mmtfDecoderInterface.setInterGroupBond(firstBondIndex, secondBondIndex, bondOrder); } } } }
java
private void addBonds(Atom atom, List<Atom> atomsInGroup, List<Atom> allAtoms) { if(atom.getBonds()==null){ return; } for(Bond bond : atom.getBonds()) { // Now set the bonding information. Atom other = bond.getOther(atom); // If both atoms are in the group if (atomsInGroup.indexOf(other)!=-1){ Integer firstBondIndex = atomsInGroup.indexOf(atom); Integer secondBondIndex = atomsInGroup.indexOf(other); // Don't add the same bond twice if(firstBondIndex>secondBondIndex){ int bondOrder = bond.getBondOrder(); mmtfDecoderInterface.setGroupBond(firstBondIndex, secondBondIndex, bondOrder); } } // Otherwise it's an inter group bond - so add it here else { Integer firstBondIndex = allAtoms.indexOf(atom); Integer secondBondIndex = allAtoms.indexOf(other); if(firstBondIndex>secondBondIndex){ // Don't add the same bond twice int bondOrder = bond.getBondOrder(); mmtfDecoderInterface.setInterGroupBond(firstBondIndex, secondBondIndex, bondOrder); } } } }
[ "private", "void", "addBonds", "(", "Atom", "atom", ",", "List", "<", "Atom", ">", "atomsInGroup", ",", "List", "<", "Atom", ">", "allAtoms", ")", "{", "if", "(", "atom", ".", "getBonds", "(", ")", "==", "null", ")", "{", "return", ";", "}", "for",...
Add the bonds for a given atom. @param atom the atom for which bonds are to be formed @param atomsInGroup the list of atoms in the group @param allAtoms the list of atoms in the whole structure
[ "Add", "the", "bonds", "for", "a", "given", "atom", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureWriter.java#L132-L160
32,047
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureWriter.java
MmtfStructureWriter.storeEntityInformation
private void storeEntityInformation(List<Chain> allChains, List<EntityInfo> entityInfos) { for (EntityInfo entityInfo : entityInfos) { String description = entityInfo.getDescription(); String type; if (entityInfo.getType()==null){ type = null; } else{ type = entityInfo.getType().getEntityType(); } List<Chain> entityChains = entityInfo.getChains(); if (entityChains.isEmpty()){ // Error mapping chain to entity System.err.println("ERROR MAPPING CHAIN TO ENTITY: "+description); mmtfDecoderInterface.setEntityInfo(new int[0], "", description, type); continue; } else{ int[] chainIndices = new int[entityChains.size()]; for (int i=0; i<entityChains.size(); i++) { chainIndices[i] = allChains.indexOf(entityChains.get(i)); } Chain chain = entityChains.get(0); ChainImpl chainImpl; if (chain instanceof ChainImpl){ chainImpl = (ChainImpl) entityChains.get(0); } else{ throw new RuntimeException(); } String sequence = chainImpl.getSeqResOneLetterSeq(); mmtfDecoderInterface.setEntityInfo(chainIndices, sequence, description, type); } } }
java
private void storeEntityInformation(List<Chain> allChains, List<EntityInfo> entityInfos) { for (EntityInfo entityInfo : entityInfos) { String description = entityInfo.getDescription(); String type; if (entityInfo.getType()==null){ type = null; } else{ type = entityInfo.getType().getEntityType(); } List<Chain> entityChains = entityInfo.getChains(); if (entityChains.isEmpty()){ // Error mapping chain to entity System.err.println("ERROR MAPPING CHAIN TO ENTITY: "+description); mmtfDecoderInterface.setEntityInfo(new int[0], "", description, type); continue; } else{ int[] chainIndices = new int[entityChains.size()]; for (int i=0; i<entityChains.size(); i++) { chainIndices[i] = allChains.indexOf(entityChains.get(i)); } Chain chain = entityChains.get(0); ChainImpl chainImpl; if (chain instanceof ChainImpl){ chainImpl = (ChainImpl) entityChains.get(0); } else{ throw new RuntimeException(); } String sequence = chainImpl.getSeqResOneLetterSeq(); mmtfDecoderInterface.setEntityInfo(chainIndices, sequence, description, type); } } }
[ "private", "void", "storeEntityInformation", "(", "List", "<", "Chain", ">", "allChains", ",", "List", "<", "EntityInfo", ">", "entityInfos", ")", "{", "for", "(", "EntityInfo", "entityInfo", ":", "entityInfos", ")", "{", "String", "description", "=", "entityI...
Store the entity information for a given structure. @param allChains a list of all the chains in a structure @param entityInfos a list of the entity information
[ "Store", "the", "entity", "information", "for", "a", "given", "structure", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureWriter.java#L168-L202
32,048
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureWriter.java
MmtfStructureWriter.storeBioassemblyInformation
private void storeBioassemblyInformation(Map<String, Integer> chainIdToIndexMap, Map<Integer, BioAssemblyInfo> inputBioAss) { int bioAssemblyIndex = 0; for (Entry<Integer, BioAssemblyInfo> entry : inputBioAss.entrySet()) { Map<double[], int[]> transformMap = MmtfUtils.getTransformMap(entry.getValue(), chainIdToIndexMap); for(Entry<double[], int[]> transformEntry : transformMap.entrySet()) { mmtfDecoderInterface.setBioAssemblyTrans(bioAssemblyIndex, transformEntry.getValue(), transformEntry.getKey(), entry.getKey().toString()); } bioAssemblyIndex++; } }
java
private void storeBioassemblyInformation(Map<String, Integer> chainIdToIndexMap, Map<Integer, BioAssemblyInfo> inputBioAss) { int bioAssemblyIndex = 0; for (Entry<Integer, BioAssemblyInfo> entry : inputBioAss.entrySet()) { Map<double[], int[]> transformMap = MmtfUtils.getTransformMap(entry.getValue(), chainIdToIndexMap); for(Entry<double[], int[]> transformEntry : transformMap.entrySet()) { mmtfDecoderInterface.setBioAssemblyTrans(bioAssemblyIndex, transformEntry.getValue(), transformEntry.getKey(), entry.getKey().toString()); } bioAssemblyIndex++; } }
[ "private", "void", "storeBioassemblyInformation", "(", "Map", "<", "String", ",", "Integer", ">", "chainIdToIndexMap", ",", "Map", "<", "Integer", ",", "BioAssemblyInfo", ">", "inputBioAss", ")", "{", "int", "bioAssemblyIndex", "=", "0", ";", "for", "(", "Entr...
Generate the bioassembly information on in the desired form. @param bioJavaStruct the Biojava structure @param header the header
[ "Generate", "the", "bioassembly", "information", "on", "in", "the", "desired", "form", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmtf/MmtfStructureWriter.java#L210-L219
32,049
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java
TranscriptSequence.removeCDS
public CDSSequence removeCDS(String accession) { for (CDSSequence cdsSequence : cdsSequenceList) { if (cdsSequence.getAccession().getID().equals(accession)) { cdsSequenceList.remove(cdsSequence); cdsSequenceHashMap.remove(accession); return cdsSequence; } } return null; }
java
public CDSSequence removeCDS(String accession) { for (CDSSequence cdsSequence : cdsSequenceList) { if (cdsSequence.getAccession().getID().equals(accession)) { cdsSequenceList.remove(cdsSequence); cdsSequenceHashMap.remove(accession); return cdsSequence; } } return null; }
[ "public", "CDSSequence", "removeCDS", "(", "String", "accession", ")", "{", "for", "(", "CDSSequence", "cdsSequence", ":", "cdsSequenceList", ")", "{", "if", "(", "cdsSequence", ".", "getAccession", "(", ")", ".", "getID", "(", ")", ".", "equals", "(", "ac...
Remove a CDS or coding sequence from the transcript sequence @param accession @return
[ "Remove", "a", "CDS", "or", "coding", "sequence", "from", "the", "transcript", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java#L82-L91
32,050
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java
TranscriptSequence.addCDS
public CDSSequence addCDS(AccessionID accession, int begin, int end, int phase) throws Exception { if (cdsSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } CDSSequence cdsSequence = new CDSSequence(this, begin, end, phase); //sense should be the same as parent cdsSequence.setAccession(accession); cdsSequenceList.add(cdsSequence); Collections.sort(cdsSequenceList, new CDSComparator()); cdsSequenceHashMap.put(accession.getID(), cdsSequence); return cdsSequence; }
java
public CDSSequence addCDS(AccessionID accession, int begin, int end, int phase) throws Exception { if (cdsSequenceHashMap.containsKey(accession.getID())) { throw new Exception("Duplicate accesion id " + accession.getID()); } CDSSequence cdsSequence = new CDSSequence(this, begin, end, phase); //sense should be the same as parent cdsSequence.setAccession(accession); cdsSequenceList.add(cdsSequence); Collections.sort(cdsSequenceList, new CDSComparator()); cdsSequenceHashMap.put(accession.getID(), cdsSequence); return cdsSequence; }
[ "public", "CDSSequence", "addCDS", "(", "AccessionID", "accession", ",", "int", "begin", ",", "int", "end", ",", "int", "phase", ")", "throws", "Exception", "{", "if", "(", "cdsSequenceHashMap", ".", "containsKey", "(", "accession", ".", "getID", "(", ")", ...
Add a Coding Sequence region with phase to the transcript sequence @param accession @param begin @param end @param phase 0,1,2 @return
[ "Add", "a", "Coding", "Sequence", "region", "with", "phase", "to", "the", "transcript", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java#L109-L119
32,051
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java
TranscriptSequence.getDNACodingSequence
public DNASequence getDNACodingSequence() { StringBuilder sb = new StringBuilder(); for (CDSSequence cdsSequence : cdsSequenceList) { sb.append(cdsSequence.getCodingSequence()); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sb.toString().toUpperCase()); } catch (CompoundNotFoundException e) { // if I understand this should not happen, please correct if I'm wrong - JD 2014-10-24 logger.error("Could not create DNA coding sequence, {}. This is most likely a bug.", e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; }
java
public DNASequence getDNACodingSequence() { StringBuilder sb = new StringBuilder(); for (CDSSequence cdsSequence : cdsSequenceList) { sb.append(cdsSequence.getCodingSequence()); } DNASequence dnaSequence = null; try { dnaSequence = new DNASequence(sb.toString().toUpperCase()); } catch (CompoundNotFoundException e) { // if I understand this should not happen, please correct if I'm wrong - JD 2014-10-24 logger.error("Could not create DNA coding sequence, {}. This is most likely a bug.", e.getMessage()); } dnaSequence.setAccession(new AccessionID(this.getAccession().getID())); return dnaSequence; }
[ "public", "DNASequence", "getDNACodingSequence", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "CDSSequence", "cdsSequence", ":", "cdsSequenceList", ")", "{", "sb", ".", "append", "(", "cdsSequence", ".", "getCod...
Get the stitched together CDS sequences then maps to the cDNA @return
[ "Get", "the", "stitched", "together", "CDS", "sequences", "then", "maps", "to", "the", "cDNA" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java#L202-L217
32,052
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java
TranscriptSequence.getProteinSequence
public ProteinSequence getProteinSequence(TranscriptionEngine engine) { DNASequence dnaCodingSequence = getDNACodingSequence(); RNASequence rnaCodingSequence = dnaCodingSequence.getRNASequence(engine); ProteinSequence proteinSequence = rnaCodingSequence.getProteinSequence(engine); proteinSequence.setAccession(new AccessionID(this.getAccession().getID())); return proteinSequence; }
java
public ProteinSequence getProteinSequence(TranscriptionEngine engine) { DNASequence dnaCodingSequence = getDNACodingSequence(); RNASequence rnaCodingSequence = dnaCodingSequence.getRNASequence(engine); ProteinSequence proteinSequence = rnaCodingSequence.getProteinSequence(engine); proteinSequence.setAccession(new AccessionID(this.getAccession().getID())); return proteinSequence; }
[ "public", "ProteinSequence", "getProteinSequence", "(", "TranscriptionEngine", "engine", ")", "{", "DNASequence", "dnaCodingSequence", "=", "getDNACodingSequence", "(", ")", ";", "RNASequence", "rnaCodingSequence", "=", "dnaCodingSequence", ".", "getRNASequence", "(", "en...
Get the protein sequence with user defined TranscriptEngine @param engine @return
[ "Get", "the", "protein", "sequence", "with", "user", "defined", "TranscriptEngine" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/TranscriptSequence.java#L232-L239
32,053
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java
SequenceScalePanel.setPaintDefaults
protected void setPaintDefaults(Graphics2D g2D){ g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setFont(seqFont); }
java
protected void setPaintDefaults(Graphics2D g2D){ g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2D.setFont(seqFont); }
[ "protected", "void", "setPaintDefaults", "(", "Graphics2D", "g2D", ")", "{", "g2D", ".", "setRenderingHint", "(", "RenderingHints", ".", "KEY_TEXT_ANTIALIASING", ",", "RenderingHints", ".", "VALUE_TEXT_ANTIALIAS_ON", ")", ";", "g2D", ".", "setRenderingHint", "(", "R...
set some default rendering hints, like text antialiasing on @param g2D the graphics object to set the defaults on
[ "set", "some", "default", "rendering", "hints", "like", "text", "antialiasing", "on" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java#L200-L207
32,054
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java
SequenceScalePanel.drawSequence
protected int drawSequence(Graphics2D g2D, int y){ //g2D.drawString(panelName,10,10); g2D.setColor(SEQUENCE_COLOR); int aminosize = Math.round(1*scale); if ( aminosize < 1) aminosize = 1; // only draw within the ranges of the Clip Rectangle drawHere = g2D.getClipBounds(); int startpos = coordManager.getSeqPos(drawHere.x); //int endpos = coordManager.getSeqPos(drawHere.x+drawHere.width-2); Composite oldComp = g2D.getComposite(); g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.8f)); //logger.info("paint l " + l + " length " + length ); if ( startpos < 0) startpos = 999; if ( scale > SEQUENCE_SHOW){ g2D.setColor(Color.black); //g2D.setColor(SCALE_COLOR); int i = startpos; // display the actual sequence!; for ( int gap = startpos ; gap < apos.size() ;gap++){ int xpos = coordManager.getPanelPos(gap) ; AlignedPosition m = apos.get(gap); if (m.getPos(position) == -1){ // a gap position g2D.drawString("-",xpos+1,y+2+DEFAULT_Y_STEP); continue; } i = m.getPos(position); // TODO: // color amino acids by hydrophobicity g2D.drawString(seqArr[i].toString(),xpos+1,y+2+DEFAULT_Y_STEP); } // in full sequence mode we need abit more space to look nice y+=2; } g2D.setComposite(oldComp); y+= DEFAULT_Y_STEP + 2; return y; }
java
protected int drawSequence(Graphics2D g2D, int y){ //g2D.drawString(panelName,10,10); g2D.setColor(SEQUENCE_COLOR); int aminosize = Math.round(1*scale); if ( aminosize < 1) aminosize = 1; // only draw within the ranges of the Clip Rectangle drawHere = g2D.getClipBounds(); int startpos = coordManager.getSeqPos(drawHere.x); //int endpos = coordManager.getSeqPos(drawHere.x+drawHere.width-2); Composite oldComp = g2D.getComposite(); g2D.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,0.8f)); //logger.info("paint l " + l + " length " + length ); if ( startpos < 0) startpos = 999; if ( scale > SEQUENCE_SHOW){ g2D.setColor(Color.black); //g2D.setColor(SCALE_COLOR); int i = startpos; // display the actual sequence!; for ( int gap = startpos ; gap < apos.size() ;gap++){ int xpos = coordManager.getPanelPos(gap) ; AlignedPosition m = apos.get(gap); if (m.getPos(position) == -1){ // a gap position g2D.drawString("-",xpos+1,y+2+DEFAULT_Y_STEP); continue; } i = m.getPos(position); // TODO: // color amino acids by hydrophobicity g2D.drawString(seqArr[i].toString(),xpos+1,y+2+DEFAULT_Y_STEP); } // in full sequence mode we need abit more space to look nice y+=2; } g2D.setComposite(oldComp); y+= DEFAULT_Y_STEP + 2; return y; }
[ "protected", "int", "drawSequence", "(", "Graphics2D", "g2D", ",", "int", "y", ")", "{", "//g2D.drawString(panelName,10,10);", "g2D", ".", "setColor", "(", "SEQUENCE_COLOR", ")", ";", "int", "aminosize", "=", "Math", ".", "round", "(", "1", "*", "scale", ")"...
draw the Amino acid sequence @param g2D @param y .. height of line to draw the sequence onto @return the new y value
[ "draw", "the", "Amino", "acid", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/SequenceScalePanel.java#L422-L477
32,055
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java
CalcPoint.centroid
public static Point3d centroid(Point3d[] x) { Point3d center = new Point3d(); for (Point3d p : x) { center.add(p); } center.scale(1.0 / x.length); return center; }
java
public static Point3d centroid(Point3d[] x) { Point3d center = new Point3d(); for (Point3d p : x) { center.add(p); } center.scale(1.0 / x.length); return center; }
[ "public", "static", "Point3d", "centroid", "(", "Point3d", "[", "]", "x", ")", "{", "Point3d", "center", "=", "new", "Point3d", "(", ")", ";", "for", "(", "Point3d", "p", ":", "x", ")", "{", "center", ".", "add", "(", "p", ")", ";", "}", "center"...
Calculate the centroid of the point cloud. @param x array of points. Point objects will not be modified @return centroid as Point3d
[ "Calculate", "the", "centroid", "of", "the", "point", "cloud", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java#L62-L69
32,056
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java
CalcPoint.transform
public static void transform(Matrix4d rotTrans, Point3d[] x) { for (Point3d p : x) { rotTrans.transform(p); } }
java
public static void transform(Matrix4d rotTrans, Point3d[] x) { for (Point3d p : x) { rotTrans.transform(p); } }
[ "public", "static", "void", "transform", "(", "Matrix4d", "rotTrans", ",", "Point3d", "[", "]", "x", ")", "{", "for", "(", "Point3d", "p", ":", "x", ")", "{", "rotTrans", ".", "transform", "(", "p", ")", ";", "}", "}" ]
Transform all points with a 4x4 transformation matrix. @param rotTrans 4x4 transformation matrix @param x array of points. Point objects will be modified
[ "Transform", "all", "points", "with", "a", "4x4", "transformation", "matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java#L79-L83
32,057
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java
CalcPoint.translate
public static void translate(Vector3d trans, Point3d[] x) { for (Point3d p : x) { p.add(trans); } }
java
public static void translate(Vector3d trans, Point3d[] x) { for (Point3d p : x) { p.add(trans); } }
[ "public", "static", "void", "translate", "(", "Vector3d", "trans", ",", "Point3d", "[", "]", "x", ")", "{", "for", "(", "Point3d", "p", ":", "x", ")", "{", "p", ".", "add", "(", "trans", ")", ";", "}", "}" ]
Translate all points with a translation vector. @param trans the translation vector to apply @param x array of points. Point objects will be modified
[ "Translate", "all", "points", "with", "a", "translation", "vector", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java#L93-L97
32,058
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java
CalcPoint.clonePoint3dArray
public static Point3d[] clonePoint3dArray(Point3d[] x) { Point3d[] clone = new Point3d[x.length]; for (int i = 0; i < x.length; i++) { clone[i] = new Point3d(x[i]); } return clone; }
java
public static Point3d[] clonePoint3dArray(Point3d[] x) { Point3d[] clone = new Point3d[x.length]; for (int i = 0; i < x.length; i++) { clone[i] = new Point3d(x[i]); } return clone; }
[ "public", "static", "Point3d", "[", "]", "clonePoint3dArray", "(", "Point3d", "[", "]", "x", ")", "{", "Point3d", "[", "]", "clone", "=", "new", "Point3d", "[", "x", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "x", ...
Clone an array of points. @param x original array of points. Point objects will not be modified @return new array of points, identical clone of x
[ "Clone", "an", "array", "of", "points", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java#L106-L112
32,059
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java
CalcPoint.rmsd
public static double rmsd(Point3d[] x, Point3d[] y) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } double sum = 0.0; for (int i = 0; i < x.length; i++) { sum += x[i].distanceSquared(y[i]); } return Math.sqrt(sum / x.length); }
java
public static double rmsd(Point3d[] x, Point3d[] y) { if (x.length != y.length) { throw new IllegalArgumentException( "Point arrays are not of the same length."); } double sum = 0.0; for (int i = 0; i < x.length; i++) { sum += x[i].distanceSquared(y[i]); } return Math.sqrt(sum / x.length); }
[ "public", "static", "double", "rmsd", "(", "Point3d", "[", "]", "x", ",", "Point3d", "[", "]", "y", ")", "{", "if", "(", "x", ".", "length", "!=", "y", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Point arrays are not of t...
Calculate the RMSD of two point arrays, already superposed. @param x array of points superposed to y @param y array of points superposed to x @return RMSD
[ "Calculate", "the", "RMSD", "of", "two", "point", "arrays", "already", "superposed", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/CalcPoint.java#L244-L256
32,060
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java
MenuCreator.initMenu
public static JMenuBar initMenu(){ // show a menu JMenuBar menu = new JMenuBar(); JMenu file= new JMenu("File"); file.getAccessibleContext().setAccessibleDescription("File Menu"); JMenuItem openI = new JMenuItem("Open"); openI.setMnemonic(KeyEvent.VK_O); openI.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("Open")){ final JFileChooser fc = new JFileChooser(); // In response to a button click: int returnVal = fc.showOpenDialog(null); if ( returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); PDBFileReader reader = new PDBFileReader(); try { Structure s = reader.getStructure(file); BiojavaJmol jmol = new BiojavaJmol(); jmol.setStructure(s); jmol.evalString("select * ; color chain;"); jmol.evalString("select *; spacefill off; wireframe off; backbone 0.4; "); } catch (Exception ex){ ex.printStackTrace(); } } } } }); file.add(openI); JMenuItem exitI = new JMenuItem("Exit"); exitI.setMnemonic(KeyEvent.VK_X); exitI.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("Exit")){ System.exit(0); } } }); file.add(exitI); menu.add(file); JMenu align = new JMenu("Align"); JMenuItem pairI = new JMenuItem("2 protein structures"); pairI.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("2 protein structures")){ MenuCreator.showPairDialog(); } } }); align.add(pairI); menu.add(align); JMenu about = new JMenu("About"); JMenuItem aboutI = new JMenuItem("PDBview"); aboutI.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("PDBview")){ MenuCreator.showAboutDialog(); } } }); about.add(aboutI); menu.add(Box.createGlue()); menu.add(about); return menu; }
java
public static JMenuBar initMenu(){ // show a menu JMenuBar menu = new JMenuBar(); JMenu file= new JMenu("File"); file.getAccessibleContext().setAccessibleDescription("File Menu"); JMenuItem openI = new JMenuItem("Open"); openI.setMnemonic(KeyEvent.VK_O); openI.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("Open")){ final JFileChooser fc = new JFileChooser(); // In response to a button click: int returnVal = fc.showOpenDialog(null); if ( returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); PDBFileReader reader = new PDBFileReader(); try { Structure s = reader.getStructure(file); BiojavaJmol jmol = new BiojavaJmol(); jmol.setStructure(s); jmol.evalString("select * ; color chain;"); jmol.evalString("select *; spacefill off; wireframe off; backbone 0.4; "); } catch (Exception ex){ ex.printStackTrace(); } } } } }); file.add(openI); JMenuItem exitI = new JMenuItem("Exit"); exitI.setMnemonic(KeyEvent.VK_X); exitI.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("Exit")){ System.exit(0); } } }); file.add(exitI); menu.add(file); JMenu align = new JMenu("Align"); JMenuItem pairI = new JMenuItem("2 protein structures"); pairI.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("2 protein structures")){ MenuCreator.showPairDialog(); } } }); align.add(pairI); menu.add(align); JMenu about = new JMenu("About"); JMenuItem aboutI = new JMenuItem("PDBview"); aboutI.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if ( cmd.equals("PDBview")){ MenuCreator.showAboutDialog(); } } }); about.add(aboutI); menu.add(Box.createGlue()); menu.add(about); return menu; }
[ "public", "static", "JMenuBar", "initMenu", "(", ")", "{", "// show a menu", "JMenuBar", "menu", "=", "new", "JMenuBar", "(", ")", ";", "JMenu", "file", "=", "new", "JMenu", "(", "\"File\"", ")", ";", "file", ".", "getAccessibleContext", "(", ")", ".", "...
provide a JMenuBar that can be added to a JFrame @return a JMenuBar
[ "provide", "a", "JMenuBar", "that", "can", "be", "added", "to", "a", "JFrame" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java#L48-L145
32,061
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java
MenuCreator.showAboutDialog
private static void showAboutDialog(){ JDialog dialog = new JDialog(); dialog.setSize(new Dimension(300,300)); String msg = "This viewer is based on <b>BioJava</b> and <b>Jmol</>. <br>Author: Andreas Prlic <br> "; msg += "Structure Alignment algorithm based on a variation of the PSC++ algorithm by Peter Lackner."; JEditorPane txt = new JEditorPane("text/html", msg); txt.setEditable(false); JScrollPane scroll = new JScrollPane(txt); Box vBox = Box.createVerticalBox(); vBox.add(scroll); JButton close = new JButton("Close"); close.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent event) { Object source = event.getSource(); JButton but = (JButton)source; Container parent = but.getParent().getParent().getParent().getParent().getParent().getParent() ; JDialog dia = (JDialog) parent; dia.dispose(); } }); Box hBoxb = Box.createHorizontalBox(); hBoxb.add(Box.createGlue()); hBoxb.add(close,BorderLayout.EAST); vBox.add(hBoxb); dialog.getContentPane().add(vBox); dialog.setVisible(true); }
java
private static void showAboutDialog(){ JDialog dialog = new JDialog(); dialog.setSize(new Dimension(300,300)); String msg = "This viewer is based on <b>BioJava</b> and <b>Jmol</>. <br>Author: Andreas Prlic <br> "; msg += "Structure Alignment algorithm based on a variation of the PSC++ algorithm by Peter Lackner."; JEditorPane txt = new JEditorPane("text/html", msg); txt.setEditable(false); JScrollPane scroll = new JScrollPane(txt); Box vBox = Box.createVerticalBox(); vBox.add(scroll); JButton close = new JButton("Close"); close.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent event) { Object source = event.getSource(); JButton but = (JButton)source; Container parent = but.getParent().getParent().getParent().getParent().getParent().getParent() ; JDialog dia = (JDialog) parent; dia.dispose(); } }); Box hBoxb = Box.createHorizontalBox(); hBoxb.add(Box.createGlue()); hBoxb.add(close,BorderLayout.EAST); vBox.add(hBoxb); dialog.getContentPane().add(vBox); dialog.setVisible(true); }
[ "private", "static", "void", "showAboutDialog", "(", ")", "{", "JDialog", "dialog", "=", "new", "JDialog", "(", ")", ";", "dialog", ".", "setSize", "(", "new", "Dimension", "(", "300", ",", "300", ")", ")", ";", "String", "msg", "=", "\"This viewer is ba...
show some info about this gui
[ "show", "some", "info", "about", "this", "gui" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/gui/util/MenuCreator.java#L159-L203
32,062
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java
AnchoredPairwiseSequenceAligner.getAnchors
public int[] getAnchors() { int[] anchor = new int[getScoreMatrixDimensions()[0] - 1]; for (int i = 0; i < anchor.length; i++) { anchor[i] = -1; } for (int i = 0; i < anchors.size(); i++) { anchor[anchors.get(i).getQueryIndex()] = anchors.get(i).getTargetIndex(); } return anchor; }
java
public int[] getAnchors() { int[] anchor = new int[getScoreMatrixDimensions()[0] - 1]; for (int i = 0; i < anchor.length; i++) { anchor[i] = -1; } for (int i = 0; i < anchors.size(); i++) { anchor[anchors.get(i).getQueryIndex()] = anchors.get(i).getTargetIndex(); } return anchor; }
[ "public", "int", "[", "]", "getAnchors", "(", ")", "{", "int", "[", "]", "anchor", "=", "new", "int", "[", "getScoreMatrixDimensions", "(", ")", "[", "0", "]", "-", "1", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "anchor", ".", ...
Returns the list of anchors. The populated elements correspond to query compounds with a connection established to a target compound. @return the list of anchors
[ "Returns", "the", "list", "of", "anchors", ".", "The", "populated", "elements", "correspond", "to", "query", "compounds", "with", "a", "connection", "established", "to", "a", "target", "compound", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java#L97-L106
32,063
biojava/biojava
biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java
AnchoredPairwiseSequenceAligner.setAnchors
public void setAnchors(int[] anchors) { super.anchors = new ArrayList<Anchor>(); if (anchors != null) { for (int i = 0; i < anchors.length; i++) { if (anchors[i] >= 0) { addAnchor(i, anchors[i]); } } } }
java
public void setAnchors(int[] anchors) { super.anchors = new ArrayList<Anchor>(); if (anchors != null) { for (int i = 0; i < anchors.length; i++) { if (anchors[i] >= 0) { addAnchor(i, anchors[i]); } } } }
[ "public", "void", "setAnchors", "(", "int", "[", "]", "anchors", ")", "{", "super", ".", "anchors", "=", "new", "ArrayList", "<", "Anchor", ">", "(", ")", ";", "if", "(", "anchors", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", ...
Sets the starting list of anchors before running the alignment routine. @param anchors list of points that are tied to the given indices in the target
[ "Sets", "the", "starting", "list", "of", "anchors", "before", "running", "the", "alignment", "routine", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-alignment/src/main/java/org/biojava/nbio/alignment/routines/AnchoredPairwiseSequenceAligner.java#L113-L122
32,064
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java
GenbankReaderHelper.readGenbankProteinSequence
public static LinkedHashMap<String, ProteinSequence> readGenbankProteinSequence( File file) throws Exception { FileInputStream inStream = new FileInputStream(file); LinkedHashMap<String, ProteinSequence> proteinSequences = readGenbankProteinSequence(inStream); inStream.close(); return proteinSequences; }
java
public static LinkedHashMap<String, ProteinSequence> readGenbankProteinSequence( File file) throws Exception { FileInputStream inStream = new FileInputStream(file); LinkedHashMap<String, ProteinSequence> proteinSequences = readGenbankProteinSequence(inStream); inStream.close(); return proteinSequences; }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "ProteinSequence", ">", "readGenbankProteinSequence", "(", "File", "file", ")", "throws", "Exception", "{", "FileInputStream", "inStream", "=", "new", "FileInputStream", "(", "file", ")", ";", "LinkedHashMap",...
Read a Genbank file containing amino acids with setup that would handle most cases. @param file @return @throws Exception
[ "Read", "a", "Genbank", "file", "containing", "amino", "acids", "with", "setup", "that", "would", "handle", "most", "cases", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java#L141-L147
32,065
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java
GenbankReaderHelper.readGenbankProteinSequence
public static LinkedHashMap<String, ProteinSequence> readGenbankProteinSequence( InputStream inStream) throws Exception { GenbankReader<ProteinSequence, AminoAcidCompound> GenbankReader = new GenbankReader<ProteinSequence, AminoAcidCompound>( inStream, new GenericGenbankHeaderParser<ProteinSequence, AminoAcidCompound>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); return GenbankReader.process(); }
java
public static LinkedHashMap<String, ProteinSequence> readGenbankProteinSequence( InputStream inStream) throws Exception { GenbankReader<ProteinSequence, AminoAcidCompound> GenbankReader = new GenbankReader<ProteinSequence, AminoAcidCompound>( inStream, new GenericGenbankHeaderParser<ProteinSequence, AminoAcidCompound>(), new ProteinSequenceCreator(AminoAcidCompoundSet.getAminoAcidCompoundSet())); return GenbankReader.process(); }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "ProteinSequence", ">", "readGenbankProteinSequence", "(", "InputStream", "inStream", ")", "throws", "Exception", "{", "GenbankReader", "<", "ProteinSequence", ",", "AminoAcidCompound", ">", "GenbankReader", "=", ...
Read a Genbank file containing amino acids with setup that would handle most cases. User is responsible for closing InputStream because you opened it @param inStream @return @throws Exception
[ "Read", "a", "Genbank", "file", "containing", "amino", "acids", "with", "setup", "that", "would", "handle", "most", "cases", ".", "User", "is", "responsible", "for", "closing", "InputStream", "because", "you", "opened", "it" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java#L157-L164
32,066
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java
GenbankReaderHelper.readGenbankDNASequence
public static LinkedHashMap<String, DNASequence> readGenbankDNASequence( InputStream inStream) throws Exception { GenbankReader<DNASequence, NucleotideCompound> GenbankReader = new GenbankReader<DNASequence, NucleotideCompound>( inStream, new GenericGenbankHeaderParser<DNASequence, NucleotideCompound>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet())); return GenbankReader.process(); }
java
public static LinkedHashMap<String, DNASequence> readGenbankDNASequence( InputStream inStream) throws Exception { GenbankReader<DNASequence, NucleotideCompound> GenbankReader = new GenbankReader<DNASequence, NucleotideCompound>( inStream, new GenericGenbankHeaderParser<DNASequence, NucleotideCompound>(), new DNASequenceCreator(DNACompoundSet.getDNACompoundSet())); return GenbankReader.process(); }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "DNASequence", ">", "readGenbankDNASequence", "(", "InputStream", "inStream", ")", "throws", "Exception", "{", "GenbankReader", "<", "DNASequence", ",", "NucleotideCompound", ">", "GenbankReader", "=", "new", ...
Read a Genbank DNA sequence @param inStream @return @throws Exception
[ "Read", "a", "Genbank", "DNA", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java#L172-L179
32,067
biojava/biojava
biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java
GenbankReaderHelper.readGenbankRNASequence
public static LinkedHashMap<String, RNASequence> readGenbankRNASequence( InputStream inStream) throws Exception { GenbankReader<RNASequence, NucleotideCompound> GenbankReader = new GenbankReader<RNASequence, NucleotideCompound>( inStream, new GenericGenbankHeaderParser<RNASequence, NucleotideCompound>(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet())); return GenbankReader.process(); }
java
public static LinkedHashMap<String, RNASequence> readGenbankRNASequence( InputStream inStream) throws Exception { GenbankReader<RNASequence, NucleotideCompound> GenbankReader = new GenbankReader<RNASequence, NucleotideCompound>( inStream, new GenericGenbankHeaderParser<RNASequence, NucleotideCompound>(), new RNASequenceCreator(RNACompoundSet.getRNACompoundSet())); return GenbankReader.process(); }
[ "public", "static", "LinkedHashMap", "<", "String", ",", "RNASequence", ">", "readGenbankRNASequence", "(", "InputStream", "inStream", ")", "throws", "Exception", "{", "GenbankReader", "<", "RNASequence", ",", "NucleotideCompound", ">", "GenbankReader", "=", "new", ...
Read a Genbank RNA sequence @param inStream @return @throws Exception
[ "Read", "a", "Genbank", "RNA", "sequence" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-core/src/main/java/org/biojava/nbio/core/sequence/io/GenbankReaderHelper.java#L200-L207
32,068
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/scop/CachedRemoteScopInstallation.java
CachedRemoteScopInstallation.loadRepresentativeDomains
private void loadRepresentativeDomains() throws IOException { URL u = null; try { u = new URL(RemoteScopInstallation.DEFAULT_SERVER + "getRepresentativeScopDomains"); } catch (MalformedURLException e) { throw new IOException("URL " + RemoteScopInstallation.DEFAULT_SERVER + "getRepresentativeScopDomains" + " is wrong", e); } logger.info("Using " + u + " to download representative domains"); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); ScopDomains results = ScopDomains.fromXML(xml); logger.info("got " + results.getScopDomain().size() + " domain ranges for Scop domains from server."); for (ScopDomain dom : results.getScopDomain()){ String scopId = dom.getScopId(); serializedCache.put(scopId, dom); } }
java
private void loadRepresentativeDomains() throws IOException { URL u = null; try { u = new URL(RemoteScopInstallation.DEFAULT_SERVER + "getRepresentativeScopDomains"); } catch (MalformedURLException e) { throw new IOException("URL " + RemoteScopInstallation.DEFAULT_SERVER + "getRepresentativeScopDomains" + " is wrong", e); } logger.info("Using " + u + " to download representative domains"); InputStream response = URLConnectionTools.getInputStream(u); String xml = JFatCatClient.convertStreamToString(response); ScopDomains results = ScopDomains.fromXML(xml); logger.info("got " + results.getScopDomain().size() + " domain ranges for Scop domains from server."); for (ScopDomain dom : results.getScopDomain()){ String scopId = dom.getScopId(); serializedCache.put(scopId, dom); } }
[ "private", "void", "loadRepresentativeDomains", "(", ")", "throws", "IOException", "{", "URL", "u", "=", "null", ";", "try", "{", "u", "=", "new", "URL", "(", "RemoteScopInstallation", ".", "DEFAULT_SERVER", "+", "\"getRepresentativeScopDomains\"", ")", ";", "}"...
get the ranges of representative domains from the centralized server
[ "get", "the", "ranges", "of", "representative", "domains", "from", "the", "centralized", "server" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/scop/CachedRemoteScopInstallation.java#L86-L105
32,069
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getDistance
public static final double getDistance(Atom a, Atom b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); double z = a.getZ() - b.getZ(); double s = x * x + y * y + z * z; return Math.sqrt(s); }
java
public static final double getDistance(Atom a, Atom b) { double x = a.getX() - b.getX(); double y = a.getY() - b.getY(); double z = a.getZ() - b.getZ(); double s = x * x + y * y + z * z; return Math.sqrt(s); }
[ "public", "static", "final", "double", "getDistance", "(", "Atom", "a", ",", "Atom", "b", ")", "{", "double", "x", "=", "a", ".", "getX", "(", ")", "-", "b", ".", "getX", "(", ")", ";", "double", "y", "=", "a", ".", "getY", "(", ")", "-", "b"...
calculate distance between two atoms. @param a an Atom object @param b an Atom object @return a double
[ "calculate", "distance", "between", "two", "atoms", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L68-L76
32,070
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.angle
public static final double angle(Atom a, Atom b){ Vector3d va = new Vector3d(a.getCoordsAsPoint3d()); Vector3d vb = new Vector3d(b.getCoordsAsPoint3d()); return Math.toDegrees(va.angle(vb)); }
java
public static final double angle(Atom a, Atom b){ Vector3d va = new Vector3d(a.getCoordsAsPoint3d()); Vector3d vb = new Vector3d(b.getCoordsAsPoint3d()); return Math.toDegrees(va.angle(vb)); }
[ "public", "static", "final", "double", "angle", "(", "Atom", "a", ",", "Atom", "b", ")", "{", "Vector3d", "va", "=", "new", "Vector3d", "(", "a", ".", "getCoordsAsPoint3d", "(", ")", ")", ";", "Vector3d", "vb", "=", "new", "Vector3d", "(", "b", ".", ...
Gets the angle between two vectors @param a an Atom object @param b an Atom object @return Angle between a and b in degrees, in range [0,180]. If either vector has length 0 then angle is not defined and NaN is returned
[ "Gets", "the", "angle", "between", "two", "vectors" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L195-L202
32,071
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.unitVector
public static final Atom unitVector(Atom a) { double amount = amount(a) ; double[] coords = new double[3]; coords[0] = a.getX() / amount ; coords[1] = a.getY() / amount ; coords[2] = a.getZ() / amount ; a.setCoords(coords); return a; }
java
public static final Atom unitVector(Atom a) { double amount = amount(a) ; double[] coords = new double[3]; coords[0] = a.getX() / amount ; coords[1] = a.getY() / amount ; coords[2] = a.getZ() / amount ; a.setCoords(coords); return a; }
[ "public", "static", "final", "Atom", "unitVector", "(", "Atom", "a", ")", "{", "double", "amount", "=", "amount", "(", "a", ")", ";", "double", "[", "]", "coords", "=", "new", "double", "[", "3", "]", ";", "coords", "[", "0", "]", "=", "a", ".", ...
Returns the unit vector of vector a . @param a an Atom object @return an Atom object
[ "Returns", "the", "unit", "vector", "of", "vector", "a", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L211-L223
32,072
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getPhi
public static final double getPhi(AminoAcid a, AminoAcid b) throws StructureException { if ( ! isConnected(a,b)){ throw new StructureException( "can not calc Phi - AminoAcids are not connected!"); } Atom a_C = a.getC(); Atom b_N = b.getN(); Atom b_CA = b.getCA(); Atom b_C = b.getC(); // C and N were checked in isConnected already if (b_CA == null) throw new StructureException( "Can not calculate Phi, CA atom is missing"); return torsionAngle(a_C,b_N,b_CA,b_C); }
java
public static final double getPhi(AminoAcid a, AminoAcid b) throws StructureException { if ( ! isConnected(a,b)){ throw new StructureException( "can not calc Phi - AminoAcids are not connected!"); } Atom a_C = a.getC(); Atom b_N = b.getN(); Atom b_CA = b.getCA(); Atom b_C = b.getC(); // C and N were checked in isConnected already if (b_CA == null) throw new StructureException( "Can not calculate Phi, CA atom is missing"); return torsionAngle(a_C,b_N,b_CA,b_C); }
[ "public", "static", "final", "double", "getPhi", "(", "AminoAcid", "a", ",", "AminoAcid", "b", ")", "throws", "StructureException", "{", "if", "(", "!", "isConnected", "(", "a", ",", "b", ")", ")", "{", "throw", "new", "StructureException", "(", "\"can not...
Calculate the phi angle. @param a an AminoAcid object @param b an AminoAcid object @return a double @throws StructureException if aminoacids not connected or if any of the 4 needed atoms missing
[ "Calculate", "the", "phi", "angle", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L275-L294
32,073
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getPsi
public static final double getPsi(AminoAcid a, AminoAcid b) throws StructureException { if ( ! isConnected(a,b)) { throw new StructureException( "can not calc Psi - AminoAcids are not connected!"); } Atom a_N = a.getN(); Atom a_CA = a.getCA(); Atom a_C = a.getC(); Atom b_N = b.getN(); // C and N were checked in isConnected already if (a_CA == null) throw new StructureException( "Can not calculate Psi, CA atom is missing"); return torsionAngle(a_N,a_CA,a_C,b_N); }
java
public static final double getPsi(AminoAcid a, AminoAcid b) throws StructureException { if ( ! isConnected(a,b)) { throw new StructureException( "can not calc Psi - AminoAcids are not connected!"); } Atom a_N = a.getN(); Atom a_CA = a.getCA(); Atom a_C = a.getC(); Atom b_N = b.getN(); // C and N were checked in isConnected already if (a_CA == null) throw new StructureException( "Can not calculate Psi, CA atom is missing"); return torsionAngle(a_N,a_CA,a_C,b_N); }
[ "public", "static", "final", "double", "getPsi", "(", "AminoAcid", "a", ",", "AminoAcid", "b", ")", "throws", "StructureException", "{", "if", "(", "!", "isConnected", "(", "a", ",", "b", ")", ")", "{", "throw", "new", "StructureException", "(", "\"can not...
Calculate the psi angle. @param a an AminoAcid object @param b an AminoAcid object @return a double @throws StructureException if aminoacids not connected or if any of the 4 needed atoms missing
[ "Calculate", "the", "psi", "angle", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L308-L327
32,074
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.isConnected
public static final boolean isConnected(AminoAcid a, AminoAcid b) { Atom C = null ; Atom N = null; C = a.getC(); N = b.getN(); if ( C == null || N == null) return false; // one could also check if the CA atoms are < 4 A... double distance = getDistance(C,N); return distance < 2.5; }
java
public static final boolean isConnected(AminoAcid a, AminoAcid b) { Atom C = null ; Atom N = null; C = a.getC(); N = b.getN(); if ( C == null || N == null) return false; // one could also check if the CA atoms are < 4 A... double distance = getDistance(C,N); return distance < 2.5; }
[ "public", "static", "final", "boolean", "isConnected", "(", "AminoAcid", "a", ",", "AminoAcid", "b", ")", "{", "Atom", "C", "=", "null", ";", "Atom", "N", "=", "null", ";", "C", "=", "a", ".", "getC", "(", ")", ";", "N", "=", "b", ".", "getN", ...
Test if two amino acids are connected, i.e. if the distance from C to N < 2.5 Angstrom. If one of the AminoAcids has an atom missing, returns false. @param a an AminoAcid object @param b an AminoAcid object @return true if ...
[ "Test", "if", "two", "amino", "acids", "are", "connected", "i", ".", "e", ".", "if", "the", "distance", "from", "C", "to", "N", "<", "2", ".", "5", "Angstrom", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L341-L354
32,075
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.rotate
public static final void rotate(Atom atom, double[][] m){ double x = atom.getX(); double y = atom.getY() ; double z = atom.getZ(); double nx = m[0][0] * x + m[0][1] * y + m[0][2] * z ; double ny = m[1][0] * x + m[1][1] * y + m[1][2] * z ; double nz = m[2][0] * x + m[2][1] * y + m[2][2] * z ; atom.setX(nx); atom.setY(ny); atom.setZ(nz); }
java
public static final void rotate(Atom atom, double[][] m){ double x = atom.getX(); double y = atom.getY() ; double z = atom.getZ(); double nx = m[0][0] * x + m[0][1] * y + m[0][2] * z ; double ny = m[1][0] * x + m[1][1] * y + m[1][2] * z ; double nz = m[2][0] * x + m[2][1] * y + m[2][2] * z ; atom.setX(nx); atom.setY(ny); atom.setZ(nz); }
[ "public", "static", "final", "void", "rotate", "(", "Atom", "atom", ",", "double", "[", "]", "[", "]", "m", ")", "{", "double", "x", "=", "atom", ".", "getX", "(", ")", ";", "double", "y", "=", "atom", ".", "getY", "(", ")", ";", "double", "z",...
Rotate a single Atom aroud a rotation matrix. The rotation Matrix must be a pre-multiplication 3x3 Matrix. If the matrix is indexed m[row][col], then the matrix will be pre-multiplied (y=atom*M) @param atom atom to be rotated @param m a rotation matrix represented as a double[3][3] array
[ "Rotate", "a", "single", "Atom", "aroud", "a", "rotation", "matrix", ".", "The", "rotation", "Matrix", "must", "be", "a", "pre", "-", "multiplication", "3x3", "Matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L368-L381
32,076
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.rotate
public static final void rotate(Structure structure, double[][] rotationmatrix) throws StructureException { if ( rotationmatrix.length != 3 ) { throw new StructureException ("matrix does not have size 3x3 !"); } AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext()) { Atom atom = iter.next() ; Calc.rotate(atom,rotationmatrix); } }
java
public static final void rotate(Structure structure, double[][] rotationmatrix) throws StructureException { if ( rotationmatrix.length != 3 ) { throw new StructureException ("matrix does not have size 3x3 !"); } AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext()) { Atom atom = iter.next() ; Calc.rotate(atom,rotationmatrix); } }
[ "public", "static", "final", "void", "rotate", "(", "Structure", "structure", ",", "double", "[", "]", "[", "]", "rotationmatrix", ")", "throws", "StructureException", "{", "if", "(", "rotationmatrix", ".", "length", "!=", "3", ")", "{", "throw", "new", "S...
Rotate a structure. The rotation Matrix must be a pre-multiplication Matrix. @param structure a Structure object @param rotationmatrix an array (3x3) of double representing the rotation matrix. @throws StructureException ...
[ "Rotate", "a", "structure", ".", "The", "rotation", "Matrix", "must", "be", "a", "pre", "-", "multiplication", "Matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L394-L405
32,077
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.rotate
public static final void rotate(Group group, double[][] rotationmatrix) throws StructureException { if ( rotationmatrix.length != 3 ) { throw new StructureException ("matrix does not have size 3x3 !"); } AtomIterator iter = new AtomIterator(group) ; while (iter.hasNext()) { Atom atom = null ; atom = iter.next() ; rotate(atom,rotationmatrix); } }
java
public static final void rotate(Group group, double[][] rotationmatrix) throws StructureException { if ( rotationmatrix.length != 3 ) { throw new StructureException ("matrix does not have size 3x3 !"); } AtomIterator iter = new AtomIterator(group) ; while (iter.hasNext()) { Atom atom = null ; atom = iter.next() ; rotate(atom,rotationmatrix); } }
[ "public", "static", "final", "void", "rotate", "(", "Group", "group", ",", "double", "[", "]", "[", "]", "rotationmatrix", ")", "throws", "StructureException", "{", "if", "(", "rotationmatrix", ".", "length", "!=", "3", ")", "{", "throw", "new", "Structure...
Rotate a Group. The rotation Matrix must be a pre-multiplication Matrix. @param group a group object @param rotationmatrix an array (3x3) of double representing the rotation matrix. @throws StructureException ...
[ "Rotate", "a", "Group", ".", "The", "rotation", "Matrix", "must", "be", "a", "pre", "-", "multiplication", "Matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L417-L431
32,078
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.rotate
public static final void rotate(Atom atom, Matrix m){ double x = atom.getX(); double y = atom.getY(); double z = atom.getZ(); double[][] ad = new double[][]{{x,y,z}}; Matrix am = new Matrix(ad); Matrix na = am.times(m); atom.setX(na.get(0,0)); atom.setY(na.get(0,1)); atom.setZ(na.get(0,2)); }
java
public static final void rotate(Atom atom, Matrix m){ double x = atom.getX(); double y = atom.getY(); double z = atom.getZ(); double[][] ad = new double[][]{{x,y,z}}; Matrix am = new Matrix(ad); Matrix na = am.times(m); atom.setX(na.get(0,0)); atom.setY(na.get(0,1)); atom.setZ(na.get(0,2)); }
[ "public", "static", "final", "void", "rotate", "(", "Atom", "atom", ",", "Matrix", "m", ")", "{", "double", "x", "=", "atom", ".", "getX", "(", ")", ";", "double", "y", "=", "atom", ".", "getY", "(", ")", ";", "double", "z", "=", "atom", ".", "...
Rotate an Atom around a Matrix object. The rotation Matrix must be a pre-multiplication Matrix. @param atom atom to be rotated @param m rotation matrix to be applied to the atom
[ "Rotate", "an", "Atom", "around", "a", "Matrix", "object", ".", "The", "rotation", "Matrix", "must", "be", "a", "pre", "-", "multiplication", "Matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L442-L456
32,079
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.rotate
public static final void rotate(Group group, Matrix m){ AtomIterator iter = new AtomIterator(group) ; while (iter.hasNext()) { Atom atom = iter.next() ; rotate(atom,m); } }
java
public static final void rotate(Group group, Matrix m){ AtomIterator iter = new AtomIterator(group) ; while (iter.hasNext()) { Atom atom = iter.next() ; rotate(atom,m); } }
[ "public", "static", "final", "void", "rotate", "(", "Group", "group", ",", "Matrix", "m", ")", "{", "AtomIterator", "iter", "=", "new", "AtomIterator", "(", "group", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "Atom", "atom", ...
Rotate a group object. The rotation Matrix must be a pre-multiplication Matrix. @param group a group to be rotated @param m a Matrix object representing the rotation matrix
[ "Rotate", "a", "group", "object", ".", "The", "rotation", "Matrix", "must", "be", "a", "pre", "-", "multiplication", "Matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L467-L477
32,080
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.rotate
public static final void rotate(Structure structure, Matrix m){ AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext()) { Atom atom = iter.next() ; rotate(atom,m); } }
java
public static final void rotate(Structure structure, Matrix m){ AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext()) { Atom atom = iter.next() ; rotate(atom,m); } }
[ "public", "static", "final", "void", "rotate", "(", "Structure", "structure", ",", "Matrix", "m", ")", "{", "AtomIterator", "iter", "=", "new", "AtomIterator", "(", "structure", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "Atom", ...
Rotate a structure object. The rotation Matrix must be a pre-multiplication Matrix. @param structure the structure to be rotated @param m rotation matrix to be applied
[ "Rotate", "a", "structure", "object", ".", "The", "rotation", "Matrix", "must", "be", "a", "pre", "-", "multiplication", "Matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L488-L498
32,081
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.transform
public static void transform(Atom[] ca, Matrix4d t) { for (Atom atom : ca) Calc.transform(atom, t); }
java
public static void transform(Atom[] ca, Matrix4d t) { for (Atom atom : ca) Calc.transform(atom, t); }
[ "public", "static", "void", "transform", "(", "Atom", "[", "]", "ca", ",", "Matrix4d", "t", ")", "{", "for", "(", "Atom", "atom", ":", "ca", ")", "Calc", ".", "transform", "(", "atom", ",", "t", ")", ";", "}" ]
Transform an array of atoms at once. The transformation Matrix must be a post-multiplication Matrix. @param ca array of Atoms to shift @param t transformation Matrix4d
[ "Transform", "an", "array", "of", "atoms", "at", "once", ".", "The", "transformation", "Matrix", "must", "be", "a", "post", "-", "multiplication", "Matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L509-L512
32,082
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.plus
public static final void plus(Structure s, Matrix matrix){ AtomIterator iter = new AtomIterator(s) ; Atom oldAtom = null; Atom rotOldAtom = null; while (iter.hasNext()) { Atom atom = null ; atom = iter.next() ; try { if ( oldAtom != null){ logger.debug("before {}", getDistance(oldAtom,atom)); } } catch (Exception e){ logger.error("Exception: ", e); } oldAtom = (Atom)atom.clone(); double x = atom.getX(); double y = atom.getY() ; double z = atom.getZ(); double[][] ad = new double[][]{{x,y,z}}; Matrix am = new Matrix(ad); Matrix na = am.plus(matrix); double[] coords = new double[3] ; coords[0] = na.get(0,0); coords[1] = na.get(0,1); coords[2] = na.get(0,2); atom.setCoords(coords); try { if ( rotOldAtom != null){ logger.debug("after {}", getDistance(rotOldAtom,atom)); } } catch (Exception e){ logger.error("Exception: ", e); } rotOldAtom = (Atom) atom.clone(); } }
java
public static final void plus(Structure s, Matrix matrix){ AtomIterator iter = new AtomIterator(s) ; Atom oldAtom = null; Atom rotOldAtom = null; while (iter.hasNext()) { Atom atom = null ; atom = iter.next() ; try { if ( oldAtom != null){ logger.debug("before {}", getDistance(oldAtom,atom)); } } catch (Exception e){ logger.error("Exception: ", e); } oldAtom = (Atom)atom.clone(); double x = atom.getX(); double y = atom.getY() ; double z = atom.getZ(); double[][] ad = new double[][]{{x,y,z}}; Matrix am = new Matrix(ad); Matrix na = am.plus(matrix); double[] coords = new double[3] ; coords[0] = na.get(0,0); coords[1] = na.get(0,1); coords[2] = na.get(0,2); atom.setCoords(coords); try { if ( rotOldAtom != null){ logger.debug("after {}", getDistance(rotOldAtom,atom)); } } catch (Exception e){ logger.error("Exception: ", e); } rotOldAtom = (Atom) atom.clone(); } }
[ "public", "static", "final", "void", "plus", "(", "Structure", "s", ",", "Matrix", "matrix", ")", "{", "AtomIterator", "iter", "=", "new", "AtomIterator", "(", "s", ")", ";", "Atom", "oldAtom", "=", "null", ";", "Atom", "rotOldAtom", "=", "null", ";", ...
calculate structure + Matrix coodinates ... @param s the structure to operate on @param matrix a Matrix object
[ "calculate", "structure", "+", "Matrix", "coodinates", "..." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L649-L689
32,083
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.shift
public static final void shift(Structure structure, Atom a ){ AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext() ) { Atom atom = null ; atom = iter.next() ; Atom natom = add(atom,a); double x = natom.getX(); double y = natom.getY() ; double z = natom.getZ(); atom.setX(x); atom.setY(y); atom.setZ(z); } }
java
public static final void shift(Structure structure, Atom a ){ AtomIterator iter = new AtomIterator(structure) ; while (iter.hasNext() ) { Atom atom = null ; atom = iter.next() ; Atom natom = add(atom,a); double x = natom.getX(); double y = natom.getY() ; double z = natom.getZ(); atom.setX(x); atom.setY(y); atom.setZ(z); } }
[ "public", "static", "final", "void", "shift", "(", "Structure", "structure", ",", "Atom", "a", ")", "{", "AtomIterator", "iter", "=", "new", "AtomIterator", "(", "structure", ")", ";", "while", "(", "iter", ".", "hasNext", "(", ")", ")", "{", "Atom", "...
shift a structure with a vector. @param structure a Structure object @param a an Atom object representing a shift vector
[ "shift", "a", "structure", "with", "a", "vector", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L699-L716
32,084
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.shift
public static final void shift(Atom a, Atom b){ Atom natom = add(a,b); double x = natom.getX(); double y = natom.getY() ; double z = natom.getZ(); a.setX(x); a.setY(y); a.setZ(z); }
java
public static final void shift(Atom a, Atom b){ Atom natom = add(a,b); double x = natom.getX(); double y = natom.getY() ; double z = natom.getZ(); a.setX(x); a.setY(y); a.setZ(z); }
[ "public", "static", "final", "void", "shift", "(", "Atom", "a", ",", "Atom", "b", ")", "{", "Atom", "natom", "=", "add", "(", "a", ",", "b", ")", ";", "double", "x", "=", "natom", ".", "getX", "(", ")", ";", "double", "y", "=", "natom", ".", ...
Shift a vector. @param a vector a @param b vector b
[ "Shift", "a", "vector", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L726-L735
32,085
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getCentroid
public static final Atom getCentroid(Atom[] atomSet){ // if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line if (atomSet.length==0) throw new IllegalArgumentException("Atom array has length 0, can't calculate centroid!"); double[] coords = new double[3]; coords[0] = 0; coords[1] = 0; coords[2] = 0 ; for (Atom a : atomSet) { coords[0] += a.getX(); coords[1] += a.getY(); coords[2] += a.getZ(); } int n = atomSet.length; coords[0] = coords[0] / n; coords[1] = coords[1] / n; coords[2] = coords[2] / n; Atom vec = new AtomImpl(); vec.setCoords(coords); return vec; }
java
public static final Atom getCentroid(Atom[] atomSet){ // if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line if (atomSet.length==0) throw new IllegalArgumentException("Atom array has length 0, can't calculate centroid!"); double[] coords = new double[3]; coords[0] = 0; coords[1] = 0; coords[2] = 0 ; for (Atom a : atomSet) { coords[0] += a.getX(); coords[1] += a.getY(); coords[2] += a.getZ(); } int n = atomSet.length; coords[0] = coords[0] / n; coords[1] = coords[1] / n; coords[2] = coords[2] / n; Atom vec = new AtomImpl(); vec.setCoords(coords); return vec; }
[ "public", "static", "final", "Atom", "getCentroid", "(", "Atom", "[", "]", "atomSet", ")", "{", "// if we don't catch this case, the centroid returned is (NaN,NaN,NaN), which can cause lots of problems down the line", "if", "(", "atomSet", ".", "length", "==", "0", ")", "th...
Returns the centroid of the set of atoms. @param atomSet a set of Atoms @return an Atom representing the Centroid of the set of atoms
[ "Returns", "the", "centroid", "of", "the", "set", "of", "atoms", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L771-L799
32,086
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.centerOfMass
public static Atom centerOfMass(Atom[] points) { Atom center = new AtomImpl(); float totalMass = 0.0f; for (Atom a : points) { float mass = a.getElement().getAtomicMass(); totalMass += mass; center = scaleAdd(mass, a, center); } center = scaleEquals(center, 1.0f/totalMass); return center; }
java
public static Atom centerOfMass(Atom[] points) { Atom center = new AtomImpl(); float totalMass = 0.0f; for (Atom a : points) { float mass = a.getElement().getAtomicMass(); totalMass += mass; center = scaleAdd(mass, a, center); } center = scaleEquals(center, 1.0f/totalMass); return center; }
[ "public", "static", "Atom", "centerOfMass", "(", "Atom", "[", "]", "points", ")", "{", "Atom", "center", "=", "new", "AtomImpl", "(", ")", ";", "float", "totalMass", "=", "0.0f", ";", "for", "(", "Atom", "a", ":", "points", ")", "{", "float", "mass",...
Returns the center of mass of the set of atoms. Atomic masses of the Atoms are used. @param points a set of Atoms @return an Atom representing the center of mass
[ "Returns", "the", "center", "of", "mass", "of", "the", "set", "of", "atoms", ".", "Atomic", "masses", "of", "the", "Atoms", "are", "used", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L809-L821
32,087
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.scale
public static Atom scale(Atom a, double s) { double x = a.getX(); double y = a.getY(); double z = a.getZ(); Atom b = new AtomImpl(); b.setX(x*s); b.setY(y*s); b.setZ(z*s); return b; }
java
public static Atom scale(Atom a, double s) { double x = a.getX(); double y = a.getY(); double z = a.getZ(); Atom b = new AtomImpl(); b.setX(x*s); b.setY(y*s); b.setZ(z*s); return b; }
[ "public", "static", "Atom", "scale", "(", "Atom", "a", ",", "double", "s", ")", "{", "double", "x", "=", "a", ".", "getX", "(", ")", ";", "double", "y", "=", "a", ".", "getY", "(", ")", ";", "double", "z", "=", "a", ".", "getZ", "(", ")", "...
Multiply elements of a by s @param a @param s @return A new Atom with s*a
[ "Multiply", "elements", "of", "a", "by", "s" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L854-L865
32,088
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getCenterVector
public static final Atom getCenterVector(Atom[] atomSet){ Atom centroid = getCentroid(atomSet); return getCenterVector(atomSet,centroid); }
java
public static final Atom getCenterVector(Atom[] atomSet){ Atom centroid = getCentroid(atomSet); return getCenterVector(atomSet,centroid); }
[ "public", "static", "final", "Atom", "getCenterVector", "(", "Atom", "[", "]", "atomSet", ")", "{", "Atom", "centroid", "=", "getCentroid", "(", "atomSet", ")", ";", "return", "getCenterVector", "(", "atomSet", ",", "centroid", ")", ";", "}" ]
Returns the Vector that needs to be applied to shift a set of atoms to the Centroid. @param atomSet array of Atoms @return the vector needed to shift the set of atoms to its geometric center
[ "Returns", "the", "Vector", "that", "needs", "to", "be", "applied", "to", "shift", "a", "set", "of", "atoms", "to", "the", "Centroid", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L901-L906
32,089
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getCenterVector
public static final Atom getCenterVector(Atom[] atomSet, Atom centroid){ double[] coords = new double[3]; coords[0] = 0 - centroid.getX(); coords[1] = 0 - centroid.getY(); coords[2] = 0 - centroid.getZ(); Atom shiftVec = new AtomImpl(); shiftVec.setCoords(coords); return shiftVec; }
java
public static final Atom getCenterVector(Atom[] atomSet, Atom centroid){ double[] coords = new double[3]; coords[0] = 0 - centroid.getX(); coords[1] = 0 - centroid.getY(); coords[2] = 0 - centroid.getZ(); Atom shiftVec = new AtomImpl(); shiftVec.setCoords(coords); return shiftVec; }
[ "public", "static", "final", "Atom", "getCenterVector", "(", "Atom", "[", "]", "atomSet", ",", "Atom", "centroid", ")", "{", "double", "[", "]", "coords", "=", "new", "double", "[", "3", "]", ";", "coords", "[", "0", "]", "=", "0", "-", "centroid", ...
Returns the Vector that needs to be applied to shift a set of atoms to the Centroid, if the centroid is already known @param atomSet array of Atoms @return the vector needed to shift the set of atoms to its geometric center
[ "Returns", "the", "Vector", "that", "needs", "to", "be", "applied", "to", "shift", "a", "set", "of", "atoms", "to", "the", "Centroid", "if", "the", "centroid", "is", "already", "known" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L917-L928
32,090
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.centerAtoms
public static final Atom[] centerAtoms(Atom[] atomSet) throws StructureException { Atom centroid = getCentroid(atomSet); return centerAtoms(atomSet, centroid); }
java
public static final Atom[] centerAtoms(Atom[] atomSet) throws StructureException { Atom centroid = getCentroid(atomSet); return centerAtoms(atomSet, centroid); }
[ "public", "static", "final", "Atom", "[", "]", "centerAtoms", "(", "Atom", "[", "]", "atomSet", ")", "throws", "StructureException", "{", "Atom", "centroid", "=", "getCentroid", "(", "atomSet", ")", ";", "return", "centerAtoms", "(", "atomSet", ",", "centroi...
Center the atoms at the Centroid. @param atomSet a set of Atoms @return an Atom representing the Centroid of the set of atoms @throws StructureException
[ "Center", "the", "atoms", "at", "the", "Centroid", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L938-L943
32,091
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.centerAtoms
public static final Atom[] centerAtoms(Atom[] atomSet, Atom centroid) throws StructureException { Atom shiftVector = getCenterVector(atomSet, centroid); Atom[] newAtoms = new AtomImpl[atomSet.length]; for (int i =0 ; i < atomSet.length; i++){ Atom a = atomSet[i]; Atom n = add(a,shiftVector); newAtoms[i] = n ; } return newAtoms; }
java
public static final Atom[] centerAtoms(Atom[] atomSet, Atom centroid) throws StructureException { Atom shiftVector = getCenterVector(atomSet, centroid); Atom[] newAtoms = new AtomImpl[atomSet.length]; for (int i =0 ; i < atomSet.length; i++){ Atom a = atomSet[i]; Atom n = add(a,shiftVector); newAtoms[i] = n ; } return newAtoms; }
[ "public", "static", "final", "Atom", "[", "]", "centerAtoms", "(", "Atom", "[", "]", "atomSet", ",", "Atom", "centroid", ")", "throws", "StructureException", "{", "Atom", "shiftVector", "=", "getCenterVector", "(", "atomSet", ",", "centroid", ")", ";", "Atom...
Center the atoms at the Centroid, if the centroid is already know. @param atomSet a set of Atoms @return an Atom representing the Centroid of the set of atoms @throws StructureException
[ "Center", "the", "atoms", "at", "the", "Centroid", "if", "the", "centroid", "is", "already", "know", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L953-L966
32,092
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.createVirtualCBAtom
public static final Atom createVirtualCBAtom(AminoAcid amino) throws StructureException{ AminoAcid ala = StandardAminoAcid.getAminoAcid("ALA"); Atom aN = ala.getN(); Atom aCA = ala.getCA(); Atom aC = ala.getC(); Atom aCB = ala.getCB(); Atom[] arr1 = new Atom[3]; arr1[0] = aN; arr1[1] = aCA; arr1[2] = aC; Atom[] arr2 = new Atom[3]; arr2[0] = amino.getN(); arr2[1] = amino.getCA(); arr2[2] = amino.getC(); // ok now we got the two arrays, do a Superposition: SuperPositionSVD svd = new SuperPositionSVD(false); Matrix4d transform = svd.superpose(Calc.atomsToPoints(arr1), Calc.atomsToPoints(arr2)); Matrix rotMatrix = Matrices.getRotationJAMA(transform); Atom tranMatrix = getTranslationVector(transform); Calc.rotate(aCB,rotMatrix); Atom virtualCB = Calc.add(aCB,tranMatrix); virtualCB.setName("CB"); return virtualCB; }
java
public static final Atom createVirtualCBAtom(AminoAcid amino) throws StructureException{ AminoAcid ala = StandardAminoAcid.getAminoAcid("ALA"); Atom aN = ala.getN(); Atom aCA = ala.getCA(); Atom aC = ala.getC(); Atom aCB = ala.getCB(); Atom[] arr1 = new Atom[3]; arr1[0] = aN; arr1[1] = aCA; arr1[2] = aC; Atom[] arr2 = new Atom[3]; arr2[0] = amino.getN(); arr2[1] = amino.getCA(); arr2[2] = amino.getC(); // ok now we got the two arrays, do a Superposition: SuperPositionSVD svd = new SuperPositionSVD(false); Matrix4d transform = svd.superpose(Calc.atomsToPoints(arr1), Calc.atomsToPoints(arr2)); Matrix rotMatrix = Matrices.getRotationJAMA(transform); Atom tranMatrix = getTranslationVector(transform); Calc.rotate(aCB,rotMatrix); Atom virtualCB = Calc.add(aCB,tranMatrix); virtualCB.setName("CB"); return virtualCB; }
[ "public", "static", "final", "Atom", "createVirtualCBAtom", "(", "AminoAcid", "amino", ")", "throws", "StructureException", "{", "AminoAcid", "ala", "=", "StandardAminoAcid", ".", "getAminoAcid", "(", "\"ALA\"", ")", ";", "Atom", "aN", "=", "ala", ".", "getN", ...
creates a virtual C-beta atom. this might be needed when working with GLY thanks to Peter Lackner for a python template of this method. @param amino the amino acid for which a "virtual" CB atom should be calculated @return a "virtual" CB atom @throws StructureException
[ "creates", "a", "virtual", "C", "-", "beta", "atom", ".", "this", "might", "be", "needed", "when", "working", "with", "GLY" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L979-L1012
32,093
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.calcRotationAngleInDegrees
public static double calcRotationAngleInDegrees(Atom centerPt, Atom targetPt) { // calculate the angle theta from the deltaY and deltaX values // (atan2 returns radians values from [-PI,PI]) // 0 currently points EAST. // NOTE: By preserving Y and X param order to atan2, we are expecting // a CLOCKWISE angle direction. double theta = Math.atan2(targetPt.getY() - centerPt.getY(), targetPt.getX() - centerPt.getX()); // rotate the theta angle clockwise by 90 degrees // (this makes 0 point NORTH) // NOTE: adding to an angle rotates it clockwise. // subtracting would rotate it counter-clockwise theta += Math.PI/2.0; // convert from radians to degrees // this will give you an angle from [0->270],[-180,0] double angle = Math.toDegrees(theta); // convert to positive range [0-360) // since we want to prevent negative angles, adjust them now. // we can assume that atan2 will not return a negative value // greater than one partial rotation if (angle < 0) { angle += 360; } return angle; }
java
public static double calcRotationAngleInDegrees(Atom centerPt, Atom targetPt) { // calculate the angle theta from the deltaY and deltaX values // (atan2 returns radians values from [-PI,PI]) // 0 currently points EAST. // NOTE: By preserving Y and X param order to atan2, we are expecting // a CLOCKWISE angle direction. double theta = Math.atan2(targetPt.getY() - centerPt.getY(), targetPt.getX() - centerPt.getX()); // rotate the theta angle clockwise by 90 degrees // (this makes 0 point NORTH) // NOTE: adding to an angle rotates it clockwise. // subtracting would rotate it counter-clockwise theta += Math.PI/2.0; // convert from radians to degrees // this will give you an angle from [0->270],[-180,0] double angle = Math.toDegrees(theta); // convert to positive range [0-360) // since we want to prevent negative angles, adjust them now. // we can assume that atan2 will not return a negative value // greater than one partial rotation if (angle < 0) { angle += 360; } return angle; }
[ "public", "static", "double", "calcRotationAngleInDegrees", "(", "Atom", "centerPt", ",", "Atom", "targetPt", ")", "{", "// calculate the angle theta from the deltaY and deltaX values", "// (atan2 returns radians values from [-PI,PI])", "// 0 currently points EAST.", "// NOTE: By prese...
Calculates the angle from centerPt to targetPt in degrees. The return should range from [0,360), rotating CLOCKWISE, 0 and 360 degrees represents NORTH, 90 degrees represents EAST, etc... Assumes all points are in the same coordinate space. If they are not, you will need to call SwingUtilities.convertPointToScreen or equivalent on all arguments before passing them to this function. @param centerPt Point we are rotating around. @param targetPt Point we want to calculate the angle to. @return angle in degrees. This is the angle from centerPt to targetPt.
[ "Calculates", "the", "angle", "from", "centerPt", "to", "targetPt", "in", "degrees", ".", "The", "return", "should", "range", "from", "[", "0", "360", ")", "rotating", "CLOCKWISE", "0", "and", "360", "degrees", "represents", "NORTH", "90", "degrees", "repres...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1125-L1153
32,094
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.shift
public static void shift(Atom[] ca, Atom b) { for (Atom atom : ca) Calc.shift(atom, b); }
java
public static void shift(Atom[] ca, Atom b) { for (Atom atom : ca) Calc.shift(atom, b); }
[ "public", "static", "void", "shift", "(", "Atom", "[", "]", "ca", ",", "Atom", "b", ")", "{", "for", "(", "Atom", "atom", ":", "ca", ")", "Calc", ".", "shift", "(", "atom", ",", ")", ";", "}" ]
Shift an array of atoms at once. @param ca array of Atoms to shift @param b reference Atom vector
[ "Shift", "an", "array", "of", "atoms", "at", "once", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1182-L1185
32,095
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getTransformation
public static Matrix4d getTransformation(Matrix rot, Atom trans) { return new Matrix4d(new Matrix3d(rot.getColumnPackedCopy()), new Vector3d(trans.getCoordsAsPoint3d()), 1.0); }
java
public static Matrix4d getTransformation(Matrix rot, Atom trans) { return new Matrix4d(new Matrix3d(rot.getColumnPackedCopy()), new Vector3d(trans.getCoordsAsPoint3d()), 1.0); }
[ "public", "static", "Matrix4d", "getTransformation", "(", "Matrix", "rot", ",", "Atom", "trans", ")", "{", "return", "new", "Matrix4d", "(", "new", "Matrix3d", "(", "rot", ".", "getColumnPackedCopy", "(", ")", ")", ",", "new", "Vector3d", "(", "trans", "."...
Convert JAMA rotation and translation to a Vecmath transformation matrix. Because the JAMA matrix is a pre-multiplication matrix and the Vecmath matrix is a post-multiplication one, the rotation matrix is transposed to ensure that the transformation they produce is the same. @param rot 3x3 Rotation matrix @param trans 3x1 translation vector in Atom coordinates @return 4x4 transformation matrix
[ "Convert", "JAMA", "rotation", "and", "translation", "to", "a", "Vecmath", "transformation", "matrix", ".", "Because", "the", "JAMA", "matrix", "is", "a", "pre", "-", "multiplication", "matrix", "and", "the", "Vecmath", "matrix", "is", "a", "post", "-", "mul...
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1199-L1202
32,096
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.getTranslationVector
public static Atom getTranslationVector(Matrix4d transform){ Atom transl = new AtomImpl(); double[] coords = {transform.m03, transform.m13, transform.m23}; transl.setCoords(coords); return transl; }
java
public static Atom getTranslationVector(Matrix4d transform){ Atom transl = new AtomImpl(); double[] coords = {transform.m03, transform.m13, transform.m23}; transl.setCoords(coords); return transl; }
[ "public", "static", "Atom", "getTranslationVector", "(", "Matrix4d", "transform", ")", "{", "Atom", "transl", "=", "new", "AtomImpl", "(", ")", ";", "double", "[", "]", "coords", "=", "{", "transform", ".", "m03", ",", "transform", ".", "m13", ",", "tran...
Extract the translational vector as an Atom of a transformation matrix. @param transform Matrix4d @return Atom shift vector
[ "Extract", "the", "translational", "vector", "as", "an", "Atom", "of", "a", "transformation", "matrix", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1211-L1217
32,097
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java
Calc.rmsd
public static double rmsd(Atom[] x, Atom[] y) { return CalcPoint.rmsd(atomsToPoints(x), atomsToPoints(y)); }
java
public static double rmsd(Atom[] x, Atom[] y) { return CalcPoint.rmsd(atomsToPoints(x), atomsToPoints(y)); }
[ "public", "static", "double", "rmsd", "(", "Atom", "[", "]", "x", ",", "Atom", "[", "]", "y", ")", "{", "return", "CalcPoint", ".", "rmsd", "(", "atomsToPoints", "(", "x", ")", ",", "atomsToPoints", "(", "y", ")", ")", ";", "}" ]
Calculate the RMSD of two Atom arrays, already superposed. @param x array of Atoms superposed to y @param y array of Atoms superposed to x @return RMSD
[ "Calculate", "the", "RMSD", "of", "two", "Atom", "arrays", "already", "superposed", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/Calc.java#L1257-L1259
32,098
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/CliTools.java
CliTools.getEnumValuesAsString
public static <T extends Enum<?>> String getEnumValuesAsString(Class<T> enumClass) { //ScoringStrategy[] vals = ScoringStrategy.values(); T[] vals = enumClass.getEnumConstants(); StringBuilder str = new StringBuilder(); if(vals.length == 1) { str.append(vals[0].name()); } else if(vals.length > 1 ) { for(int i=0;i<vals.length-1;i++) { str.append(vals[i].name()); str.append(", "); } str.append("or "); str.append(vals[vals.length-1].name()); } return str.toString(); }
java
public static <T extends Enum<?>> String getEnumValuesAsString(Class<T> enumClass) { //ScoringStrategy[] vals = ScoringStrategy.values(); T[] vals = enumClass.getEnumConstants(); StringBuilder str = new StringBuilder(); if(vals.length == 1) { str.append(vals[0].name()); } else if(vals.length > 1 ) { for(int i=0;i<vals.length-1;i++) { str.append(vals[i].name()); str.append(", "); } str.append("or "); str.append(vals[vals.length-1].name()); } return str.toString(); }
[ "public", "static", "<", "T", "extends", "Enum", "<", "?", ">", ">", "String", "getEnumValuesAsString", "(", "Class", "<", "T", ">", "enumClass", ")", "{", "//ScoringStrategy[] vals = ScoringStrategy.values();", "T", "[", "]", "vals", "=", "enumClass", ".", "g...
Constructs a comma-separated list of values for an enum. Example: > getEnumValues(ScoringStrategy.class) "CA_SCORING, SIDE_CHAIN_SCORING, SIDE_CHAIN_ANGLE_SCORING, CA_AND_SIDE_CHAIN_ANGLE_SCORING, or SEQUENCE_CONSERVATION" @param enumClass @return
[ "Constructs", "a", "comma", "-", "separated", "list", "of", "values", "for", "an", "enum", "." ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/util/CliTools.java#L340-L357
32,099
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/UnitCellBoundingBox.java
UnitCellBoundingBox.getTranslatedBbs
public UnitCellBoundingBox getTranslatedBbs(Vector3d translation) { UnitCellBoundingBox translatedBbs = new UnitCellBoundingBox(numOperatorsSg, numPolyChainsAu); for (int i=0; i<numOperatorsSg; i++) { for (int j = 0;j<numPolyChainsAu; j++) { translatedBbs.chainBbs[i][j] = new BoundingBox(this.chainBbs[i][j]); translatedBbs.chainBbs[i][j].translate(translation); } translatedBbs.auBbs[i] = new BoundingBox(translatedBbs.chainBbs[i]); } return translatedBbs; }
java
public UnitCellBoundingBox getTranslatedBbs(Vector3d translation) { UnitCellBoundingBox translatedBbs = new UnitCellBoundingBox(numOperatorsSg, numPolyChainsAu); for (int i=0; i<numOperatorsSg; i++) { for (int j = 0;j<numPolyChainsAu; j++) { translatedBbs.chainBbs[i][j] = new BoundingBox(this.chainBbs[i][j]); translatedBbs.chainBbs[i][j].translate(translation); } translatedBbs.auBbs[i] = new BoundingBox(translatedBbs.chainBbs[i]); } return translatedBbs; }
[ "public", "UnitCellBoundingBox", "getTranslatedBbs", "(", "Vector3d", "translation", ")", "{", "UnitCellBoundingBox", "translatedBbs", "=", "new", "UnitCellBoundingBox", "(", "numOperatorsSg", ",", "numPolyChainsAu", ")", ";", "for", "(", "int", "i", "=", "0", ";", ...
Returns a new BoundingBoxes object containing the same bounds as this BoundingBoxes object translated by the given translation @param translation @return
[ "Returns", "a", "new", "BoundingBoxes", "object", "containing", "the", "same", "bounds", "as", "this", "BoundingBoxes", "object", "translated", "by", "the", "given", "translation" ]
a1c71a8e3d40cc32104b1d387a3d3b560b43356e
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/UnitCellBoundingBox.java#L114-L126