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 ...
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 ...
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 ( minCP...
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 = ...
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 ...
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 = M...
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 ( asym...
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 =...
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 { thr...
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 I...
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 + timePe...
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 + ...
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...
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 ( ) ; ...
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 . getModelNumber...
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 < Intege...
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 || btransfor...
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 . clos...
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...
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 ( ...
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 si...
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 ) ) { ...
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 ) )...
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 . getBioBeg...
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 . v...
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 Ar...
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 = ch...
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 > mat...
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 ...
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:" ...
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 ( ScopCategor...
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 = "" ...
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 FileO...
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 ) { addToZipFileS...
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 ( Po...
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 < l...
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 = AlignmentT...
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 . len...
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 . c...
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 . symbolTab...
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 = detect...
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 ) ; }...
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 coor...
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 ...
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 ( )...
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 ] [ ...
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 ; }...
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 ) { as...
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...
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 ( ...
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 ] : ...
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 . rea...
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 ; dRe...
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 fa...
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 ( ) ...
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 . getCompone...
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 . colo...
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 : f...
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 ; Integ...
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 . ...
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 ( ) . ...
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 ( )...
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 )...
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 wri...
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 : a...
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 = ...
Do a DB search with the input file against representative PDB domains