idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
24,600
public void jmolColorByChain ( ) { String script = "function color_by_chain(objtype, color_list) {" + String . format ( "%n" ) + "" + String . format ( "%n" ) + " if (color_list) {" + String . format ( "%n" ) + " if (color_list.type == \"string\") {" + String . format ( "%n" ) + " color_list = color_list.sp...
assign a custom color to the Jmol chains command .
24,601
private void addAmbiguousEquivalents ( String one , String two , String either ) { Set < AminoAcidCompound > equivalents ; AminoAcidCompound cOne , cTwo , cEither ; equivalents = new HashSet < AminoAcidCompound > ( ) ; equivalents . add ( cOne = aminoAcidCompoundCache . get ( one ) ) ; equivalents . add ( cTwo = aminoA...
helper method to initialize the equivalent sets for 2 amino acid compounds and their ambiguity compound
24,602
private Group getNewGroup ( String recordName , Character aminoCode1 , long seq_id , String groupCode3 ) { Group g = ChemCompGroupFactory . getGroupFromChemCompDictionary ( groupCode3 ) ; if ( g != null && ! g . getChemComp ( ) . isEmpty ( ) ) { if ( g instanceof AminoAcidImpl ) { AminoAcidImpl aa = ( AminoAcidImpl ) g...
initiate new group either Hetatom Nucleotide or AminoAcid
24,603
private static Chain isKnownChain ( String asymId , List < Chain > chains ) { for ( int i = 0 ; i < chains . size ( ) ; i ++ ) { Chain testchain = chains . get ( i ) ; if ( asymId . equals ( testchain . getId ( ) ) ) { return testchain ; } } return null ; }
Test if the given asymId is already present in the list of chains given . If yes returns the chain otherwise returns null .
24,604
private Atom convertAtom ( AtomSite atom ) { Atom a = new AtomImpl ( ) ; a . setPDBserial ( Integer . parseInt ( atom . getId ( ) ) ) ; a . setName ( atom . getLabel_atom_id ( ) ) ; double x = Double . parseDouble ( atom . getCartn_x ( ) ) ; double y = Double . parseDouble ( atom . getCartn_y ( ) ) ; double z = Double ...
Convert a mmCIF AtomSite object to a BioJava Atom object
24,605
public void documentStart ( ) { structure = new StructureImpl ( ) ; currentChain = null ; currentGroup = null ; currentNmrModelNumber = null ; allModels = new ArrayList < List < Chain > > ( ) ; currentModel = new ArrayList < Chain > ( ) ; entities = new ArrayList < Entity > ( ) ; entityPolys = new ArrayList < > ( ) ; s...
Start the parsing
24,606
private void addAncilliaryEntityData ( StructAsym asym , int entityId , Entity entity , EntityInfo entityInfo ) { for ( EntitySrcGen esg : entitySrcGens ) { if ( ! esg . getEntity_id ( ) . equals ( asym . getEntity_id ( ) ) ) continue ; addInformationFromESG ( esg , entityId , entityInfo ) ; } for ( EntitySrcNat esn : ...
Add any extra information to the entity information .
24,607
private void addInformationFromESG ( EntitySrcGen entitySrcInfo , int entityId , EntityInfo c ) { c . setAtcc ( entitySrcInfo . getPdbx_gene_src_atcc ( ) ) ; c . setCell ( entitySrcInfo . getPdbx_gene_src_cell ( ) ) ; c . setOrganismCommon ( entitySrcInfo . getGene_src_common_name ( ) ) ; c . setOrganismScientific ( en...
Add the information from an ESG to a compound .
24,608
private void addInformationFromESN ( EntitySrcNat esn , int eId , EntityInfo c ) { c . setAtcc ( esn . getPdbx_atcc ( ) ) ; c . setCell ( esn . getPdbx_cell ( ) ) ; c . setOrganismCommon ( esn . getCommon_name ( ) ) ; c . setOrganismScientific ( esn . getPdbx_organism_scientific ( ) ) ; c . setOrganismTaxId ( esn . get...
Add the information to entity info from ESN .
24,609
private void addInfoFromESS ( EntitySrcSyn ess , int eId , EntityInfo c ) { c . setOrganismCommon ( ess . getOrganism_common_name ( ) ) ; c . setOrganismScientific ( ess . getOrganism_scientific ( ) ) ; c . setOrganismTaxId ( ess . getNcbi_taxonomy_id ( ) ) ; }
Add the information from ESS to Entity info .
24,610
private void addSites ( ) { List < Site > sites = structure . getSites ( ) ; if ( sites == null ) sites = new ArrayList < Site > ( ) ; for ( StructSiteGen siteGen : structSiteGens ) { String site_id = siteGen . getSite_id ( ) ; if ( site_id == null ) site_id = "" ; String comp_id = siteGen . getLabel_comp_id ( ) ; Stri...
Build sites in a BioJava Structure using the original author chain id & residue numbers . Sites are built from struct_site_gen records that have been parsed .
24,611
public void drawPairs ( Graphics g ) { if ( aligs == null ) return ; int nr = aligs . length ; Graphics2D g2D = ( Graphics2D ) g ; Stroke oldStroke = g2D . getStroke ( ) ; g2D . setStroke ( stroke ) ; Color color ; float hue ; int width = Math . round ( scale ) ; int w2 = width / 2 ; for ( int i = 0 ; i < aligs . lengt...
draw alternative alignments
24,612
public void drawBoxes ( Graphics g ) { if ( fragmentPairs == null ) return ; g . setColor ( Color . yellow ) ; for ( int i = 0 ; i < fragmentPairs . length ; i ++ ) { FragmentPair fp = fragmentPairs [ i ] ; int xp = fp . getPos1 ( ) ; int yp = fp . getPos2 ( ) ; int width = Math . round ( scale ) ; g . drawRect ( Math ...
draw high scoring fragments that are used for the initial alignment seed selection
24,613
public void drawDistances ( Graphics g1 ) { Graphics2D g = ( Graphics2D ) g1 ; int c = matrix . getRowDimension ( ) ; int d = matrix . getColumnDimension ( ) ; float scale = getScale ( ) ; int width = Math . round ( scale ) ; for ( int i = 0 ; i < c ; i ++ ) { int ipaint = Math . round ( i * scale ) ; for ( int j = 0 ;...
For each element in matrix draw it as a colored square or pixel .
24,614
private void ABITraceInit ( BufferedInputStream bis ) throws IOException { byte [ ] bytes = null ; ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; int b ; while ( ( b = bis . read ( ) ) >= 0 ) { baos . write ( b ) ; } bis . close ( ) ; baos . close ( ) ; bytes = baos . toByteArray ( ) ; initData ( bytes ) ...
Helper method for constructors
24,615
public int [ ] getTrace ( String base ) throws CompoundNotFoundException { if ( base . equals ( "A" ) ) { return A ; } else if ( base . equals ( "C" ) ) { return C ; } else if ( base . equals ( "G" ) ) { return G ; } else if ( base . equals ( "T" ) ) { return T ; } else { throw new CompoundNotFoundException ( "Don't kn...
Returns one of the four traces - all of the y - coordinate values each of which correspond to a single x - coordinate relative to the position in the array so that if element 4 in the array is 972 then x is 4 and y is 972 for that point .
24,616
private double calculateScale ( int height ) { double newScale = 0.0 ; double max = ( double ) getMaximum ( ) ; double ht = ( double ) height ; newScale = ( ( ht - 50.0 ) ) / max ; return newScale ; }
Returns the scaling factor necessary to allow all of the traces to fit vertically into the specified space .
24,617
private int getMaximum ( ) { int max = 0 ; for ( int x = 0 ; x <= T . length - 1 ; x ++ ) { if ( T [ x ] > max ) max = T [ x ] ; if ( A [ x ] > max ) max = A [ x ] ; if ( C [ x ] > max ) max = C [ x ] ; if ( G [ x ] > max ) max = G [ x ] ; } return max ; }
Get the maximum height of any of the traces . The data is persisted for performance in the event of multiple calls but it initialized lazily .
24,618
private void initData ( byte [ ] fileData ) { traceData = fileData ; if ( isABI ( ) ) { setIndex ( ) ; setBasecalls ( ) ; setQcalls ( ) ; setSeq ( ) ; setTraces ( ) ; } else throw new IllegalArgumentException ( "Not a valid ABI file." ) ; }
Initialize all of the data fields for this object .
24,619
private void setTraces ( ) { int pointers [ ] = new int [ 4 ] ; int datas [ ] = new int [ 4 ] ; char order [ ] = new char [ 4 ] ; datas [ 0 ] = DATA9 ; datas [ 1 ] = DATA10 ; datas [ 2 ] = DATA11 ; datas [ 3 ] = DATA12 ; for ( int i = 0 ; i <= 3 ; i ++ ) { order [ i ] = ( char ) traceData [ FWO + i ] ; } for ( int i = ...
Shuffle the pointers to point to the proper spots in the trace then load the traces into their arrays .
24,620
private void setSeq ( ) { char tempseq [ ] = new char [ seqLength ] ; for ( int x = 0 ; x <= seqLength - 1 ; ++ x ) { tempseq [ x ] = ( char ) traceData [ PBAS2 + x ] ; } sequence = new String ( tempseq ) ; }
Fetch the sequence from the trace data .
24,621
private void setQcalls ( ) { qCalls = new int [ seqLength ] ; byte [ ] qq = new byte [ seqLength ] ; getSubArray ( qq , PCON ) ; DataInputStream dis = new DataInputStream ( new ByteArrayInputStream ( qq ) ) ; for ( int i = 0 ; i <= seqLength - 1 ; ++ i ) { try { qCalls [ i ] = ( int ) dis . readByte ( ) ; } catch ( IOE...
Fetch the quality calls from the trace data .
24,622
private void setBasecalls ( ) { baseCalls = new int [ seqLength ] ; byte [ ] qq = new byte [ seqLength * 2 ] ; getSubArray ( qq , PLOC ) ; DataInputStream dis = new DataInputStream ( new ByteArrayInputStream ( qq ) ) ; for ( int i = 0 ; i <= seqLength - 1 ; ++ i ) { try { baseCalls [ i ] = ( int ) dis . readShort ( ) ;...
Fetch the basecalls from the trace data .
24,623
private void setIndex ( ) { int DataCounter , PBASCounter , PLOCCounter , PCONCounter , NumRecords , indexBase ; byte [ ] RecNameArray = new byte [ 4 ] ; String RecName ; DataCounter = 0 ; PBASCounter = 0 ; PLOCCounter = 0 ; PCONCounter = 0 ; indexBase = getIntAt ( absIndexBase + macJunk ) ; NumRecords = getIntAt ( abs...
Sets up all of the initial pointers to the important records in TraceData .
24,624
private void getSubArray ( byte [ ] b , int traceDataOffset ) { for ( int x = 0 ; x <= b . length - 1 ; x ++ ) { b [ x ] = traceData [ traceDataOffset + x ] ; } }
A utility method which fills array b with data from the trace starting at traceDataOffset .
24,625
private boolean isABI ( ) { char ABI [ ] = new char [ 4 ] ; for ( int i = 0 ; i <= 2 ; i ++ ) { ABI [ i ] = ( char ) traceData [ i ] ; } if ( ABI [ 0 ] == 'A' && ( ABI [ 1 ] == 'B' && ABI [ 2 ] == 'I' ) ) { return true ; } else { for ( int i = 128 ; i <= 130 ; i ++ ) { ABI [ i - 128 ] = ( char ) traceData [ i ] ; } if ...
Test to see if the file is ABI format by checking to see that the first three bytes are ABI . Also handle the special case where 128 bytes were prepended to the file due to binary FTP from an older macintosh system .
24,626
public static void main ( String [ ] args ) { try { List < GeneName > geneNames = getGeneNames ( ) ; logger . info ( "got {} gene names" , geneNames . size ( ) ) ; for ( GeneName g : geneNames ) { if ( g . getApprovedSymbol ( ) . equals ( "FOLH1" ) ) logger . info ( "Gene Name: {}" , g ) ; } } catch ( Exception e ) { l...
parses a file from the genenames website
24,627
public static List < GeneName > getGeneNames ( InputStream inStream ) throws IOException { ArrayList < GeneName > geneNames = new ArrayList < GeneName > ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( inStream ) ) ; String line = reader . readLine ( ) ; while ( ( line = reader . readLine ( ) ...
Get a list of GeneNames from an input stream .
24,628
public void addIntronsUsingExons ( ) throws Exception { if ( intronAdded ) { return ; } if ( exonSequenceList . size ( ) == 0 ) { return ; } ExonComparator exonComparator = new ExonComparator ( ) ; Collections . sort ( exonSequenceList , exonComparator ) ; int shift = - 1 ; if ( getStrand ( ) == Strand . NEGATIVE ) { s...
Once everything has been added to the gene sequence where you might have added exon sequences only then you can infer the intron sequences and add them . You may also have the case where you only added one or more TranscriptSequences and from that you can infer the exon sequences and intron sequences . Currently not im...
24,629
public TranscriptSequence addTranscript ( AccessionID accession , int begin , int end ) throws Exception { if ( transcriptSequenceHashMap . containsKey ( accession . getID ( ) ) ) { throw new Exception ( "Duplicate accesion id " + accession . getID ( ) ) ; } TranscriptSequence transcriptSequence = new TranscriptSequenc...
Add a transcription sequence to a gene which describes a ProteinSequence
24,630
public IntronSequence removeIntron ( String accession ) { for ( IntronSequence intronSequence : intronSequenceList ) { if ( intronSequence . getAccession ( ) . getID ( ) . equals ( accession ) ) { intronSequenceList . remove ( intronSequence ) ; intronSequenceHashMap . remove ( accession ) ; return intronSequence ; } }...
Remove the intron by accession
24,631
public IntronSequence addIntron ( AccessionID accession , int begin , int end ) throws Exception { if ( intronSequenceHashMap . containsKey ( accession . getID ( ) ) ) { throw new Exception ( "Duplicate accesion id " + accession . getID ( ) ) ; } intronAdded = true ; IntronSequence intronSequence = new IntronSequence (...
Add an Intron Currently used to mark an IntronSequence as a feature
24,632
public ExonSequence removeExon ( String accession ) { for ( ExonSequence exonSequence : exonSequenceList ) { if ( exonSequence . getAccession ( ) . getID ( ) . equals ( accession ) ) { exonSequenceList . remove ( exonSequence ) ; exonSequenceHashMap . remove ( accession ) ; intronSequenceList . clear ( ) ; intronSequen...
Remove the exon sequence
24,633
public ExonSequence addExon ( AccessionID accession , int begin , int end ) throws Exception { if ( exonSequenceHashMap . containsKey ( accession . getID ( ) ) ) { throw new Exception ( "Duplicate accesion id " + accession . getID ( ) ) ; } ExonSequence exonSequence = new ExonSequence ( this , begin , end ) ; exonSeque...
Add an ExonSequence mainly used to mark as a feature
24,634
public DNASequence getSequence5PrimeTo3Prime ( ) { String sequence = getSequenceAsString ( this . getBioBegin ( ) , this . getBioEnd ( ) , this . getStrand ( ) ) ; if ( getStrand ( ) == Strand . NEGATIVE ) { StringBuilder b = new StringBuilder ( getLength ( ) ) ; CompoundSet < NucleotideCompound > compoundSet = this . ...
Try to give method clarity where you want a DNASequence coding in the 5 to 3 direction Returns the DNASequence representative of the 5 and 3 reading based on strand
24,635
public void toPDB ( StringBuffer buf ) { printHeader ( buf ) ; printTitle ( buf ) ; printExpdata ( buf ) ; printAuthors ( buf ) ; printResolution ( buf ) ; }
Appends a PDB representation of the PDB header to the provided StringBuffer
24,636
public boolean setExperimentalTechnique ( String techniqueStr ) { ExperimentalTechnique et = ExperimentalTechnique . getByName ( techniqueStr ) ; if ( et == null ) return false ; if ( techniques == null ) { techniques = EnumSet . of ( et ) ; return true ; } else { return techniques . add ( et ) ; } }
Adds the experimental technique to the set of experimental techniques of this header . Note that if input is not a recognised technique string then no errors will be produced but false will be returned
24,637
public static void addCharges ( Structure structure ) { for ( int i = 0 ; i < structure . nrModels ( ) ; i ++ ) { for ( Chain c : structure . getChains ( i ) ) { for ( Group g : c . getAtomGroups ( ) ) { ChemComp thisChemComp = ChemCompGroupFactory . getChemComp ( g . getPDBName ( ) ) ; List < ChemCompAtom > chemAtoms ...
Function to add the charges to a given structure .
24,638
private void updateMultipleAlignment ( ) throws StructureException , RefinerFailedException { msa . clear ( ) ; Block b = msa . getBlock ( 0 ) ; b . setAlignRes ( block ) ; repeatCore = b . getCoreLength ( ) ; if ( repeatCore < 1 ) throw new RefinerFailedException ( "Optimization converged to length 0" ) ; SymmetryTool...
This method translates the internal data structures to a MultipleAlignment of the repeats in order to use the methods to score MultipleAlignments .
24,639
private boolean shrinkBlock ( ) throws StructureException , RefinerFailedException { if ( repeatCore <= Lmin ) return false ; updateMultipleAlignment ( ) ; Matrix residueDistances = MultipleAlignmentTools . getAverageResidueDistances ( msa ) ; double maxDist = Double . MIN_VALUE ; double [ ] colDistances = new double [...
Deletes an alignment column at a randomly selected position .
24,640
private void saveHistory ( String folder ) throws IOException { String name = msa . getStructureIdentifier ( 0 ) . getIdentifier ( ) ; FileWriter writer = new FileWriter ( folder + name + "-symm_opt.csv" ) ; writer . append ( "Step,Time,RepeatLength,RMSD,TMscore,MCscore\n" ) ; for ( int i = 0 ; i < lengthHistory . size...
Save the evolution of the optimization process as a csv file .
24,641
private void addBonds ( Atom atom , List < Atom > atomsInGroup , List < Atom > allAtoms ) { if ( atom . getBonds ( ) == null ) { return ; } for ( Bond bond : atom . getBonds ( ) ) { Atom other = bond . getOther ( atom ) ; if ( atomsInGroup . indexOf ( other ) != - 1 ) { Integer firstBondIndex = atomsInGroup . indexOf (...
Add the bonds for a given atom .
24,642
private void storeEntityInformation ( List < Chain > allChains , List < EntityInfo > entityInfos ) { for ( EntityInfo entityInfo : entityInfos ) { String description = entityInfo . getDescription ( ) ; String type ; if ( entityInfo . getType ( ) == null ) { type = null ; } else { type = entityInfo . getType ( ) . getEn...
Store the entity information for a given structure .
24,643
private void storeBioassemblyInformation ( Map < String , Integer > chainIdToIndexMap , Map < Integer , BioAssemblyInfo > inputBioAss ) { int bioAssemblyIndex = 0 ; for ( Entry < Integer , BioAssemblyInfo > entry : inputBioAss . entrySet ( ) ) { Map < double [ ] , int [ ] > transformMap = MmtfUtils . getTransformMap ( ...
Generate the bioassembly information on in the desired form .
24,644
public CDSSequence removeCDS ( String accession ) { for ( CDSSequence cdsSequence : cdsSequenceList ) { if ( cdsSequence . getAccession ( ) . getID ( ) . equals ( accession ) ) { cdsSequenceList . remove ( cdsSequence ) ; cdsSequenceHashMap . remove ( accession ) ; return cdsSequence ; } } return null ; }
Remove a CDS or coding sequence from the transcript sequence
24,645
public CDSSequence addCDS ( AccessionID accession , int begin , int end , int phase ) throws Exception { if ( cdsSequenceHashMap . containsKey ( accession . getID ( ) ) ) { throw new Exception ( "Duplicate accesion id " + accession . getID ( ) ) ; } CDSSequence cdsSequence = new CDSSequence ( this , begin , end , phase...
Add a Coding Sequence region with phase to the transcript sequence
24,646
public DNASequence getDNACodingSequence ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( CDSSequence cdsSequence : cdsSequenceList ) { sb . append ( cdsSequence . getCodingSequence ( ) ) ; } DNASequence dnaSequence = null ; try { dnaSequence = new DNASequence ( sb . toString ( ) . toUpperCase ( ) ) ; } catch ( Co...
Get the stitched together CDS sequences then maps to the cDNA
24,647
public ProteinSequence getProteinSequence ( TranscriptionEngine engine ) { DNASequence dnaCodingSequence = getDNACodingSequence ( ) ; RNASequence rnaCodingSequence = dnaCodingSequence . getRNASequence ( engine ) ; ProteinSequence proteinSequence = rnaCodingSequence . getProteinSequence ( engine ) ; proteinSequence . se...
Get the protein sequence with user defined TranscriptEngine
24,648
protected void setPaintDefaults ( Graphics2D g2D ) { g2D . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; g2D . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; g2D . setFont ( seqFont ) ; }
set some default rendering hints like text antialiasing on
24,649
protected int drawSequence ( Graphics2D g2D , int y ) { g2D . setColor ( SEQUENCE_COLOR ) ; int aminosize = Math . round ( 1 * scale ) ; if ( aminosize < 1 ) aminosize = 1 ; Rectangle drawHere = g2D . getClipBounds ( ) ; int startpos = coordManager . getSeqPos ( drawHere . x ) ; Composite oldComp = g2D . getComposite (...
draw the Amino acid sequence
24,650
public static Point3d centroid ( Point3d [ ] x ) { Point3d center = new Point3d ( ) ; for ( Point3d p : x ) { center . add ( p ) ; } center . scale ( 1.0 / x . length ) ; return center ; }
Calculate the centroid of the point cloud .
24,651
public static void transform ( Matrix4d rotTrans , Point3d [ ] x ) { for ( Point3d p : x ) { rotTrans . transform ( p ) ; } }
Transform all points with a 4x4 transformation matrix .
24,652
public static void translate ( Vector3d trans , Point3d [ ] x ) { for ( Point3d p : x ) { p . add ( trans ) ; } }
Translate all points with a translation vector .
24,653
public static Point3d [ ] clonePoint3dArray ( Point3d [ ] x ) { Point3d [ ] clone = new Point3d [ x . length ] ; for ( int i = 0 ; i < x . length ; i ++ ) { clone [ i ] = new Point3d ( x [ i ] ) ; } return clone ; }
Clone an array of points .
24,654
public static double rmsd ( Point3d [ ] x , Point3d [ ] y ) { if ( x . length != y . length ) { throw new IllegalArgumentException ( "Point arrays are not of the same length." ) ; } double sum = 0.0 ; for ( int i = 0 ; i < x . length ; i ++ ) { sum += x [ i ] . distanceSquared ( y [ i ] ) ; } return Math . sqrt ( sum /...
Calculate the RMSD of two point arrays already superposed .
24,655
public static JMenuBar initMenu ( ) { JMenuBar menu = new JMenuBar ( ) ; JMenu file = new JMenu ( "File" ) ; file . getAccessibleContext ( ) . setAccessibleDescription ( "File Menu" ) ; JMenuItem openI = new JMenuItem ( "Open" ) ; openI . setMnemonic ( KeyEvent . VK_O ) ; openI . addActionListener ( new ActionListener ...
provide a JMenuBar that can be added to a JFrame
24,656
private static void showAboutDialog ( ) { JDialog dialog = new JDialog ( ) ; dialog . setSize ( new Dimension ( 300 , 300 ) ) ; String msg = "This viewer is based on <b>BioJava</b> and <b>Jmol</>. <br>Author: Andreas Prlic <br> " ; msg += "Structure Alignment algorithm based on a variation of the PSC++ algorithm by Pet...
show some info about this gui
24,657
public int [ ] getAnchors ( ) { int [ ] anchor = new int [ getScoreMatrixDimensions ( ) [ 0 ] - 1 ] ; for ( int i = 0 ; i < anchor . length ; i ++ ) { anchor [ i ] = - 1 ; } for ( int i = 0 ; i < anchors . size ( ) ; i ++ ) { anchor [ anchors . get ( i ) . getQueryIndex ( ) ] = anchors . get ( i ) . getTargetIndex ( ) ...
Returns the list of anchors . The populated elements correspond to query compounds with a connection established to a target compound .
24,658
public void setAnchors ( int [ ] anchors ) { super . anchors = new ArrayList < Anchor > ( ) ; if ( anchors != null ) { for ( int i = 0 ; i < anchors . length ; i ++ ) { if ( anchors [ i ] >= 0 ) { addAnchor ( i , anchors [ i ] ) ; } } } }
Sets the starting list of anchors before running the alignment routine .
24,659
public static LinkedHashMap < String , ProteinSequence > readGenbankProteinSequence ( File file ) throws Exception { FileInputStream inStream = new FileInputStream ( file ) ; LinkedHashMap < String , ProteinSequence > proteinSequences = readGenbankProteinSequence ( inStream ) ; inStream . close ( ) ; return proteinSequ...
Read a Genbank file containing amino acids with setup that would handle most cases .
24,660
public static LinkedHashMap < String , ProteinSequence > readGenbankProteinSequence ( InputStream inStream ) throws Exception { GenbankReader < ProteinSequence , AminoAcidCompound > GenbankReader = new GenbankReader < ProteinSequence , AminoAcidCompound > ( inStream , new GenericGenbankHeaderParser < ProteinSequence , ...
Read a Genbank file containing amino acids with setup that would handle most cases . User is responsible for closing InputStream because you opened it
24,661
public static LinkedHashMap < String , DNASequence > readGenbankDNASequence ( InputStream inStream ) throws Exception { GenbankReader < DNASequence , NucleotideCompound > GenbankReader = new GenbankReader < DNASequence , NucleotideCompound > ( inStream , new GenericGenbankHeaderParser < DNASequence , NucleotideCompound...
Read a Genbank DNA sequence
24,662
public static LinkedHashMap < String , RNASequence > readGenbankRNASequence ( InputStream inStream ) throws Exception { GenbankReader < RNASequence , NucleotideCompound > GenbankReader = new GenbankReader < RNASequence , NucleotideCompound > ( inStream , new GenericGenbankHeaderParser < RNASequence , NucleotideCompound...
Read a Genbank RNA sequence
24,663
private void loadRepresentativeDomains ( ) throws IOException { URL u = null ; try { u = new URL ( RemoteScopInstallation . DEFAULT_SERVER + "getRepresentativeScopDomains" ) ; } catch ( MalformedURLException e ) { throw new IOException ( "URL " + RemoteScopInstallation . DEFAULT_SERVER + "getRepresentativeScopDomains" ...
get the ranges of representative domains from the centralized server
24,664
public static final double getDistance ( Atom a , Atom b ) { double x = a . getX ( ) - b . getX ( ) ; double y = a . getY ( ) - b . getY ( ) ; double z = a . getZ ( ) - b . getZ ( ) ; double s = x * x + y * y + z * z ; return Math . sqrt ( s ) ; }
calculate distance between two atoms .
24,665
public static final double angle ( Atom a , Atom b ) { Vector3d va = new Vector3d ( a . getCoordsAsPoint3d ( ) ) ; Vector3d vb = new Vector3d ( b . getCoordsAsPoint3d ( ) ) ; return Math . toDegrees ( va . angle ( vb ) ) ; }
Gets the angle between two vectors
24,666
public static final Atom unitVector ( Atom a ) { double amount = amount ( a ) ; double [ ] coords = new double [ 3 ] ; coords [ 0 ] = a . getX ( ) / amount ; coords [ 1 ] = a . getY ( ) / amount ; coords [ 2 ] = a . getZ ( ) / amount ; a . setCoords ( coords ) ; return a ; }
Returns the unit vector of vector a .
24,667
public static final double getPhi ( AminoAcid a , AminoAcid b ) throws StructureException { if ( ! isConnected ( a , b ) ) { throw new StructureException ( "can not calc Phi - AminoAcids are not connected!" ) ; } Atom a_C = a . getC ( ) ; Atom b_N = b . getN ( ) ; Atom b_CA = b . getCA ( ) ; Atom b_C = b . getC ( ) ; i...
Calculate the phi angle .
24,668
public static final double getPsi ( AminoAcid a , AminoAcid b ) throws StructureException { if ( ! isConnected ( a , b ) ) { throw new StructureException ( "can not calc Psi - AminoAcids are not connected!" ) ; } Atom a_N = a . getN ( ) ; Atom a_CA = a . getCA ( ) ; Atom a_C = a . getC ( ) ; Atom b_N = b . getN ( ) ; i...
Calculate the psi angle .
24,669
public static final boolean isConnected ( AminoAcid a , AminoAcid b ) { Atom C = null ; Atom N = null ; C = a . getC ( ) ; N = b . getN ( ) ; if ( C == null || N == null ) return false ; double distance = getDistance ( C , N ) ; return distance < 2.5 ; }
Test if two amino acids are connected i . e . if the distance from C to N < 2 . 5 Angstrom .
24,670
public static final void rotate ( Atom atom , double [ ] [ ] m ) { double x = atom . getX ( ) ; double y = atom . getY ( ) ; double z = atom . getZ ( ) ; double nx = m [ 0 ] [ 0 ] * x + m [ 0 ] [ 1 ] * y + m [ 0 ] [ 2 ] * z ; double ny = m [ 1 ] [ 0 ] * x + m [ 1 ] [ 1 ] * y + m [ 1 ] [ 2 ] * z ; double nz = m [ 2 ] [ ...
Rotate a single Atom aroud a rotation matrix . The rotation Matrix must be a pre - multiplication 3x3 Matrix .
24,671
public static final void rotate ( Structure structure , double [ ] [ ] rotationmatrix ) throws StructureException { if ( rotationmatrix . length != 3 ) { throw new StructureException ( "matrix does not have size 3x3 !" ) ; } AtomIterator iter = new AtomIterator ( structure ) ; while ( iter . hasNext ( ) ) { Atom atom =...
Rotate a structure . The rotation Matrix must be a pre - multiplication Matrix .
24,672
public static final void rotate ( Group group , double [ ] [ ] rotationmatrix ) throws StructureException { if ( rotationmatrix . length != 3 ) { throw new StructureException ( "matrix does not have size 3x3 !" ) ; } AtomIterator iter = new AtomIterator ( group ) ; while ( iter . hasNext ( ) ) { Atom atom = null ; atom...
Rotate a Group . The rotation Matrix must be a pre - multiplication Matrix .
24,673
public static final void rotate ( Atom atom , Matrix m ) { double x = atom . getX ( ) ; double y = atom . getY ( ) ; double z = atom . getZ ( ) ; double [ ] [ ] ad = new double [ ] [ ] { { x , y , z } } ; Matrix am = new Matrix ( ad ) ; Matrix na = am . times ( m ) ; atom . setX ( na . get ( 0 , 0 ) ) ; atom . setY ( n...
Rotate an Atom around a Matrix object . The rotation Matrix must be a pre - multiplication Matrix .
24,674
public static final void rotate ( Group group , Matrix m ) { AtomIterator iter = new AtomIterator ( group ) ; while ( iter . hasNext ( ) ) { Atom atom = iter . next ( ) ; rotate ( atom , m ) ; } }
Rotate a group object . The rotation Matrix must be a pre - multiplication Matrix .
24,675
public static final void rotate ( Structure structure , Matrix m ) { AtomIterator iter = new AtomIterator ( structure ) ; while ( iter . hasNext ( ) ) { Atom atom = iter . next ( ) ; rotate ( atom , m ) ; } }
Rotate a structure object . The rotation Matrix must be a pre - multiplication Matrix .
24,676
public static void transform ( Atom [ ] ca , Matrix4d t ) { for ( Atom atom : ca ) Calc . transform ( atom , t ) ; }
Transform an array of atoms at once . The transformation Matrix must be a post - multiplication Matrix .
24,677
public static final void plus ( Structure s , Matrix matrix ) { AtomIterator iter = new AtomIterator ( s ) ; Atom oldAtom = null ; Atom rotOldAtom = null ; while ( iter . hasNext ( ) ) { Atom atom = null ; atom = iter . next ( ) ; try { if ( oldAtom != null ) { logger . debug ( "before {}" , getDistance ( oldAtom , ato...
calculate structure + Matrix coodinates ...
24,678
public static final void shift ( Structure structure , Atom a ) { AtomIterator iter = new AtomIterator ( structure ) ; while ( iter . hasNext ( ) ) { Atom atom = null ; atom = iter . next ( ) ; Atom natom = add ( atom , a ) ; double x = natom . getX ( ) ; double y = natom . getY ( ) ; double z = natom . getZ ( ) ; atom...
shift a structure with a vector .
24,679
public static final void shift ( Atom a , Atom b ) { Atom natom = add ( a , b ) ; double x = natom . getX ( ) ; double y = natom . getY ( ) ; double z = natom . getZ ( ) ; a . setX ( x ) ; a . setY ( y ) ; a . setZ ( z ) ; }
Shift a vector .
24,680
public static final Atom getCentroid ( Atom [ ] atomSet ) { if ( atomSet . length == 0 ) throw new IllegalArgumentException ( "Atom array has length 0, can't calculate centroid!" ) ; double [ ] coords = new double [ 3 ] ; coords [ 0 ] = 0 ; coords [ 1 ] = 0 ; coords [ 2 ] = 0 ; for ( Atom a : atomSet ) { coords [ 0 ] +...
Returns the centroid of the set of atoms .
24,681
public static Atom centerOfMass ( Atom [ ] points ) { Atom center = new AtomImpl ( ) ; float totalMass = 0.0f ; for ( Atom a : points ) { float mass = a . getElement ( ) . getAtomicMass ( ) ; totalMass += mass ; center = scaleAdd ( mass , a , center ) ; } center = scaleEquals ( center , 1.0f / totalMass ) ; return cent...
Returns the center of mass of the set of atoms . Atomic masses of the Atoms are used .
24,682
public static Atom scale ( Atom a , double s ) { double x = a . getX ( ) ; double y = a . getY ( ) ; double z = a . getZ ( ) ; Atom b = new AtomImpl ( ) ; b . setX ( x * s ) ; b . setY ( y * s ) ; b . setZ ( z * s ) ; return b ; }
Multiply elements of a by s
24,683
public static final Atom getCenterVector ( Atom [ ] atomSet ) { Atom centroid = getCentroid ( atomSet ) ; return getCenterVector ( atomSet , centroid ) ; }
Returns the Vector that needs to be applied to shift a set of atoms to the Centroid .
24,684
public static final Atom getCenterVector ( Atom [ ] atomSet , Atom centroid ) { double [ ] coords = new double [ 3 ] ; coords [ 0 ] = 0 - centroid . getX ( ) ; coords [ 1 ] = 0 - centroid . getY ( ) ; coords [ 2 ] = 0 - centroid . getZ ( ) ; Atom shiftVec = new AtomImpl ( ) ; shiftVec . setCoords ( coords ) ; return sh...
Returns the Vector that needs to be applied to shift a set of atoms to the Centroid if the centroid is already known
24,685
public static final Atom [ ] centerAtoms ( Atom [ ] atomSet ) throws StructureException { Atom centroid = getCentroid ( atomSet ) ; return centerAtoms ( atomSet , centroid ) ; }
Center the atoms at the Centroid .
24,686
public static final Atom [ ] centerAtoms ( Atom [ ] atomSet , Atom centroid ) throws StructureException { Atom shiftVector = getCenterVector ( atomSet , centroid ) ; Atom [ ] newAtoms = new AtomImpl [ atomSet . length ] ; for ( int i = 0 ; i < atomSet . length ; i ++ ) { Atom a = atomSet [ i ] ; Atom n = add ( a , shif...
Center the atoms at the Centroid if the centroid is already know .
24,687
public static final Atom createVirtualCBAtom ( AminoAcid amino ) throws StructureException { AminoAcid ala = StandardAminoAcid . getAminoAcid ( "ALA" ) ; Atom aN = ala . getN ( ) ; Atom aCA = ala . getCA ( ) ; Atom aC = ala . getC ( ) ; Atom aCB = ala . getCB ( ) ; Atom [ ] arr1 = new Atom [ 3 ] ; arr1 [ 0 ] = aN ; arr...
creates a virtual C - beta atom . this might be needed when working with GLY
24,688
public static double calcRotationAngleInDegrees ( Atom centerPt , Atom targetPt ) { double theta = Math . atan2 ( targetPt . getY ( ) - centerPt . getY ( ) , targetPt . getX ( ) - centerPt . getX ( ) ) ; theta += Math . PI / 2.0 ; double angle = Math . toDegrees ( theta ) ; if ( angle < 0 ) { angle += 360 ; } return an...
Calculates the angle from centerPt to targetPt in degrees . The return should range from [ 0 360 ) rotating CLOCKWISE 0 and 360 degrees represents NORTH 90 degrees represents EAST etc ...
24,689
public static void shift ( Atom [ ] ca , Atom b ) { for ( Atom atom : ca ) Calc . shift ( atom , b ) ; }
Shift an array of atoms at once .
24,690
public static Matrix4d getTransformation ( Matrix rot , Atom trans ) { return new Matrix4d ( new Matrix3d ( rot . getColumnPackedCopy ( ) ) , new Vector3d ( trans . getCoordsAsPoint3d ( ) ) , 1.0 ) ; }
Convert JAMA rotation and translation to a Vecmath transformation 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,691
public static Atom getTranslationVector ( Matrix4d transform ) { Atom transl = new AtomImpl ( ) ; double [ ] coords = { transform . m03 , transform . m13 , transform . m23 } ; transl . setCoords ( coords ) ; return transl ; }
Extract the translational vector as an Atom of a transformation matrix .
24,692
public static double rmsd ( Atom [ ] x , Atom [ ] y ) { return CalcPoint . rmsd ( atomsToPoints ( x ) , atomsToPoints ( y ) ) ; }
Calculate the RMSD of two Atom arrays already superposed .
24,693
public static < T extends Enum < ? > > String getEnumValuesAsString ( Class < T > enumClass ) { T [ ] vals = enumClass . getEnumConstants ( ) ; StringBuilder str = new StringBuilder ( ) ; if ( vals . length == 1 ) { str . append ( vals [ 0 ] . name ( ) ) ; } else if ( vals . length > 1 ) { for ( int i = 0 ; i < vals . ...
Constructs a comma - separated list of values for an enum .
24,694
public UnitCellBoundingBox getTranslatedBbs ( Vector3d translation ) { UnitCellBoundingBox translatedBbs = new UnitCellBoundingBox ( numOperatorsSg , numPolyChainsAu ) ; for ( int i = 0 ; i < numOperatorsSg ; i ++ ) { for ( int j = 0 ; j < numPolyChainsAu ; j ++ ) { translatedBbs . chainBbs [ i ] [ j ] = new BoundingBo...
Returns a new BoundingBoxes object containing the same bounds as this BoundingBoxes object translated by the given translation
24,695
private static void releaseReferences ( ) { synchronized ( versionedEcodDBs ) { Iterator < Entry < String , SoftReference < EcodDatabase > > > it = versionedEcodDBs . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Entry < String , SoftReference < EcodDatabase > > entry = it . next ( ) ; SoftReference < Ecod...
removes SoftReferences which have already been garbage collected
24,696
public AbstractSequence < AminoAcidCompound > getSequence ( List < AminoAcidCompound > list ) { AbstractSequence < AminoAcidCompound > seq = super . getSequence ( list ) ; Collection < Object > strCase = new ArrayList < Object > ( seq . getLength ( ) ) ; for ( int i = 0 ; i < seq . getLength ( ) ; i ++ ) { strCase . ad...
Assumes all compounds were uppercase
24,697
private static List < Object > getStringCase ( String str ) { List < Object > types = new ArrayList < Object > ( str . length ( ) ) ; for ( int i = 0 ; i < str . length ( ) ; i ++ ) { types . add ( Character . isUpperCase ( str . charAt ( i ) ) ) ; } return types ; }
Returns a list of Booleans of the same length as the input specifying whether each character was uppercase or not .
24,698
public static SortedSet < String > getAll ( ) { SortedSet < String > representatives = new TreeSet < String > ( ) ; try { URL u = new URL ( allUrl ) ; InputStream stream = URLConnectionTools . getInputStream ( u , 60000 ) ; if ( stream != null ) { BufferedReader reader = new BufferedReader ( new InputStreamReader ( str...
Returns the current list of all PDB IDs .
24,699
private static void lazyInit ( ) { if ( components == null ) { components = new HashSet < Component > ( ) ; nonTerminalComps = new HashMap < Set < String > , Component > ( ) ; nTerminalAminoAcids = new HashMap < Set < String > , Component > ( ) ; cTerminalAminoAcids = new HashMap < Set < String > , Component > ( ) ; } ...
Lazy initialization of the static variables .