idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
24,300
public void setInscribedRadius ( double radius ) { double side = getSideLengthFromInscribedRadius ( radius , n ) ; this . circumscribedRadius = getCircumscribedRadiusFromSideLength ( side , n ) ; }
Sets the radius of an inscribed sphere that is tangent to each of the icosahedron s faces
24,301
public static FeatureList read ( String filename ) throws IOException { logger . info ( "Reading: {}" , filename ) ; FeatureList features = new FeatureList ( ) ; BufferedReader br = new BufferedReader ( new FileReader ( filename ) ) ; String s ; for ( s = br . readLine ( ) ; null != s ; s = br . readLine ( ) ) { s = s . trim ( ) ; if ( s . length ( ) > 0 ) { if ( s . charAt ( 0 ) == '#' ) { } else { FeatureI f = parseLine ( s ) ; if ( f != null ) { features . add ( f ) ; } } } } br . close ( ) ; return features ; }
Read a file into a FeatureList . Each line of the file becomes one Feature object .
24,302
public AFPChain invertAlignment ( AFPChain a ) { String name1 = a . getName1 ( ) ; String name2 = a . getName2 ( ) ; a . setName1 ( name2 ) ; a . setName2 ( name1 ) ; int len1 = a . getCa1Length ( ) ; a . setCa1Length ( a . getCa2Length ( ) ) ; a . setCa2Length ( len1 ) ; int beg1 = a . getAlnbeg1 ( ) ; a . setAlnbeg1 ( a . getAlnbeg2 ( ) ) ; a . setAlnbeg2 ( beg1 ) ; char [ ] alnseq1 = a . getAlnseq1 ( ) ; a . setAlnseq1 ( a . getAlnseq2 ( ) ) ; a . setAlnseq2 ( alnseq1 ) ; Matrix distab1 = a . getDisTable1 ( ) ; a . setDisTable1 ( a . getDisTable2 ( ) ) ; a . setDisTable2 ( distab1 ) ; int [ ] focusRes1 = a . getFocusRes1 ( ) ; a . setFocusRes1 ( a . getFocusRes2 ( ) ) ; a . setFocusRes2 ( focusRes1 ) ; String [ ] [ ] [ ] pdbAln = a . getPdbAln ( ) ; if ( pdbAln != null ) { for ( int block = 0 ; block < a . getBlockNum ( ) ; block ++ ) { String [ ] paln1 = pdbAln [ block ] [ 0 ] ; pdbAln [ block ] [ 0 ] = pdbAln [ block ] [ 1 ] ; pdbAln [ block ] [ 1 ] = paln1 ; } } int [ ] [ ] [ ] optAln = a . getOptAln ( ) ; if ( optAln != null ) { for ( int block = 0 ; block < a . getBlockNum ( ) ; block ++ ) { int [ ] aln1 = optAln [ block ] [ 0 ] ; optAln [ block ] [ 0 ] = optAln [ block ] [ 1 ] ; optAln [ block ] [ 1 ] = aln1 ; } } a . setOptAln ( optAln ) ; Matrix distmat = a . getDistanceMatrix ( ) ; if ( distmat != null ) a . setDistanceMatrix ( distmat . transpose ( ) ) ; Matrix [ ] blockRotMat = a . getBlockRotationMatrix ( ) ; Atom [ ] shiftVec = a . getBlockShiftVector ( ) ; if ( blockRotMat != null ) { for ( int block = 0 ; block < a . getBlockNum ( ) ; block ++ ) { if ( blockRotMat [ block ] != null ) { blockRotMat [ block ] = blockRotMat [ block ] . inverse ( ) ; Calc . rotate ( shiftVec [ block ] , blockRotMat [ block ] ) ; shiftVec [ block ] = Calc . invert ( shiftVec [ block ] ) ; } } } return a ; }
Swaps the order of structures in an AFPChain
24,303
public static AFPChain filterDuplicateAFPs ( AFPChain afpChain , CECalculator ceCalc , Atom [ ] ca1 , Atom [ ] ca2duplicated ) throws StructureException { return filterDuplicateAFPs ( afpChain , ceCalc , ca1 , ca2duplicated , null ) ; }
Takes as input an AFPChain where ca2 has been artificially duplicated . This raises the possibility that some residues of ca2 will appear in multiple AFPs . This method filters out duplicates and makes sure that all AFPs are numbered relative to the original ca2 .
24,304
protected static CPRange calculateMinCP ( int [ ] block , int blockLen , int ca2len , int minCPlength ) { CPRange range = new CPRange ( ) ; int middle = Arrays . binarySearch ( block , ca2len ) ; if ( middle < 0 ) { middle = - middle - 1 ; } range . mid = middle ; int minCPntermIndex = middle - minCPlength ; if ( minCPntermIndex >= 0 ) { range . n = block [ minCPntermIndex ] ; } else { range . n = - 1 ; } int minCPctermIndex = middle + minCPlength - 1 ; if ( minCPctermIndex < blockLen ) { range . c = block [ minCPctermIndex ] ; } else { range . c = ca2len * 2 ; } return range ; }
Finds the alignment index of the residues minCPlength before and after the duplication .
24,305
public void setPath ( String p ) { path = p ; if ( ! ( path . endsWith ( fileSeparator ) ) ) path = path + fileSeparator ; }
directory where to find PDB files
24,306
public List < String > getAllPDBIDs ( ) throws IOException { File f = new File ( path ) ; if ( ! f . isDirectory ( ) ) throw new IOException ( "Path " + path + " is not a directory!" ) ; String [ ] dirName = f . list ( ) ; List < String > pdbIds = new ArrayList < String > ( ) ; for ( String dir : dirName ) { File d2 = new File ( f , dir ) ; if ( ! d2 . isDirectory ( ) ) continue ; String [ ] pdbDirs = d2 . list ( ) ; for ( String pdbId : pdbDirs ) { if ( ! pdbIds . contains ( pdbId ) ) pdbIds . add ( pdbId ) ; } } return pdbIds ; }
Returns a list of all PDB IDs that are available in this installation
24,307
public static double getMaximumExtend ( final Structure structure ) { double [ ] [ ] bounds = getAtomCoordinateBounds ( structure ) ; double xMax = Math . abs ( bounds [ 0 ] [ 0 ] - bounds [ 1 ] [ 0 ] ) ; double yMax = Math . abs ( bounds [ 0 ] [ 1 ] - bounds [ 1 ] [ 1 ] ) ; double zMax = Math . abs ( bounds [ 0 ] [ 2 ] - bounds [ 1 ] [ 2 ] ) ; return Math . max ( xMax , Math . max ( yMax , zMax ) ) ; }
Returns the maximum extend of the structure in the x y or z direction .
24,308
public static double getBiologicalMoleculeMaximumExtend ( final Structure structure , List < BiologicalAssemblyTransformation > transformations ) { double [ ] [ ] bounds = getBiologicalMoleculeBounds ( structure , transformations ) ; double xMax = Math . abs ( bounds [ 0 ] [ 0 ] - bounds [ 1 ] [ 0 ] ) ; double yMax = Math . abs ( bounds [ 0 ] [ 1 ] - bounds [ 1 ] [ 1 ] ) ; double zMax = Math . abs ( bounds [ 0 ] [ 2 ] - bounds [ 1 ] [ 2 ] ) ; return Math . max ( xMax , Math . max ( yMax , zMax ) ) ; }
Returns the maximum extend of the biological molecule in the x y or z direction .
24,309
public static double [ ] getBiologicalMoleculeCentroid ( final Structure asymUnit , List < BiologicalAssemblyTransformation > transformations ) throws IllegalArgumentException { if ( asymUnit == null ) { throw new IllegalArgumentException ( "null structure" ) ; } Atom [ ] atoms = StructureTools . getAllAtomArray ( asymUnit ) ; int atomCount = atoms . length ; double [ ] centroid = new double [ 3 ] ; if ( atomCount <= 0 ) { return centroid ; } if ( transformations . size ( ) == 0 ) { return Calc . getCentroid ( atoms ) . getCoords ( ) ; } int count = 0 ; double [ ] transformedCoordinate = new double [ 3 ] ; for ( int i = 0 ; i < atomCount ; i ++ ) { Atom atom = atoms [ i ] ; Chain chain = atom . getGroup ( ) . getChain ( ) ; String intChainID = chain . getId ( ) ; for ( BiologicalAssemblyTransformation m : transformations ) { if ( ! m . getChainId ( ) . equals ( intChainID ) ) continue ; Point3d coords = atom . getCoordsAsPoint3d ( ) ; transformedCoordinate [ 0 ] = coords . x ; transformedCoordinate [ 1 ] = coords . y ; transformedCoordinate [ 2 ] = coords . z ; m . transformPoint ( transformedCoordinate ) ; centroid [ 0 ] += transformedCoordinate [ 0 ] ; centroid [ 1 ] += transformedCoordinate [ 1 ] ; centroid [ 2 ] += transformedCoordinate [ 2 ] ; count ++ ; } } centroid [ 0 ] /= count ; centroid [ 1 ] /= count ; centroid [ 2 ] /= count ; return centroid ; }
Returns the centroid of the biological molecule .
24,310
public static Location fromBioExt ( int start , int length , char strand , int totalLength ) { int s = start ; int e = s + length ; if ( ! ( strand == '-' || strand == '+' || strand == '.' ) ) { throw new IllegalArgumentException ( "Strand must be '+', '-', or '.'" ) ; } if ( strand == '-' ) { s = s - totalLength ; e = e - totalLength ; } return new Location ( s , e ) ; }
Create a location from MAF file coordinates which represent negative strand locations as the distance from the end of the sequence .
24,311
public Location intersection ( Location other ) { if ( isSameStrand ( other ) ) { return intersect ( mStart , mEnd , other . mStart , other . mEnd ) ; } else { throw new IllegalArgumentException ( "Locations are on opposite strands." ) ; } }
Return the intersection or null if no overlap .
24,312
public Location upstream ( int length ) { if ( length < 0 ) { throw new IllegalArgumentException ( "Parameter must be >= 0; is=" + length ) ; } if ( Math . signum ( mStart - length ) == Math . signum ( mStart ) || 0 == Math . signum ( mStart - length ) ) { return new Location ( mStart - length , mStart ) ; } else { throw new IndexOutOfBoundsException ( "Specified length causes crossing of origin: " + length + "; " + toString ( ) ) ; } }
Return the adjacent location of specified length directly upstream of this location .
24,313
public Location downstream ( int length ) { if ( length < 0 ) { throw new IllegalArgumentException ( "Parameter must be >= 0; is=" + length ) ; } if ( Math . signum ( mEnd + length ) == Math . signum ( mEnd ) || 0 == Math . signum ( mEnd + length ) ) { return new Location ( mEnd , mEnd + length ) ; } else { throw new IndexOutOfBoundsException ( "Specified length causes crossing of origin: " + length + "; " + toString ( ) ) ; } }
Return the adjacent location of specified length directly downstream of this location .
24,314
public int distance ( Location other ) { if ( isSameStrand ( other ) ) { if ( overlaps ( other ) ) { return - 1 ; } else { return ( mEnd <= other . mStart ) ? ( other . mStart - mEnd ) : ( mStart - other . mEnd ) ; } } else { throw new IllegalArgumentException ( "Locations are on opposite strands." ) ; } }
Return distance between this location and the other location .
24,315
public double percentOverlap ( Location other ) { if ( length ( ) > 0 && overlaps ( other ) ) { return 100.0 * ( ( ( double ) intersection ( other ) . length ( ) ) / ( double ) length ( ) ) ; } else { return 0 ; } }
Return percent overlap of two locations .
24,316
public boolean contains ( Location other ) { if ( isSameStrand ( other ) ) { return ( mStart <= other . mStart && mEnd >= other . mEnd ) ; } else { throw new IllegalArgumentException ( "Locations are on opposite strands." ) ; } }
Check if this location contains the other .
24,317
public void transformPoint ( final double [ ] point ) { Point3d p = new Point3d ( point [ 0 ] , point [ 1 ] , point [ 2 ] ) ; transformation . transform ( p ) ; point [ 0 ] = p . x ; point [ 1 ] = p . y ; point [ 2 ] = p . z ; }
Applies the transformation to given point .
24,318
public Double getNearestTime ( double timePercentage ) { Double minTime = null ; Double maxTime = null ; for ( Double t : time ) { if ( minTime == null || t < minTime ) { minTime = t ; } if ( maxTime == null || t > maxTime ) { maxTime = t ; } } Double timeRange = maxTime - minTime ; Double targetTime = minTime + timePercentage * timeRange ; Double previousTime = null ; for ( Double t : time ) { if ( previousTime == null || t <= targetTime ) { previousTime = t ; } else { return previousTime ; } } return previousTime ; }
Need to find the actual time for the nearest time represented as a percentage Would be used to then look up the number at risk at that particular time
24,319
public Double getNearestAtRisk ( double t ) { Integer index = 0 ; DecimalFormat newFormat = new DecimalFormat ( "#.#" ) ; for ( int i = 0 ; i < time . size ( ) ; i ++ ) { Double compareTime = time . get ( i ) ; compareTime = Double . valueOf ( newFormat . format ( compareTime ) ) ; if ( compareTime < t ) { index = i + 1 ; } else if ( compareTime == t ) { index = i ; break ; } else { break ; } } if ( index >= nrisk . size ( ) ) { return null ; } else { return nrisk . get ( index ) ; } }
Selection of number of risk will depend on the precision and rounding of time in the survival table . If you are asking for 12 and entry exists for 11 . 9999999 then 12 is greater than 11 . 99999 unless you round .
24,320
public String getDefaultOrientation ( ) { StringBuilder s = new StringBuilder ( ) ; s . append ( setCentroid ( ) ) ; Quat4d q = new Quat4d ( ) ; q . set ( helixAxisAligner . getRotationMatrix ( ) ) ; s . append ( "moveto 0 quaternion{" ) ; s . append ( jMolFloat ( q . x ) ) ; s . append ( "," ) ; s . append ( jMolFloat ( q . y ) ) ; s . append ( "," ) ; s . append ( jMolFloat ( q . z ) ) ; s . append ( "," ) ; s . append ( jMolFloat ( q . w ) ) ; s . append ( "};" ) ; return s . toString ( ) ; }
Returns a Jmol script to set the default orientation for a structure
24,321
public String playOrientations ( ) { StringBuilder s = new StringBuilder ( ) ; s . append ( drawFooter ( "Symmetry Helical" , "white" ) ) ; s . append ( drawPolyhedron ( ) ) ; s . append ( showPolyhedron ( ) ) ; s . append ( drawAxes ( ) ) ; s . append ( showAxes ( ) ) ; for ( int i = 0 ; i < getOrientationCount ( ) ; i ++ ) { s . append ( deleteHeader ( ) ) ; s . append ( getOrientationWithZoom ( i ) ) ; s . append ( drawHeader ( getOrientationName ( i ) , "white" ) ) ; s . append ( "delay 4;" ) ; } s . append ( deleteHeader ( ) ) ; s . append ( getOrientationWithZoom ( 0 ) ) ; s . append ( drawHeader ( getOrientationName ( 0 ) , "white" ) ) ; return s . toString ( ) ; }
Returns a Jmol script that displays a symmetry polyhedron and symmetry axes and then loop through different orientations
24,322
public String colorBySymmetry ( ) { List < List < Integer > > units = helixAxisAligner . getHelixLayers ( ) . getByLargestContacts ( ) . getLayerLines ( ) ; units = orientLayerLines ( units ) ; QuatSymmetrySubunits subunits = helixAxisAligner . getSubunits ( ) ; List < Integer > modelNumbers = subunits . getModelNumbers ( ) ; List < String > chainIds = subunits . getChainIds ( ) ; List < Integer > clusterIds = subunits . getClusterIds ( ) ; int clusterCount = Collections . max ( clusterIds ) + 1 ; Map < Color4f , List < String > > colorMap = new HashMap < Color4f , List < String > > ( ) ; int maxLen = 0 ; for ( List < Integer > unit : units ) { maxLen = Math . max ( maxLen , unit . size ( ) ) ; } Color4f [ ] colors = getSymmetryColors ( subunits . getSubunitCount ( ) ) ; int count = 0 ; for ( int i = 0 ; i < maxLen ; i ++ ) { for ( int j = 0 ; j < units . size ( ) ; j ++ ) { int m = units . get ( j ) . size ( ) ; if ( i < m ) { int subunit = units . get ( j ) . get ( i ) ; int cluster = clusterIds . get ( subunit ) ; float scale = 0.3f + 0.7f * ( cluster + 1 ) / clusterCount ; Color4f c = new Color4f ( colors [ count ] ) ; count ++ ; c . scale ( scale ) ; List < String > ids = colorMap . get ( c ) ; if ( ids == null ) { ids = new ArrayList < String > ( ) ; colorMap . put ( c , ids ) ; } String id = getChainSpecification ( modelNumbers , chainIds , subunit ) ; ids . add ( id ) ; } } } String coloring = defaultColoring + getJmolColorScript ( colorMap ) ; return coloring ; }
Returns a Jmol script that colors subunits to highlight the symmetry within a structure Different subunits should have a consistent color scheme or different shade of the same colors
24,323
private List < List < Integer > > orientLayerLines ( List < List < Integer > > layerLines ) { Matrix4d transformation = helixAxisAligner . getTransformation ( ) ; List < Point3d > centers = helixAxisAligner . getSubunits ( ) . getOriginalCenters ( ) ; for ( int i = 0 ; i < layerLines . size ( ) ; i ++ ) { List < Integer > layerLine = layerLines . get ( i ) ; int first = layerLine . get ( 0 ) ; Point3d firstSubunit = new Point3d ( centers . get ( first ) ) ; transformation . transform ( firstSubunit ) ; int last = layerLine . get ( layerLine . size ( ) - 1 ) ; Point3d lastSubunit = new Point3d ( centers . get ( last ) ) ; transformation . transform ( lastSubunit ) ; if ( firstSubunit . y > lastSubunit . y ) { Collections . reverse ( layerLine ) ; } } return layerLines ; }
Orients layer lines from lowest y - axis value to largest y - axis value
24,324
public static String toTransformMatrices ( MultipleAlignment alignment ) { StringBuffer txt = new StringBuffer ( ) ; for ( int bs = 0 ; bs < alignment . getBlockSets ( ) . size ( ) ; bs ++ ) { List < Matrix4d > btransforms = alignment . getBlockSet ( bs ) . getTransformations ( ) ; if ( btransforms == null || btransforms . size ( ) < 1 ) continue ; if ( alignment . getBlockSets ( ) . size ( ) > 1 ) { txt . append ( "Operations for block " ) ; txt . append ( bs + 1 ) ; txt . append ( "\n" ) ; } for ( int str = 0 ; str < alignment . size ( ) ; str ++ ) { String origString = "ref" ; txt . append ( String . format ( " X" + ( str + 1 ) + " = (%9.6f)*X" + origString + " + (%9.6f)*Y" + origString + " + (%9.6f)*Z" + origString + " + (%12.6f)" , btransforms . get ( str ) . getElement ( 0 , 0 ) , btransforms . get ( str ) . getElement ( 0 , 1 ) , btransforms . get ( str ) . getElement ( 0 , 2 ) , btransforms . get ( str ) . getElement ( 0 , 3 ) ) ) ; txt . append ( "\n" ) ; txt . append ( String . format ( " Y" + ( str + 1 ) + " = (%9.6f)*X" + origString + " + (%9.6f)*Y" + origString + " + (%9.6f)*Z" + origString + " + (%12.6f)" , btransforms . get ( str ) . getElement ( 1 , 0 ) , btransforms . get ( str ) . getElement ( 1 , 1 ) , btransforms . get ( str ) . getElement ( 1 , 2 ) , btransforms . get ( str ) . getElement ( 1 , 3 ) ) ) ; txt . append ( "\n" ) ; txt . append ( String . format ( " Z" + ( str + 1 ) + " = (%9.6f)*X" + origString + " + (%9.6f)*Y" + origString + " + (%9.6f)*Z" + origString + " + (%12.6f)" , btransforms . get ( str ) . getElement ( 2 , 0 ) , btransforms . get ( str ) . getElement ( 2 , 1 ) , btransforms . get ( str ) . getElement ( 2 , 2 ) , btransforms . get ( str ) . getElement ( 2 , 3 ) ) ) ; txt . append ( "\n\n" ) ; } } return txt . toString ( ) ; }
Converts the transformation Matrices of the alignment into a String output .
24,325
public static String toXML ( MultipleAlignmentEnsemble ensemble ) throws IOException { StringWriter result = new StringWriter ( ) ; PrintWriter writer = new PrintWriter ( result ) ; PrettyXMLWriter xml = new PrettyXMLWriter ( writer ) ; MultipleAlignmentXMLConverter . printXMLensemble ( xml , ensemble ) ; writer . close ( ) ; return result . toString ( ) ; }
Converts all the information of a multiple alignment ensemble into an XML String format . Cached variables like transformation matrices and scores are also converted .
24,326
public static Iterable < Number > qualityScores ( final Fastq fastq ) { if ( fastq == null ) { throw new IllegalArgumentException ( "fastq must not be null" ) ; } int size = fastq . getQuality ( ) . length ( ) ; List < Number > qualityScores = Lists . newArrayListWithExpectedSize ( size ) ; FastqVariant variant = fastq . getVariant ( ) ; for ( int i = 0 ; i < size ; i ++ ) { char c = fastq . getQuality ( ) . charAt ( i ) ; qualityScores . add ( variant . qualityScore ( c ) ) ; } return ImmutableList . copyOf ( qualityScores ) ; }
Return the quality scores from the specified FASTQ formatted sequence .
24,327
public static int [ ] qualityScores ( final Fastq fastq , final int [ ] qualityScores ) { if ( fastq == null ) { throw new IllegalArgumentException ( "fastq must not be null" ) ; } if ( qualityScores == null ) { throw new IllegalArgumentException ( "qualityScores must not be null" ) ; } int size = fastq . getQuality ( ) . length ( ) ; if ( qualityScores . length != size ) { throw new IllegalArgumentException ( "qualityScores must be the same length as the FASTQ formatted sequence quality" ) ; } FastqVariant variant = fastq . getVariant ( ) ; for ( int i = 0 ; i < size ; i ++ ) { char c = fastq . getQuality ( ) . charAt ( i ) ; qualityScores [ i ] = variant . qualityScore ( c ) ; } return qualityScores ; }
Copy the quality scores from the specified FASTQ formatted sequence into the specified int array .
24,328
public static double [ ] errorProbabilities ( final Fastq fastq , final double [ ] errorProbabilities ) { if ( fastq == null ) { throw new IllegalArgumentException ( "fastq must not be null" ) ; } if ( errorProbabilities == null ) { throw new IllegalArgumentException ( "errorProbabilities must not be null" ) ; } int size = fastq . getQuality ( ) . length ( ) ; if ( errorProbabilities . length != size ) { throw new IllegalArgumentException ( "errorProbabilities must be the same length as the FASTQ formatted sequence quality" ) ; } FastqVariant variant = fastq . getVariant ( ) ; for ( int i = 0 ; i < size ; i ++ ) { char c = fastq . getQuality ( ) . charAt ( i ) ; errorProbabilities [ i ] = variant . errorProbability ( c ) ; } return errorProbabilities ; }
Copy the error probabilities from the specified FASTQ formatted sequence into the specified double array .
24,329
public static Fastq convert ( final Fastq fastq , final FastqVariant variant ) { if ( fastq == null ) { throw new IllegalArgumentException ( "fastq must not be null" ) ; } if ( variant == null ) { throw new IllegalArgumentException ( "variant must not be null" ) ; } if ( fastq . getVariant ( ) . equals ( variant ) ) { return fastq ; } return new Fastq ( fastq . getDescription ( ) , fastq . getSequence ( ) , convertQualities ( fastq , variant ) , variant ) ; }
Convert the specified FASTQ formatted sequence to the specified FASTQ sequence format variant .
24,330
static String convertQualities ( final Fastq fastq , final FastqVariant variant ) { if ( fastq == null ) { throw new IllegalArgumentException ( "fastq must not be null" ) ; } if ( variant == null ) { throw new IllegalArgumentException ( "variant must not be null" ) ; } if ( fastq . getVariant ( ) . equals ( variant ) ) { return fastq . getQuality ( ) ; } int size = fastq . getQuality ( ) . length ( ) ; double [ ] errorProbabilities = errorProbabilities ( fastq , new double [ size ] ) ; StringBuilder sb = new StringBuilder ( size ) ; for ( int i = 0 ; i < size ; i ++ ) { sb . append ( variant . quality ( variant . qualityScore ( errorProbabilities [ i ] ) ) ) ; } return sb . toString ( ) ; }
Convert the qualities in the specified FASTQ formatted sequence to the specified FASTQ sequence format variant .
24,331
@ SuppressWarnings ( "unchecked" ) static < T > List < T > toList ( final Iterable < ? extends T > iterable ) { if ( iterable instanceof List ) { return ( List < T > ) iterable ; } return ImmutableList . copyOf ( iterable ) ; }
Return the specified iterable as a list .
24,332
public int compare ( CDSSequence o1 , CDSSequence o2 ) { if ( o1 . getStrand ( ) != o2 . getStrand ( ) ) { return o1 . getBioBegin ( ) - o2 . getBioBegin ( ) ; } if ( o1 . getStrand ( ) == Strand . NEGATIVE ) { return - 1 * ( o1 . getBioBegin ( ) - o2 . getBioBegin ( ) ) ; } return o1 . getBioBegin ( ) - o2 . getBioBegin ( ) ; }
Used to sort two CDSSequences where Negative Strand makes it tough
24,333
public AtomContact getContact ( Atom atom1 , Atom atom2 ) { return contacts . get ( new Pair < AtomIdentifier > ( new AtomIdentifier ( atom1 . getPDBserial ( ) , atom1 . getGroup ( ) . getChainId ( ) ) , new AtomIdentifier ( atom2 . getPDBserial ( ) , atom2 . getGroup ( ) . getChainId ( ) ) ) ) ; }
Returns the corresponding AtomContact or null if no contact exists between the 2 given atoms
24,334
public boolean hasContactsWithinDistance ( double distance ) { if ( distance >= cutoff ) throw new IllegalArgumentException ( "Given distance " + String . format ( "%.2f" , distance ) + " is larger than contacts' distance cutoff " + String . format ( "%.2f" , cutoff ) ) ; for ( AtomContact contact : this . contacts . values ( ) ) { if ( contact . getDistance ( ) < distance ) { return true ; } } return false ; }
Returns true if at least 1 contact from this set is within the given distance . Note that if the distance given is larger than the distance cutoff used to calculate the contacts then nothing will be found .
24,335
public List < AtomContact > getContactsWithinDistance ( double distance ) { if ( distance >= cutoff ) throw new IllegalArgumentException ( "Given distance " + String . format ( "%.2f" , distance ) + " is larger than contacts' distance cutoff " + String . format ( "%.2f" , cutoff ) ) ; List < AtomContact > list = new ArrayList < AtomContact > ( ) ; for ( AtomContact contact : this . contacts . values ( ) ) { if ( contact . getDistance ( ) < distance ) { list . add ( contact ) ; } } return list ; }
Returns the list of contacts from this set that are within the given distance .
24,336
public static ProteinSequence getProteinSequenceForStructure ( Structure struct , Map < Integer , Group > groupIndexPosition ) { if ( groupIndexPosition != null ) { groupIndexPosition . clear ( ) ; } StringBuilder seqStr = new StringBuilder ( ) ; for ( Chain chain : struct . getChains ( ) ) { List < Group > groups = chain . getAtomGroups ( ) ; Map < Integer , Integer > chainIndexPosition = new HashMap < Integer , Integer > ( ) ; int prevLen = seqStr . length ( ) ; String chainSeq = SeqRes2AtomAligner . getFullAtomSequence ( groups , chainIndexPosition , false ) ; seqStr . append ( chainSeq ) ; for ( Integer seqIndex : chainIndexPosition . keySet ( ) ) { Integer groupIndex = chainIndexPosition . get ( seqIndex ) ; groupIndexPosition . put ( prevLen + seqIndex , groups . get ( groupIndex ) ) ; } } ProteinSequence s = null ; try { s = new ProteinSequence ( seqStr . toString ( ) ) ; } catch ( CompoundNotFoundException e ) { logger . error ( "Could not create protein sequence, unknown compounds in string: {}" , e . getMessage ( ) ) ; } return s ; }
Generates a ProteinSequence corresponding to the sequence of struct and maintains a mapping from the sequence back to the original groups .
24,337
public static ResidueNumber [ ] matchSequenceToStructure ( ProteinSequence seq , Structure struct ) { Map < Integer , Group > atomIndexPosition = new HashMap < Integer , Group > ( ) ; ProteinSequence structSeq = getProteinSequenceForStructure ( struct , atomIndexPosition ) ; SubstitutionMatrix < AminoAcidCompound > matrix = new SimpleSubstitutionMatrix < AminoAcidCompound > ( AminoAcidCompoundSet . getAminoAcidCompoundSet ( ) , ( short ) 1 , ( short ) - 1 ) ; matrix = new SimpleSubstitutionMatrix < AminoAcidCompound > ( AminoAcidCompoundSet . getAminoAcidCompoundSet ( ) , new InputStreamReader ( SimpleSubstitutionMatrix . class . getResourceAsStream ( "/matrices/blosum100.txt" ) ) , "blosum100" ) ; SequencePair < ProteinSequence , AminoAcidCompound > pair = Alignments . getPairwiseAlignment ( seq , structSeq , PairwiseSequenceAlignerType . GLOBAL , new SimpleGapPenalty ( ) , matrix ) ; AlignedSequence < ProteinSequence , AminoAcidCompound > alignedSeq = pair . getQuery ( ) ; AlignedSequence < ProteinSequence , AminoAcidCompound > alignedStruct = pair . getTarget ( ) ; assert ( alignedSeq . getLength ( ) == alignedStruct . getLength ( ) ) ; ResidueNumber [ ] ca = new ResidueNumber [ seq . getLength ( ) ] ; for ( int pos = alignedSeq . getStart ( ) . getPosition ( ) ; pos <= alignedSeq . getEnd ( ) . getPosition ( ) ; pos ++ ) { if ( alignedSeq . isGap ( pos ) ) { int structIndex = alignedStruct . getSequenceIndexAt ( pos ) - 1 ; assert ( structIndex > 0 ) ; Group g = atomIndexPosition . get ( structIndex ) ; logger . warn ( "Chain {} residue {} in the Structure {} has no corresponding amino acid in the sequence." , g . getChainId ( ) , g . getResidueNumber ( ) . toString ( ) , g . getChain ( ) . getStructure ( ) . getPDBCode ( ) ) ; continue ; } if ( ! alignedStruct . isGap ( pos ) ) { int seqIndex = alignedSeq . getSequenceIndexAt ( pos ) - 1 ; int structIndex = alignedStruct . getSequenceIndexAt ( pos ) - 1 ; Group g = atomIndexPosition . get ( structIndex ) ; assert ( 0 <= seqIndex && seqIndex < ca . length ) ; ca [ seqIndex ] = g . getResidueNumber ( ) ; } } return ca ; }
Given a sequence and the corresponding Structure get the ResidueNumber for each residue in the sequence .
24,338
public static < T > T [ ] [ ] removeGaps ( final T [ ] [ ] gapped ) { if ( gapped == null ) return null ; if ( gapped . length < 1 ) return Arrays . copyOf ( gapped , gapped . length ) ; final int nProts = gapped . length ; final int protLen = gapped [ 0 ] . length ; for ( int i = 0 ; i < nProts ; i ++ ) { if ( gapped [ i ] . length != protLen ) { throw new IllegalArgumentException ( String . format ( "Expected a rectangular array, but row 0 has %d elements " + "while row %d has %d." , protLen , i , gapped [ i ] . length ) ) ; } } boolean [ ] isGap = new boolean [ protLen ] ; int gaps = 0 ; for ( int j = 0 ; j < protLen ; j ++ ) { for ( int i = 0 ; i < nProts ; i ++ ) { if ( gapped [ i ] [ j ] == null ) { isGap [ j ] = true ; gaps ++ ; break ; } } } T [ ] [ ] ungapped = Arrays . copyOf ( gapped , nProts ) ; final int ungappedLen = protLen - gaps ; for ( int i = 0 ; i < nProts ; i ++ ) { ungapped [ i ] = Arrays . copyOf ( gapped [ i ] , ungappedLen ) ; int k = 0 ; for ( int j = 0 ; j < protLen ; j ++ ) { if ( ! isGap [ j ] ) { assert ( gapped [ i ] [ j ] != null ) ; ungapped [ i ] [ k ] = gapped [ i ] [ j ] ; k ++ ; } } assert ( k == ungappedLen ) ; } return ungapped ; }
Creates a new list consisting of all columns of gapped where no row contained a null value .
24,339
public void traverseHierarchy ( ) { String pdbId = "4HHB" ; ScopDatabase scop = ScopFactory . getSCOP ( ) ; List < ScopDomain > domains = scop . getDomainsForPDB ( pdbId ) ; ScopNode node = scop . getScopNode ( domains . get ( 0 ) . getSunid ( ) ) ; while ( node != null ) { System . out . println ( "This node: sunid:" + node . getSunid ( ) ) ; System . out . println ( scop . getScopDescriptionBySunid ( node . getSunid ( ) ) ) ; node = scop . getScopNode ( node . getParentSunid ( ) ) ; } }
Traverse throught the SCOP hierarchy
24,340
public void getCategories ( ) { ScopDatabase scop = ScopFactory . getSCOP ( ) ; List < ScopDescription > superfams = scop . getByCategory ( ScopCategory . Superfamily ) ; System . out . println ( "Total nr. of superfamilies:" + superfams . size ( ) ) ; List < ScopDescription > folds = scop . getByCategory ( ScopCategory . Fold ) ; System . out . println ( "Total nr. of folds:" + folds . size ( ) ) ; }
Get various categories
24,341
private String _write_the_first_line ( S sequence ) { String locus ; try { locus = sequence . getAccession ( ) . getID ( ) ; } catch ( Exception e ) { locus = "" ; } if ( locus . length ( ) > 16 ) { throw new RuntimeException ( "Locus identifier " + locus + " is too long" ) ; } String units = "" ; String mol_type = "" ; if ( sequence . getCompoundSet ( ) instanceof DNACompoundSet ) { units = "bp" ; mol_type = "DNA" ; } else if ( sequence . getCompoundSet ( ) instanceof DNACompoundSet ) { units = "bp" ; mol_type = "RNA" ; } else if ( sequence . getCompoundSet ( ) instanceof AminoAcidCompoundSet ) { units = "aa" ; mol_type = "" ; } else { throw new RuntimeException ( "Need a DNACompoundSet, RNACompoundSet, or an AminoAcidCompoundSet" ) ; } String division = _get_data_division ( sequence ) ; if ( seqType != null ) { division = seqType ; } assert units . length ( ) == 2 ; StringBuilder sb = new StringBuilder ( ) ; Formatter formatter = new Formatter ( sb , Locale . US ) ; formatter . format ( "LOCUS %s %s %s %s %s %s" + lineSep , StringManipulationHelper . padRight ( locus , 16 ) , StringManipulationHelper . padLeft ( Integer . toString ( sequence . getLength ( ) ) , 11 ) , units , StringManipulationHelper . padRight ( mol_type , 6 ) , division , _get_date ( sequence ) ) ; String output = formatter . toString ( ) ; formatter . close ( ) ; return output ; }
Write the LOCUS line .
24,342
public static ChemComp getEmptyChemComp ( ) { ChemComp comp = new ChemComp ( ) ; comp . setOne_letter_code ( "?" ) ; comp . setThree_letter_code ( "???" ) ; comp . setPolymerType ( PolymerType . unknown ) ; comp . setResidueType ( ResidueType . atomn ) ; return comp ; }
Creates a new instance of the dummy empty ChemComp .
24,343
private void initializeZip ( ) throws IOException { s_logger . info ( "Using chemical component dictionary: " + m_zipFile . toString ( ) ) ; final File f = m_zipFile . toFile ( ) ; if ( ! f . exists ( ) ) { s_logger . info ( "Creating missing zip archive: " + m_zipFile . toString ( ) ) ; FileOutputStream fo = new FileOutputStream ( f ) ; ZipOutputStream zip = new ZipOutputStream ( new BufferedOutputStream ( fo ) ) ; try { zip . putNextEntry ( new ZipEntry ( "chemcomp/" ) ) ; zip . closeEntry ( ) ; } finally { zip . close ( ) ; } } }
ZipFileSystems - due to URI issues in Java7 .
24,344
private ChemComp downloadAndAdd ( String recordName ) { final ChemComp cc = m_dlProvider . getChemComp ( recordName ) ; final File [ ] files = new File [ 1 ] ; Path cif = m_tempDir . resolve ( "chemcomp" ) . resolve ( recordName + ".cif.gz" ) ; files [ 0 ] = cif . toFile ( ) ; if ( files [ 0 ] != null ) { addToZipFileSystem ( m_zipFile , files , m_zipRootDir ) ; if ( m_removeCif ) for ( File f : files ) f . delete ( ) ; } return cc ; }
Use DownloadChemCompProvider to grab a gzipped cif record from the PDB . Zip all downloaded cif . gz files into the dictionary .
24,345
private ChemComp getEmptyChemComp ( String resName ) { String pdbName = "" ; if ( null != resName && resName . length ( ) >= 3 ) { pdbName = resName . substring ( 0 , 3 ) ; } final ChemComp comp = new ChemComp ( ) ; comp . setOne_letter_code ( "?" ) ; comp . setThree_letter_code ( pdbName ) ; comp . setPolymerType ( PolymerType . unknown ) ; comp . setResidueType ( ResidueType . atomn ) ; return comp ; }
Return an empty ChemComp group for a three - letter resName .
24,346
public int countCompounds ( C ... compounds ) { int count = 0 ; List < C > search = Arrays . asList ( compounds ) ; for ( C compound : getAsList ( ) ) { if ( search . contains ( compound ) ) { count ++ ; } } return count ; }
methods for Sequence
24,347
private void setLocation ( List < Step > steps ) { List < Location > sublocations = new ArrayList < Location > ( ) ; int start = 0 , step = 0 , oStep = numBefore + numAfter , oMax = this . original . getLength ( ) , pStep = 0 , pMax = ( prev == null ) ? 0 : prev . getLength ( ) ; boolean inGap = true ; for ( ; step < length ; step ++ ) { boolean isGapStep = ( steps . get ( step ) == Step . GAP ) , isGapPrev = ( pStep < pMax && prev . isGap ( pStep + 1 ) ) ; if ( ! isGapStep && ! isGapPrev ) { oStep ++ ; if ( inGap ) { inGap = false ; start = step + 1 ; } } else if ( ! inGap ) { inGap = true ; sublocations . add ( new SimpleLocation ( start , step , Strand . UNDEFINED ) ) ; } if ( prev != null && ! isGapStep ) { pStep ++ ; } } if ( ! inGap ) { sublocations . add ( new SimpleLocation ( start , step , Strand . UNDEFINED ) ) ; } if ( sublocations . size ( ) == 0 ) { location = null ; } else if ( sublocations . size ( ) == 1 ) { location = sublocations . get ( 0 ) ; } else { location = new SimpleLocation ( sublocations . get ( 0 ) . getStart ( ) , sublocations . get ( sublocations . size ( ) - 1 ) . getEnd ( ) , Strand . UNDEFINED , false , sublocations ) ; } if ( step != length || oStep != oMax || pStep != pMax ) { throw new IllegalArgumentException ( "Given sequence does not fit in alignment." ) ; } }
helper method to initialize the location
24,348
public static StructureAlignmentJmol display ( AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) throws StructureException { if ( ca1 . length < 1 || ca2 . length < 1 ) { throw new StructureException ( "length of atoms arrays is too short! " + ca1 . length + "," + ca2 . length ) ; } Group [ ] twistedGroups = AlignmentTools . prepareGroupsForDisplay ( afpChain , ca1 , ca2 ) ; List < Group > hetatms = StructureTools . getUnalignedGroups ( ca1 ) ; List < Group > hetatms2 = StructureTools . getUnalignedGroups ( ca2 ) ; return DisplayAFP . display ( afpChain , twistedGroups , ca1 , ca2 , hetatms , hetatms2 ) ; }
Display an AFPChain alignment
24,349
public static SiftsChainToUniprotMapping load ( boolean useOnlyLocal ) throws IOException { UserConfiguration config = new UserConfiguration ( ) ; File cacheDir = new File ( config . getCacheFilePath ( ) ) ; DEFAULT_FILE = new File ( cacheDir , DEFAULT_FILENAME ) ; if ( ! DEFAULT_FILE . exists ( ) || DEFAULT_FILE . length ( ) == 0 ) { if ( useOnlyLocal ) throw new IOException ( DEFAULT_FILE + " does not exist, and did not download" ) ; download ( ) ; } try { return build ( ) ; } catch ( IOException e ) { logger . info ( "Caught IOException while reading {}. Error: {}" , DEFAULT_FILE , e . getMessage ( ) ) ; if ( useOnlyLocal ) throw new IOException ( DEFAULT_FILE + " could not be read, and did not redownload" ) ; download ( ) ; return build ( ) ; } }
Loads the SIFTS mapping . Attempts to load the mapping file in the PDB cache directory . If the file does not exist or could not be parsed downloads and stores a GZ - compressed file .
24,350
public double get ( int i ) { if ( i < 0 || i >= N ) throw new IllegalArgumentException ( "Illegal index " + i + " should be > 0 and < " + N ) ; if ( symbolTable . contains ( i ) ) return symbolTable . get ( i ) ; else return 0.0 ; }
get a value
24,351
public double dot ( SparseVector b ) { SparseVector a = this ; if ( a . N != b . N ) throw new IllegalArgumentException ( "Vector lengths disagree. " + a . N + " != " + b . N ) ; double sum = 0.0 ; if ( a . symbolTable . size ( ) <= b . symbolTable . size ( ) ) { for ( int i : a . symbolTable ) if ( b . symbolTable . contains ( i ) ) sum += a . get ( i ) * b . get ( i ) ; } else { for ( int i : b . symbolTable ) if ( a . symbolTable . contains ( i ) ) sum += a . get ( i ) * b . get ( i ) ; } return sum ; }
Calculates the dot product of this vector a with b
24,352
public SparseVector plus ( SparseVector b ) { SparseVector a = this ; if ( a . N != b . N ) throw new IllegalArgumentException ( "Vector lengths disagree : " + a . N + " != " + b . N ) ; SparseVector c = new SparseVector ( N ) ; for ( int i : a . symbolTable ) c . put ( i , a . get ( i ) ) ; for ( int i : b . symbolTable ) c . put ( i , b . get ( i ) + c . get ( i ) ) ; return c ; }
Calcualtes return a + b
24,353
public static Location location ( List < Location > subLocations , String type ) { if ( subLocations . size ( ) == 1 ) { return subLocations . get ( 0 ) ; } boolean circular = detectCicular ( subLocations ) ; Strand strand = detectStrand ( subLocations ) ; Point start = detectStart ( subLocations ) ; Point end = detectEnd ( subLocations , circular ) ; Location l ; if ( "join" . equals ( type ) ) { l = new SimpleLocation ( start , end , strand , circular , subLocations ) ; } else if ( "order" . equals ( type ) ) { l = new InsdcLocations . OrderLocation ( start , end , strand , circular , subLocations ) ; } else if ( "one-of" . equals ( type ) ) { l = new InsdcLocations . OneOfLocation ( subLocations ) ; } else if ( "group" . equals ( type ) ) { l = new InsdcLocations . GroupLocation ( start , end , strand , circular , subLocations ) ; } else if ( "bond" . equals ( type ) ) { l = new InsdcLocations . BondLocation ( subLocations ) ; } else { throw new ParserException ( "Unknown join type " + type ) ; } return l ; }
Builds a location from a List of locations ; this can be circular or linear joins . The code expects that these locations are in a sensible format .
24,354
public static Location location ( int start , int end , Strand strand , int length ) { int min = Math . min ( start , end ) ; boolean isReverse = ( min != start ) ; if ( isReverse ) { return new SimpleLocation ( new SimplePoint ( start ) . reverse ( length ) , new SimplePoint ( end ) . reverse ( length ) , strand ) ; } return new SimpleLocation ( start , end , strand ) ; }
Returns a location object which unlike the location constructors allows you to input reverse coordinates and will convert these into the right location on the positive strand .
24,355
public static Location circularLocation ( int start , int end , Strand strand , int length ) { int min = Math . min ( start , end ) ; int max = Math . max ( start , end ) ; boolean isReverse = ( min != start ) ; if ( min > length ) { throw new IllegalArgumentException ( "Cannot process a " + "location whose lowest coordinate is less than " + "the given length " + length ) ; } if ( max <= length ) { return location ( start , end , strand , length ) ; } int modStart = modulateCircularIndex ( start , length ) ; int modEnd = modulateCircularIndex ( end , length ) ; int numberOfPasses = completeCircularPasses ( Math . max ( start , end ) , length ) ; if ( isReverse ) { int reversedModStart = new SimplePoint ( modStart ) . reverse ( length ) . getPosition ( ) ; int reversedModEnd = new SimplePoint ( modEnd ) . reverse ( length ) . getPosition ( ) ; modStart = reversedModStart ; modEnd = reversedModEnd ; start = reversedModStart ; end = ( length * ( numberOfPasses + 1 ) ) + modEnd ; } List < Location > locations = new ArrayList < Location > ( ) ; locations . add ( new SimpleLocation ( modStart , length , strand ) ) ; for ( int i = 0 ; i < numberOfPasses ; i ++ ) { locations . add ( new SimpleLocation ( 1 , length , strand ) ) ; } locations . add ( new SimpleLocation ( 1 , modEnd , strand ) ) ; return new SimpleLocation ( new SimplePoint ( start ) , new SimplePoint ( end ) , strand , true , false , locations ) ; }
Converts a location which defines the outer bounds of a circular location and splits it into the required portions . Unlike any other location builder this allows you to express your input location on the reverse strand
24,356
public static Location getMin ( List < Location > locations ) { return scanLocations ( locations , new LocationPredicate ( ) { public boolean accept ( Location previous , Location current ) { int res = current . getStart ( ) . compareTo ( previous . getStart ( ) ) ; return res < 0 ; } } ) ; }
Scans through a list of locations to find the Location with the lowest start
24,357
public static Location getMax ( List < Location > locations ) { return scanLocations ( locations , new LocationPredicate ( ) { public boolean accept ( Location previous , Location current ) { int res = current . getEnd ( ) . compareTo ( previous . getEnd ( ) ) ; return res > 0 ; } } ) ; }
Scans through a list of locations to find the Location with the highest end
24,358
private static Location scanLocations ( List < Location > locations , LocationPredicate predicate ) { Location location = null ; for ( Location l : locations ) { if ( location == null ) { location = l ; } else { if ( predicate . accept ( location , l ) ) { location = l ; } } } return location ; }
Used for scanning through a list of locations ; assumes the locations given will have at least one value otherwise we will get a null pointer
24,359
public static int modulateCircularIndex ( int index , int seqLength ) { if ( seqLength == 0 ) { return index ; } while ( index > seqLength ) { index -= seqLength ; } return index ; }
Takes a point on a circular location and moves it left until it falls at the earliest possible point that represents the same base .
24,360
public static int completeCircularPasses ( int index , int seqLength ) { int count = 0 ; while ( index > seqLength ) { count ++ ; index -= seqLength ; } return count - 1 ; }
Works in a similar way to modulateCircularLocation but returns the number of complete passes over a Sequence length a circular location makes i . e . if we have a sequence of length 10 and the location 3 .. 52 we make 4 complete passes through the genome to go from position 3 to position 52 .
24,361
public static boolean detectCicular ( List < Location > subLocations ) { boolean isCircular = false ; if ( ! consistentAccessions ( subLocations ) ) return isCircular ; int lastMax = 0 ; for ( Location sub : subLocations ) { if ( sub . getEnd ( ) . getPosition ( ) > lastMax ) { lastMax = sub . getEnd ( ) . getPosition ( ) ; } else { isCircular = true ; break ; } } return isCircular ; }
Loops through the given list of locations and returns true if it looks like they represent a circular location . Detection cannot happen if we do not have consistent accessions
24,362
public static boolean consistentAccessions ( List < Location > subLocations ) { Set < AccessionID > set = new HashSet < AccessionID > ( ) ; for ( Location sub : subLocations ) { set . add ( sub . getAccession ( ) ) ; } return set . size ( ) == 1 ; }
Scans a list of locations and returns true if all the given locations are linked to the same sequence . A list of null accessioned locations is the same as a list where the accession is the same
24,363
public static Strand detectStrand ( List < Location > subLocations ) { Strand strand = subLocations . get ( 0 ) . getStrand ( ) ; for ( Location sub : subLocations ) { if ( strand != sub . getStrand ( ) ) { strand = Strand . UNDEFINED ; break ; } } return strand ; }
Loops through the given list of locations and returns the consensus Strand class . If the class switches then we will return an undefined strand
24,364
public static Point detectEnd ( List < Location > subLocations , boolean isCircular ) { int end = 0 ; Point lastPoint = null ; if ( isCircular ) { for ( Location sub : subLocations ) { lastPoint = sub . getEnd ( ) ; end += lastPoint . getPosition ( ) ; } } else { lastPoint = subLocations . get ( subLocations . size ( ) - 1 ) . getEnd ( ) ; end = lastPoint . getPosition ( ) ; } return new SimplePoint ( end , lastPoint . isUnknown ( ) , lastPoint . isUncertain ( ) ) ; }
This will attempt to find what the last point is and returns that position . If the location is circular this will return the total length of the location and does not mean the maximum point on the Sequence we may find the locations on
24,365
public double getPercentageOfIdentity ( boolean countGaps ) { double seqid = getNumIdenticals ( ) ; double length = getLength ( ) ; if ( ! countGaps ) { length = length - getAlignedSequence ( 1 ) . getNumGapPositions ( ) - getAlignedSequence ( 2 ) . getNumGapPositions ( ) ; } return seqid / length ; }
Returns the percentage of identity between the two sequences in the alignment as a fraction between 0 and 1 .
24,366
public static void setCuts ( int x , Subproblem subproblem , Last [ ] [ ] pointers , Cut [ ] cuts ) { for ( Cut c : cuts ) { c . update ( x , subproblem , pointers ) ; } }
updates cut rows given the latest row of traceback pointers
24,367
public static Last [ ] setScorePoint ( int x , int y , int gop , int gep , int sub , int [ ] [ ] [ ] scores ) { Last [ ] pointers = new Last [ 3 ] ; if ( scores [ x - 1 ] [ y - 1 ] [ 1 ] >= scores [ x - 1 ] [ y - 1 ] [ 0 ] && scores [ x - 1 ] [ y - 1 ] [ 1 ] >= scores [ x - 1 ] [ y - 1 ] [ 2 ] ) { scores [ x ] [ y ] [ 0 ] = scores [ x - 1 ] [ y - 1 ] [ 1 ] + sub ; pointers [ 0 ] = Last . DELETION ; } else if ( scores [ x - 1 ] [ y - 1 ] [ 0 ] >= scores [ x - 1 ] [ y - 1 ] [ 2 ] ) { scores [ x ] [ y ] [ 0 ] = scores [ x - 1 ] [ y - 1 ] [ 0 ] + sub ; pointers [ 0 ] = Last . SUBSTITUTION ; } else { scores [ x ] [ y ] [ 0 ] = scores [ x - 1 ] [ y - 1 ] [ 2 ] + sub ; pointers [ 0 ] = Last . INSERTION ; } if ( scores [ x - 1 ] [ y ] [ 1 ] >= scores [ x - 1 ] [ y ] [ 0 ] + gop ) { scores [ x ] [ y ] [ 1 ] = scores [ x - 1 ] [ y ] [ 1 ] + gep ; pointers [ 1 ] = Last . DELETION ; } else { scores [ x ] [ y ] [ 1 ] = scores [ x - 1 ] [ y ] [ 0 ] + gop + gep ; pointers [ 1 ] = Last . SUBSTITUTION ; } if ( scores [ x ] [ y - 1 ] [ 0 ] + gop >= scores [ x ] [ y - 1 ] [ 2 ] ) { scores [ x ] [ y ] [ 2 ] = scores [ x ] [ y - 1 ] [ 0 ] + gop + gep ; pointers [ 2 ] = Last . SUBSTITUTION ; } else { scores [ x ] [ y ] [ 2 ] = scores [ x ] [ y - 1 ] [ 2 ] + gep ; pointers [ 2 ] = Last . INSERTION ; } return pointers ; }
Calculate the optimal alignment score for the given sequence positions with an affine or constant gap penalty
24,368
public static Last setScorePoint ( int x , int y , int gep , int sub , int [ ] [ ] [ ] scores ) { int d = scores [ x - 1 ] [ y ] [ 0 ] + gep ; int i = scores [ x ] [ y - 1 ] [ 0 ] + gep ; int s = scores [ x - 1 ] [ y - 1 ] [ 0 ] + sub ; if ( d >= s && d >= i ) { scores [ x ] [ y ] [ 0 ] = d ; return Last . DELETION ; } else if ( s >= i ) { scores [ x ] [ y ] [ 0 ] = s ; return Last . SUBSTITUTION ; } else { scores [ x ] [ y ] [ 0 ] = i ; return Last . INSERTION ; } }
Calculates the optimal alignment score for the given sequence positions and a linear gap penalty
24,369
public static Last [ ] [ ] setScoreVector ( int x , int xb , int yb , int ye , int gep , int [ ] subs , boolean storing , int [ ] [ ] [ ] scores , boolean startAnchored ) { Last [ ] [ ] pointers = new Last [ ye + 1 ] [ 1 ] ; ensureScoringMatrixColumn ( x , storing , scores ) ; if ( x == xb ) { if ( startAnchored ) { assert ( xb > 0 && yb > 0 ) ; scores [ xb ] [ yb ] [ 0 ] = scores [ xb - 1 ] [ yb - 1 ] [ 0 ] + subs [ yb ] ; pointers [ yb ] [ 0 ] = Last . SUBSTITUTION ; } for ( int y = yb + 1 ; y <= ye ; y ++ ) { scores [ xb ] [ y ] [ 0 ] = scores [ xb ] [ y - 1 ] [ 0 ] + gep ; pointers [ y ] [ 0 ] = Last . INSERTION ; } } else { scores [ x ] [ yb ] [ 0 ] = scores [ x - 1 ] [ yb ] [ 0 ] + gep ; pointers [ yb ] [ 0 ] = Last . DELETION ; for ( int y = yb + 1 ; y <= ye ; y ++ ) { pointers [ y ] [ 0 ] = setScorePoint ( x , y , gep , subs [ y ] , scores ) ; } } return pointers ; }
Score global alignment for a given position in the query sequence for a linear gap penalty
24,370
public static Last [ ] [ ] setScoreVector ( int x , int xb , int yb , int ye , int gop , int gep , int [ ] subs , boolean storing , int [ ] [ ] [ ] scores , int [ ] xyMax , int score ) { Last [ ] [ ] pointers ; ensureScoringMatrixColumn ( x , storing , scores ) ; if ( x == xb ) { pointers = new Last [ ye + 1 ] [ scores [ 0 ] [ 0 ] . length ] ; } else { pointers = new Last [ ye + 1 ] [ ] ; pointers [ 0 ] = new Last [ scores [ 0 ] [ 0 ] . length ] ; for ( int y = 1 ; y < scores [ 0 ] . length ; y ++ ) { pointers [ y ] = setScorePoint ( x , y , gop , gep , subs [ y ] , scores ) ; for ( int z = 0 ; z < scores [ 0 ] [ 0 ] . length ; z ++ ) { if ( scores [ x ] [ y ] [ z ] <= 0 ) { scores [ x ] [ y ] [ z ] = 0 ; pointers [ y ] [ z ] = null ; } } if ( scores [ x ] [ y ] [ 0 ] > score ) { xyMax [ 0 ] = x ; xyMax [ 1 ] = y ; score = scores [ x ] [ y ] [ 0 ] ; } } } return pointers ; }
Score local alignment for a given position in the query sequence
24,371
public static Last [ ] [ ] setScoreVector ( int x , int gep , int [ ] subs , boolean storing , int [ ] [ ] [ ] scores , int [ ] xyMax , int score ) { return setScoreVector ( x , 0 , 0 , scores [ 0 ] . length - 1 , gep , subs , storing , scores , xyMax , score ) ; }
Score local alignment for a given position in the query sequence for a linear gap penalty
24,372
public static int [ ] setSteps ( Last [ ] [ ] [ ] traceback , boolean local , int [ ] xyMax , Last last , List < Step > sx , List < Step > sy ) { int x = xyMax [ 0 ] , y = xyMax [ 1 ] ; boolean linear = ( traceback [ x ] [ y ] . length == 1 ) ; while ( local ? ( linear ? last : traceback [ x ] [ y ] [ last . ordinal ( ) ] ) != null : x > 0 || y > 0 ) { switch ( last ) { case DELETION : sx . add ( Step . COMPOUND ) ; sy . add ( Step . GAP ) ; last = linear ? traceback [ -- x ] [ y ] [ 0 ] : traceback [ x -- ] [ y ] [ 1 ] ; break ; case SUBSTITUTION : sx . add ( Step . COMPOUND ) ; sy . add ( Step . COMPOUND ) ; last = linear ? traceback [ -- x ] [ -- y ] [ 0 ] : traceback [ x -- ] [ y -- ] [ 0 ] ; break ; case INSERTION : sx . add ( Step . GAP ) ; sy . add ( Step . COMPOUND ) ; last = linear ? traceback [ x ] [ -- y ] [ 0 ] : traceback [ x ] [ y -- ] [ 2 ] ; } } Collections . reverse ( sx ) ; Collections . reverse ( sy ) ; return new int [ ] { x , y } ; }
Find alignment path through traceback matrix
24,373
public static int [ ] setSteps ( Last [ ] [ ] [ ] traceback , int [ ] [ ] [ ] scores , List < Step > sx , List < Step > sy ) { int xMax = scores . length - 1 , yMax = scores [ xMax ] . length - 1 ; boolean linear = ( traceback [ xMax ] [ yMax ] . length == 1 ) ; Last last = linear ? traceback [ xMax ] [ yMax ] [ 0 ] : ( scores [ xMax ] [ yMax ] [ 1 ] > scores [ xMax ] [ yMax ] [ 0 ] && scores [ xMax ] [ yMax ] [ 1 ] > scores [ xMax ] [ yMax ] [ 2 ] ) ? Last . DELETION : ( scores [ xMax ] [ yMax ] [ 0 ] > scores [ xMax ] [ yMax ] [ 2 ] ) ? Last . SUBSTITUTION : Last . INSERTION ; return setSteps ( traceback , false , new int [ ] { xMax , yMax } , last , sx , sy ) ; }
Find global alignment path through traceback matrix
24,374
public static int [ ] setSteps ( Last [ ] [ ] [ ] traceback , int [ ] xyMax , List < Step > sx , List < Step > sy ) { return setSteps ( traceback , true , xyMax , Last . SUBSTITUTION , sx , sy ) ; }
Find local alignment path through traceback matrix
24,375
public static Matrix getRotationJAMA ( Matrix4d transform ) { Matrix rot = new Matrix ( 3 , 3 ) ; for ( int i = 0 ; i < 3 ; i ++ ) { for ( int j = 0 ; j < 3 ; j ++ ) { rot . set ( j , i , transform . getElement ( i , j ) ) ; } } return rot ; }
Convert a transformation matrix into a JAMA rotation matrix . Because the JAMA matrix is a pre - multiplication matrix and the Vecmath matrix is a post - multiplication one the rotation matrix is transposed to ensure that the transformation they produce is the same .
24,376
public static Matrix3d getRotationMatrix ( Matrix4d transform ) { Matrix3d rot = new Matrix3d ( ) ; transform . setRotationScale ( rot ) ; return rot ; }
Convert a transformation matrix into a rotation matrix .
24,377
public static Vector3d getTranslationVector ( Matrix4d transform ) { Vector3d transl = new Vector3d ( ) ; transform . get ( transl ) ; return transl ; }
Extract the translational vector of a transformation matrix .
24,378
public void setParentDNASequence ( AbstractSequence < NucleotideCompound > parentDNASequence , Integer begin , Integer end ) { this . setParentSequence ( parentDNASequence ) ; setBioBegin ( begin ) ; setBioEnd ( end ) ; }
However due to the derivation of this class this is the only possible type argument for this parameter ...
24,379
public void parse ( InputStream inputStream ) throws IOException { currentMatrix = null ; currentRows = "" ; currentCols = "" ; max = Short . MIN_VALUE ; min = Short . MAX_VALUE ; inMatrix = false ; BufferedReader buf = new BufferedReader ( new InputStreamReader ( inputStream ) ) ; String line = null ; line = buf . readLine ( ) ; while ( line != null ) { if ( line . startsWith ( "//" ) ) { finalizeMatrix ( ) ; inMatrix = false ; } else if ( line . startsWith ( "H " ) ) { newMatrix ( line ) ; } else if ( line . startsWith ( "D " ) ) { currentMatrix . setDescription ( line . substring ( 2 ) ) ; } else if ( line . startsWith ( "M " ) ) { initMatrix ( line ) ; inMatrix = true ; } else if ( line . startsWith ( " " ) ) { if ( inMatrix ) processScores ( line ) ; } line = buf . readLine ( ) ; } }
parse an inputStream that points to an AAINDEX database file
24,380
private final float [ ] align ( final int sResidue , final int dIndex ) { int dResidue , r ; float maxScore = - 1000000 ; float rho1 = 0 ; int maxIdx = 0 ; float rho0 = 0 ; short [ ] dbAARow = model . dbAA [ dIndex ] ; int numOfIterations = model . Length [ dIndex ] - ORonnModel . AA_ALPHABET ; for ( dResidue = 0 ; dResidue <= numOfIterations ; dResidue ++ ) { rho1 = 0.0f ; for ( r = 0 ; r < ORonnModel . AA_ALPHABET ; r ++ ) { rho1 += RonnConstraint . Blosum62 [ seqAA [ sResidue + r ] ] [ dbAARow [ dResidue + r ] ] ; } if ( rho1 > maxScore ) { maxScore = rho1 ; maxIdx = dResidue ; } } for ( r = 0 ; r < ORonnModel . AA_ALPHABET ; r ++ ) { rho0 += RonnConstraint . Blosum62 [ dbAARow [ maxIdx + r ] ] [ dbAARow [ maxIdx + r ] ] ; } return new float [ ] { rho0 , maxScore } ; }
sResidue query sequence index and dIndex database sequence index
24,381
public static void addAlgorithm ( StructureAlignment alg ) { try { getAlgorithm ( alg . getAlgorithmName ( ) ) ; } catch ( StructureException e ) { algorithms . add ( alg ) ; } }
Adds a new StructureAlignment algorithm to the list .
24,382
public static boolean removeAlgorithm ( String name ) { ListIterator < StructureAlignment > algIt = algorithms . listIterator ( ) ; while ( algIt . hasNext ( ) ) { StructureAlignment alg = algIt . next ( ) ; if ( alg . getAlgorithmName ( ) . equalsIgnoreCase ( name ) ) { algIt . remove ( ) ; return true ; } } return false ; }
Removes the specified algorithm from the list of options
24,383
public List < Subunit > getAlignedSubunits1 ( ) { List < Subunit > aligned = new ArrayList < Subunit > ( subunitMap . size ( ) ) ; for ( Integer key : subunitMap . keySet ( ) ) aligned . add ( subunits1 . get ( key ) ) ; return aligned ; }
Return the aligned subunits of the first Subunit group in the alignment order .
24,384
public List < Subunit > getAlignedSubunits2 ( ) { List < Subunit > aligned = new ArrayList < Subunit > ( subunitMap . size ( ) ) ; for ( Integer key : subunitMap . keySet ( ) ) aligned . add ( subunits2 . get ( subunitMap . get ( key ) ) ) ; return aligned ; }
Return the aligned subunits of the second Subunit group in the alignment order .
24,385
public void setPDBName ( String s ) { if ( s != null && s . equals ( "?" ) ) logger . info ( "invalid pdbname: ?" ) ; pdb_name = s ; }
Set three character name of Group .
24,386
public void clearAtoms ( ) { atoms . clear ( ) ; setPDBFlag ( false ) ; if ( atomNameLookup != null ) atomNameLookup . clear ( ) ; }
remove all atoms
24,387
public void trimToSize ( ) { if ( atoms instanceof ArrayList < ? > ) { ArrayList < Atom > myatoms = ( ArrayList < Atom > ) atoms ; myatoms . trimToSize ( ) ; } if ( altLocs instanceof ArrayList < ? > ) { ArrayList < Group > myAltLocs = ( ArrayList < Group > ) altLocs ; myAltLocs . trimToSize ( ) ; } if ( hasAltLoc ( ) ) { for ( Group alt : getAltLocs ( ) ) { alt . trimToSize ( ) ; } } properties = new HashMap < String , Object > ( properties ) ; if ( atomNameLookup != null ) atomNameLookup = new HashMap < String , Atom > ( atomNameLookup ) ; }
attempts to reduce the memory imprint of this group by trimming all internal Collection objects to the required size .
24,388
public Color interpolate ( Color a , Color b , float mixing ) { float [ ] compA , compB ; if ( a . getColorSpace ( ) . equals ( colorSpace ) ) { compA = a . getComponents ( null ) ; } else { compA = a . getComponents ( colorSpace , null ) ; } if ( b . getColorSpace ( ) . equals ( colorSpace ) ) { compB = b . getComponents ( null ) ; } else { compB = b . getComponents ( colorSpace , null ) ; } float [ ] compMixed = new float [ compA . length ] ; for ( int i = 0 ; i < compA . length ; i ++ ) { float left , right ; left = compA [ i ] ; InterpolationDirection dir = i < interpolationDirection . length ? interpolationDirection [ i ] : InterpolationDirection . INNER ; switch ( dir ) { case INNER : right = compB [ i ] ; break ; case OUTER : if ( compA [ i ] < compB [ i ] ) { right = compB [ i ] - 1 ; } else { right = compB [ i ] + 1 ; } break ; case UPPER : if ( compA [ i ] < compB [ i ] ) { right = compB [ i ] ; } else { right = compB [ i ] + 1 ; } break ; case LOWER : if ( compA [ i ] < compB [ i ] ) { right = compB [ i ] - 1 ; } else { right = compB [ i ] ; } break ; default : throw new IllegalStateException ( "Unkown interpolation Direction " + interpolationDirection [ i ] ) ; } compMixed [ i ] = mixing * left + ( 1 - mixing ) * right ; if ( dir != InterpolationDirection . INNER ) { if ( compMixed [ i ] < 0 ) compMixed [ i ] += 1f ; if ( compMixed [ i ] > 1 ) compMixed [ i ] -= 1f ; } } return new Color ( colorSpace , compMixed , compMixed [ compMixed . length - 1 ] ) ; }
Interpolates to a color between a and b
24,389
public void setColorSpace ( ColorSpace colorSpace , InterpolationDirection [ ] dir ) { if ( dir . length < colorSpace . getNumComponents ( ) ) { throw new IllegalArgumentException ( "Must specify an interpolation " + "direction for each colorspace component (" + colorSpace . getNumComponents ( ) + ")" ) ; } this . colorSpace = colorSpace ; this . interpolationDirection = dir ; }
Sets the ColorSpace to use for interpolation .
24,390
static public LinkedHashMap < String , FeatureList > buildFeatureAtrributeIndex ( String attribute , FeatureList list ) { LinkedHashMap < String , FeatureList > featureHashMap = new LinkedHashMap < String , FeatureList > ( ) ; FeatureList featureList = list . selectByAttribute ( attribute ) ; for ( FeatureI feature : featureList ) { String value = feature . getAttribute ( attribute ) ; FeatureList features = featureHashMap . get ( value ) ; if ( features == null ) { features = new FeatureList ( ) ; featureHashMap . put ( value , features ) ; } features . add ( feature ) ; } return featureHashMap ; }
Build a list of individual features to allow easy indexing and to avoid iterating through large genome gff3 files The index for the returned HashMap is the value of the attribute used to build the index
24,391
public List < EcodDomain > filterByHierarchy ( String hierarchy ) throws IOException { String [ ] xhtGroup = hierarchy . split ( "\\." ) ; Integer xGroup = xhtGroup . length > 0 ? Integer . parseInt ( xhtGroup [ 0 ] ) : null ; Integer hGroup = xhtGroup . length > 1 ? Integer . parseInt ( xhtGroup [ 1 ] ) : null ; Integer tGroup = xhtGroup . length > 2 ? Integer . parseInt ( xhtGroup [ 2 ] ) : null ; List < EcodDomain > filtered = new ArrayList < EcodDomain > ( ) ; for ( EcodDomain d : getAllDomains ( ) ) { boolean match = true ; if ( xhtGroup . length > 0 ) { match = match && xGroup . equals ( d . getXGroup ( ) ) ; } if ( xhtGroup . length > 1 ) { match = match && hGroup . equals ( d . getHGroup ( ) ) ; } if ( xhtGroup . length > 2 ) { match = match && tGroup . equals ( d . getTGroup ( ) ) ; } if ( xhtGroup . length > 3 ) { logger . warn ( "Ignoring unexpected additional parts of ECOD {}" , hierarchy ) ; } if ( match ) { filtered . add ( d ) ; } } return filtered ; }
Get a list of domains within a particular level of the hierarchy
24,392
public List < EcodDomain > getAllDomains ( ) throws IOException { domainsFileLock . readLock ( ) . lock ( ) ; logger . trace ( "LOCK readlock" ) ; try { while ( allDomains == null ) { logger . trace ( "UNLOCK readlock" ) ; domainsFileLock . readLock ( ) . unlock ( ) ; ensureDomainsFileInstalled ( ) ; domainsFileLock . readLock ( ) . lock ( ) ; logger . trace ( "LOCK readlock" ) ; } return allDomains ; } finally { logger . trace ( "UNLOCK readlock" ) ; domainsFileLock . readLock ( ) . unlock ( ) ; } }
Get all ECOD domains
24,393
public void clear ( ) { domainsFileLock . writeLock ( ) . lock ( ) ; logger . trace ( "LOCK writelock" ) ; allDomains = null ; domainMap = null ; logger . trace ( "UNLOCK writelock" ) ; domainsFileLock . writeLock ( ) . unlock ( ) ; }
Clears all domains requiring the file to be reparsed for subsequent accesses
24,394
public void setCacheLocation ( String cacheLocation ) { if ( cacheLocation . equals ( this . cacheLocation ) ) { return ; } domainsFileLock . writeLock ( ) . lock ( ) ; logger . trace ( "LOCK writelock" ) ; this . cacheLocation = cacheLocation ; logger . trace ( "UNLOCK writelock" ) ; domainsFileLock . writeLock ( ) . unlock ( ) ; }
Set an alternate download location for files
24,395
private boolean domainsAvailable ( ) { domainsFileLock . readLock ( ) . lock ( ) ; logger . trace ( "LOCK readlock" ) ; try { File f = getDomainFile ( ) ; if ( ! f . exists ( ) || f . length ( ) <= 0 ) return false ; if ( updateFrequency != null && requestedVersion == DEFAULT_VERSION ) { long mod = f . lastModified ( ) ; Date lastUpdate = new Date ( ) ; Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( lastUpdate ) ; cal . add ( Calendar . DAY_OF_WEEK , - updateFrequency ) ; long updateTime = cal . getTimeInMillis ( ) ; if ( mod < updateTime ) { logger . info ( "{} is out of date." , f ) ; return false ; } } return true ; } finally { logger . trace ( "UNLOCK readlock" ) ; domainsFileLock . readLock ( ) . unlock ( ) ; } }
Checks that the domains file has been downloaded
24,396
private void downloadDomains ( ) throws IOException { domainsFileLock . writeLock ( ) . lock ( ) ; logger . trace ( "LOCK writelock" ) ; try { URL domainsURL = new URL ( url + DOMAINS_PATH + getDomainFilename ( ) ) ; File localFile = getDomainFile ( ) ; logger . info ( "Downloading {} to: {}" , domainsURL , localFile ) ; FileDownloadUtils . downloadFile ( domainsURL , localFile ) ; } catch ( MalformedURLException e ) { logger . error ( "Malformed url: " + url + DOMAINS_PATH + getDomainFilename ( ) , e ) ; } finally { logger . trace ( "UNLOCK writelock" ) ; domainsFileLock . writeLock ( ) . unlock ( ) ; } }
Downloads the domains file overwriting any existing file
24,397
private void parseDomains ( ) throws IOException { domainsFileLock . writeLock ( ) . lock ( ) ; logger . trace ( "LOCK writelock" ) ; try { EcodParser parser = new EcodParser ( getDomainFile ( ) ) ; allDomains = parser . getDomains ( ) ; parsedVersion = parser . getVersion ( ) ; } finally { logger . trace ( "UNLOCK writelock" ) ; domainsFileLock . writeLock ( ) . unlock ( ) ; } }
Parses the domains from the local file
24,398
private void indexDomains ( ) throws IOException { domainsFileLock . writeLock ( ) . lock ( ) ; logger . trace ( "LOCK writelock" ) ; try { if ( allDomains == null ) { ensureDomainsFileInstalled ( ) ; } domainMap = new HashMap < String , List < EcodDomain > > ( ( int ) ( 150000 / .85 ) , .85f ) ; for ( EcodDomain d : allDomains ) { String pdbId = d . getPdbId ( ) ; if ( pdbId == null ) { String ecodId = d . getDomainId ( ) ; if ( ecodId != null && ! ecodId . isEmpty ( ) ) { Matcher match = ECOD_RE . matcher ( ecodId ) ; pdbId = match . group ( 1 ) ; } } List < EcodDomain > currDomains ; if ( domainMap . containsKey ( pdbId ) ) { currDomains = domainMap . get ( pdbId ) ; } else { currDomains = new LinkedList < EcodDomain > ( ) ; domainMap . put ( pdbId , currDomains ) ; } currDomains . add ( d ) ; } } finally { logger . trace ( "UNLOCK writelock" ) ; domainsFileLock . writeLock ( ) . unlock ( ) ; } }
Populates domainMap from allDomains
24,399
private void runDbSearch ( AtomCache cache , String searchFile , String outputFile , int useNrCPUs , StartupParameters params ) throws ConfigurationException { System . out . println ( "will use " + useNrCPUs + " CPUs." ) ; PDBFileReader reader = new PDBFileReader ( ) ; Structure structure1 = null ; try { structure1 = reader . getStructure ( searchFile ) ; } catch ( IOException e ) { throw new ConfigurationException ( "could not parse as PDB file: " + searchFile ) ; } File searchF = new File ( searchFile ) ; String name1 = "CUSTOM" ; StructureAlignment algorithm = getAlgorithm ( ) ; MultiThreadedDBSearch dbSearch = new MultiThreadedDBSearch ( name1 , structure1 , outputFile , algorithm , useNrCPUs , params . isDomainSplit ( ) ) ; dbSearch . setCustomFile1 ( searchF . getAbsolutePath ( ) ) ; dbSearch . run ( ) ; }
Do a DB search with the input file against representative PDB domains