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 . shouldContinueWri...
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 . rep...
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 ( curr...
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 . curre...
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 . getAbsolutePat...
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 . not...
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 ; } ...
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 ( ...
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 ) ...
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 . ...
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 = ...
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 ...
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 <...
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 . g...
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_C...
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 ) { retu...
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 = Str...
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 ( ) . spl...
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...
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 un...
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 ( ) ) ; ...
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...
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 . g...
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 SimpleDateF...
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 ) ...
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 ( ) == ObsoleteBehav...
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 = ( Re...
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" ) ; } f...
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 ; } } retur...
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 ( ...
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 : "%-" + ...
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 ? "&nbsp;" : " " ) ; }
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 == '-...
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 ( " <s...
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...
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 ...
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 . chai...
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 ) { re...
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 . getC...
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 . appe...
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...
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 > g...
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 WHI...
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 ...
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 o...
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...
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 . setPa...
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 ...
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 ( featureGlobalStar...
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 IndexOu...
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 = maxSeqI...
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 . isEmpt...
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 {}, versi...
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 ( ) , ...
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 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 ( ! se...
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 = ...
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 ...
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 -...
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 StructureFilety...
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 . getRef...
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 ( "Residu...
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...
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 A...
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 .