idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
24,000 | public final void writeStream ( InputStream stream , OnStreamWriteListener listener ) throws IOException { if ( listener == null ) throw new IllegalArgumentException ( "listener MUST not be null!" ) ; byte [ ] buffer = new byte [ UploadService . BUFFER_SIZE ] ; int bytesRead ; try { while ( listener . shouldContinueWriting ( ) && ( bytesRead = stream . read ( buffer , 0 , buffer . length ) ) > 0 ) { write ( buffer , bytesRead ) ; flush ( ) ; listener . onBytesWritten ( bytesRead ) ; } } finally { stream . close ( ) ; } } | Writes an input stream to the request body . The stream will be automatically closed after successful write or if an exception is thrown . |
24,001 | public static UploadNotificationAction from ( NotificationCompat . Action action ) { return new UploadNotificationAction ( action . icon , action . title , action . actionIntent ) ; } | Creates a new object from an existing NotificationCompat . Action object . |
24,002 | public static String replace ( String string , UploadInfo uploadInfo ) { if ( string == null || string . isEmpty ( ) ) return "" ; String tmp ; tmp = string . replace ( ELAPSED_TIME , uploadInfo . getElapsedTimeString ( ) ) ; tmp = tmp . replace ( PROGRESS , uploadInfo . getProgressPercent ( ) + "%" ) ; tmp = tmp . replace ( UPLOAD_RATE , uploadInfo . getUploadRateString ( ) ) ; tmp = tmp . replace ( UPLOADED_FILES , Integer . toString ( uploadInfo . getSuccessfullyUploadedFiles ( ) . size ( ) ) ) ; tmp = tmp . replace ( TOTAL_FILES , Integer . toString ( uploadInfo . getTotalFiles ( ) ) ) ; return tmp ; } | Replace placeholders in a string . |
24,003 | protected final void broadcastProgress ( final long uploadedBytes , final long totalBytes ) { long currentTime = System . currentTimeMillis ( ) ; if ( uploadedBytes < totalBytes && currentTime < lastProgressNotificationTime + UploadService . PROGRESS_REPORT_INTERVAL ) { return ; } setLastProgressNotificationTime ( currentTime ) ; Logger . debug ( LOG_TAG , "Broadcasting upload progress for " + params . id + ": " + uploadedBytes + " bytes of " + totalBytes ) ; final UploadInfo uploadInfo = new UploadInfo ( params . id , startTime , uploadedBytes , totalBytes , ( attempts - 1 ) , successfullyUploadedFiles , pathStringListFrom ( params . files ) ) ; BroadcastData data = new BroadcastData ( ) . setStatus ( BroadcastData . Status . IN_PROGRESS ) . setUploadInfo ( uploadInfo ) ; final UploadStatusDelegate delegate = UploadService . getUploadStatusDelegate ( params . id ) ; if ( delegate != null ) { mainThreadHandler . post ( new Runnable ( ) { public void run ( ) { delegate . onProgress ( service , uploadInfo ) ; } } ) ; } else { service . sendBroadcast ( data . getIntent ( ) ) ; } updateNotificationProgress ( uploadInfo ) ; } | Broadcasts a progress update . |
24,004 | protected final void addSuccessfullyUploadedFile ( UploadFile file ) { if ( ! successfullyUploadedFiles . contains ( file . path ) ) { successfullyUploadedFiles . add ( file . path ) ; params . files . remove ( file ) ; } } | Add a file to the list of the successfully uploaded files and remove it from the file list |
24,005 | private void createNotification ( UploadInfo uploadInfo ) { if ( params . notificationConfig == null || params . notificationConfig . getProgress ( ) . message == null ) return ; UploadNotificationStatusConfig statusConfig = params . notificationConfig . getProgress ( ) ; notificationCreationTimeMillis = System . currentTimeMillis ( ) ; NotificationCompat . Builder notification = new NotificationCompat . Builder ( service , params . notificationConfig . getNotificationChannelId ( ) ) . setWhen ( notificationCreationTimeMillis ) . setContentTitle ( Placeholders . replace ( statusConfig . title , uploadInfo ) ) . setContentText ( Placeholders . replace ( statusConfig . message , uploadInfo ) ) . setContentIntent ( statusConfig . getClickIntent ( service ) ) . setSmallIcon ( statusConfig . iconResourceID ) . setLargeIcon ( statusConfig . largeIcon ) . setColor ( statusConfig . iconColorResourceID ) . setGroup ( UploadService . NAMESPACE ) . setProgress ( 100 , 0 , true ) . setOngoing ( true ) ; statusConfig . addActionsToNotificationBuilder ( notification ) ; Notification builtNotification = notification . build ( ) ; if ( service . holdForegroundNotification ( params . id , builtNotification ) ) { notificationManager . cancel ( notificationId ) ; } else { notificationManager . notify ( notificationId , builtNotification ) ; } } | If the upload task is initialized with a notification configuration this handles its creation . |
24,006 | private boolean deleteFile ( File fileToDelete ) { boolean deleted = false ; try { deleted = fileToDelete . delete ( ) ; if ( ! deleted ) { Logger . error ( LOG_TAG , "Unable to delete: " + fileToDelete . getAbsolutePath ( ) ) ; } else { Logger . info ( LOG_TAG , "Successfully deleted: " + fileToDelete . getAbsolutePath ( ) ) ; } } catch ( Exception exc ) { Logger . error ( LOG_TAG , "Error while deleting: " + fileToDelete . getAbsolutePath ( ) + " Check if you granted: android.permission.WRITE_EXTERNAL_STORAGE" , exc ) ; } return deleted ; } | Tries to delete a file from the device . If it fails the error will be printed in the LogCat . |
24,007 | private static String formatNumber ( final Number target , final Integer minIntegerDigits , final NumberPointType thousandsPointType , final Integer fractionDigits , final NumberPointType decimalPointType , final Locale locale ) { Validate . notNull ( fractionDigits , "Fraction digits cannot be null" ) ; Validate . notNull ( decimalPointType , "Decimal point type cannot be null" ) ; Validate . notNull ( thousandsPointType , "Thousands point type cannot be null" ) ; Validate . notNull ( locale , "Locale cannot be null" ) ; if ( target == null ) { return null ; } DecimalFormat format = ( DecimalFormat ) NumberFormat . getNumberInstance ( locale ) ; format . setMinimumFractionDigits ( fractionDigits . intValue ( ) ) ; format . setMaximumFractionDigits ( fractionDigits . intValue ( ) ) ; if ( minIntegerDigits != null ) { format . setMinimumIntegerDigits ( minIntegerDigits . intValue ( ) ) ; } format . setDecimalSeparatorAlwaysShown ( decimalPointType != NumberPointType . NONE && fractionDigits . intValue ( ) > 0 ) ; format . setGroupingUsed ( thousandsPointType != NumberPointType . NONE ) ; format . setDecimalFormatSymbols ( computeDecimalFormatSymbols ( decimalPointType , thousandsPointType , locale ) ) ; return format . format ( target ) ; } | Formats a number as per the given values . |
24,008 | public static String formatCurrency ( final Number target , final Locale locale ) { Validate . notNull ( locale , "Locale cannot be null" ) ; if ( target == null ) { return null ; } NumberFormat format = NumberFormat . getCurrencyInstance ( locale ) ; return format . format ( target ) ; } | Formats a number as a currency value according to the specified locale . |
24,009 | public static String formatPercent ( final Number target , final Integer minIntegerDigits , final Integer fractionDigits , final Locale locale ) { Validate . notNull ( fractionDigits , "Fraction digits cannot be null" ) ; Validate . notNull ( locale , "Locale cannot be null" ) ; if ( target == null ) { return null ; } NumberFormat format = NumberFormat . getPercentInstance ( locale ) ; format . setMinimumFractionDigits ( fractionDigits . intValue ( ) ) ; format . setMaximumFractionDigits ( fractionDigits . intValue ( ) ) ; if ( minIntegerDigits != null ) { format . setMinimumIntegerDigits ( minIntegerDigits . intValue ( ) ) ; } return format . format ( target ) ; } | Formats a number as a percentage value . |
24,010 | boolean sameAs ( final Model model ) { if ( model == null || model . queueSize != this . queueSize ) { return false ; } for ( int i = 0 ; i < this . queueSize ; i ++ ) { if ( this . queue [ i ] != model . queue [ i ] ) { return false ; } } return true ; } | considered a change anyway . |
24,011 | private static boolean checkTokenValid ( final char [ ] token ) { if ( token == null || token . length == 0 ) { return true ; } for ( int i = 0 ; i < token . length ; i ++ ) { if ( token [ i ] == '\n' ) { return false ; } } return true ; } | Used to check internally that neither event names nor IDs contain line feeds |
24,012 | public ActionResponse godHandPrologue ( final ActionRuntime runtime ) { fessLoginAssist . getSavedUserBean ( ) . ifPresent ( u -> { boolean result = u . getFessUser ( ) . refresh ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "refresh user info: {}" , result ) ; } } ) ; return viewHelper . getActionHook ( ) . godHandPrologue ( runtime , r -> super . godHandPrologue ( r ) ) ; } | you should remove the final if you need to override this |
24,013 | public static String quoteEscape ( final String original ) { String result = original ; if ( result . indexOf ( '\"' ) >= 0 ) { result = result . replace ( "\"" , ESCAPED_QUOTE ) ; } if ( result . indexOf ( COMMA ) >= 0 ) { result = "\"" + result + "\"" ; } return result ; } | Quote and escape input value for CSV |
24,014 | public static void setFessConfig ( final FessConfig fessConfig ) { ComponentUtil . fessConfig = fessConfig ; if ( fessConfig == null ) { FessProp . propMap . clear ( ) ; componentMap . clear ( ) ; } } | For test purpose only . |
24,015 | private void set ( Point3d [ ] x , Point3d [ ] y ) { this . x = x ; this . y = y ; rmsdCalculated = false ; transformationCalculated = false ; } | Sets the two input coordinate arrays . These input arrays must be of equal length . Input coordinates are not modified . |
24,016 | public Matrix4d weightedSuperpose ( Point3d [ ] fixed , Point3d [ ] moved , double [ ] weight ) { set ( moved , fixed , weight ) ; getRotationMatrix ( ) ; if ( ! centered ) { calcTransformation ( ) ; } else { transformation . set ( rotmat ) ; } return transformation ; } | Weighted superposition . |
24,017 | private void calcRmsd ( Point3d [ ] x , Point3d [ ] y ) { if ( centered ) { innerProduct ( y , x ) ; } else { xref = CalcPoint . clonePoint3dArray ( x ) ; xtrans = CalcPoint . centroid ( xref ) ; logger . debug ( "x centroid: " + xtrans ) ; xtrans . negate ( ) ; CalcPoint . translate ( new Vector3d ( xtrans ) , xref ) ; yref = CalcPoint . clonePoint3dArray ( y ) ; ytrans = CalcPoint . centroid ( yref ) ; logger . debug ( "y centroid: " + ytrans ) ; ytrans . negate ( ) ; CalcPoint . translate ( new Vector3d ( ytrans ) , yref ) ; innerProduct ( yref , xref ) ; } calcRmsd ( wsum ) ; } | Calculates the RMSD value for superposition of y onto x . This requires the coordinates to be precentered . |
24,018 | public double [ ] calculateAsas ( ) { double [ ] asas = new double [ atomCoords . length ] ; long start = System . currentTimeMillis ( ) ; if ( useSpatialHashingForNeighbors ) { logger . debug ( "Will use spatial hashing to find neighbors" ) ; neighborIndices = findNeighborIndicesSpatialHashing ( ) ; } else { logger . debug ( "Will not use spatial hashing to find neighbors" ) ; neighborIndices = findNeighborIndices ( ) ; } long end = System . currentTimeMillis ( ) ; logger . debug ( "Took {} s to find neighbors" , ( end - start ) / 1000.0 ) ; start = System . currentTimeMillis ( ) ; if ( nThreads <= 1 ) { logger . debug ( "Will use 1 thread for ASA calculation" ) ; for ( int i = 0 ; i < atomCoords . length ; i ++ ) { asas [ i ] = calcSingleAsa ( i ) ; } } else { logger . debug ( "Will use {} threads for ASA calculation" , nThreads ) ; ExecutorService threadPool = Executors . newFixedThreadPool ( nThreads ) ; for ( int i = 0 ; i < atomCoords . length ; i ++ ) { threadPool . submit ( new AsaCalcWorker ( i , asas ) ) ; } threadPool . shutdown ( ) ; while ( ! threadPool . isTerminated ( ) ) ; } end = System . currentTimeMillis ( ) ; logger . debug ( "Took {} s to calculate all {} atoms ASAs (excluding neighbors calculation)" , ( end - start ) / 1000.0 , atomCoords . length ) ; return asas ; } | Calculates the Accessible Surface Areas for the atoms given in constructor and with parameters given . Beware that the parallel implementation is quite memory hungry . It scales well as long as there is enough memory available . |
24,019 | private Point3d [ ] generateSpherePoints ( int nSpherePoints ) { Point3d [ ] points = new Point3d [ nSpherePoints ] ; double inc = Math . PI * ( 3.0 - Math . sqrt ( 5.0 ) ) ; double offset = 2.0 / nSpherePoints ; for ( int k = 0 ; k < nSpherePoints ; k ++ ) { double y = k * offset - 1.0 + ( offset / 2.0 ) ; double r = Math . sqrt ( 1.0 - y * y ) ; double phi = k * inc ; points [ k ] = new Point3d ( Math . cos ( phi ) * r , y , Math . sin ( phi ) * r ) ; } return points ; } | Returns list of 3d coordinates of points on a sphere using the Golden Section Spiral algorithm . |
24,020 | int [ ] [ ] findNeighborIndices ( ) { int initialCapacity = 60 ; int [ ] [ ] nbsIndices = new int [ atomCoords . length ] [ ] ; for ( int k = 0 ; k < atomCoords . length ; k ++ ) { double radius = radii [ k ] + probe + probe ; List < Integer > thisNbIndices = new ArrayList < > ( initialCapacity ) ; for ( int i = 0 ; i < atomCoords . length ; i ++ ) { if ( i == k ) continue ; double dist = atomCoords [ i ] . distance ( atomCoords [ k ] ) ; if ( dist < radius + radii [ i ] ) { thisNbIndices . add ( i ) ; } } int [ ] indicesArray = new int [ thisNbIndices . size ( ) ] ; for ( int i = 0 ; i < thisNbIndices . size ( ) ; i ++ ) indicesArray [ i ] = thisNbIndices . get ( i ) ; nbsIndices [ k ] = indicesArray ; } return nbsIndices ; } | Returns the 2 - dimensional array with neighbor indices for every atom . |
24,021 | int [ ] [ ] findNeighborIndicesSpatialHashing ( ) { int initialCapacity = 60 ; List < Contact > contactList = calcContacts ( ) ; Map < Integer , List < Integer > > indices = new HashMap < > ( atomCoords . length ) ; for ( Contact contact : contactList ) { int i = contact . getI ( ) ; int j = contact . getJ ( ) ; List < Integer > iIndices ; List < Integer > jIndices ; if ( ! indices . containsKey ( i ) ) { iIndices = new ArrayList < > ( initialCapacity ) ; indices . put ( i , iIndices ) ; } else { iIndices = indices . get ( i ) ; } if ( ! indices . containsKey ( j ) ) { jIndices = new ArrayList < > ( initialCapacity ) ; indices . put ( j , jIndices ) ; } else { jIndices = indices . get ( j ) ; } double radius = radii [ i ] + probe + probe ; double dist = contact . getDistance ( ) ; if ( dist < radius + radii [ j ] ) { iIndices . add ( j ) ; jIndices . add ( i ) ; } } int [ ] [ ] nbsIndices = new int [ atomCoords . length ] [ ] ; for ( Map . Entry < Integer , List < Integer > > entry : indices . entrySet ( ) ) { List < Integer > list = entry . getValue ( ) ; int [ ] indicesArray = new int [ list . size ( ) ] ; for ( int i = 0 ; i < entry . getValue ( ) . size ( ) ; i ++ ) indicesArray [ i ] = list . get ( i ) ; nbsIndices [ entry . getKey ( ) ] = indicesArray ; } for ( int i = 0 ; i < nbsIndices . length ; i ++ ) { if ( nbsIndices [ i ] == null ) { nbsIndices [ i ] = new int [ 0 ] ; } } return nbsIndices ; } | Returns the 2 - dimensional array with neighbor indices for every atom using spatial hashing to avoid all to all distance calculation . |
24,022 | private static double getRadiusForAmino ( AminoAcid amino , Atom atom ) { if ( atom . getElement ( ) . equals ( Element . H ) ) return Element . H . getVDWRadius ( ) ; if ( atom . getElement ( ) . equals ( Element . D ) ) return Element . D . getVDWRadius ( ) ; String atomCode = atom . getName ( ) ; char aa = amino . getAminoType ( ) ; if ( atom . getElement ( ) == Element . O ) { return OXIGEN_VDW ; } else if ( atom . getElement ( ) == Element . S ) { return SULFUR_VDW ; } else if ( atom . getElement ( ) == Element . N ) { if ( atomCode . equals ( "NZ" ) ) return TETRAHEDRAL_NITROGEN_VDW ; return TRIGONAL_NITROGEN_VDW ; } else if ( atom . getElement ( ) == Element . C ) { if ( atomCode . equals ( "C" ) || atomCode . equals ( "CE1" ) || atomCode . equals ( "CE2" ) || atomCode . equals ( "CE3" ) || atomCode . equals ( "CH2" ) || atomCode . equals ( "CZ" ) || atomCode . equals ( "CZ2" ) || atomCode . equals ( "CZ3" ) ) { return TRIGONAL_CARBON_VDW ; } else if ( atomCode . equals ( "CA" ) || atomCode . equals ( "CB" ) || atomCode . equals ( "CE" ) || atomCode . equals ( "CG1" ) || atomCode . equals ( "CG2" ) ) { return TETRAHEDRAL_CARBON_VDW ; } else { switch ( aa ) { case 'F' : case 'W' : case 'Y' : case 'H' : case 'D' : case 'N' : return TRIGONAL_CARBON_VDW ; case 'P' : case 'K' : case 'R' : case 'M' : case 'I' : case 'L' : return TETRAHEDRAL_CARBON_VDW ; case 'Q' : case 'E' : if ( atomCode . equals ( "CD" ) ) return TRIGONAL_CARBON_VDW ; else if ( atomCode . equals ( "CG" ) ) return TETRAHEDRAL_CARBON_VDW ; default : logger . info ( "Unexpected carbon atom " + atomCode + " for aminoacid " + aa + ", assigning its standard vdw radius" ) ; return Element . C . getVDWRadius ( ) ; } } } else { logger . info ( "Unexpected atom " + atomCode + " for aminoacid " + aa + " (" + amino . getPDBName ( ) + "), assigning its standard vdw radius" ) ; return atom . getElement ( ) . getVDWRadius ( ) ; } } | Gets the radius for given amino acid and atom |
24,023 | private static double getRadiusForNucl ( NucleotideImpl nuc , Atom atom ) { if ( atom . getElement ( ) . equals ( Element . H ) ) return Element . H . getVDWRadius ( ) ; if ( atom . getElement ( ) . equals ( Element . D ) ) return Element . D . getVDWRadius ( ) ; if ( atom . getElement ( ) == Element . C ) return NUC_CARBON_VDW ; if ( atom . getElement ( ) == Element . N ) return NUC_NITROGEN_VDW ; if ( atom . getElement ( ) == Element . P ) return PHOSPHOROUS_VDW ; if ( atom . getElement ( ) == Element . O ) return OXIGEN_VDW ; logger . info ( "Unexpected atom " + atom . getName ( ) + " for nucleotide " + nuc . getPDBName ( ) + ", assigning its standard vdw radius" ) ; return atom . getElement ( ) . getVDWRadius ( ) ; } | Gets the radius for given nucleotide atom |
24,024 | private Group getCorrectAltLocGroup ( Character altLoc ) { List < Atom > atoms = group . getAtoms ( ) ; if ( atoms . size ( ) > 0 ) { Atom a1 = atoms . get ( 0 ) ; if ( a1 . getAltLoc ( ) . equals ( altLoc ) ) { return group ; } } Group altLocgroup = group . getAltLocGroup ( altLoc ) ; if ( altLocgroup != null ) { return altLocgroup ; } Group oldGroup = getGroupWithSameResNumButDiffPDBName ( ) ; if ( oldGroup != null ) { Group altLocG = group ; group = oldGroup ; group . addAltLoc ( altLocG ) ; chain . getAtomGroups ( ) . remove ( altLocG ) ; return altLocG ; } if ( group . getAtoms ( ) . size ( ) == 0 ) { return group ; } Group altLocG = ( Group ) group . clone ( ) ; altLocG . setAtoms ( new ArrayList < Atom > ( ) ) ; altLocG . getAltLocs ( ) . clear ( ) ; group . addAltLoc ( altLocG ) ; return altLocG ; } | Generates Alternate location groups . |
24,025 | public Structure loadStructure ( AtomCache cache ) throws StructureException , IOException { StructureFiletype format = StructureFiletype . UNKNOWN ; try { Map < String , String > params = parseQuery ( url ) ; if ( params . containsKey ( FORMAT_PARAM ) ) { String formatStr = params . get ( FORMAT_PARAM ) ; format = StructureIO . guessFiletype ( "." + formatStr ) ; } } catch ( UnsupportedEncodingException e ) { logger . error ( "Unable to decode URL " + url , e ) ; } if ( format == StructureFiletype . UNKNOWN ) { format = StructureIO . guessFiletype ( url . getPath ( ) ) ; } switch ( format ) { case CIF : InputStreamProvider prov = new InputStreamProvider ( ) ; InputStream inStream = prov . getInputStream ( url ) ; MMcifParser parser = new SimpleMMcifParser ( ) ; SimpleMMcifConsumer consumer = new SimpleMMcifConsumer ( ) ; consumer . setFileParsingParameters ( cache . getFileParsingParams ( ) ) ; parser . addMMcifConsumer ( consumer ) ; try { parser . parse ( new BufferedReader ( new InputStreamReader ( inStream ) ) ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return consumer . getStructure ( ) ; default : case PDB : PDBFileReader reader = new PDBFileReader ( cache . getPath ( ) ) ; reader . setFetchBehavior ( cache . getFetchBehavior ( ) ) ; reader . setObsoleteBehavior ( cache . getObsoleteBehavior ( ) ) ; reader . setFileParsingParameters ( cache . getFileParsingParams ( ) ) ; return reader . getStructure ( url ) ; } } | Load the structure from the URL |
24,026 | public static String guessPDBID ( String name ) { Matcher match = PDBID_REGEX . matcher ( name ) ; if ( match . matches ( ) ) { return match . group ( 1 ) . toUpperCase ( ) ; } else { return null ; } } | Recognizes PDB IDs that occur at the beginning of name followed by some delimiter . |
24,027 | private static Map < String , String > parseQuery ( URL url ) throws UnsupportedEncodingException { Map < String , String > params = new LinkedHashMap < String , String > ( ) ; String query = url . getQuery ( ) ; if ( query == null || query . isEmpty ( ) ) { return params ; } String [ ] pairs = url . getQuery ( ) . split ( "&" ) ; for ( String pair : pairs ) { int i = pair . indexOf ( "=" ) ; String key = pair ; if ( i > 0 ) { key = URLDecoder . decode ( pair . substring ( 0 , i ) , "UTF-8" ) ; } String value = null ; if ( i > 0 && pair . length ( ) > i + 1 ) { value = URLDecoder . decode ( pair . substring ( i + 1 ) , "UTF-8" ) ; } params . put ( key . toLowerCase ( ) , value ) ; } return params ; } | Parses URL parameters into a map . Keys are stored lower - case . |
24,028 | protected InputStream getInputStream ( String pdbId ) throws IOException { if ( pdbId . length ( ) != 4 ) throw new IOException ( "The provided ID does not look like a PDB ID : " + pdbId ) ; File file = downloadStructure ( pdbId ) ; if ( ! file . exists ( ) ) { throw new IOException ( "Structure " + pdbId + " not found and unable to download." ) ; } InputStreamProvider isp = new InputStreamProvider ( ) ; InputStream inputStream = isp . getInputStream ( file ) ; return inputStream ; } | Load or download the specified structure and return it as an InputStream for direct parsing . |
24,029 | public void prefetchStructure ( String pdbId ) throws IOException { if ( pdbId . length ( ) != 4 ) throw new IOException ( "The provided ID does not look like a PDB ID : " + pdbId ) ; File file = downloadStructure ( pdbId ) ; if ( ! file . exists ( ) ) { throw new IOException ( "Structure " + pdbId + " not found and unable to download." ) ; } } | Download a structure but don t parse it yet or store it in memory . |
24,030 | public boolean deleteStructure ( String pdbId ) throws IOException { boolean deleted = false ; ObsoleteBehavior obsolete = getObsoleteBehavior ( ) ; setObsoleteBehavior ( ObsoleteBehavior . FETCH_OBSOLETE ) ; try { File existing = getLocalFile ( pdbId ) ; while ( existing != null ) { assert ( existing . exists ( ) ) ; if ( getFetchBehavior ( ) == FetchBehavior . LOCAL_ONLY ) { throw new RuntimeException ( "Refusing to delete from LOCAL_ONLY directory" ) ; } boolean success = existing . delete ( ) ; if ( success ) { logger . debug ( "Deleting " + existing . getAbsolutePath ( ) ) ; } deleted = deleted || success ; File parent = existing . getParentFile ( ) ; if ( parent != null ) { success = parent . delete ( ) ; if ( success ) { logger . debug ( "Deleting " + parent . getAbsolutePath ( ) ) ; } } existing = getLocalFile ( pdbId ) ; } return deleted ; } finally { setObsoleteBehavior ( obsolete ) ; } } | Attempts to delete all versions of a structure from the local directory . |
24,031 | protected File downloadStructure ( String pdbId ) throws IOException { if ( pdbId . length ( ) != 4 ) throw new IOException ( "The provided ID does not look like a PDB ID : " + pdbId ) ; File existing = getLocalFile ( pdbId ) ; switch ( fetchBehavior ) { case LOCAL_ONLY : if ( existing == null ) { throw new IOException ( String . format ( "Structure %s not found in %s " + "and configured not to download." , pdbId , getPath ( ) ) ) ; } else { return existing ; } case FETCH_FILES : if ( existing != null ) { return existing ; } break ; case FETCH_IF_OUTDATED : break ; case FETCH_REMEDIATED : if ( existing != null ) { long lastModified = existing . lastModified ( ) ; if ( lastModified < LAST_REMEDIATION_DATE ) { logger . warn ( "Replacing file {} with latest remediated (remediation of {}) file from PDB." , existing , LAST_REMEDIATION_DATE_STRING ) ; existing = null ; break ; } else { return existing ; } } case FORCE_DOWNLOAD : existing = null ; break ; } if ( obsoleteBehavior == ObsoleteBehavior . FETCH_CURRENT ) { String current = PDBStatus . getCurrent ( pdbId ) ; if ( current == null ) { current = pdbId ; } return downloadStructure ( current , splitDirURL , false , existing ) ; } else if ( obsoleteBehavior == ObsoleteBehavior . FETCH_OBSOLETE && PDBStatus . getStatus ( pdbId ) == Status . OBSOLETE ) { return downloadStructure ( pdbId , obsoleteDirURL , true , existing ) ; } else { return downloadStructure ( pdbId , splitDirURL , false , existing ) ; } } | Downloads an MMCIF file from the PDB to the local path |
24,032 | private File downloadStructure ( String pdbId , String pathOnServer , boolean obsolete , File existingFile ) throws IOException { File dir = getDir ( pdbId , obsolete ) ; File realFile = new File ( dir , getFilename ( pdbId ) ) ; String ftp ; if ( getFilename ( pdbId ) . endsWith ( ".mmtf.gz" ) ) { ftp = CodecUtils . getMmtfEntryUrl ( pdbId , true , false ) ; } else { ftp = String . format ( "%s%s/%s/%s" , serverName , pathOnServer , pdbId . substring ( 1 , 3 ) . toLowerCase ( ) , getFilename ( pdbId ) ) ; } URL url = new URL ( ftp ) ; Date serverFileDate = null ; if ( existingFile != null ) { serverFileDate = getLastModifiedTime ( url ) ; if ( serverFileDate != null ) { if ( existingFile . lastModified ( ) >= serverFileDate . getTime ( ) ) { return existingFile ; } else { logger . warn ( "File {} is outdated, will download new one from PDB (updated on {})" , existingFile , serverFileDate . toString ( ) ) ; } } else { logger . warn ( "Could not determine if file {} is outdated (could not get timestamp from server). Will force redownload" , existingFile ) ; } } logger . info ( "Fetching " + ftp ) ; logger . info ( "Writing to " + realFile ) ; FileDownloadUtils . downloadFile ( url , realFile ) ; return realFile ; } | Download a file from the ftp server replacing any existing files if needed |
24,033 | private Date getLastModifiedTime ( URL url ) { Date date = null ; try { String lastModified = url . openConnection ( ) . getHeaderField ( "Last-Modified" ) ; logger . debug ( "Last modified date of server file ({}) is {}" , url . toString ( ) , lastModified ) ; if ( lastModified != null ) { try { date = new SimpleDateFormat ( "E, d MMM yyyy HH:mm:ss Z" , Locale . ENGLISH ) . parse ( lastModified ) ; } catch ( ParseException e ) { logger . warn ( "Could not parse last modified time from string '{}', no last modified time available for file {}" , lastModified , url . toString ( ) ) ; } } } catch ( IOException e ) { logger . warn ( "Problems while retrieving last modified time for file {}" , url . toString ( ) ) ; } return date ; } | Get the last modified time of the file in given url by retrieveing the Last - Modified header . Note that this only works for http URLs |
24,034 | protected File getDir ( String pdbId , boolean obsolete ) { File dir = null ; if ( obsolete ) { String middle = pdbId . substring ( 1 , 3 ) . toLowerCase ( ) ; dir = new File ( obsoleteDirPath , middle ) ; } else { String middle = pdbId . substring ( 1 , 3 ) . toLowerCase ( ) ; dir = new File ( splitDirPath , middle ) ; } if ( ! dir . exists ( ) ) { boolean success = dir . mkdirs ( ) ; if ( ! success ) logger . error ( "Could not create mmCIF dir {}" , dir . toString ( ) ) ; } return dir ; } | Gets the directory in which the file for a given MMCIF file would live creating it if necessary . |
24,035 | public File getLocalFile ( String pdbId ) throws IOException { LinkedList < File > searchdirs = new LinkedList < File > ( ) ; String middle = pdbId . substring ( 1 , 3 ) . toLowerCase ( ) ; File splitdir = new File ( splitDirPath , middle ) ; searchdirs . add ( splitdir ) ; if ( getObsoleteBehavior ( ) == ObsoleteBehavior . FETCH_OBSOLETE ) { File obsdir = new File ( obsoleteDirPath , middle ) ; searchdirs . add ( obsdir ) ; } String [ ] prefixes = new String [ ] { "" , "pdb" } ; for ( File searchdir : searchdirs ) { for ( String prefix : prefixes ) { for ( String ex : getExtensions ( ) ) { File f = new File ( searchdir , prefix + pdbId . toLowerCase ( ) + ex ) ; if ( f . exists ( ) ) { if ( f . length ( ) < MIN_PDB_FILE_SIZE ) { Files . delete ( f . toPath ( ) ) ; return null ; } return f ; } } } } return null ; } | Searches for previously downloaded files |
24,036 | protected void checkInput ( Point3d [ ] fixed , Point3d [ ] moved ) { if ( fixed . length != moved . length ) throw new IllegalArgumentException ( "Point arrays to superpose are of different lengths." ) ; } | Check that the input to the superposition algorithms is valid . |
24,037 | public double get ( int i , int j ) { if ( i < 0 || i >= N ) throw new IllegalArgumentException ( "Illegal index " + i + " should be > 0 and < " + N ) ; if ( j < 0 || j >= N ) throw new IllegalArgumentException ( "Illegal index " + j + " should be > 0 and < " + N ) ; return rows [ i ] . get ( j ) ; } | access a value at i j |
24,038 | public void interrupt ( ) { interrupted . set ( true ) ; ExecutorService pool = ConcurrencyTools . getThreadPool ( ) ; pool . shutdownNow ( ) ; try { DomainProvider domainProvider = DomainProviderFactory . getDomainProvider ( ) ; if ( domainProvider instanceof RemoteDomainProvider ) { RemoteDomainProvider remote = ( RemoteDomainProvider ) domainProvider ; remote . flushCache ( ) ; } } catch ( IOException e ) { } } | stops what is currently happening and does not continue |
24,039 | public static boolean equal ( Object one , Object two ) { return one == null && two == null || ! ( one == null || two == null ) && ( one == two || one . equals ( two ) ) ; } | Does not compare class types . |
24,040 | public static void processReader ( BufferedReader br , ReaderProcessor processor ) throws ParserException { String line ; try { while ( ( line = br . readLine ( ) ) != null ) { processor . process ( line ) ; } } catch ( IOException e ) { throw new ParserException ( "Could not read from the given BufferedReader" ) ; } finally { close ( br ) ; } } | Takes in a reader and a processor reads every line from the given file and then invokes the processor . What you do with the lines is dependent on your processor . |
24,041 | public static List < String > getList ( BufferedReader br ) throws ParserException { final List < String > list = new ArrayList < String > ( ) ; processReader ( br , new ReaderProcessor ( ) { public void process ( String line ) { list . add ( line ) ; } } ) ; return list ; } | Returns the contents of a buffered reader as a list of strings |
24,042 | public static < S extends Sequence < C > , C extends Compound > int getGCGChecksum ( List < S > sequences ) { int check = 0 ; for ( S as : sequences ) { check += getGCGChecksum ( as ) ; } return check % 10000 ; } | Calculates GCG checksum for entire list of sequences |
24,043 | public static < S extends Sequence < C > , C extends Compound > int getGCGChecksum ( S sequence ) { String s = sequence . toString ( ) . toUpperCase ( ) ; int count = 0 , check = 0 ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { count ++ ; check += count * s . charAt ( i ) ; if ( count == 57 ) { count = 0 ; } } return check % 10000 ; } | Calculates GCG checksum for a given sequence |
24,044 | public static < S extends Sequence < C > , C extends Compound > String getGCGHeader ( List < S > sequences ) { StringBuilder header = new StringBuilder ( ) ; S s1 = sequences . get ( 0 ) ; header . append ( String . format ( "MSA from BioJava%n%n MSF: %d Type: %s Check: %d ..%n%n" , s1 . getLength ( ) , getGCGType ( s1 . getCompoundSet ( ) ) , getGCGChecksum ( sequences ) ) ) ; String format = " Name: " + getIDFormat ( sequences ) + " Len: " + s1 . getLength ( ) + " Check: %4d Weight: 1.0%n" ; for ( S as : sequences ) { header . append ( String . format ( format , as . getAccession ( ) , getGCGChecksum ( as ) ) ) ; } header . append ( String . format ( "%n//%n%n" ) ) ; return header . toString ( ) ; } | Assembles a GCG file header |
24,045 | public static < C extends Compound > String getGCGType ( CompoundSet < C > cs ) { return ( cs == DNACompoundSet . getDNACompoundSet ( ) || cs == AmbiguityDNACompoundSet . getDNACompoundSet ( ) ) ? "D" : ( cs == RNACompoundSet . getRNACompoundSet ( ) || cs == AmbiguityRNACompoundSet . getRNACompoundSet ( ) ) ? "R" : "P" ; } | Determines GCG type |
24,046 | public static < S extends Sequence < C > , C extends Compound > String getIDFormat ( List < S > sequences ) { int length = 0 ; for ( S as : sequences ) { length = Math . max ( length , ( as . getAccession ( ) == null ) ? 0 : as . getAccession ( ) . toString ( ) . length ( ) ) ; } return ( length == 0 ) ? null : "%-" + ( length + 1 ) + "s" ; } | Creates format String for accession IDs |
24,047 | public static String getPDBCharacter ( boolean web , char c1 , char c2 , boolean similar , char c ) { String s = String . valueOf ( c ) ; return getPDBString ( web , c1 , c2 , similar , s , s , s , s ) ; } | Creates formatted String for a single character of PDB output |
24,048 | public static String getPDBConservation ( boolean web , char c1 , char c2 , boolean similar ) { return getPDBString ( web , c1 , c2 , similar , "|" , "." , " " , web ? " " : " " ) ; } | Creates formatted String for displaying conservation in PDB output |
24,049 | private static String getPDBString ( boolean web , char c1 , char c2 , boolean similar , String m , String sm , String dm , String qg ) { if ( c1 == c2 ) return web ? "<span class=\"m\">" + m + "</span>" : m ; else if ( similar ) return web ? "<span class=\"sm\">" + sm + "</span>" : sm ; else if ( c1 == '-' || c2 == '-' ) return web ? "<span class=\"dm\">" + dm + "</span>" : dm ; else return web ? "<span class=\"qg\">" + qg + "</span>" : qg ; } | helper method for getPDBCharacter and getPDBConservation |
24,050 | public static String getPDBLegend ( ) { StringBuilder s = new StringBuilder ( ) ; s . append ( "</pre></div>" ) ; s . append ( " <div class=\"subText\">" ) ; s . append ( " <b>Legend:</b>" ) ; s . append ( " <span class=\"m\">Green</span> - identical residues |" ) ; s . append ( " <span class=\"sm\">Pink</span> - similar residues | " ) ; s . append ( " <span class=\"qg\">Blue</span> - sequence mismatch |" ) ; s . append ( " <span class=\"dm\">Brown</span> - insertion/deletion |" ) ; s . append ( " </div>" ) ; s . append ( String . format ( "%n" ) ) ; return s . toString ( ) ; } | Creates formatted String for displaying conservation legend in PDB output |
24,051 | public boolean equalsPositional ( Object obj ) { if ( this == obj ) return true ; if ( obj == null ) return false ; if ( getClass ( ) != obj . getClass ( ) ) return false ; ResidueNumber other = ( ResidueNumber ) obj ; if ( insCode == null ) { if ( other . insCode != null ) return false ; } else if ( ! insCode . equals ( other . insCode ) ) return false ; if ( seqNum == null ) { if ( other . seqNum != null ) return false ; } else if ( ! seqNum . equals ( other . seqNum ) ) return false ; return true ; } | Check if the seqNum and insertion code are equivalent ignoring the chain |
24,052 | public static ResidueNumber fromString ( String pdb_code ) { if ( pdb_code == null ) return null ; ResidueNumber residueNumber = new ResidueNumber ( ) ; Integer resNum = null ; String icode = null ; try { resNum = Integer . parseInt ( pdb_code ) ; } catch ( NumberFormatException e ) { String [ ] spl = pdb_code . split ( "(?<=\\d)(?=\\D)|(?<=\\D)(?=\\d)" ) ; if ( spl . length == 2 ) { resNum = Integer . parseInt ( spl [ 0 ] ) ; icode = spl [ 1 ] ; } } residueNumber . setSeqNum ( resNum ) ; if ( icode == null ) residueNumber . setInsCode ( null ) ; else if ( icode . length ( ) > 0 ) residueNumber . setInsCode ( icode . charAt ( 0 ) ) ; return residueNumber ; } | Convert a string representation of a residue number to a residue number object . The string representation can be a integer followed by a character . |
24,053 | public int compareTo ( ResidueNumber other ) { if ( chainName != null && other . chainName != null ) { if ( ! chainName . equals ( other . chainName ) ) return chainName . compareTo ( other . chainName ) ; } if ( chainName != null && other . chainName == null ) { return 1 ; } else if ( chainName == null && other . chainName != null ) { return - 1 ; } return compareToPositional ( other ) ; } | Compare residue numbers by chain sequence number and insertion code |
24,054 | public int compareToPositional ( ResidueNumber other ) { if ( seqNum != null && other . seqNum != null ) { if ( ! seqNum . equals ( other . seqNum ) ) return seqNum . compareTo ( other . seqNum ) ; } if ( seqNum != null && other . seqNum == null ) { return 1 ; } else if ( seqNum == null && other . seqNum != null ) { return - 1 ; } if ( insCode != null && other . insCode != null ) { if ( ! insCode . equals ( other . insCode ) ) return insCode . compareTo ( other . insCode ) ; } if ( insCode != null && other . insCode == null ) { return 1 ; } else if ( insCode == null && other . insCode != null ) { return - 1 ; } return 0 ; } | Compare residue numbers by sequence number and insertion code ignoring the chain |
24,055 | public static ResidueRangeAndLength parse ( String s , AtomPositionMap map ) { ResidueRange rr = parse ( s ) ; ResidueNumber start = rr . getStart ( ) ; String chain = rr . getChainName ( ) ; if ( chain == null || chain . equals ( "_" ) ) { ResidueNumber first = map . getNavMap ( ) . firstKey ( ) ; chain = first . getChainName ( ) ; if ( ! map . getNavMap ( ) . lastKey ( ) . getChainName ( ) . equals ( chain ) ) { logger . warn ( "Multiple possible chains match '_'. Using chain {}" , chain ) ; } } if ( start == null ) { start = map . getFirst ( chain ) ; } ResidueNumber end = rr . getEnd ( ) ; if ( end == null ) { end = map . getLast ( chain ) ; } start . setChainName ( chain ) ; end . setChainName ( chain ) ; return map . trimToValidResidues ( new ResidueRange ( chain , start , end ) ) ; } | Parses a residue range . |
24,056 | public static FastaSequence convertProteinSequencetoFasta ( ProteinSequence sequence ) { StringBuffer buf = new StringBuffer ( ) ; for ( AminoAcidCompound compound : sequence ) { String c = compound . getShortName ( ) ; if ( ! SequenceUtil . NON_AA . matcher ( c ) . find ( ) ) { buf . append ( c ) ; } else { buf . append ( "X" ) ; } } return new FastaSequence ( sequence . getAccession ( ) . getID ( ) , buf . toString ( ) ) ; } | Utility method to convert a BioJava ProteinSequence object to the FastaSequence object used internally in JRonn . |
24,057 | public static Range [ ] getDisorder ( FastaSequence sequence ) { float [ ] scores = getDisorderScores ( sequence ) ; return scoresToRanges ( scores , RonnConstraint . DEFAULT_RANGE_PROBABILITY_THRESHOLD ) ; } | Calculates the disordered regions of the sequence . More formally the regions for which the probability of disorder is greater then 0 . 50 . |
24,058 | public static Range [ ] scoresToRanges ( float [ ] scores , float probability ) { assert scores != null && scores . length > 0 ; assert probability > 0 && probability < 1 ; int count = 0 ; int regionLen = 0 ; List < Range > ranges = new ArrayList < Range > ( ) ; for ( float score : scores ) { count ++ ; score = ( float ) ( Math . round ( score * 100.0 ) / 100.0 ) ; if ( score > probability ) { regionLen ++ ; } else { if ( regionLen > 0 ) { ranges . add ( new Range ( count - regionLen , count - 1 , score ) ) ; } regionLen = 0 ; } } if ( regionLen > 1 ) { ranges . add ( new Range ( count - regionLen + 1 , count , scores [ scores . length - 1 ] ) ) ; } return ranges . toArray ( new Range [ ranges . size ( ) ] ) ; } | Convert raw scores to ranges . Gives ranges for given probability of disorder value |
24,059 | public static Map < FastaSequence , float [ ] > getDisorderScores ( List < FastaSequence > sequences ) { Map < FastaSequence , float [ ] > results = new TreeMap < FastaSequence , float [ ] > ( ) ; for ( FastaSequence fsequence : sequences ) { results . put ( fsequence , predictSerial ( fsequence ) ) ; } return results ; } | Calculates the probability of disorder scores for each residue in the sequence for many sequences in the input . |
24,060 | public static Map < FastaSequence , Range [ ] > getDisorder ( List < FastaSequence > sequences ) { Map < FastaSequence , Range [ ] > disorderRanges = new TreeMap < FastaSequence , Range [ ] > ( ) ; for ( FastaSequence fs : sequences ) { disorderRanges . put ( fs , getDisorder ( fs ) ) ; } return disorderRanges ; } | Calculates the disordered regions of the sequence for many sequences in the input . |
24,061 | public static Map < FastaSequence , Range [ ] > getDisorder ( String fastaFile ) throws FileNotFoundException , IOException { final List < FastaSequence > sequences = SequenceUtil . readFasta ( new FileInputStream ( fastaFile ) ) ; return getDisorder ( sequences ) ; } | Calculates the disordered regions of the protein sequence . |
24,062 | public static List < Chain > getRepresentativeAtomsOnly ( List < Chain > chains ) { List < Chain > newChains = new ArrayList < Chain > ( ) ; for ( Chain chain : chains ) { Chain newChain = getRepresentativeAtomsOnly ( chain ) ; newChains . add ( newChain ) ; } return newChains ; } | Convert a List of chain objects to another List of chains containing Representative atoms only . |
24,063 | public static Chain getRepresentativeAtomsOnly ( Chain chain ) { Chain newChain = new ChainImpl ( ) ; newChain . setId ( chain . getId ( ) ) ; newChain . setName ( chain . getName ( ) ) ; newChain . setEntityInfo ( chain . getEntityInfo ( ) ) ; newChain . setSwissprotId ( chain . getSwissprotId ( ) ) ; List < Group > groups = chain . getAtomGroups ( ) ; grouploop : for ( Group g : groups ) { List < Atom > atoms = g . getAtoms ( ) ; if ( ! ( g instanceof AminoAcid ) ) continue ; for ( Atom a : atoms ) { if ( a . getName ( ) . equals ( StructureTools . CA_ATOM_NAME ) && a . getElement ( ) == Element . C ) { AminoAcid n = new AminoAcidImpl ( ) ; n . setPDBName ( g . getPDBName ( ) ) ; n . setResidueNumber ( g . getResidueNumber ( ) ) ; n . addAtom ( a ) ; newChain . addGroup ( n ) ; continue grouploop ; } } } return newChain ; } | Convert a Chain to a new Chain containing C - alpha atoms only . |
24,064 | public static GradientMapper getGradientMapper ( int gradientType , double min , double max ) { GradientMapper gm ; switch ( gradientType ) { case BLACK_WHITE_GRADIENT : gm = new GradientMapper ( Color . BLACK , Color . WHITE ) ; gm . put ( min , Color . BLACK ) ; gm . put ( max , Color . WHITE ) ; return gm ; case WHITE_BLACK_GRADIENT : gm = new GradientMapper ( Color . WHITE , Color . BLACK ) ; gm . put ( min , Color . WHITE ) ; gm . put ( max , Color . BLACK ) ; return gm ; case RED_BLUE_GRADIENT : gm = new GradientMapper ( Color . RED , Color . BLUE ) ; gm . put ( min , Color . RED ) ; gm . put ( max , Color . BLUE ) ; return gm ; case RAINBOW_GRADIENT : { ColorSpace hsv = HSVColorSpace . getHSVColorSpace ( ) ; LinearColorInterpolator interp = new LinearColorInterpolator ( hsv ) ; interp . setInterpolationDirection ( 0 , InterpolationDirection . UPPER ) ; Color hsvLow = new Color ( hsv , new float [ ] { 0f , 1f , 1f } , 1f ) ; Color hsvHigh = new Color ( hsv , new float [ ] { 1f , 1f , 1f } , 1f ) ; gm = new GradientMapper ( hsvLow , hsvHigh , hsv ) ; gm . put ( min , hsvLow ) ; gm . put ( max , hsvHigh ) ; gm . setInterpolator ( interp ) ; return gm ; } case RAINBOW_INTENSITY_GRADIENT : { ColorSpace hsv = HSVColorSpace . getHSVColorSpace ( ) ; LinearColorInterpolator interp = new LinearColorInterpolator ( hsv ) ; interp . setInterpolationDirection ( 0 , InterpolationDirection . LOWER ) ; Color hsvLow = new Color ( hsv , new float [ ] { 1f , 1f , 1f } , 1f ) ; Color hsvHigh = new Color ( hsv , new float [ ] { 0f , 1f , 0f } , 1f ) ; gm = new GradientMapper ( hsvLow , hsvHigh , hsv ) ; gm . put ( min , hsvLow ) ; gm . put ( max , hsvHigh ) ; gm . setInterpolator ( interp ) ; return gm ; } default : throw new IllegalArgumentException ( "Unsupported gradient " + gradientType ) ; } } | Constructs a gradientMapper to draw one of the pre - defined gradients |
24,065 | public void clear ( ) { Color neg = mapping . get ( Double . NEGATIVE_INFINITY ) ; Color pos = mapping . get ( Double . POSITIVE_INFINITY ) ; mapping . clear ( ) ; mapping . put ( Double . NEGATIVE_INFINITY , neg ) ; mapping . put ( Double . POSITIVE_INFINITY , pos ) ; } | Clears all finite endpoints |
24,066 | public Color put ( Double position , Color color ) { if ( position == null ) { throw new NullPointerException ( "Null endpoint position" ) ; } if ( color == null ) { throw new NullPointerException ( "Null colors are not allowed." ) ; } return mapping . put ( position , color ) ; } | Adds a gradient endpoint at the specified position . |
24,067 | public Ontology parseOBO ( BufferedReader oboFile , String ontoName , String ontoDescription ) throws ParseException , IOException { try { OntologyFactory factory = OntoTools . getDefaultFactory ( ) ; Ontology ontology = factory . createOntology ( ontoName , ontoDescription ) ; OboFileParser parser = new OboFileParser ( ) ; OboFileEventListener handler = new OboFileHandler ( ontology ) ; parser . addOboFileEventListener ( handler ) ; parser . parseOBO ( oboFile ) ; return ontology ; } catch ( AlreadyExistsException ex ) { throw new RuntimeException ( "Duplication in ontology" ) ; } catch ( OntologyException ex ) { throw new RuntimeException ( ex ) ; } } | Parse a OBO file and return its content as a BioJava Ontology object |
24,068 | public static List < Atom [ ] > getRotatedAtoms ( MultipleAlignment multAln ) throws StructureException { int size = multAln . size ( ) ; List < Atom [ ] > atomArrays = multAln . getAtomArrays ( ) ; for ( int i = 0 ; i < size ; i ++ ) { if ( atomArrays . get ( i ) . length < 1 ) throw new StructureException ( "Length of atoms arrays is too short! Size: " + atomArrays . get ( i ) . length ) ; } List < Atom [ ] > rotatedAtoms = new ArrayList < Atom [ ] > ( ) ; List < Matrix4d > transf = multAln . getBlockSet ( 0 ) . getTransformations ( ) ; if ( transf == null ) { logger . error ( "Alignment Transformations are not calculated. " + "Superimposing to first structure as reference." ) ; multAln = multAln . clone ( ) ; MultipleSuperimposer imposer = new ReferenceSuperimposer ( ) ; imposer . superimpose ( multAln ) ; transf = multAln . getBlockSet ( 0 ) . getTransformations ( ) ; assert ( transf != null ) ; } for ( int i = 0 ; i < size ; i ++ ) { Structure displayS = atomArrays . get ( i ) [ 0 ] . getGroup ( ) . getChain ( ) . getStructure ( ) . clone ( ) ; Atom [ ] rotCA = StructureTools . getRepresentativeAtomArray ( displayS ) ; List < Group > hetatms = StructureTools . getUnalignedGroups ( rotCA ) ; int index = rotCA . length ; rotCA = Arrays . copyOf ( rotCA , rotCA . length + hetatms . size ( ) ) ; for ( Group g : hetatms ) { rotCA [ index ] = g . getAtom ( 0 ) ; index ++ ; } Calc . transform ( displayS , transf . get ( i ) ) ; rotatedAtoms . add ( rotCA ) ; } return rotatedAtoms ; } | New structures are downloaded if they were not cached in the alignment and they are entirely transformed here with the superposition information in the Multiple Alignment . |
24,069 | public void formLinkRecordBond ( LinkRecord linkRecord ) { if ( linkRecord . getAltLoc1 ( ) . equals ( " " ) || linkRecord . getAltLoc2 ( ) . equals ( " " ) ) return ; try { Map < Integer , Atom > a = getAtomFromRecord ( linkRecord . getName1 ( ) , linkRecord . getAltLoc1 ( ) , linkRecord . getResName1 ( ) , linkRecord . getChainID1 ( ) , linkRecord . getResSeq1 ( ) , linkRecord . getiCode1 ( ) ) ; Map < Integer , Atom > b = getAtomFromRecord ( linkRecord . getName2 ( ) , linkRecord . getAltLoc2 ( ) , linkRecord . getResName2 ( ) , linkRecord . getChainID2 ( ) , linkRecord . getResSeq2 ( ) , linkRecord . getiCode2 ( ) ) ; for ( int i = 0 ; i < structure . nrModels ( ) ; i ++ ) { if ( a . containsKey ( i ) && b . containsKey ( i ) ) { if ( ! a . get ( i ) . equals ( b . get ( i ) ) ) { new BondImpl ( a . get ( i ) , b . get ( i ) , 1 ) ; } } } } catch ( StructureException e ) { if ( ! params . isParseCAOnly ( ) ) { logger . warn ( "Could not find atoms specified in LINK record: {}" , linkRecord . toString ( ) ) ; } else { logger . debug ( "Could not find atoms specified in LINK record while parsing in parseCAonly mode." ) ; } } } | Creates bond objects from a LinkRecord as parsed from a PDB file |
24,070 | private void setEAxis ( ) { Rotation e = rotations . get ( 0 ) ; Rotation h = rotations . get ( principalAxisIndex ) ; e . setAxisAngle ( new AxisAngle4d ( h . getAxisAngle ( ) ) ) ; e . getAxisAngle ( ) . angle = 0.0 ; e . setFold ( h . getFold ( ) ) ; } | Add E operation to the highest order rotation axis . By definition E belongs to the highest order axis . |
24,071 | public static void main ( String [ ] args ) { PDBFileReader pdbr = new PDBFileReader ( ) ; pdbr . setPath ( "/tmp/" ) ; String pdb1 = "1buz" ; String pdb2 = "1ali" ; StructurePairAligner sc = new StructurePairAligner ( ) ; StrucAligParameters params = new StrucAligParameters ( ) ; params . setMaxIter ( 1 ) ; sc . setParams ( params ) ; try { Structure s1 = pdbr . getStructureById ( pdb1 ) ; Structure s2 = pdbr . getStructureById ( pdb2 ) ; System . out . println ( "aligning " + pdb1 + " vs. " + pdb2 ) ; System . out . println ( s1 ) ; System . out . println ( ) ; System . out . println ( s2 ) ; sc . align ( s1 , s2 ) ; ScaleableMatrixPanel smp = new ScaleableMatrixPanel ( ) ; JFrame frame = new JFrame ( ) ; frame . addWindowListener ( new WindowAdapter ( ) { public void windowClosing ( WindowEvent e ) { JFrame f = ( JFrame ) e . getSource ( ) ; f . setVisible ( false ) ; f . dispose ( ) ; } } ) ; smp . setMatrix ( sc . getDistMat ( ) ) ; smp . setFragmentPairs ( sc . getFragmentPairs ( ) ) ; smp . setAlternativeAligs ( sc . getAlignments ( ) ) ; for ( int i = 0 ; i < sc . getAlignments ( ) . length ; i ++ ) { AlternativeAlignment aa = sc . getAlignments ( ) [ i ] ; System . out . println ( aa ) ; } frame . getContentPane ( ) . add ( smp ) ; frame . pack ( ) ; frame . setVisible ( true ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } | Number of minor ticks per unit scaled |
24,072 | private List < String [ ] > readSection ( BufferedReader bufferedReader ) { List < String [ ] > section = new ArrayList < String [ ] > ( ) ; String line = "" ; String currKey = null ; StringBuffer currVal = new StringBuffer ( ) ; boolean done = false ; int linecount = 0 ; try { while ( ! done ) { bufferedReader . mark ( 320 ) ; line = bufferedReader . readLine ( ) ; String firstSecKey = section . isEmpty ( ) ? "" : section . get ( 0 ) [ 0 ] ; if ( line != null && line . matches ( "\\p{Space}*" ) ) { continue ; } if ( line == null || ( ! line . startsWith ( " " ) && linecount ++ > 0 && ( ! firstSecKey . equals ( START_SEQUENCE_TAG ) || line . startsWith ( END_SEQUENCE_TAG ) ) ) ) { section . add ( new String [ ] { currKey , currVal . toString ( ) } ) ; bufferedReader . reset ( ) ; done = true ; } else { Matcher m = sectp . matcher ( line ) ; if ( m . matches ( ) ) { if ( currKey != null ) { section . add ( new String [ ] { currKey , currVal . toString ( ) } ) ; } currKey = m . group ( 2 ) == null ? ( m . group ( 4 ) == null ? m . group ( 6 ) : m . group ( 4 ) ) : m . group ( 2 ) ; currVal = new StringBuffer ( ) ; currVal . append ( ( m . group ( 2 ) == null ? ( m . group ( 4 ) == null ? "" : m . group ( 5 ) ) : m . group ( 3 ) ) . trim ( ) ) ; } else { if ( line . startsWith ( START_SEQUENCE_TAG ) || line . startsWith ( END_SEQUENCE_TAG ) ) { currKey = line ; } else { currVal . append ( "\n" ) ; currVal . append ( currKey . charAt ( 0 ) == '/' ? line . substring ( 21 ) : line . substring ( 12 ) ) ; } } } } } catch ( IOException e ) { throw new ParserException ( e . getMessage ( ) ) ; } catch ( RuntimeException e ) { throw new ParserException ( e . getMessage ( ) ) ; } return section ; } | key - > value tuples |
24,073 | public Location parse ( String locationString ) throws ParserException { featureGlobalStart = Integer . MAX_VALUE ; featureGlobalEnd = 1 ; Location l ; List < Location > ll = parseLocationString ( locationString , 1 ) ; if ( ll . size ( ) == 1 ) { l = ll . get ( 0 ) ; } else { l = new SimpleLocation ( featureGlobalStart , featureGlobalEnd , Strand . UNDEFINED , ll ) ; } return l ; } | Main method for parsing a location from a String instance |
24,074 | public String getProteinSequenceString ( ) { if ( sequence != null ) return sequence . toString ( ) ; StringBuilder builder = new StringBuilder ( ) ; for ( Atom a : reprAtoms ) builder . append ( StructureTools . get1LetterCode ( a . getGroup ( ) . getPDBName ( ) ) ) ; return builder . toString ( ) ; } | Get the protein sequence of the Subunit as String . |
24,075 | private int linearSearch ( int position ) { int [ ] minSeqIndex = getMinSequenceIndex ( ) ; int [ ] maxSeqIndex = getMaxSequenceIndex ( ) ; int length = minSeqIndex . length ; for ( int i = 0 ; i < length ; i ++ ) { if ( position >= minSeqIndex [ i ] && position <= maxSeqIndex [ i ] ) { return i ; } } throw new IndexOutOfBoundsException ( "Given position " + position + " does not map into this Sequence" ) ; } | Scans through the sequence index arrays in linear time . Not the best performance but easier to code |
24,076 | private int binarySearch ( int position ) { int [ ] minSeqIndex = getMinSequenceIndex ( ) ; int [ ] maxSeqIndex = getMaxSequenceIndex ( ) ; int low = 0 ; int high = minSeqIndex . length - 1 ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; int midMinPosition = minSeqIndex [ mid ] ; int midMaxPosition = maxSeqIndex [ mid ] ; if ( midMinPosition < position && midMaxPosition < position ) { low = mid + 1 ; } else if ( midMinPosition > position && midMaxPosition > position ) { high = mid - 1 ; } else { return mid ; } } throw new IndexOutOfBoundsException ( "Given position " + position + " does not map into this Sequence" ) ; } | Scans through the sequence index arrays using binary search |
24,077 | public Iterator < C > iterator ( ) { final List < Sequence < C > > localSequences = sequences ; return new Iterator < C > ( ) { private Iterator < C > currentSequenceIterator = null ; private int currentPosition = 0 ; public boolean hasNext ( ) { if ( currentSequenceIterator == null ) { return ! localSequences . isEmpty ( ) ; } boolean hasNext = currentSequenceIterator . hasNext ( ) ; if ( ! hasNext ) { hasNext = currentPosition < sequences . size ( ) ; } return hasNext ; } public C next ( ) { if ( currentSequenceIterator == null ) { if ( localSequences . isEmpty ( ) ) { throw new NoSuchElementException ( "No sequences to iterate over; make sure you call hasNext() before next()" ) ; } currentSequenceIterator = localSequences . get ( currentPosition ) . iterator ( ) ; currentPosition ++ ; } if ( ! currentSequenceIterator . hasNext ( ) ) { currentSequenceIterator = localSequences . get ( currentPosition ) . iterator ( ) ; currentPosition ++ ; } return currentSequenceIterator . next ( ) ; } public void remove ( ) throws UnsupportedOperationException { throw new UnsupportedOperationException ( "Cannot remove from this Sequence" ) ; } } ; } | Iterator implementation which attempts to move through the 2D structure attempting to skip onto the next sequence as & when it is asked to |
24,078 | public static ScopDatabase getSCOP ( String version , boolean forceLocalData ) { if ( version == null ) { version = defaultVersion ; } ScopDatabase scop = versionedScopDBs . get ( version ) ; if ( forceLocalData ) { if ( scop == null || ! ( scop instanceof LocalScopDatabase ) ) { logger . info ( "Creating new {}, version {}" , BerkeleyScopInstallation . class . getSimpleName ( ) , version ) ; BerkeleyScopInstallation berkeley = new BerkeleyScopInstallation ( ) ; berkeley . setScopVersion ( version ) ; versionedScopDBs . put ( version , berkeley ) ; return berkeley ; } return scop ; } else { if ( scop == null ) { logger . info ( "Creating new {}, version {}" , RemoteScopInstallation . class . getSimpleName ( ) , version ) ; scop = new RemoteScopInstallation ( ) ; scop . setScopVersion ( version ) ; versionedScopDBs . put ( version , scop ) ; } return scop ; } } | Gets an instance of the specified scop version . |
24,079 | public static void setScopDatabase ( String version , boolean forceLocalData ) { logger . debug ( "ScopFactory: Setting ScopDatabase to version: {}, forced local: {}" , version , forceLocalData ) ; getSCOP ( version , forceLocalData ) ; defaultVersion = version ; } | Set the default scop version |
24,080 | public static void setScopDatabase ( ScopDatabase scop ) { logger . debug ( "ScopFactory: Setting ScopDatabase to type: {}" , scop . getClass ( ) . getName ( ) ) ; defaultVersion = scop . getScopVersion ( ) ; versionedScopDBs . put ( defaultVersion , scop ) ; } | Set the default scop version and instance |
24,081 | public void setStructure1 ( Structure structure ) { this . structure1 = structure ; if ( structure != null ) { setAtoms ( structure1 , panel1 ) ; label1 . setText ( structure . getPDBCode ( ) ) ; label1 . repaint ( ) ; } } | has been called with setting the atoms directly |
24,082 | public void calcScale ( int zoomFactor ) { float s = getScaleForZoom ( zoomFactor ) ; scale = s ; panel1 . setScale ( s ) ; panel2 . setScale ( s ) ; panel1 . repaint ( ) ; panel2 . repaint ( ) ; } | a value of 100 means that the whole sequence should be displayed in the current visible window a factor of 1 means that one amino acid shoud be drawn as big as possible |
24,083 | public FastqBuilder withSequence ( final String sequence ) { if ( sequence == null ) { throw new IllegalArgumentException ( "sequence must not be null" ) ; } if ( this . sequence == null ) { this . sequence = new StringBuilder ( sequence . length ( ) ) ; } this . sequence . replace ( 0 , this . sequence . length ( ) , sequence ) ; return this ; } | Return this FASTQ formatted sequence builder configured with the specified sequence . |
24,084 | public FastqBuilder appendSequence ( final String sequence ) { if ( sequence == null ) { throw new IllegalArgumentException ( "sequence must not be null" ) ; } if ( this . sequence == null ) { this . sequence = new StringBuilder ( sequence . length ( ) ) ; } this . sequence . append ( sequence ) ; return this ; } | Return this FASTQ formatted sequence builder configured with the specified sequence appended to its current sequence . |
24,085 | public FastqBuilder withQuality ( final String quality ) { if ( quality == null ) { throw new IllegalArgumentException ( "quality must not be null" ) ; } if ( this . quality == null ) { this . quality = new StringBuilder ( quality . length ( ) ) ; } this . quality . replace ( 0 , this . quality . length ( ) , quality ) ; return this ; } | Return this FASTQ formatted sequence builder configured with the specified quality scores . |
24,086 | public FastqBuilder appendQuality ( final String quality ) { if ( quality == null ) { throw new IllegalArgumentException ( "quality must not be null" ) ; } if ( this . quality == null ) { this . quality = new StringBuilder ( quality . length ( ) ) ; } this . quality . append ( quality ) ; return this ; } | Return this FASTQ formatted sequence builder configured with the specified quality scores appended to its current quality scores . |
24,087 | public boolean sequenceAndQualityLengthsMatch ( ) { if ( sequence == null && quality == null ) { return true ; } if ( ( sequence != null && quality == null ) || ( sequence == null && quality != null ) ) { return false ; } return sequence . length ( ) == quality . length ( ) ; } | Return true if the sequence and quality scores for this FASTQ formatted sequence builder are equal in length . |
24,088 | public Fastq build ( ) { if ( description == null ) { throw new IllegalStateException ( "description must not be null" ) ; } if ( sequence == null ) { throw new IllegalStateException ( "sequence must not be null" ) ; } if ( quality == null ) { throw new IllegalStateException ( "quality must not be null" ) ; } if ( ! sequenceAndQualityLengthsMatch ( ) ) { throw new IllegalStateException ( "sequence and quality scores must be the same length" ) ; } Fastq fastq = new Fastq ( description , sequence . toString ( ) , quality . toString ( ) , variant ) ; return fastq ; } | Build and return a new FASTQ formatted sequence configured from the properties of this builder . |
24,089 | private void doAlign ( ) { int i , j ; double s , e , c , d , wa ; double [ ] CC = new double [ N + 1 ] ; double [ ] DD = new double [ N + 1 ] ; double maxs = - 100 ; char trace_e , trace_d ; CC [ 0 ] = 0 ; for ( j = 1 ; j <= N ; j ++ ) { CC [ j ] = 0 ; DD [ j ] = - g ; } for ( i = 1 ; i <= M ; i ++ ) { CC [ 0 ] = c = s = 0 ; e = - g ; for ( j = 1 ; j <= N ; j ++ ) { trace_e = 'e' ; if ( ( c = c - m ) > ( e = e - h ) ) { e = c ; trace_e = 'E' ; } trace_d = 'd' ; if ( ( c = CC [ j ] - m ) > ( d = DD [ j ] - h ) ) { d = c ; trace_d = 'D' ; } wa = sij [ i - 1 ] [ j - 1 ] ; c = s + wa ; trace [ i ] [ j ] = 's' ; if ( e > c ) { c = e ; trace [ i ] [ j ] = trace_e ; } if ( d > c ) { c = d ; trace [ i ] [ j ] = trace_d ; } etrace [ i ] [ j ] = trace_e ; dtrace [ i ] [ j ] = trace_d ; s = CC [ j ] ; CC [ j ] = c ; DD [ j ] = d ; if ( c < 0 ) { CC [ j ] = 0 ; DD [ j ] = - g ; c = 0 ; e = - g ; trace [ i ] [ j ] = '0' ; } if ( c > maxs ) { E1 = i ; E2 = j ; maxs = c ; } } } alignScore = maxs ; if ( trace [ E1 ] [ E2 ] != 's' ) { throw new RuntimeException ( "FCAlignHelper encoutered Exception: Not ending with substitution" ) ; } trace ( 's' , E1 , E2 ) ; checkAlign ( ) ; } | local - model |
24,090 | private void trace ( char mod , int i , int j ) { if ( mod == '0' || i <= 0 || j <= 0 ) { B1 = i + 1 ; B2 = j + 1 ; } if ( mod == 's' ) { trace ( trace [ i - 1 ] [ j - 1 ] , i - 1 , j - 1 ) ; rep ( ) ; } else if ( mod == 'D' ) { trace ( trace [ i - 1 ] [ j ] , i - 1 , j ) ; del ( 1 ) ; } else if ( mod == 'd' ) { trace ( dtrace [ i - 1 ] [ j ] , i - 1 , j ) ; del ( 1 ) ; } else if ( mod == 'E' ) { trace ( trace [ i ] [ j - 1 ] , i , j - 1 ) ; ins ( 1 ) ; } else if ( mod == 'e' ) { trace ( etrace [ i ] [ j - 1 ] , i , j - 1 ) ; ins ( 1 ) ; } } | trace - back recorded in sapp wrong method! |
24,091 | private double checkScore ( ) { int i , j , op , s ; double sco ; sco = 0 ; op = 0 ; s = 0 ; i = B1 ; j = B2 ; while ( i <= E1 && j <= E2 ) { op = sapp0 [ s ++ ] ; if ( op == 0 ) { sco += sij [ i - 1 ] [ j - 1 ] ; i ++ ; j ++ ; } else if ( op > 0 ) { sco -= g + op * h ; j = j + op ; } else { sco -= g - op * h ; i = i - op ; } } return ( sco ) ; } | checkscore - return the score of the alignment stored in sapp |
24,092 | public static StructureFiletype guessFiletype ( String filename ) { String lower = filename . toLowerCase ( ) ; for ( StructureFiletype type : StructureFiletype . values ( ) ) { for ( String ext : type . getExtensions ( ) ) { if ( lower . endsWith ( ext . toLowerCase ( ) ) ) { return type ; } } } return StructureFiletype . UNKNOWN ; } | Attempts to guess the type of a structure file based on the extension |
24,093 | public EmblReference copyEmblReference ( EmblReference emblReference ) { EmblReference copy = new EmblReference ( ) ; copy . setReferenceAuthor ( emblReference . getReferenceAuthor ( ) ) ; copy . setReferenceComment ( emblReference . getReferenceComment ( ) ) ; copy . setReferenceCrossReference ( emblReference . getReferenceCrossReference ( ) ) ; copy . setReferenceGroup ( emblReference . getReferenceGroup ( ) ) ; copy . setReferenceLocation ( emblReference . getReferenceLocation ( ) ) ; copy . setReferenceNumber ( emblReference . getReferenceNumber ( ) ) ; copy . setReferencePosition ( emblReference . getReferencePosition ( ) ) ; copy . setReferenceTitle ( emblReference . getReferenceTitle ( ) ) ; return copy ; } | return copy of EmblReference |
24,094 | public boolean addBridge ( BetaBridge bridge ) { if ( bridge1 == null ) { bridge1 = bridge ; return true ; } else if ( bridge1 . equals ( bridge ) ) { return true ; } else if ( bridge2 == null ) { bridge2 = bridge ; return true ; } else if ( bridge2 . equals ( bridge ) ) { return true ; } else { logger . info ( "Residue forms more than 2 beta Bridges, " + "DSSP output might differ in Bridges column." ) ; return false ; } } | Adds a Bridge to the residue . Each residue can only store two bridges . If the residue contains already two Bridges the Bridge will not be added and the method returns false . |
24,095 | private static void createAndShowGUI ( GUIAlignmentProgressListener progressListener ) { JFrame frame = new JFrame ( "Monitor alignment process" ) ; frame . setDefaultCloseOperation ( JFrame . EXIT_ON_CLOSE ) ; JComponent newContentPane = progressListener ; newContentPane . setOpaque ( true ) ; newContentPane . setSize ( new Dimension ( 400 , 400 ) ) ; frame . setContentPane ( newContentPane ) ; frame . pack ( ) ; frame . setVisible ( true ) ; } | Create the GUI and show it . As with all GUI code this must run on the event - dispatching thread . |
24,096 | private List < Integer > getPermutation ( Matrix4d transformation ) { double rmsdThresholdSq = Math . pow ( this . parameters . getRmsdThreshold ( ) , 2 ) ; List < Point3d > centers = subunits . getOriginalCenters ( ) ; List < Integer > seqClusterId = subunits . getClusterIds ( ) ; List < Integer > permutations = new ArrayList < Integer > ( centers . size ( ) ) ; double [ ] dSqs = new double [ centers . size ( ) ] ; boolean [ ] used = new boolean [ centers . size ( ) ] ; Arrays . fill ( used , false ) ; for ( int i = 0 ; i < centers . size ( ) ; i ++ ) { Point3d tCenter = new Point3d ( centers . get ( i ) ) ; transformation . transform ( tCenter ) ; int permutation = - 1 ; double minDistSq = Double . MAX_VALUE ; for ( int j = 0 ; j < centers . size ( ) ; j ++ ) { if ( seqClusterId . get ( i ) == seqClusterId . get ( j ) ) { if ( ! used [ j ] ) { double dSq = tCenter . distanceSquared ( centers . get ( j ) ) ; if ( dSq < minDistSq && dSq <= rmsdThresholdSq ) { minDistSq = dSq ; permutation = j ; dSqs [ j ] = dSq ; } } } } if ( permutations . size ( ) == permutation ) { permutation = - 1 ; } if ( permutation != - 1 ) { used [ permutation ] = true ; } permutations . add ( permutation ) ; } return permutations ; } | Returns a permutation of subunit indices for the given helix transformation . An index of - 1 is used to indicate subunits that do not superpose onto any other subunit . |
24,097 | private static double getRise ( Matrix4d transformation , Point3d p1 , Point3d p2 ) { AxisAngle4d axis = getAxisAngle ( transformation ) ; Vector3d h = new Vector3d ( axis . x , axis . y , axis . z ) ; Vector3d p = new Vector3d ( ) ; p . sub ( p1 , p2 ) ; return p . dot ( h ) ; } | Returns the rise of a helix given the subunit centers of two adjacent subunits and the helix transformation |
24,098 | private static AxisAngle4d getAxisAngle ( Matrix4d transformation ) { AxisAngle4d axis = new AxisAngle4d ( ) ; axis . set ( transformation ) ; return axis ; } | Returns the AxisAngle of the helix transformation |
24,099 | public List < OrderedPair < T > > getOrderedPairs ( ) { List < OrderedPair < T > > pairs = new ArrayList < OrderedPair < T > > ( list1 . size ( ) * list2 . size ( ) ) ; for ( T element1 : list1 ) { for ( T element2 : list2 ) { pairs . add ( new OrderedPair < T > ( element1 , element2 ) ) ; } } return pairs ; } | Generates the list of ordered pair between two sets . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.