idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
24,100
public Structure getDomain ( String pdpDomainName , AtomCache cache ) throws IOException , StructureException { return cache . getStructure ( getPDPDomain ( pdpDomainName ) ) ; }
Get the structure for a particular PDP domain
24,101
public PDPDomain getPDPDomain ( String pdpDomainName ) throws IOException { SortedSet < String > domainRanges = null ; if ( serializedCache != null ) { if ( serializedCache . containsKey ( pdpDomainName ) ) { domainRanges = serializedCache . get ( pdpDomainName ) ; } } boolean shouldRequestDomainRanges = checkDomainRan...
Get a StructureIdentifier representing the specified PDP domain .
24,102
private boolean checkDomainRanges ( SortedSet < String > domainRanges ) { if ( ( domainRanges == null ) || ( domainRanges . size ( ) == 0 ) ) { return true ; } for ( String d : domainRanges ) { if ( ( d != null ) && ( d . length ( ) > 0 ) ) { return false ; } } return true ; }
returns true if client should fetch domain definitions from server
24,103
public SortedSet < String > getPDPDomainNamesForPDB ( String pdbId ) throws IOException { SortedSet < String > results = null ; try { URL u = new URL ( server + "getPDPDomainNamesForPDB?pdbId=" + pdbId ) ; logger . info ( "Fetching {}" , u ) ; InputStream response = URLConnectionTools . getInputStream ( u ) ; String xm...
Get a list of all PDP domains for a given PDB entry
24,104
public static void blockInfo ( AFPChain afpChain ) { int i , j , k , a , n ; int blockNum = afpChain . getBlockNum ( ) ; int [ ] blockSize = afpChain . getBlockSize ( ) ; int [ ] afpChainList = afpChain . getAfpChainList ( ) ; int [ ] block2Afp = afpChain . getBlock2Afp ( ) ; int [ ] [ ] [ ] blockResList = afpChain . g...
get the afp list and residue list for each block
24,105
public static void updateScore ( FatCatParameters params , AFPChain afpChain ) { int i , j , bknow , bkold , g1 , g2 ; afpChain . setConn ( 0d ) ; afpChain . setDVar ( 0d ) ; int blockNum = afpChain . getBlockNum ( ) ; int alignScoreUpdate = 0 ; double [ ] blockScore = afpChain . getBlockScore ( ) ; int [ ] blockGap = ...
to update the chaining score after block delete and merge processed the blockScore value is important for significance evaluation
24,106
public static CeSymmResult analyze ( Atom [ ] atoms ) throws StructureException { CESymmParameters params = new CESymmParameters ( ) ; return analyze ( atoms , params ) ; }
Analyze the symmetries of the input Atom array using the DEFAULT parameters .
24,107
public static CeSymmResult analyze ( Atom [ ] atoms , CESymmParameters params ) throws StructureException { if ( atoms . length < 1 ) throw new IllegalArgumentException ( "Empty Atom array given." ) ; if ( params . getSSEThreshold ( ) > 0 ) { Structure s = atoms [ 0 ] . getGroup ( ) . getChain ( ) . getStructure ( ) ; ...
Analyze the symmetries of the input Atom array using the provided parameters .
24,108
public static CeSymmResult analyzeLevel ( Atom [ ] atoms , CESymmParameters params ) throws StructureException { if ( atoms . length < 1 ) throw new IllegalArgumentException ( "Empty Atom array given." ) ; CeSymmResult result = align ( atoms , params ) ; if ( result . isRefined ( ) ) { if ( result . getParams ( ) . get...
Analyze a single level of symmetry .
24,109
public int getLength ( int positionA , int positionB , String startingChain ) { int positionStart , positionEnd ; if ( positionA <= positionB ) { positionStart = positionA ; positionEnd = positionB ; } else { positionStart = positionB ; positionEnd = positionA ; } int count = 0 ; for ( Map . Entry < ResidueNumber , Int...
Calculates the number of residues of the specified chain in a given range inclusive .
24,110
public int getLengthDirectional ( int positionStart , int positionEnd , String startingChain ) { int count = getLength ( positionStart , positionEnd , startingChain ) ; if ( positionStart <= positionEnd ) { return count ; } else { return - count ; } }
Calculates the number of residues of the specified chain in a given range . Will return a negative value if the start is past the end .
24,111
public int getLength ( ResidueNumber start , ResidueNumber end ) { if ( ! start . getChainName ( ) . equals ( end . getChainName ( ) ) ) { throw new IllegalArgumentException ( String . format ( "Chains differ between %s and %s. Unable to calculate length." , start , end ) ) ; } Integer startPos = getPosition ( start ) ...
Calculates the number of atoms between two ResidueNumbers inclusive . Both residues must belong to the same chain .
24,112
public ResidueRangeAndLength trimToValidResidues ( ResidueRange rr ) { ResidueNumber start = rr . getStart ( ) ; ResidueNumber end = rr . getEnd ( ) ; String chain = rr . getChainName ( ) ; if ( start . getChainName ( ) == null ) { start = new ResidueNumber ( chain , start . getSeqNum ( ) , start . getInsCode ( ) ) ; }...
Trims a residue range so that both endpoints are contained in this map .
24,113
public static Atom [ ] findNearestAtomLinkage ( final Group group1 , final Group group2 , List < String > potentialNamesOfAtomOnGroup1 , List < String > potentialNamesOfAtomOnGroup2 , final boolean ignoreNCLinkage , double bondLengthTolerance ) { List < Atom [ ] > linkages = findAtomLinkages ( group1 , group2 , potenti...
Find a linkage between two groups within tolerance of bond length from potential atoms .
24,114
public static Atom [ ] findLinkage ( final Group group1 , final Group group2 , String nameOfAtomOnGroup1 , String nameOfAtomOnGroup2 , double bondLengthTolerance ) { Atom [ ] ret = new Atom [ 2 ] ; ret [ 0 ] = group1 . getAtom ( nameOfAtomOnGroup1 ) ; ret [ 1 ] = group2 . getAtom ( nameOfAtomOnGroup2 ) ; if ( ret [ 0 ]...
Find a linkage between two groups within tolerance of bond length .
24,115
public static List < Group > getAminoAcids ( Chain chain ) { List < Group > gs = new ArrayList < > ( ) ; for ( Group g : chain . getAtomGroups ( ) ) { if ( g . isAminoAcid ( ) ) gs . add ( g ) ; } return gs ; }
Get all amino acids in a chain .
24,116
public boolean isCrystallographic ( ) { if ( pdbHeader . getExperimentalTechniques ( ) != null ) { return ExperimentalTechnique . isCrystallographic ( pdbHeader . getExperimentalTechniques ( ) ) ; } else { if ( pdbHeader . getCrystallographicInfo ( ) . getSpaceGroup ( ) != null ) { return pdbHeader . getCrystallographi...
Whether this Structure is a crystallographic structure or not . It will first check the experimental technique and if not present it will try to guess from the presence of a space group and sensible cell parameters
24,117
public boolean isNmr ( ) { if ( pdbHeader . getExperimentalTechniques ( ) != null ) { return ExperimentalTechnique . isNmr ( pdbHeader . getExperimentalTechniques ( ) ) ; } else { if ( nrModels ( ) > 1 ) { if ( pdbHeader . getCrystallographicInfo ( ) . getSpaceGroup ( ) != null ) { if ( pdbHeader . getCrystallographicI...
Whether this Structure is a NMR structure or not . It will first check the experimental technique and if not present it will try to guess from the presence of more than 1 model and from b - factors being 0 in first chain of first model
24,118
private SubstructureIdentifier toCanonical ( ) { StructureIdentifier real = getStructureIdentifier ( ) ; if ( real != null ) { try { return real . toCanonical ( ) ; } catch ( StructureException e ) { } } List < ResidueRange > range = new ArrayList < > ( ) ; for ( Chain chain : getChains ( ) ) { List < Group > groups = ...
Creates a SubstructureIdentifier based on the residues in this Structure .
24,119
private Dimension layoutSize ( Container target , boolean preferred ) { synchronized ( target . getTreeLock ( ) ) { int targetWidth = target . getSize ( ) . width ; Container container = target ; while ( container . getSize ( ) . width == 0 && container . getParent ( ) != null ) { container = container . getParent ( ) ...
Returns the minimum or preferred dimension needed to layout the target container .
24,120
public void setKaplanMeierFigure ( KaplanMeierFigure kmf ) { this . kmf = kmf ; int numRows = kmf . getSurvivalFitInfo ( ) . getStrataInfoHashMap ( ) . size ( ) ; int height = ( numRows + 1 ) * getFontMetrics ( getFont ( ) ) . getHeight ( ) ; int width = kmf . getWidth ( ) ; setPreferredSize ( new Dimension ( width , h...
Pick up needed info and details from the KM Figure
24,121
private static boolean isCategorical ( LinkedHashMap < String , Double > values ) { try { for ( String value : values . keySet ( ) ) { Double . parseDouble ( value ) ; } return false ; } catch ( Exception e ) { return true ; } }
If any not numeric value then categorical
24,122
public static void categorizeData ( ArrayList < SurvivalInfo > DataT ) { LinkedHashMap < String , LinkedHashMap < String , Double > > valueMap = new LinkedHashMap < String , LinkedHashMap < String , Double > > ( ) ; for ( SurvivalInfo si : DataT ) { for ( String key : si . unknownDataType . keySet ( ) ) { LinkedHashMap...
Take a collection of categorical data and convert it to numeric to be used in cox calculations
24,123
public static ArrayList < String > addInteraction ( String variable1 , String variable2 , ArrayList < SurvivalInfo > survivalInfoList ) { ArrayList < String > variables = new ArrayList < String > ( ) ; variables . add ( variable1 ) ; variables . add ( variable2 ) ; variables . add ( variable1 + ":" + variable2 ) ; for ...
To test for interactions use two variables and create a third variable where the two are multiplied together .
24,124
public static void groupByRange ( double [ ] range , String variable , String groupName , ArrayList < SurvivalInfo > survivalInfoList ) throws Exception { ArrayList < String > labels = new ArrayList < String > ( ) ; for ( int i = 0 ; i < range . length ; i ++ ) { String label = "" ; if ( i == 0 ) { label = "[<=" + rang...
Need to allow a range of values similar to cut in R and a continuous c
24,125
public static Matrix grayOutCEOrig ( Atom [ ] ca2 , int rows , int cols , CECalculator calculator , Matrix origM , int blankWindowSize , double [ ] gradientPolyCoeff , double gradientExpCoeff ) { if ( origM == null ) { origM = new Matrix ( calculator . getMatMatrix ( ) ) ; } for ( int i = 0 ; i < rows ; i ++ ) { for ( ...
Grays out the main diagonal of a duplicated distance matrix .
24,126
public static List < List < Integer > > buildSymmetryGraph ( List < AFPChain > afps , Atom [ ] atoms , boolean undirected ) { List < List < Integer > > graph = new ArrayList < List < Integer > > ( ) ; for ( int n = 0 ; n < atoms . length ; n ++ ) { graph . add ( new ArrayList < Integer > ( ) ) ; } for ( int k = 0 ; k <...
Converts a set of AFP alignments into a Graph of aligned residues where each vertex is a residue and each edge means the connection between the two residues in one of the alignments .
24,127
public static Graph < Integer , DefaultEdge > buildSymmetryGraph ( AFPChain selfAlignment ) { Graph < Integer , DefaultEdge > graph = new SimpleGraph < Integer , DefaultEdge > ( DefaultEdge . class ) ; for ( int i = 0 ; i < selfAlignment . getOptAln ( ) . length ; i ++ ) { for ( int j = 0 ; j < selfAlignment . getOptAl...
Converts a self alignment into a directed jGraphT of aligned residues where each vertex is a residue and each edge means the equivalence between the two residues in the self - alignment .
24,128
public static List < Structure > divideStructure ( CeSymmResult symmetry ) throws StructureException { if ( ! symmetry . isRefined ( ) ) throw new IllegalArgumentException ( "The symmetry result " + "is not refined, repeats cannot be defined" ) ; int order = symmetry . getMultipleAlignment ( ) . size ( ) ; Atom [ ] ato...
Method that converts the symmetric units of a structure into different structures so that they can be individually visualized .
24,129
public static MultipleAlignment fromAFP ( AFPChain symm , Atom [ ] atoms ) throws StructureException { if ( ! symm . getAlgorithmName ( ) . contains ( "symm" ) ) { throw new IllegalArgumentException ( "The input alignment is not a symmetry alignment." ) ; } MultipleAlignmentEnsemble e = new MultipleAlignmentEnsembleImp...
Converts a refined symmetry AFPChain alignment into the standard representation of symmetry in a MultipleAlignment that contains the entire Atom array of the strcuture and the symmetric repeats are orgaized in different rows in a single Block .
24,130
public static Atom [ ] getRepresentativeAtoms ( Structure structure ) { if ( structure . isNmr ( ) ) return StructureTools . getRepresentativeAtomArray ( structure ) ; else { List < Atom > atomList = new ArrayList < Atom > ( ) ; for ( int m = 0 ; m < structure . nrModels ( ) ; m ++ ) { for ( Chain c : structure . getMo...
Returns the representative Atom Array of the first model if the structure is NMR or the Array for each model if it is a biological assembly with multiple models .
24,131
public static Alignable align_NPE ( Matrix sim , StrucAligParameters params ) { float gapOpen = params . getGapOpen ( ) ; float gapExtension = params . getGapExtension ( ) ; int rows = sim . getRowDimension ( ) ; int cols = sim . getColumnDimension ( ) ; Alignable al = new StrCompAlignment ( rows , cols ) ; al . setGap...
Align without penalizing end - gaps . Return alignment and score
24,132
public static void calculateScores ( MultipleAlignment alignment ) throws StructureException { List < Atom [ ] > trans = MultipleAlignmentTools . transformAtoms ( alignment ) ; alignment . putScore ( RMSD , getRMSD ( trans ) ) ; List < Integer > lengths = new ArrayList < Integer > ( alignment . size ( ) ) ; for ( Atom ...
Calculates and puts the RMSD and the average TM - Score of the MultipleAlignment .
24,133
public Ontology parse ( BufferedReader in , OntologyFactory of ) throws IOException , OntologyException { String name = "" ; String description = "" ; Ontology onto = null ; for ( String line = in . readLine ( ) ; line != null ; line = in . readLine ( ) ) { line = line . trim ( ) ; if ( line . length ( ) > 0 ) { if ( l...
Parse an ontology from a reader . The reader will be emptied of text . It is the caller s responsibility to close the reader .
24,134
public static AFPChain fromXML ( String xml , String name1 , String name2 , Atom [ ] ca1 , Atom [ ] ca2 ) throws IOException , StructureException { AFPChain [ ] afps = parseMultiXML ( xml ) ; if ( afps . length > 0 ) { AFPChain afpChain = afps [ 0 ] ; String n1 = afpChain . getName1 ( ) ; String n2 = afpChain . getName...
new utility method that checks that the order of the pair in the XML alignment is correct and flips the direction if needed
24,135
public static String flipAlignment ( String xml ) throws IOException , StructureException { AFPChain [ ] afps = parseMultiXML ( xml ) ; if ( afps . length < 1 ) return null ; if ( afps . length == 1 ) { AFPChain newChain = AFPChainFlipper . flipChain ( afps [ 0 ] ) ; if ( newChain . getAlgorithmName ( ) == null ) { new...
Takes an XML representation of the alignment and flips the positions of name1 and name2
24,136
private static int getPositionForPDBresunm ( String pdbresnum , String authId , Atom [ ] atoms ) { ResidueNumber residueNumber = ResidueNumber . fromString ( pdbresnum ) ; residueNumber . setChainName ( authId ) ; boolean blankChain = authId == null || authId . equalsIgnoreCase ( "null" ) || authId . equals ( "_" ) ; f...
get the position of PDB residue nr X in the ato marray
24,137
public List < Matrix4d > getTransformations ( ) { List < Matrix4d > transfs = new ArrayList < Matrix4d > ( ) ; for ( int i = 1 ; i < this . transformations . size ( ) ; i ++ ) { transfs . add ( transformations . get ( i ) ) ; } return transfs ; }
Gets all transformations except for the identity in crystal axes basis .
24,138
private static Group [ ] rChainAfp ( FatCatParameters params , AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) throws StructureException { params . setMaxTra ( 0 ) ; afpChain . setMaxTra ( 0 ) ; return chainAfp ( params , afpChain , ca1 , ca2 ) ; }
runs rigid chaining process
24,139
private static Group [ ] chainAfp ( FatCatParameters params , AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) throws StructureException { Atom [ ] ca2clone = StructureTools . cloneAtomArray ( ca2 ) ; List < AFP > afpSet = afpChain . getAfpSet ( ) ; if ( debug ) System . out . println ( "entering chainAfp" ) ; int afp...
run AFP chaining allowing up to maxTra flexible regions . Input is original coordinates .
24,140
public void process ( ) throws Exception { PrintWriter writer = new PrintWriter ( os ) ; for ( S sequence : sequences ) { String header = headerFormat . getHeader ( sequence ) ; writer . format ( header ) ; writer . println ( ) ; String data = sequence . getSequenceAsString ( ) . toLowerCase ( ) ; int seq_len = data . ...
Allow an override of operating system line separator for programs that needs a specific CRLF or CR or LF option
24,141
public Set < String > getOutputOptions ( ) { Set < String > result = new HashSet < String > ( ) ; for ( BlastOutputParameterEnum parameter : param . keySet ( ) ) { result . add ( parameter . name ( ) ) ; } return result ; }
Gets output parameters which are currently set
24,142
public Chain getCurrentChain ( ) { if ( current_model_pos >= structure . nrModels ( ) ) { return null ; } List < Chain > model = structure . getModel ( current_model_pos ) ; if ( current_chain_pos >= model . size ( ) ) { return null ; } return model . get ( current_chain_pos ) ; }
Get the current Chain . Returns null if we are at the end of the iteration .
24,143
public final static double roundToDecimals ( double d , int c ) { if ( c < 0 ) return d ; double p = Math . pow ( 10 , c ) ; d = d * p ; double tmp = Math . round ( d ) ; return tmp / p ; }
Returns a value with the desired number of decimal places .
24,144
public final static boolean doesSequenceContainInvalidChar ( String sequence , Set < Character > cSet ) { for ( char c : sequence . toCharArray ( ) ) { if ( ! cSet . contains ( c ) ) return true ; } return false ; }
Checks if given sequence contains invalid characters . Returns true if invalid characters are found else return false . Note that any characters are deemed as valid only if it is found in cSet .
24,145
public final static int getNumberOfInvalidChar ( String sequence , Set < Character > cSet , boolean ignoreCase ) { int total = 0 ; char [ ] cArray ; if ( ignoreCase ) cArray = sequence . toUpperCase ( ) . toCharArray ( ) ; else cArray = sequence . toCharArray ( ) ; if ( cSet == null ) cSet = PeptideProperties . standar...
Return the number of invalid characters in sequence .
24,146
public final static String cleanSequence ( String sequence , Set < Character > cSet ) { Set < Character > invalidCharSet = new HashSet < Character > ( ) ; StringBuilder cleanSeq = new StringBuilder ( ) ; if ( cSet == null ) cSet = PeptideProperties . standardAASet ; for ( char c : sequence . toCharArray ( ) ) { if ( ! ...
Returns a new sequence with all invalid characters being replaced by - . Note that any character outside of the 20 standard protein amino acid codes are considered as invalid .
24,147
public static final String checkSequence ( String sequence , Set < Character > cSet ) { boolean containInvalid = false ; if ( cSet != null ) { containInvalid = sequence != null && doesSequenceContainInvalidChar ( sequence , cSet ) ; } else { containInvalid = sequence != null && doesSequenceContainInvalidChar ( sequence...
Checks if the sequence contains invalid characters . Note that any character outside of the 20 standard protein amino acid codes are considered as invalid . If yes it will return a new sequence where invalid characters are replaced with - . If no it will simply return the input sequence .
24,148
public static LinkedHashMap < String , ProteinSequence > readFastaProteinSequence ( File file ) throws IOException { FileInputStream inStream = new FileInputStream ( file ) ; LinkedHashMap < String , ProteinSequence > proteinSequences = readFastaProteinSequence ( inStream ) ; inStream . close ( ) ; return proteinSequen...
Read a fasta file containing amino acids with setup that would handle most cases .
24,149
public static LinkedHashMap < String , ProteinSequence > readFastaProteinSequence ( InputStream inStream ) throws IOException { FastaReader < ProteinSequence , AminoAcidCompound > fastaReader = new FastaReader < ProteinSequence , AminoAcidCompound > ( inStream , new GenericFastaHeaderParser < ProteinSequence , AminoAci...
Read a fasta file containing amino acids with setup that would handle most cases . User is responsible for closing InputStream because you opened it
24,150
public static LinkedHashMap < String , DNASequence > readFastaDNASequence ( InputStream inStream ) throws IOException { FastaReader < DNASequence , NucleotideCompound > fastaReader = new FastaReader < DNASequence , NucleotideCompound > ( inStream , new GenericFastaHeaderParser < DNASequence , NucleotideCompound > ( ) ,...
Read a fasta DNA sequence
24,151
public static LinkedHashMap < String , RNASequence > readFastaRNASequence ( InputStream inStream ) throws IOException { FastaReader < RNASequence , NucleotideCompound > fastaReader = new FastaReader < RNASequence , NucleotideCompound > ( inStream , new GenericFastaHeaderParser < RNASequence , NucleotideCompound > ( ) ,...
Read a fasta RNA sequence
24,152
public static void setThreadPoolCPUsFraction ( float fraction ) { setThreadPoolSize ( Math . max ( 1 , Math . round ( fraction * Runtime . getRuntime ( ) . availableProcessors ( ) ) ) ) ; }
Sets thread pool to a given fraction of the available processors .
24,153
public static void setThreadPoolSize ( int threads ) { setThreadPool ( new ThreadPoolExecutor ( threads , threads , 0L , TimeUnit . MILLISECONDS , new LinkedBlockingQueue < Runnable > ( ) ) ) ; }
Sets thread pool to given size .
24,154
public static void shutdownAndAwaitTermination ( ) { shutdown ( ) ; if ( pool != null ) { try { if ( ! pool . awaitTermination ( 60L , TimeUnit . SECONDS ) ) { pool . shutdownNow ( ) ; if ( ! pool . awaitTermination ( 60L , TimeUnit . SECONDS ) ) { logger . warn ( "BioJava ConcurrencyTools thread pool did not terminate...
Closes the thread pool . Waits 1 minute for a clean exit ; if necessary waits another minute for cancellation .
24,155
public static < T > Future < T > submit ( Callable < T > task , String message ) { logger . debug ( "Task " + ( ++ tasks ) + " submitted to shared thread pool. " + message ) ; return getThreadPool ( ) . submit ( task ) ; }
Queues up a task and adds a log entry .
24,156
public void process ( String uniprotDatFileName , String fastaFileName ) throws Exception { FileReader fr = new FileReader ( uniprotDatFileName ) ; BufferedReader br = new BufferedReader ( fr ) ; String line = br . readLine ( ) ; String id = "" ; StringBuffer sequence = new StringBuffer ( ) ; ArrayList < ProteinSequenc...
Convert a Uniprot sequence file to a fasta file . Allows you to download all sequence data for a species and convert to fasta to be used in a blast database
24,157
public boolean hasNext ( ) { if ( group == null ) return false ; if ( current_atom_pos < group . size ( ) - 1 ) { return true ; } else { if ( groupiter != null ) { GroupIterator tmp = ( GroupIterator ) groupiter . clone ( ) ; while ( tmp . hasNext ( ) ) { Group tmpg = tmp . next ( ) ; if ( tmpg . size ( ) > 0 ) { retur...
Is there a next atom ?
24,158
public Atom next ( ) throws NoSuchElementException { current_atom_pos ++ ; if ( current_atom_pos >= group . size ( ) ) { if ( groupiter == null ) { throw new NoSuchElementException ( "no more atoms found in group!" ) ; } if ( groupiter . hasNext ( ) ) { group = groupiter . next ( ) ; current_atom_pos = - 1 ; return nex...
Return next atom .
24,159
private static ProteinSequence getUniprot ( String uniProtID ) throws Exception { AminoAcidCompoundSet set = AminoAcidCompoundSet . getAminoAcidCompoundSet ( ) ; UniprotProxySequenceReader < AminoAcidCompound > uniprotSequence = new UniprotProxySequenceReader < AminoAcidCompound > ( uniProtID , set ) ; ProteinSequence ...
Fetch a protein sequence from the UniProt web site
24,160
public static boolean equalLengthSequences ( ProteinSequence [ ] sequences ) { for ( int i = 0 ; i < sequences . length - 1 ; i ++ ) { if ( sequences [ i ] == null ) continue ; for ( int j = i + 1 ; j < sequences . length ; j ++ ) { if ( sequences [ j ] == null ) continue ; if ( sequences [ i ] . getLength ( ) == seque...
A method to check whether an array of sequences contains at least two sequences having an equal length .
24,161
private void readResults ( ) throws IOException , ParseException { factory . setFile ( file ) ; results = factory . createObjects ( evalueThreshold ) ; }
This method is declared private because it is the default action of constructor when file exists
24,162
public static String formatExonStructure ( GeneChromosomePosition chromosomePosition ) { if ( chromosomePosition . getOrientation ( ) == '+' ) return formatExonStructureForward ( chromosomePosition ) ; return formatExonStructureReverse ( chromosomePosition ) ; }
Pretty print the details of a GeneChromosomePosition to a String
24,163
public static int getCDSLength ( GeneChromosomePosition chromPos ) { List < Integer > exonStarts = chromPos . getExonStarts ( ) ; List < Integer > exonEnds = chromPos . getExonEnds ( ) ; int cdsStart = chromPos . getCdsStart ( ) ; int cdsEnd = chromPos . getCdsEnd ( ) ; int codingLength ; if ( chromPos . getOrientation...
Get the length of the CDS in nucleotides .
24,164
public static ChromPos getChromosomePosForCDScoordinate ( int cdsNucleotidePosition , GeneChromosomePosition chromPos ) { logger . debug ( " ? Checking chromosome position for CDS position " + cdsNucleotidePosition ) ; List < Integer > exonStarts = chromPos . getExonStarts ( ) ; List < Integer > exonEnds = chromPos . g...
Maps the position of a CDS nucleotide back to the genome
24,165
public static List < Range < Integer > > getChromosomalRangesForCDS ( GeneChromosomePosition chromPos ) { if ( chromPos . getOrientation ( ) == '+' ) return getCDSExonRangesForward ( chromPos , CHROMOSOME ) ; return getCDSExonRangesReverse ( chromPos , CHROMOSOME ) ; }
Extracts the boundaries of the coding regions in chromosomal coordinates
24,166
public static int getCDSPosForChromosomeCoordinate ( int coordinate , GeneChromosomePosition chromosomePosition ) { if ( chromosomePosition . getOrientation ( ) == '+' ) return getCDSPosForward ( coordinate , chromosomePosition . getExonStarts ( ) , chromosomePosition . getExonEnds ( ) , chromosomePosition . getCdsStar...
I have a genomic coordinate where is it on the mRNA
24,167
public static int getCDSPosForward ( int chromPos , List < Integer > exonStarts , List < Integer > exonEnds , int cdsStart , int cdsEnd ) { if ( ( chromPos < ( cdsStart + base ) ) || ( chromPos > ( cdsEnd + base ) ) ) { logger . debug ( "The " + format ( chromPos ) + " position is not in a coding region" ) ; return - 1...
Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the forward DNA strand .
24,168
public static int getCDSPosReverse ( int chromPos , List < Integer > exonStarts , List < Integer > exonEnds , int cdsStart , int cdsEnd ) { if ( ( chromPos < ( cdsStart + base ) ) || ( chromPos > ( cdsEnd + base ) ) ) { logger . debug ( "The " + format ( chromPos ) + " position is not in a coding region" ) ; return - 1...
Converts the genetic coordinate to the position of the nucleotide on the mRNA sequence for a gene living on the reverse DNA strand .
24,169
public static List < Range < Integer > > getCDSRegions ( List < Integer > origExonStarts , List < Integer > origExonEnds , int cdsStart , int cdsEnd ) { List < Integer > exonStarts = new ArrayList < Integer > ( origExonStarts ) ; List < Integer > exonEnds = new ArrayList < Integer > ( origExonEnds ) ; int j = 0 ; for (...
Extracts the exons boundaries in CDS coordinates corresponding to the forward DNA strand .
24,170
private int resetbuf ( int bit_pos ) { int pos = bit_pos >> 3 ; System . arraycopy ( data , pos , data , 0 , end - pos ) ; end -= pos ; return 0 ; }
Moves the unread data in the buffer to the beginning and resets the pointers .
24,171
public static CathDatabase getCathDatabase ( String version ) { if ( version == null ) version = DEFAULT_VERSION ; CathDatabase cath = versions . get ( version ) ; if ( cath == null ) { CathInstallation newCath = new CathInstallation ( ) ; newCath . setCathVersion ( version ) ; cath = newCath ; } return cath ; }
Returns a CATH database of the specified version .
24,172
public static QuatSymmetryScores calcScores ( QuatSymmetrySubunits subunits , Matrix4d transformation , List < Integer > permutation ) { QuatSymmetryScores scores = new QuatSymmetryScores ( ) ; double minTm = Double . MAX_VALUE ; double maxTm = Double . MIN_VALUE ; double minRmsd = Double . MAX_VALUE ; double maxRmsd =...
Returns minimum mean and maximum RMSD and TM - Score for two superimposed sets of subunits
24,173
private static double combineRmsd ( int b1 , int b2 , AFPChain afpChain , Atom [ ] ca1 , Atom [ ] ca2 ) { int i ; int afpn = 0 ; int [ ] afpChainList = afpChain . getAfpChainList ( ) ; int [ ] block2Afp = afpChain . getBlock2Afp ( ) ; int [ ] blockSize = afpChain . getBlockSize ( ) ; int [ ] list = new int [ blockSize ...
return the rmsd of two blocks
24,174
private int getSubstitutionScore ( float [ ] qv , float [ ] tv ) { float score = 0.0f ; for ( int q = 0 ; q < qv . length ; q ++ ) { if ( qv [ q ] > 0.0f ) { for ( int t = 0 ; t < tv . length ; t ++ ) { if ( tv [ t ] > 0.0f ) { score += qv [ q ] * tv [ t ] * getSubstitutionMatrix ( ) . getValue ( cslist . get ( q ) , c...
helper method that scores alignment of two column vectors
24,175
private static List < EntityInfo > findUniqueEntities ( TreeMap < String , EntityInfo > chainIds2entities ) { List < EntityInfo > list = new ArrayList < EntityInfo > ( ) ; for ( EntityInfo cluster : chainIds2entities . values ( ) ) { boolean present = false ; for ( EntityInfo cl : list ) { if ( cl == cluster ) { presen...
Utility method to obtain a list of unique entities from the chainIds2entities map
24,176
public static void createPurelyNonPolyEntities ( List < List < Chain > > nonPolyModels , List < List < Chain > > waterModels , List < EntityInfo > entities ) { if ( nonPolyModels . isEmpty ( ) ) return ; int maxMolId = 0 ; if ( ! entities . isEmpty ( ) ) { maxMolId = Collections . max ( entities , new Comparator < Enti...
Given all chains of all models find entities for the nonpolymers and water chains within them assigning entity ids types and descriptions to them . The result is written back to the passed entities List .
24,177
private static ProteinSequence getProteinSequence ( String str ) { try { ProteinSequence s = new ProteinSequence ( str ) ; return s ; } catch ( CompoundNotFoundException e ) { logger . error ( "Unexpected error when creating ProteinSequence" , e ) ; } return null ; }
Returns the ProteinSequence or null if one can t be created
24,178
private static DNASequence getDNASequence ( String str ) { try { DNASequence s = new DNASequence ( str ) ; return s ; } catch ( CompoundNotFoundException e ) { logger . error ( "Unexpected error when creating DNASequence " , e ) ; } return null ; }
Returns the DNASequence or null if one can t be created
24,179
private static RNASequence getRNASequence ( String str ) { try { RNASequence s = new RNASequence ( str ) ; return s ; } catch ( CompoundNotFoundException e ) { logger . error ( "Unexpected error when creating RNASequence " , e ) ; } return null ; }
Returns the RNASequence or null if one can t be created
24,180
private void combineWithTranslation ( Matrix4d rotation ) { rotation . setTranslation ( centroid ) ; rotation . mul ( rotation , centroidInverse ) ; }
Adds translational component to rotation matrix
24,181
public AxisAngle4d getAxisAngle4d ( ) { return new AxisAngle4d ( rotationAxis . getX ( ) , rotationAxis . getY ( ) , rotationAxis . getZ ( ) , theta ) ; }
Returns the rotation axis and angle in a single javax . vecmath . AxisAngle4d object
24,182
public Matrix getRotationMatrix ( double theta ) { if ( rotationAxis == null ) { return Matrix . identity ( 3 , 3 ) ; } double x = rotationAxis . getX ( ) ; double y = rotationAxis . getY ( ) ; double z = rotationAxis . getZ ( ) ; double cos = Math . cos ( theta ) ; double sin = Math . sin ( theta ) ; double com = 1 - ...
Get the rotation matrix corresponding to a rotation about this axis
24,183
private void calculateTranslationalAxis ( Matrix rotation , Atom translation ) { rotationAxis = Calc . scale ( translation , 1. / Calc . amount ( translation ) ) ; rotationPos = null ; screwTranslation = translation ; otherTranslation = new AtomImpl ( ) ; otherTranslation . setCoords ( new double [ ] { 0 , 0 , 0 } ) ; ...
Handle cases with small angles of rotation
24,184
public Atom getProjectedPoint ( Atom point ) { if ( rotationPos == null ) { return null ; } Atom localPoint = Calc . subtract ( point , rotationPos ) ; double dot = Calc . scalarProduct ( localPoint , rotationAxis ) ; Atom localProjected = Calc . scale ( rotationAxis , dot ) ; Atom projected = Calc . add ( localProject...
Projects a given point onto the axis of rotation
24,185
public double getProjectedDistance ( Atom point ) { Atom projected = getProjectedPoint ( point ) ; if ( projected == null ) { return Double . NaN ; } return Calc . getDistance ( point , projected ) ; }
Get the distance from a point to the axis of rotation
24,186
public static double getAngle ( AFPChain afpChain ) throws StructureException { if ( afpChain . getBlockNum ( ) < 1 ) { throw new StructureException ( "No aligned residues" ) ; } Matrix rotation = afpChain . getBlockRotationMatrix ( ) [ 0 ] ; if ( rotation == null ) { throw new NullPointerException ( "AFPChain does not...
Calculate the rotation angle for a structure
24,187
public static double getAngle ( Matrix rotation ) { double c = ( rotation . trace ( ) - 1 ) / 2.0 ; if ( - 1 - 1e-8 < c && c < - 1 ) c = - 1 ; if ( 1 + 1e-8 > c && c > 1 ) c = 1 ; if ( - 1 > c || c > 1 ) { throw new IllegalArgumentException ( "Input matrix is not a valid rotation matrix." ) ; } return Math . acos ( c )...
Calculate the rotation angle for a given matrix
24,188
public static double getAngle ( Matrix4d transform ) { double c = ( transform . m00 + transform . m11 + transform . m22 - 1 ) / 2.0 ; if ( - 1 - 1e-8 < c && c < - 1 ) c = - 1 ; if ( 1 + 1e-8 > c && c > 1 ) c = 1 ; if ( - 1 > c || c > 1 ) { throw new IllegalArgumentException ( "Input matrix is not a valid rotation matri...
Quickly compute the rotation angle from a rotation matrix .
24,189
@ SuppressWarnings ( "unchecked" ) protected void calculateIndirectAmbiguities ( ) { Map < NucleotideCompound , List < NucleotideCompound > > equivalentsMap = new HashMap < NucleotideCompound , List < NucleotideCompound > > ( ) ; List < NucleotideCompound > ambiguousCompounds = new ArrayList < NucleotideCompound > ( ) ...
Loops through all known nucleotides and attempts to find which are equivalent to each other . Also takes into account lower casing nucleotides as well as upper - cased ones .
24,190
public NucleotideCompound getAmbiguity ( NucleotideCompound ... compounds ) { Set < NucleotideCompound > settedCompounds = new HashSet < NucleotideCompound > ( ) ; for ( NucleotideCompound compound : compounds ) { for ( NucleotideCompound subCompound : compound . getConstituents ( ) ) { settedCompounds . add ( getCompo...
Calculates the best symbol for a collection of compounds . For example if you gave this method a AC it will return a M which is the ambiguity symbol for these compounds .
24,191
public static int getBlockNrForAlignPos ( AFPChain afpChain , int aligPos ) { int blockNum = afpChain . getBlockNum ( ) ; int [ ] optLen = afpChain . getOptLen ( ) ; int [ ] [ ] [ ] optAln = afpChain . getOptAln ( ) ; int len = 0 ; int p1b = 0 ; int p2b = 0 ; for ( int i = 0 ; i < blockNum ; i ++ ) { for ( int j = 0 ; ...
get the block number for an aligned position
24,192
public void apairs_from_seed ( int l , int i , int j ) { aligpath = new IndexPair [ l ] ; idx1 = new int [ l ] ; idx2 = new int [ l ] ; for ( int x = 0 ; x < l ; x ++ ) { idx1 [ x ] = i + x ; idx2 [ x ] = j + x ; aligpath [ x ] = new IndexPair ( ( short ) ( i + x ) , ( short ) ( j + x ) ) ; } }
Set apairs according to a seed position .
24,193
private void rotateShiftAtoms ( Atom [ ] ca ) { for ( int i = 0 ; i < ca . length ; i ++ ) { Atom c = ca [ i ] ; Calc . rotate ( c , currentRotMatrix ) ; Calc . shift ( c , currentTranMatrix ) ; ca [ i ] = c ; } }
rotate and shift atoms with currentRotMatrix and current Tranmatrix
24,194
private int count_gaps ( int [ ] i1 , int [ ] i2 ) { int i0 = i1 [ 0 ] ; int j0 = i2 [ 0 ] ; int gaps = 0 ; for ( int i = 1 ; i < i1 . length ; i ++ ) { if ( Math . abs ( i1 [ i ] - i0 ) != 1 || ( Math . abs ( i2 [ i ] - j0 ) != 1 ) ) { gaps += 1 ; } i0 = i1 [ i ] ; j0 = i2 [ i ] ; } return gaps ; }
Count the number of gaps in an alignment represented by idx1 idx2 .
24,195
private void super_pos_alig ( Atom [ ] ca1 , Atom [ ] ca2 , int [ ] idx1 , int [ ] idx2 , boolean getRMS ) throws StructureException { Atom [ ] ca1subset = new Atom [ idx1 . length ] ; Atom [ ] ca2subset = new Atom [ idx2 . length ] ; for ( int i = 0 ; i < idx1 . length ; i ++ ) { int pos1 = idx1 [ i ] ; int pos2 = idx...
Superimposes two molecules according to residue index list idx1 and idx2 . Does not change the original coordinates . as an internal result the rotation matrix and shift vectors for are set
24,196
public Structure getAlignedStructure ( Structure s1 , Structure s2 ) { Structure s3 = s2 . clone ( ) ; currentRotMatrix . print ( 3 , 3 ) ; Calc . rotate ( s3 , currentRotMatrix ) ; Calc . shift ( s3 , currentTranMatrix ) ; Structure newpdb = new StructureImpl ( ) ; newpdb . setPDBCode ( "Java" ) ; newpdb . setName ( "...
create an artifical Structure object that contains the two structures superimposed onto each other . Each structure is in a separate model . Model 1 is structure 1 and Model 2 is structure 2 .
24,197
public String toPDB ( Structure s1 , Structure s2 ) { Structure newpdb = getAlignedStructure ( s1 , s2 ) ; return newpdb . toPDB ( ) ; }
converts the alignment to a PDB file each of the structures will be represented as a model .
24,198
public GeneSequence addGene ( AccessionID accession , int bioBegin , int bioEnd , Strand strand ) { GeneSequence geneSequence = new GeneSequence ( this , bioBegin , bioEnd , strand ) ; geneSequence . setAccession ( accession ) ; geneSequenceHashMap . put ( accession . toString ( ) , geneSequence ) ; return geneSequence...
Add a gene to the chromosome sequence using bioIndexing starts at 1 instead of 0 . The GeneSequence that is returned will have a reference to parent chromosome sequence which actually contains the sequence data . Strand is important for positive and negative direction where negative strand means we need reverse complem...
24,199
public Point getPanelPos ( int aligSeq , int i ) { Point p = new Point ( ) ; int lineNr = i / DEFAULT_LINE_LENGTH ; int linePos = i % DEFAULT_LINE_LENGTH ; int x = linePos * DEFAULT_CHAR_SIZE + DEFAULT_X_SPACE + DEFAULT_LEGEND_SIZE ; int y = lineNr * DEFAULT_Y_STEP + DEFAULT_Y_SPACE ; y += DEFAULT_LINE_SEPARATION * ali...
get the position of the sequence position on the Panel