idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
24,500
public static double getRMS ( Atom [ ] ca1 , Atom [ ] ca2 , JointFragments frag ) throws StructureException { AlternativeAlignment ali = new AlternativeAlignment ( ) ; ali . apairs_from_idxlst ( frag ) ; double rms = 999 ; int [ ] idx1 = ali . getIdx1 ( ) ; int [ ] idx2 = ali . getIdx2 ( ) ; Atom [ ] ca1subset = AlignU...
Get the RMS of the JointFragments pair frag
24,501
public Stoichiometry getComponent ( int i ) { return new Stoichiometry ( Collections . singletonList ( orderedClusters . get ( i ) ) , this . strategy , false ) ; }
Make a Stoichiometry object that corresponds to a single component .
24,502
public void setStrategy ( StringOverflowStrategy strategy ) { if ( strategy == StringOverflowStrategy . CUSTOM ) { throw new IllegalArgumentException ( "Set this strategy by providing a function of the type Function<List<SubunitCluster>,String>." ) ; } if ( this . strategy != strategy ) { this . strategy = strategy ; i...
Change string representation of a stoichiometry in case number of clusters exceeds number of letters in the alphabet . This action may invalidate alphas already assigned to the clusters .
24,503
public void setCustomStringGenerator ( Function < List < SubunitCluster > , String > customStringGenerator ) { this . strategy = StringOverflowStrategy . CUSTOM ; this . customStringGenerator = customStringGenerator ; }
Let a user - defined function handle the entire string representation of a stoichiometry .
24,504
private static void displayStructure ( Structure structure , ResidueNumber [ ] residues ) { BiojavaJmol jmol = new BiojavaJmol ( ) ; jmol . setStructure ( structure ) ; jmol . evalString ( "select *; spacefill off; wireframe off; color chain; backbone 0.4; " ) ; String selectionCmd = buildJmolSelection ( residues ) ; ...
Displays the given structure and highlights the given residues .
24,505
private static String buildJmolSelection ( ResidueNumber [ ] residues ) { StringBuilder cmd = new StringBuilder ( "select " ) ; for ( ResidueNumber res : residues ) { if ( res != null ) { cmd . append ( String . format ( "%d^%s:%s.CA or " , res . getSeqNum ( ) , res . getInsCode ( ) == null ? " " : res . getInsCode ( )...
Converts an array of ResidueNumbers into a jMol selection .
24,506
public synchronized static String toXML ( AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) throws IOException { StringWriter result = new StringWriter ( ) ; toXML ( afpChain , result , ca1 , ca2 ) ; return result . toString ( ) ; }
Convert an afpChain to a simple XML representation
24,507
public synchronized static void toXML ( AFPChain afpChain , StringWriter swriter , Atom [ ] ca1 , Atom [ ] ca2 ) throws IOException { PrintWriter writer = new PrintWriter ( swriter ) ; PrettyXMLWriter xml = new PrettyXMLWriter ( writer ) ; xml . openTag ( "AFPChain" ) ; printXMLHeader ( xml , afpChain ) ; int blockNum ...
Write the XML representation to a StringWriter
24,508
public Set < String > getAlignmentOptions ( ) { Set < String > result = new HashSet < String > ( ) ; for ( BlastAlignmentParameterEnum parameter : param . keySet ( ) ) { result . add ( parameter . name ( ) ) ; } return result ; }
Gets parameters which are currently set
24,509
public void setBlastProgram ( BlastProgramEnum program ) { if ( BlastProgramEnum . megablast != program ) { setAlignmentOption ( PROGRAM , program . name ( ) ) ; removeAlignmentOption ( MEGABLAST ) ; } else { setAlignmentOption ( PROGRAM , BlastProgramEnum . blastn . name ( ) ) ; setAlignmentOption ( MEGABLAST , "on" )...
Sets the program to be used with blastall
24,510
public int getBlastWordSize ( ) { if ( param . containsKey ( WORD_SIZE ) ) { return Integer . parseInt ( getAlignmentOption ( WORD_SIZE ) ) ; } try { BlastProgramEnum programType = getBlastProgram ( ) ; switch ( programType ) { case blastn : return 11 ; case megablast : return 28 ; case blastp : case blastx : case tbla...
Returns the value of the WORD_SIZE parameter used for this blast run
24,511
public void setBlastGapCosts ( int gapCreation , int gapExtension ) { String gc = Integer . toString ( gapCreation ) ; String ge = Integer . toString ( gapExtension ) ; setAlignmentOption ( GAPCOSTS , gc + "+" + ge ) ; }
Sets the GAPCOSTS parameter
24,512
public String fmtpl ( String d , int pad ) { int length = d . length ( ) ; int extra = pad - length ; if ( extra < 0 ) { extra = 0 ; } String v = d ; for ( int i = 0 ; i < extra ; i ++ ) { v = " " + v ; } return v ; }
Pad left a string with spaces
24,513
private int getSeqPos ( MouseEvent e ) { int x = e . getX ( ) ; float scale = parent . getScale ( ) ; coordManager . setScale ( scale ) ; int seqpos = coordManager . getSeqPos ( x - 2 ) ; return seqpos ; }
get the sequence position of the current mouse event
24,514
public void clear ( ) { columnLookup . clear ( ) ; rowLookup . clear ( ) ; data = null ; dataGrid . clear ( ) ; doubleValues . clear ( ) ; System . gc ( ) ; }
See if we can free up memory
24,515
static public WorkSheet getCopyWorkSheetSelectedRows ( WorkSheet copyWorkSheet , ArrayList < String > rows ) throws Exception { ArrayList < String > columns = copyWorkSheet . getColumns ( ) ; WorkSheet workSheet = new WorkSheet ( rows , columns ) ; for ( String row : rows ) { for ( String col : columns ) { workSheet . ...
Create a copy of a worksheet . If shuffling of columns or row for testing a way to duplicate original worksheet
24,516
public void shuffleColumnsAndThenRows ( ArrayList < String > columns , ArrayList < String > rows ) throws Exception { doubleValues . clear ( ) ; for ( String column : columns ) { ArrayList < Integer > rowIndex = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < rows . size ( ) ; i ++ ) { rowIndex . add ( i ) ; } Co...
Randomly shuffle the columns and rows . Should be constrained to the same data type if not probably doesn t make any sense .
24,517
public void shuffleColumnValues ( ArrayList < String > columns ) throws Exception { doubleValues . clear ( ) ; ArrayList < String > rows = this . getDataRows ( ) ; for ( String column : columns ) { ArrayList < Integer > rowIndex = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < rows . size ( ) ; i ++ ) { rowIndex...
Need to shuffle column values to allow for randomized testing . The columns in the list will be shuffled together
24,518
public void shuffleRowValues ( ArrayList < String > rows ) throws Exception { doubleValues . clear ( ) ; ArrayList < String > columns = this . getColumns ( ) ; for ( String row : rows ) { ArrayList < Integer > columnIndex = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < columns . size ( ) ; i ++ ) { columnIndex ...
Need to shuffle rows values to allow for randomized testing . The rows in the list will be shuffled together
24,519
public void markMetaDataColumns ( ArrayList < String > metaDataColumns ) { for ( String column : metaDataColumns ) { metaDataColumnsHashMap . put ( column , column ) ; } }
marks columns as containing meta data
24,520
public void replaceColumnValues ( String column , HashMap < String , String > values ) throws Exception { for ( String row : rowLookup . keySet ( ) ) { String oldValue = this . getCell ( row , column ) ; String newValue = values . get ( oldValue ) ; this . addCell ( row , column , newValue ) ; } }
Change values in a column where 0 = something and 1 = something different
24,521
public void applyColumnFilter ( String column , ChangeValue changeValue ) throws Exception { for ( String row : rowLookup . keySet ( ) ) { String oldValue = this . getCell ( row , column ) ; String newValue = changeValue . change ( oldValue ) ; this . addCell ( row , column , newValue ) ; } }
Apply filter to a column to change values from say numberic to nominal based on some range
24,522
public void addColumns ( ArrayList < String > columns , String defaultValue ) { CompactCharSequence dv = new CompactCharSequence ( defaultValue ) ; for ( int i = 0 ; i < data . length ; i ++ ) { CompactCharSequence [ ] row = data [ i ] ; int oldrowlength = data [ i ] . length ; data [ i ] = ( CompactCharSequence [ ] ) ...
Add columns to worksheet and set default value
24,523
public void addRows ( ArrayList < String > rows , String defaultValue ) { CompactCharSequence dv = new CompactCharSequence ( defaultValue ) ; int oldlength = data . length ; int numColumns = 0 ; if ( data . length > 0 && data [ 0 ] != null ) { numColumns = data [ 0 ] . length ; } data = ( CompactCharSequence [ ] [ ] ) ...
Add rows to the worksheet and fill in default value
24,524
private static Object resizeArray ( Object oldArray , int newSize ) { int oldSize = java . lang . reflect . Array . getLength ( oldArray ) ; Class < ? > elementType = oldArray . getClass ( ) . getComponentType ( ) ; Object newArray = java . lang . reflect . Array . newInstance ( elementType , newSize ) ; int preserveLe...
Reallocates an array with a new size and copies the contents of the old array to the new array .
24,525
public void addCell ( String row , String col , String value ) throws Exception { HeaderInfo rowIndex = rowLookup . get ( row ) ; HeaderInfo colIndex = columnLookup . get ( col ) ; if ( rowIndex == null ) { throw new Exception ( "Row " + row + " not found in worksheet" ) ; } if ( colIndex == null ) { throw new Exceptio...
Add data to a cell
24,526
public String getCell ( String row , String col ) throws Exception { if ( col . equals ( this . getIndexColumnName ( ) ) ) { return row ; } HeaderInfo rowIndex = rowLookup . get ( row ) ; HeaderInfo colIndex = columnLookup . get ( col ) ; if ( rowIndex == null ) { for ( String rowtable : rowLookup . keySet ( ) ) { if (...
Get cell value
24,527
public void changeColumnsHeaders ( LinkedHashMap < String , String > newColumnValues ) throws Exception { for ( String oldColumn : newColumnValues . keySet ( ) ) { String newColumn = newColumnValues . get ( oldColumn ) ; changeColumnHeader ( oldColumn , newColumn ) ; } }
Change the columns in the HashMap Key to the name of the value
24,528
public ArrayList < String > getAllColumns ( ) { ArrayList < String > columns = new ArrayList < String > ( ) ; for ( String col : columnLookup . keySet ( ) ) { columns . add ( col ) ; } return columns ; }
Get the list of column names including those that may be hidden
24,529
public ArrayList < String > getColumns ( ) { ArrayList < String > columns = new ArrayList < String > ( ) ; for ( String col : columnLookup . keySet ( ) ) { HeaderInfo hi = columnLookup . get ( col ) ; if ( ! hi . isHide ( ) ) { columns . add ( col ) ; } } return columns ; }
Get the list of column names . Does not include hidden columns
24,530
public ArrayList < String > getDiscreteColumnValues ( String column ) throws Exception { HashMap < String , String > hashMapValues = new HashMap < String , String > ( ) ; ArrayList < String > values = new ArrayList < String > ( ) ; ArrayList < String > rows = getDataRows ( ) ; for ( String row : rows ) { String value =...
Get back a list of unique values in the column
24,531
public ArrayList < String > getDiscreteRowValues ( String row ) throws Exception { HashMap < String , String > hashMapValues = new HashMap < String , String > ( ) ; ArrayList < String > values = new ArrayList < String > ( ) ; for ( String column : getColumns ( ) ) { String value = getCell ( row , column ) ; if ( ! hash...
Get back a list of unique values in the row
24,532
public ArrayList < String > getAllRows ( ) { ArrayList < String > rows = new ArrayList < String > ( ) ; for ( String row : rowLookup . keySet ( ) ) { rows . add ( row ) ; } return rows ; }
Get all rows including those that may be hidden
24,533
public ArrayList < String > getRows ( ) { ArrayList < String > rows = new ArrayList < String > ( ) ; for ( String row : rowLookup . keySet ( ) ) { HeaderInfo hi = rowLookup . get ( row ) ; if ( ! hi . isHide ( ) ) { rows . add ( row ) ; } } return rows ; }
Get the list of row names . Will exclude hidden values
24,534
public ArrayList < String > getDataRows ( ) { ArrayList < String > rows = new ArrayList < String > ( ) ; for ( String row : rowLookup . keySet ( ) ) { if ( this . isMetaDataRow ( row ) ) { continue ; } HeaderInfo hi = rowLookup . get ( row ) ; if ( ! hi . isHide ( ) ) { rows . add ( row ) ; } } return rows ; }
Get the list of row names
24,535
public WorkSheet getLogScale ( double base , double zeroValue ) throws Exception { WorkSheet workSheet = new WorkSheet ( getRows ( ) , getColumns ( ) ) ; workSheet . setIndexColumnName ( this . getIndexColumnName ( ) ) ; ArrayList < String > rows = getRows ( ) ; ArrayList < String > columns = getColumns ( ) ; for ( Str...
Get the log scale of this worksheet
24,536
public WorkSheet swapRowAndColumns ( ) throws Exception { WorkSheet swappedWorkSheet = new WorkSheet ( getColumns ( ) , getRows ( ) ) ; for ( String row : getRows ( ) ) { for ( String col : getColumns ( ) ) { String value = getCell ( row , col ) ; swappedWorkSheet . addCell ( col , row , value ) ; } } ArrayList < Strin...
Swap the row and columns returning a new worksheet
24,537
static CompactCharSequence [ ] [ ] getAllValuesCompactCharSequence ( InputStream is , char delimiter ) throws Exception { BufferedReader br = new BufferedReader ( new InputStreamReader ( is ) ) ; ArrayList < CompactCharSequence [ ] > rows = new ArrayList < CompactCharSequence [ ] > ( ) ; String line = br . readLine ( )...
All support for loading from a jar file
24,538
static public WorkSheet unionWorkSheetsRowJoin ( String w1FileName , String w2FileName , char delimitter , boolean secondSheetMetaData ) throws Exception { WorkSheet w1 = WorkSheet . readCSV ( w1FileName , delimitter ) ; WorkSheet w2 = WorkSheet . readCSV ( w2FileName , delimitter ) ; return unionWorkSheetsRowJoin ( w1...
Combine two work sheets where you join based on rows . Rows that are found in one but not the other are removed . If the second sheet is meta data then a meta data column will be added between the two joined columns
24,539
public void saveCSV ( String fileName ) throws Exception { File f = new File ( fileName ) ; File parentFile = f . getParentFile ( ) ; if ( ! parentFile . isDirectory ( ) ) { parentFile . mkdirs ( ) ; } FileOutputStream file = new FileOutputStream ( fileName ) ; BufferedOutputStream bs = new BufferedOutputStream ( file ...
Save the worksheet as a csv file
24,540
public void appendWorkSheetColumns ( WorkSheet worksheet ) throws Exception { ArrayList < String > newColumns = worksheet . getColumns ( ) ; this . addColumns ( newColumns , "" ) ; ArrayList < String > rows = this . getRows ( ) ; for ( String row : rows ) { for ( String col : newColumns ) { if ( worksheet . isValidRow ...
Add columns from a second worksheet to be joined by common row . If the appended worksheet doesn t contain a row in the master worksheet then default value of is used . Rows in the appended worksheet not found in the master worksheet are not added .
24,541
public void appendWorkSheetRows ( WorkSheet worksheet ) throws Exception { ArrayList < String > newRows = worksheet . getRows ( ) ; this . addRows ( newRows , "" ) ; for ( String col : this . getColumns ( ) ) { if ( ! worksheet . isValidColumn ( col ) ) { continue ; } for ( String row : newRows ) { if ( worksheet . isV...
Add rows from a second worksheet to be joined by common column . If the appended worksheet doesn t contain a column in the master worksheet then default value of is used . Columns in the appended worksheet not found in the master worksheet are not added .
24,542
public static Structure readFromFile ( Path filePath ) throws IOException { MmtfStructureReader mmtfStructureReader = new MmtfStructureReader ( ) ; new StructureDataToAdapter ( new GenericDecoder ( ReaderUtils . getDataFromFile ( filePath ) ) , mmtfStructureReader ) ; return mmtfStructureReader . getStructure ( ) ; }
Get a Structure object from a mmtf file .
24,543
public static void writeToFile ( Structure structure , Path path ) throws IOException { AdapterToStructureData writerToEncoder = new AdapterToStructureData ( ) ; new MmtfStructureWriter ( structure , writerToEncoder ) ; WriterUtils . writeDataToFile ( writerToEncoder , path ) ; }
Write a Structure object to a file .
24,544
public static Structure readFromWeb ( String pdbId ) throws IOException { MmtfStructureReader mmtfStructureReader = new MmtfStructureReader ( ) ; new StructureDataToAdapter ( new GenericDecoder ( ReaderUtils . getDataFromUrl ( pdbId ) ) , mmtfStructureReader ) ; return mmtfStructureReader . getStructure ( ) ; }
Get a Biojava structure from the mmtf REST service .
24,545
public void updateDistanceMatrix ( ) { distanceMatrix = new ArrayList < Matrix > ( ) ; for ( int s = 0 ; s < size ( ) ; s ++ ) { Atom [ ] ca = atomArrays . get ( s ) ; Matrix distMat = AlignUtils . getDistanceMatrix ( ca , ca ) ; distanceMatrix . add ( distMat ) ; } }
Force recalculation of the distance matrices .
24,546
public static double getComposition ( ProteinSequence sequence , ATTRIBUTE attribute , GROUPING group ) throws Exception { return new ProfeatPropertiesImpl ( ) . getComposition ( sequence , attribute , group ) ; }
An adaptor method which returns the composition of the specific grouping for the given attribute .
24,547
public static double getTransition ( ProteinSequence sequence , ATTRIBUTE attribute , TRANSITION transition ) throws Exception { return new ProfeatPropertiesImpl ( ) . getTransition ( sequence , attribute , transition ) ; }
An adaptor method which returns the number of transition between the specified groups for the given attribute with respect to the length of sequence .
24,548
public int [ ] [ ] [ ] getScoreMatrix ( ) { boolean tempStoringScoreMatrix = storingScoreMatrix ; if ( scores == null ) { storingScoreMatrix = true ; align ( ) ; if ( scores == null ) { return null ; } } int [ ] [ ] [ ] copy = scores ; if ( tempStoringScoreMatrix ) { copy = new int [ scores . length ] [ scores [ 0 ] . ...
methods for MatrixAligner
24,549
protected int [ ] getSubstitutionScoreVector ( int queryColumn , Subproblem subproblem ) { int [ ] subs = new int [ subproblem . getTargetEndIndex ( ) + 1 ] ; if ( queryColumn > 0 ) { for ( int y = Math . max ( 1 , subproblem . getTargetStartIndex ( ) ) ; y <= subproblem . getTargetEndIndex ( ) ; y ++ ) { subs [ y ] = ...
Returns score for the alignment of the query column to all target columns
24,550
protected void reset ( ) { xyMax = new int [ ] { 0 , 0 } ; xyStart = new int [ ] { 0 , 0 } ; scores = null ; types = ( gapPenalty == null || gapPenalty . getType ( ) == GapPenalty . Type . LINEAR ) ? new String [ ] { null } : new String [ ] { "Substitution" , "Deletion" , "Insertion" } ; time = - 1 ; profile = null ; }
Resets output fields ; should be overridden to set max and min
24,551
public static double angle ( Quat4d q ) { AxisAngle4d axis = new AxisAngle4d ( ) ; axis . set ( q ) ; return axis . angle ; }
Calculate the rotation angle component of the input unit quaternion .
24,552
public static Quat4d relativeOrientation ( Point3d [ ] fixed , Point3d [ ] moved ) { Matrix m = CalcPoint . formMatrix ( moved , fixed ) ; EigenvalueDecomposition eig = m . eig ( ) ; double [ ] [ ] v = eig . getV ( ) . getArray ( ) ; Quat4d q = new Quat4d ( v [ 1 ] [ 3 ] , v [ 2 ] [ 3 ] , v [ 3 ] [ 3 ] , v [ 0 ] [ 3 ] ...
Calculate the relative quaternion orientation of two arrays of points .
24,553
public Iterator < Location > iterator ( ) { List < Location > list ; if ( isComplex ( ) ) { list = getSubLocations ( ) ; } else { list = new ArrayList < Location > ( ) ; list . add ( this ) ; } return list . iterator ( ) ; }
Iterates through all known sub - locations for this location but does not descend
24,554
private List < Location > getAllSubLocations ( Location location ) { List < Location > flatSubLocations = new ArrayList < Location > ( ) ; for ( Location l : location . getSubLocations ( ) ) { if ( l . isComplex ( ) ) { flatSubLocations . addAll ( getAllSubLocations ( l ) ) ; } else { flatSubLocations . add ( l ) ; } }...
Here to allow for recursion
24,555
public < C extends Compound > Sequence < C > getSubSequence ( Sequence < C > sequence ) { if ( isCircular ( ) ) { List < Sequence < C > > sequences = new ArrayList < Sequence < C > > ( ) ; for ( Location l : this ) { sequences . add ( l . getSubSequence ( sequence ) ) ; } return new JoiningSequenceReader < C > ( sequen...
If circular this will return the sequence represented by the sub locations joined . If not circular then we get the Sequence for the outer - bounds defined by this location .
24,556
protected < C extends Compound > boolean canComplement ( Sequence < C > sequence ) { CompoundSet < C > compoundSet = sequence . getCompoundSet ( ) ; Compound c = compoundSet . getAllCompounds ( ) . iterator ( ) . next ( ) ; return ComplementCompound . class . isAssignableFrom ( c . getClass ( ) ) ; }
Uses the Sequence s CompoundSet to decide if a compound can be assgined to ComplementCompound meaning it can complement
24,557
private static double getRmsd ( int focusResn , int [ ] focusRes1 , int [ ] focusRes2 , AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) { Atom [ ] tmp1 = new Atom [ focusResn ] ; Atom [ ] tmp2 = new Atom [ focusResn ] ; for ( int i = 0 ; i < focusResn ; i ++ ) { tmp1 [ i ] = ca1 [ focusRes1 [ i ] ] ; tmp2 [ i ] = ( A...
the the RMSD for the residues defined in the two arrays
24,558
private static double getRmsd ( Atom [ ] catmp1 , Atom [ ] catmp2 ) throws StructureException { Matrix4d trans = SuperPositions . superpose ( Calc . atomsToPoints ( catmp1 ) , Calc . atomsToPoints ( catmp2 ) ) ; Calc . transform ( catmp2 , trans ) ; return Calc . rmsd ( catmp1 , catmp2 ) ; }
Calculate the RMSD for two sets of atoms . Rotates the 2nd atom set so make sure this does not cause problems later
24,559
private static double pind ( double ind , double delta , double sigma ) { return ( sigma == 0 ) ? ind * delta : Math . sinh ( sigma * ind * delta ) / sigma ; }
unit sphere .
24,560
public void addAlignedSequence ( S sequence ) { if ( length == null ) { length = sequence . getLength ( ) ; } if ( sequence . getLength ( ) != length ) { throw new IllegalArgumentException ( sequence . getAccession ( ) + " length = " + sequence . getLength ( ) + " not equal to MSA length = " + length ) ; } sequences . ...
A sequence that has been aligned to other sequences will have inserts .
24,561
public List < C > getCompoundsAt ( int alignmentIndex ) { List < C > column = new ArrayList < C > ( ) ; for ( S s : sequences ) { column . add ( s . getCompoundAt ( alignmentIndex ) ) ; } return Collections . unmodifiableList ( column ) ; }
Get a list of compounds at a sequence position
24,562
public String getIdentifier ( ) { if ( ranges . isEmpty ( ) ) return pdbId ; return pdbId + "." + ResidueRange . toString ( ranges ) ; }
Get the String form of this identifier .
24,563
private static int calcAdjustedMinimumSequenceLength ( List < Subunit > subunits , int absMinLen , double fraction , int minLen ) { int maxLength = Integer . MIN_VALUE ; int minLength = Integer . MAX_VALUE ; List < Integer > lengths = new ArrayList < Integer > ( ) ; for ( int i = 0 ; i < subunits . size ( ) ; i ++ ) { ...
Returns an adapted minimum sequence length . This method ensure that structure that only have short chains are not excluded by the minimumSequenceLength cutoff value .
24,564
public String convert ( ProteinSequence sequence ) { String convertedSequence = "" ; String uppercaseSequence = sequence . getSequenceAsString ( ) . toUpperCase ( ) ; for ( int x = 0 ; x < uppercaseSequence . length ( ) ; x ++ ) { convertedSequence += String . valueOf ( convert ( uppercaseSequence . charAt ( x ) ) ) ; ...
Returns the converted sequence . The sequence argument must be a protein sequence consisting of preferably non - ambiguous characters only . Standard amino acids will be converted to 1 2 or 3 depending on its grouping Non - standard amino acids are simply converted to 0 .
24,565
public void mapSeqresRecords ( Chain atomRes , Chain seqRes ) { List < Group > seqResGroups = seqRes . getAtomGroups ( ) ; List < Group > atmResGroups = atomRes . getAtomGroups ( ) ; logger . debug ( "Comparing ATOM {} ({} groups) to SEQRES {} ({} groups) " , atomRes . getId ( ) , atmResGroups . size ( ) , seqRes . get...
Map the seqRes groups to the atomRes chain . Updates the atomRes chain object with the mapped data The seqRes chain should not be needed after this and atomRes should be further used .
24,566
public static String getFullAtomSequence ( List < Group > groups , Map < Integer , Integer > positionIndex , boolean isNucleotideChain ) { StringBuffer sequence = new StringBuffer ( ) ; int seqIndex = 0 ; for ( int i = 0 ; i < groups . size ( ) ; i ++ ) { Group g = groups . get ( i ) ; if ( g instanceof AminoAcid ) { A...
Returns the full sequence of the Atom records of a parent with X instead of HETATMSs . The advantage of this is that it allows us to also align HETATM groups back to the SEQRES .
24,567
public static void storeUnAlignedSeqRes ( Structure structure , List < Chain > seqResChains , boolean headerOnly ) { if ( headerOnly ) { List < Chain > atomChains = new ArrayList < > ( ) ; for ( Chain seqRes : seqResChains ) { seqRes . setSeqResGroups ( seqRes . getAtomGroups ( ) ) ; seqRes . setAtomGroups ( new ArrayL...
Storing unaligned SEQRES groups in a Structure .
24,568
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 ) ; }
Create and set a new structure from a given atom array .
24,569
public void evalString ( String rasmolScript ) { if ( jmolPanel == null ) { logger . error ( "please install Jmol first" ) ; return ; } jmolPanel . evalString ( rasmolScript ) ; }
Execute a command String in the current Jmol panel .
24,570
public void setStructure ( Structure s ) { if ( jmolPanel == null ) { logger . error ( "please install Jmol first" ) ; return ; } setTitle ( s . getPDBCode ( ) ) ; jmolPanel . setStructure ( s ) ; structure = s ; }
Set a new Structure to visualize in the AlignmentJmol window .
24,571
public double getTotalArea ( ) { double area = 0 ; for ( StructureInterface interf : members ) { area += interf . getTotalArea ( ) ; } return area / members . size ( ) ; }
Return the average buried surface area for this interface cluster
24,572
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 we...
Generate the secondary structure for a Biojava structure object .
24,573
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 ) xtal...
Get the length six array of the unit cell information .
24,574
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 : exp...
Converts the set of experimental techniques to an array of strings .
24,575
public static String dateToIsoString ( Date inputDate ) { DateFormat dateStringFormat = new SimpleDateFormat ( "yyyy-MM-dd" ) ; return dateStringFormat . format ( inputDate ) ; }
Covert a Date object to ISO time format .
24,576
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 ( Biolog...
Convert a bioassembly information into a map of transform chainindices it relates to .
24,577
public static double [ ] convertToDoubleArray ( Matrix4d transformationMatrix ) { double [ ] outArray = new double [ 16 ] ; for ( int i = 0 ; i < 4 ; i ++ ) { for ( int j = 0 ; j < 4 ; j ++ ) { outArray [ i * 4 + j ] = transformationMatrix . getElement ( i , j ) ; } } return outArray ; }
Convert a four - d matrix to a double array . Row - packed .
24,578
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 ; }
Count the total number of groups in the structure
24,579
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 . getAlt...
Get a list of atoms for a group . Only add each atom once .
24,580
public static int getNumBondsInGroup ( List < Atom > atomsInGroup ) { int bondCounter = 0 ; for ( Atom atom : atomsInGroup ) { if ( atom . getBonds ( ) == null ) { continue ; } for ( Bond bond : atom . getBonds ( ) ) { Atom other = bond . getOther ( atom ) ; if ( atomsInGroup . indexOf ( other ) != - 1 ) { Integer firs...
Find the number of bonds in a group
24,581
public static SecStrucType getSecStructTypeFromDsspIndex ( int dsspIndex ) { String dsspType = DsspType . dsspTypeFromInt ( dsspIndex ) . getDsspType ( ) ; for ( SecStrucType secStrucType : SecStrucType . values ( ) ) { if ( dsspType == secStrucType . name ) { return secStrucType ; } } return null ; }
Set the DSSP type based on a numerical index .
24,582
public static MmtfSummaryDataBean getStructureInfo ( Structure structure ) { MmtfSummaryDataBean mmtfSummaryDataBean = new MmtfSummaryDataBean ( ) ; List < Atom > theseAtoms = new ArrayList < > ( ) ; List < Chain > allChains = new ArrayList < > ( ) ; Map < String , Integer > chainIdToIndexMap = new LinkedHashMap < > ( ...
Get summary information for the structure .
24,583
public static void insertSeqResGroup ( Chain chain , Group group , int sequenceIndexId ) { List < Group > seqResGroups = chain . getSeqResGroups ( ) ; addGroupAtId ( seqResGroups , group , sequenceIndexId ) ; }
Insert the group in the given position in the sequence .
24,584
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 gr...
Add the missing groups to the SeqResGroups .
24,585
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 ...
Write a single SeqFeature object to features table .
24,586
protected ArrayList < String > _split_multi_line ( String text , int max_len ) { ArrayList < String > output = new ArrayList < String > ( ) ; text = text . trim ( ) ; if ( text . length ( ) <= max_len ) { output . add ( text ) ; return output ; } ArrayList < String > words = new ArrayList < String > ( ) ; Collections ....
Returns a list of strings .
24,587
private void setType ( ) { type = ( gop == 0 ) ? GapPenalty . Type . LINEAR : ( ( gep == 0 ) ? GapPenalty . Type . CONSTANT : GapPenalty . Type . AFFINE ) ; }
helper method to set the type given the open and extension penalties
24,588
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 = ...
Utility method to group child nodes by their names .
24,589
protected void postProcessCompoundLists ( List < List < AminoAcidCompound > > compoundLists ) { for ( List < AminoAcidCompound > compounds : compoundLists ) { if ( trimStops ) { trimStop ( compounds ) ; } } }
Performs the trimming of stop codons and the conversion of a valid start amino acid to M
24,590
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 (...
Imperfect code . Checks the last amino acid to see if a codon could have translated a stop for it . Left in for the moment
24,591
public void combineWith ( List < List < Integer > > alignRes ) { for ( int i = 0 ; i < order ( ) ; i ++ ) alignRes . get ( i ) . add ( residues . get ( i ) ) ; }
Combine the ResidueGroup with the alignment block .
24,592
public static void downloadFile ( ) throws IOException { initPath ( ) ; initServerName ( ) ; String localName = getLocalFileName ( ) ; String u = serverName + "/" + COMPONENTS_FILE_LOCATION ; downloadFileFromRemote ( new URL ( u ) , new File ( localName ) ) ; }
Downloads the components . cif . gz file from the wwPDB site .
24,593
public void run ( ) { long timeS = System . currentTimeMillis ( ) ; initPath ( ) ; ensureFileExists ( ) ; try { loadAllChemComps ( ) ; long timeE = System . currentTimeMillis ( ) ; logger . debug ( "Time to init chem comp dictionary: " + ( timeE - timeS ) / 1000 + " sec." ) ; } catch ( IOException e ) { logger . error ...
Do the actual loading of the dictionary in a thread .
24,594
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 ( ) ; return true ; }
Load the sequence
24,595
public static void main ( String [ ] args ) throws Exception { PDBFileReader pdbr = new PDBFileReader ( ) ; pdbr . setPath ( "/Users/andreas/WORK/PDB/" ) ; String pdb1 = "1buz" ; String pdb2 = "1ali" ; String outputfile = "/tmp/alig_" + pdb1 + "_" + pdb2 + ".pdb" ; StructurePairAligner sc = new StructurePairAligner ( )...
example usage of this class
24,596
public void align ( Structure s1 , Structure s2 ) throws StructureException { align ( s1 , s2 , params ) ; }
Calculate the alignment between the two full structures with default parameters
24,597
public void align ( Structure s1 , Structure s2 , StrucAligParameters params ) throws StructureException { Atom [ ] ca1 = getAlignmentAtoms ( s1 ) ; Atom [ ] ca2 = getAlignmentAtoms ( s2 ) ; notifyStartingAlignment ( s1 . getName ( ) , ca1 , s2 . getName ( ) , ca2 ) ; align ( ca1 , ca2 , params ) ; }
Calculate the alignment between the two full structures with user provided parameters
24,598
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 .
24,599
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 ...
Aligns two chains from the structures using user provided parameters .