_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q26100
SeqRes2AtomAligner.storeUnAlignedSeqRes
train
public static void storeUnAlignedSeqRes(Structure structure, List<Chain> seqResChains, boolean headerOnly) { if (headerOnly) { List<Chain> atomChains = new ArrayList<>(); for (Chain seqRes: seqResChains) { // In header-only mode skip ATOM records. // Here we store chains with SEQRES instead of AtomGr...
java
{ "resource": "" }
q26101
AbstractAlignmentJmol.setAtoms
train
public void setAtoms(Atom[] atoms){ Structure s = new StructureImpl(); Chain c = new ChainImpl(); c.setId("A"); for (Atom a: atoms){ c.addGroup(a.getGroup()); } s.addChain(c); setStructure(s); }
java
{ "resource": "" }
q26102
AbstractAlignmentJmol.evalString
train
public void evalString(String rasmolScript){ if ( jmolPanel == null ){ logger.error("please install Jmol first"); return; } jmolPanel.evalString(rasmolScript); }
java
{ "resource": "" }
q26103
AbstractAlignmentJmol.setStructure
train
public void setStructure(Structure s) { if (jmolPanel == null){ logger.error("please install Jmol first"); return; } setTitle(s.getPDBCode()); jmolPanel.setStructure(s); // actually this is very simple // just convert the structure to a PDB file //String pdb = s.toPDB(); //System.out.println(s....
java
{ "resource": "" }
q26104
StructureInterfaceCluster.getTotalArea
train
public double getTotalArea() { double area = 0; for (StructureInterface interf:members) { area+=interf.getTotalArea(); } return area/members.size(); }
java
{ "resource": "" }
q26105
MmtfUtils.calculateDsspSecondaryStructure
train
public static void calculateDsspSecondaryStructure(Structure bioJavaStruct) { SecStrucCalc ssp = new SecStrucCalc(); try{ ssp.calculate(bioJavaStruct, true); } catch(StructureException e) { LOGGER.warn("Could not calculate secondary structure (error {}). Will try to get a DSSP file from the RCSB web serv...
java
{ "resource": "" }
q26106
MmtfUtils.getUnitCellAsArray
train
public static float[] getUnitCellAsArray(PDBCrystallographicInfo xtalInfo) { CrystalCell xtalCell = xtalInfo.getCrystalCell(); if(xtalCell==null){ return null; }else{ float[] inputUnitCell = new float[6]; inputUnitCell[0] = (float) xtalCell.getA(); inputUnitCell[1] = (float) xtalCell.getB(); inputU...
java
{ "resource": "" }
q26107
MmtfUtils.techniquesToStringArray
train
public static String[] techniquesToStringArray(Set<ExperimentalTechnique> experimentalTechniques) { if(experimentalTechniques==null){ return new String[0]; } String[] outArray = new String[experimentalTechniques.size()]; int index = 0; for (ExperimentalTechnique experimentalTechnique : experimentalTechniqu...
java
{ "resource": "" }
q26108
MmtfUtils.dateToIsoString
train
public static String dateToIsoString(Date inputDate) { DateFormat dateStringFormat = new SimpleDateFormat("yyyy-MM-dd"); return dateStringFormat.format(inputDate); }
java
{ "resource": "" }
q26109
MmtfUtils.getTransformMap
train
public static Map<double[], int[]> getTransformMap(BioAssemblyInfo bioassemblyInfo, Map<String, Integer> chainIdToIndexMap) { Map<Matrix4d, List<Integer>> matMap = new LinkedHashMap<>(); List<BiologicalAssemblyTransformation> transforms = bioassemblyInfo.getTransforms(); for (BiologicalAssemblyTransformation t...
java
{ "resource": "" }
q26110
MmtfUtils.convertToDoubleArray
train
public static double[] convertToDoubleArray(Matrix4d transformationMatrix) { // Initialise the output array double[] outArray = new double[16]; // Iterate over the matrix for(int i=0; i<4; i++){ for(int j=0; j<4; j++){ // Now set this element outArray[i*4+j] = transformationMatrix.getElement(i,j); ...
java
{ "resource": "" }
q26111
MmtfUtils.getNumGroups
train
public static int getNumGroups(Structure structure) { int count = 0; for(int i=0; i<structure.nrModels(); i++) { for(Chain chain : structure.getChains(i)){ count+= chain.getAtomGroups().size(); } } return count; }
java
{ "resource": "" }
q26112
MmtfUtils.getAtomsForGroup
train
public static List<Atom> getAtomsForGroup(Group inputGroup) { Set<Atom> uniqueAtoms = new HashSet<Atom>(); List<Atom> theseAtoms = new ArrayList<Atom>(); for(Atom a: inputGroup.getAtoms()){ theseAtoms.add(a); uniqueAtoms.add(a); } List<Group> altLocs = inputGroup.getAltLocs(); for(Group thisG: altLocs...
java
{ "resource": "" }
q26113
MmtfUtils.getNumBondsInGroup
train
public static int getNumBondsInGroup(List<Atom> atomsInGroup) { int bondCounter = 0; for(Atom atom : atomsInGroup) { if(atom.getBonds()==null){ continue; } for(Bond bond : atom.getBonds()) { // Now set the bonding information. Atom other = bond.getOther(atom); // If both atoms are in the gr...
java
{ "resource": "" }
q26114
MmtfUtils.getSecStructTypeFromDsspIndex
train
public static SecStrucType getSecStructTypeFromDsspIndex(int dsspIndex) { String dsspType = DsspType.dsspTypeFromInt(dsspIndex).getDsspType(); for(SecStrucType secStrucType : SecStrucType.values()) { if(dsspType==secStrucType.name) { return secStrucType; } } // Return a null entry. return null;...
java
{ "resource": "" }
q26115
MmtfUtils.getStructureInfo
train
public static MmtfSummaryDataBean getStructureInfo(Structure structure) { MmtfSummaryDataBean mmtfSummaryDataBean = new MmtfSummaryDataBean(); // Get all the atoms List<Atom> theseAtoms = new ArrayList<>(); List<Chain> allChains = new ArrayList<>(); Map<String, Integer> chainIdToIndexMap = new LinkedHashMap<>...
java
{ "resource": "" }
q26116
MmtfUtils.insertSeqResGroup
train
public static void insertSeqResGroup(Chain chain, Group group, int sequenceIndexId) { List<Group> seqResGroups = chain.getSeqResGroups(); addGroupAtId(seqResGroups, group, sequenceIndexId); }
java
{ "resource": "" }
q26117
MmtfUtils.addSeqRes
train
public static void addSeqRes(Chain modelChain, String sequence) { List<Group> seqResGroups = modelChain.getSeqResGroups(); GroupType chainType = getChainType(modelChain.getAtomGroups()); for(int i=0; i<sequence.length(); i++){ char singleLetterCode = sequence.charAt(i); Group group = null; if(seqResGroup...
java
{ "resource": "" }
q26118
GenericInsdcHeaderFormat._write_feature
train
protected String _write_feature(FeatureInterface<AbstractSequence<C>, C> feature, int record_length) { String location = _insdc_feature_location_string(feature, record_length); String f_type = feature.getType().replace(" ", "_"); StringBuilder sb = new StringBuilder(); Formatter formatter = new Formatter(sb,Loc...
java
{ "resource": "" }
q26119
GenericInsdcHeaderFormat._split_multi_line
train
protected ArrayList<String> _split_multi_line(String text, int max_len) { // TODO Auto-generated method stub ArrayList<String> output = new ArrayList<String>(); text = text.trim(); if(text.length() <= max_len) { output.add(text); return output; } ArrayList<String> words = new ArrayList<String>(); C...
java
{ "resource": "" }
q26120
SimpleGapPenalty.setType
train
private void setType() { type = (gop == 0) ? GapPenalty.Type.LINEAR : ((gep == 0) ? GapPenalty.Type.CONSTANT : GapPenalty.Type.AFFINE); }
java
{ "resource": "" }
q26121
ProteinModificationXmlReader.getChildNodes
train
private static Map<String,List<Node>> getChildNodes(Node parent) { if (parent==null) return Collections.emptyMap(); Map<String,List<Node>> children = new HashMap<String,List<Node>>(); NodeList nodes = parent.getChildNodes(); int nNodes = nodes.getLength(); for (int i=0; i<nNodes; i++) { Node node = no...
java
{ "resource": "" }
q26122
RNAToAminoAcidTranslator.postProcessCompoundLists
train
@Override protected void postProcessCompoundLists( List<List<AminoAcidCompound>> compoundLists) { for (List<AminoAcidCompound> compounds : compoundLists) { if (trimStops) { trimStop(compounds); } } }
java
{ "resource": "" }
q26123
RNAToAminoAcidTranslator.trimStop
train
protected void trimStop(List<AminoAcidCompound> sequence) { AminoAcidCompound stop = sequence.get(sequence.size() - 1); boolean isStop = false; if (aminoAcidToCodon.containsKey(stop)) { for (Codon c : aminoAcidToCodon.get(stop)) { if (c.isStop()) { isStop = true; break; } } } if (isSt...
java
{ "resource": "" }
q26124
ResidueGroup.combineWith
train
public void combineWith(List<List<Integer>> alignRes) { for (int i = 0; i < order(); i++) alignRes.get(i).add(residues.get(i)); }
java
{ "resource": "" }
q26125
AllChemCompProvider.downloadFile
train
public static void downloadFile() throws IOException { initPath(); initServerName(); String localName = getLocalFileName(); String u = serverName + "/" + COMPONENTS_FILE_LOCATION; downloadFileFromRemote(new URL(u), new File(localName)); }
java
{ "resource": "" }
q26126
AllChemCompProvider.run
train
@Override public void run() { long timeS = System.currentTimeMillis(); initPath(); ensureFileExists(); try { loadAllChemComps(); long timeE = System.currentTimeMillis(); logger.debug("Time to init chem comp dictionary: " + (timeE - timeS) / 1000 + " sec."); } catch (IOException e) { logger....
java
{ "resource": "" }
q26127
SequenceFileProxyLoader.init
train
private boolean init() throws IOException, CompoundNotFoundException { BufferedReader br = new BufferedReader(new FileReader(file)); br.skip(sequenceStartIndex); String sequence = sequenceParser.getSequence(br, sequenceLength); setContents(sequence); br.close(); // close file to prevent too many being open ...
java
{ "resource": "" }
q26128
StructurePairAligner.main
train
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 outputfi...
java
{ "resource": "" }
q26129
StructurePairAligner.align
train
public void align(Structure s1, Structure s2) throws StructureException { align(s1, s2, params); }
java
{ "resource": "" }
q26130
StructurePairAligner.align
train
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, para...
java
{ "resource": "" }
q26131
StructurePairAligner.align
train
public void align(Structure s1, String chainId1, Structure s2, String chainId2) throws StructureException { align(s1, chainId1, s2, chainId2, params); }
java
{ "resource": "" }
q26132
StructurePairAligner.align
train
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...
java
{ "resource": "" }
q26133
JmolPanel.jmolColorByChain
train
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(\...
java
{ "resource": "" }
q26134
AminoAcidCompoundSet.addAmbiguousEquivalents
train
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(t...
java
{ "resource": "" }
q26135
SimpleMMcifConsumer.getNewGroup
train
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(...
java
{ "resource": "" }
q26136
SimpleMMcifConsumer.isKnownChain
train
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.ou...
java
{ "resource": "" }
q26137
SimpleMMcifConsumer.convertAtom
train
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()); ...
java
{ "resource": "" }
q26138
SimpleMMcifConsumer.documentStart
train
@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>...
java
{ "resource": "" }
q26139
SimpleMMcifConsumer.addAncilliaryEntityData
train
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 (EntitySr...
java
{ "resource": "" }
q26140
SimpleMMcifConsumer.addInformationFromESG
train
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_sc...
java
{ "resource": "" }
q26141
SimpleMMcifConsumer.addInformationFromESN
train
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
{ "resource": "" }
q26142
SimpleMMcifConsumer.addInfoFromESS
train
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
{ "resource": "" }
q26143
SimpleMMcifConsumer.addSites
train
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...
java
{ "resource": "" }
q26144
JMatrixPanel.drawPairs
train
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++)...
java
{ "resource": "" }
q26145
JMatrixPanel.drawBoxes
train
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),...
java
{ "resource": "" }
q26146
JMatrixPanel.drawDistances
train
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++) { d...
java
{ "resource": "" }
q26147
ABITrace.ABITraceInit
train
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
{ "resource": "" }
q26148
ABITrace.getTrace
train
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: " + ...
java
{ "resource": "" }
q26149
ABITrace.calculateScale
train
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
{ "resource": "" }
q26150
ABITrace.getMaximum
train
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
{ "resource": "" }
q26151
ABITrace.initData
train
private void initData(byte[] fileData) { traceData = fileData; if (isABI()) { setIndex(); setBasecalls(); setQcalls(); setSeq(); setTraces(); } else throw new IllegalArgumentException("Not a valid ABI file."); }
java
{ "resource": "" }
q26152
ABITrace.setTraces
train
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...
java
{ "resource": "" }
q26153
ABITrace.setSeq
train
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
{ "resource": "" }
q26154
ABITrace.setQcalls
train
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 sh...
java
{ "resource": "" }
q26155
ABITrace.setBasecalls
train
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 (IOExcepti...
java
{ "resource": "" }
q26156
ABITrace.setIndex
train
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(absIndex...
java
{ "resource": "" }
q26157
ABITrace.getSubArray
train
private void getSubArray(byte[] b, int traceDataOffset) { for (int x = 0; x <= b.length - 1; x++) { b[x] = traceData[traceDataOffset + x]; } }
java
{ "resource": "" }
q26158
ABITrace.isABI
train
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...
java
{ "resource": "" }
q26159
GeneNamesParser.main
train
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 co...
java
{ "resource": "" }
q26160
GeneNamesParser.getGeneNames
train
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 ((...
java
{ "resource": "" }
q26161
GeneSequence.addIntronsUsingExons
train
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, ex...
java
{ "resource": "" }
q26162
GeneSequence.addTranscript
train
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, ...
java
{ "resource": "" }
q26163
GeneSequence.removeIntron
train
public IntronSequence removeIntron(String accession) { for (IntronSequence intronSequence : intronSequenceList) { if (intronSequence.getAccession().getID().equals(accession)) { intronSequenceList.remove(intronSequence); intronSequenceHashMap.remove(accession); return intronSequence; } } return n...
java
{ "resource": "" }
q26164
GeneSequence.addIntron
train
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, en...
java
{ "resource": "" }
q26165
GeneSequence.removeExon
train
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 intronS...
java
{ "resource": "" }
q26166
GeneSequence.addExon
train
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...
java
{ "resource": "" }
q26167
GeneSequence.getSequence5PrimeTo3Prime
train
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 Str...
java
{ "resource": "" }
q26168
PDBHeader.toPDB
train
@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 THRO...
java
{ "resource": "" }
q26169
PDBHeader.setExperimentalTechnique
train
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
{ "resource": "" }
q26170
ChargeAdder.addCharges
train
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 = ...
java
{ "resource": "" }
q26171
SymmOptimizer.updateMultipleAlignment
train
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( "Opti...
java
{ "resource": "" }
q26172
SymmOptimizer.shrinkBlock
train
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 .getAvera...
java
{ "resource": "" }
q26173
SymmOptimizer.saveHistory
train
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++) { ...
java
{ "resource": "" }
q26174
MmtfStructureWriter.addBonds
train
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){ ...
java
{ "resource": "" }
q26175
MmtfStructureWriter.storeEntityInformation
train
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()...
java
{ "resource": "" }
q26176
MmtfStructureWriter.storeBioassemblyInformation
train
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(), chainIdToI...
java
{ "resource": "" }
q26177
TranscriptSequence.removeCDS
train
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
{ "resource": "" }
q26178
TranscriptSequence.addCDS
train
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 ...
java
{ "resource": "" }
q26179
TranscriptSequence.getDNACodingSequence
train
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 (CompoundNotFou...
java
{ "resource": "" }
q26180
TranscriptSequence.getProteinSequence
train
public ProteinSequence getProteinSequence(TranscriptionEngine engine) { DNASequence dnaCodingSequence = getDNACodingSequence(); RNASequence rnaCodingSequence = dnaCodingSequence.getRNASequence(engine); ProteinSequence proteinSequence = rnaCodingSequence.getProteinSequence(engine); proteinSequence.setAccession(n...
java
{ "resource": "" }
q26181
SequenceScalePanel.setPaintDefaults
train
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
{ "resource": "" }
q26182
SequenceScalePanel.drawSequence
train
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...
java
{ "resource": "" }
q26183
CalcPoint.centroid
train
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
{ "resource": "" }
q26184
CalcPoint.transform
train
public static void transform(Matrix4d rotTrans, Point3d[] x) { for (Point3d p : x) { rotTrans.transform(p); } }
java
{ "resource": "" }
q26185
CalcPoint.translate
train
public static void translate(Vector3d trans, Point3d[] x) { for (Point3d p : x) { p.add(trans); } }
java
{ "resource": "" }
q26186
CalcPoint.clonePoint3dArray
train
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
{ "resource": "" }
q26187
CalcPoint.rmsd
train
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
{ "resource": "" }
q26188
MenuCreator.initMenu
train
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(){ ...
java
{ "resource": "" }
q26189
MenuCreator.showAboutDialog
train
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 Lack...
java
{ "resource": "" }
q26190
AnchoredPairwiseSequenceAligner.getAnchors
train
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
{ "resource": "" }
q26191
AnchoredPairwiseSequenceAligner.setAnchors
train
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
{ "resource": "" }
q26192
GenbankReaderHelper.readGenbankProteinSequence
train
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
{ "resource": "" }
q26193
GenbankReaderHelper.readGenbankProteinSequence
train
public static LinkedHashMap<String, ProteinSequence> readGenbankProteinSequence( InputStream inStream) throws Exception { GenbankReader<ProteinSequence, AminoAcidCompound> GenbankReader = new GenbankReader<ProteinSequence, AminoAcidCompound>( inStream, new GenericGenbankHeaderParser<ProteinSequence, AminoA...
java
{ "resource": "" }
q26194
GenbankReaderHelper.readGenbankDNASequence
train
public static LinkedHashMap<String, DNASequence> readGenbankDNASequence( InputStream inStream) throws Exception { GenbankReader<DNASequence, NucleotideCompound> GenbankReader = new GenbankReader<DNASequence, NucleotideCompound>( inStream, new GenericGenbankHeaderParser<DNASequence, NucleotideCompound>(), ...
java
{ "resource": "" }
q26195
GenbankReaderHelper.readGenbankRNASequence
train
public static LinkedHashMap<String, RNASequence> readGenbankRNASequence( InputStream inStream) throws Exception { GenbankReader<RNASequence, NucleotideCompound> GenbankReader = new GenbankReader<RNASequence, NucleotideCompound>( inStream, new GenericGenbankHeaderParser<RNASequence, NucleotideCompound>(), ...
java
{ "resource": "" }
q26196
CachedRemoteScopInstallation.loadRepresentativeDomains
train
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" + ...
java
{ "resource": "" }
q26197
Calc.getDistance
train
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
{ "resource": "" }
q26198
Calc.angle
train
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
{ "resource": "" }
q26199
Calc.unitVector
train
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
{ "resource": "" }