input
stringlengths
10
828
output
stringlengths
5
107
public string to string string buffer s new string buffer s append model no append model no s append id append id s append cage append cage id if sex 0 s append sex male else s append sex female s append get genotype1 append s append get genotype2 append s append phenotype append n return s to string
for ascii printing purpose
public int get female count return female count
return the number of female
public string get model name return model 4 sex linked xx female xy male incomplete dominance
return the model name
public string get model name return model 1 autosomal simple dominance
return the model name
private void components setup selection table setup panels set content pane m option panel
this method sets up the gui and other characteristics of the internals of
public array list get array list return elements
return the list of elements
public int get model no return 4
return the model number
public int get model no return 1
return the model number
public string get model name return model 12 sex linked zw female zz male n3 allele circular dominance n a dominant to b b dominant to c c dominant to a
return the model name
public string get model name return model 7 autosomal 3 allele hierarchical dominance n a dominant to b and c b dominant to c c recessive to all
return the model name
public int get model no return 12
return the model number
public int get model no return 7
return the model number
public string get model name return model 10 sex linked xx female xy male n3 allele circular dominance n a dominant to b b dominant to c c dominant to a
return the model name
private void setup buttons m ok button new jbutton ok m ok button add action listener new action listener public void action performed action event e ok
this method simply creates the two buttons to accept and close or cancel
public int get model no return 10
return the model number
public int get dominance return dominance
return the dominance probability
public string get model name return model 3 sex linked xx female xy male simple dominance
return the model name
public int get model no return 3
return the model number
public int get sex linkage return sex linkage
return the sex linkage probability
public void mouse entered mouse event e system out println balloon help selected get balloon help if get balloon help system out println balloon help selected m balloon help selected if m is beginners mode m info cage m organism get cage id 1 phenotype m organism get phenotype allele1 m organism get genotype1 allele2 m organism get genotype2 else m info cage m organism get cage id 1 phenotype m organism get phenotype set tool tip text m info
implementation for mouse listener does nothing
public string get model name return model 8 autosomal 3 allele circular dominance n a dominant to b b dominant to c c dominant to a
return the model name
public int get three alleles return three alleles
return the chance of three alleles probability
public int get model no return 8
return the model number
public int get hierarchical return hierarchical
return the chance of hierarchical dominance probability
private void refresh organism boolean selected organism ui organism ui if m is parent set selected selected if m organism get sex type 0 m vial set male parent organism ui else m vial set female parent organism ui else organism ui setter ui if selected setter ui m central organism ui else setter ui null if m organism get sex type 0 m vial set male parent setter ui else m vial set female parent setter ui m central organism ui set selected selected
if this object is a parent refresh the selected deselected state of the
public boolean get practice mode return practice mode
return the practice mode value
private void components setup organism panel setup parent info panel set content pane m super panel
this method sets up the gui and other characteristics of the internals of
public boolean get suppress return suppress
return the suppress value
public void set balloon help boolean selected string info if selected if m is beginners mode system out println baloon help is selected beginners mode m is beginners mode info cage m organism get cage id 1 phenotype m organism get phenotype allele1 m organism get genotype1 allele2 m organism get genotype2 else info cage m organism get cage id 1 phenotype m organism get phenotype system out println baloon help is selected beginners mode m is beginners mode set tool tip text info m balloon help selected selected system out println set balloon help m balloon help selected
set the tooltip text to be displayed depending whether the balloon help
public string to string string buffer s new string buffer s append n t dominance append dominance s append n t sex linkage append sex linkage s append n t chance append chance s append n t practics mode append practice mode s append n t logging append logging s append n t email append email s append n t suppress append suppress s append n t model no append model append n return s to string
for ascii printing purpose
private void components setup organism panel setup parent info panel add m super panel border layout center
this method sets up the gui and other characteristics of the internals of
public string get model name return model 5 sex linked zw female zz male simple dominance
return the model name
public int get model no return 5
return the model number
public string get model name return model 11 sex linked zw female zz male n3 allele hierarchical dominance n a dominant to b and c b dominant to c c recessive to all
return the model name
public int get model no return 11
return the model number
public string get email return conf get email
return the email address
public void init super init perform japplet initialization components create and load all gui components m dialog frame add window listener new window adapter public void window closing window event e exit application
initializes the applet and sets up the various components of the
public string get model info return model get model info
return the model information
public cage populate field population return model populate
create the field population cage and return it
public cage cross two int id organism o1 organism o2 return model cross two id o1 o2
cross the given two organisms and return the offspring cage
public void save array list elements file file throws exception file output stream output new file output stream file creating the whole tree element root new element vgl root add content save meta element data new element data for int i 0 i elements size i cage c cage elements get i data add content c save root add content data document doc new document root xmloutputter outputter new xmloutputter outputter output doc output
save this genetics in the jdom element format
private element save meta throws exception element root new element meta root add content conf save root add content model save return root
save the information of configuration and model object
public array list open file file throws exception file input stream input new file input stream file saxbuilder builder new saxbuilder document doc builder build input element root doc get root element element meta root get child meta initialize meta part initialize meta initialize data part element data root get child data array list elements new array list list l data get children for iterator i l iterator i has next element current element i next cage c new cage current elements elements add c return elements
get the genetics information from the file and create the list of cages
public string get color html return htmlcontainer get color html
method to get the color of html
public string get bw html return htmlcontainer get bw html
method to get the black and white color of html
public gene get gene return the gene
method to get the gene object
private void initialize element root list elements root get children for iterator i elements iterator i has next element current element i next string name current get name if name equals configuration conf new configuration current model no conf get model else if name equals model create model obj current
get the information of configuration and model object
public void print array list elements file file throws exception file writer output new file writer file output write character output write model get character output write n n n for int i 0 i elements size i cage c cage elements get i output write c print output flush output close
print the cages information into the file
private void show details m show hide details set text m hide details m show hide details set icon m down icon jpanel panel jpanel m show hide details get parent if panel get component count 1 m dialog height 200 int dialog width this get width set size dialog width m dialog height int hgt panel get height panel add m text details border layout center pack repaint
this method sets up the panel that displays the genetics details when the
public void dialog frame jframe dialog frame m dialog frame dialog frame
provides a jframe from which dialog characteristics can be derived
private void hide details m show hide details set text m show details m show hide details set icon m close icon jpanel panel jpanel m show hide details get parent if panel get component count 2 panel remove m text details int dialog width this get width int hgt panel get height m dialog height 200 set size dialog width m dialog height pack repaint
this method hides the panel thats has the genetics information
private void show details m show hide details set text m hide details m show hide details set icon m down icon jpanel panel jpanel m show hide details get parent if panel get component count 1 m panel height 200 int dialog width this get width set size dialog width m panel height int hgt panel get height panel add m text details border layout center repaint
this method sets up the panel that displays the genetics details when the
private void hide details m show hide details set text m show details m show hide details set icon m close icon jpanel panel jpanel m show hide details get parent if panel get component count 2 panel remove m text details int dialog width this get width int hgt panel get height m panel height 200 set size dialog width m panel height repaint
this method hides the panel that has the genetics information
public cage get cage return m cage
getter method to access the cage object associated with this ui
public void window closing window event e int ans joption pane show confirm dialog this you are about to close cage m id n do you wish to continue closing cage joption pane yes no option joption pane warning message if ans joption pane yes option this set visible false
implementation for the windowlistener class method
private void add mouse listener on component final jcomponent comp comp add mouse listener new mouse adapter public void mouse pressed mouse event event request the focus if don t already have it if has focus set request focus enabled true if comp equals the htmlpanel comp equals text pane genex gui set panel focus the htmlpanel get parent get parent get parent get name else genex gui set panel focus comp get parent get parent get name
method to add mouse listener on all the components in button panel like
public int get cage id return m id
getter method to access the cage id of this panel
public organism ui get organism uifor int id for int i 0 i 2 m size i for int j 0 j 20 j organism ui organism ui organism ui m organism images i j if organism ui null if organism ui get organism get id id return organism ui else break return null
this method returns the organism ui of the organism with the sent id
protected void update htmlpanel string g dna dna g dna selected base 1 system out println comes here in seq panel one g dna number of times i was displaying the previous dna seq if one is selected from history visible gene current gene express gene g dna 1 refresh display current gene 1 current protein string current gene get gene get protein string header length current gene get gene get header length dnasequence length current gene get gene get dnasequence length header length current gene get gene get header length
method to update the selected paneland display the dna and it processing
public void test context diff diff new diff test1 test2 diff change script diff diff 2 false diff print base p new diff print normal print test1 test2 string writer wtr new string writer p set output wtr p print header test1 test2 p print script script fixme when diff print is updated to diff 2 7 testfor expected output in wtr to string diff 1 15 does not combine adjacent changes when they are close together
test context based output
private void init get content pane set layout new border layout add components to main frame create menu bar create tool bar get content pane add m tool bar border layout north system out println n in init method jsplit pane split pane new jsplit pane jsplit pane horizontal split make history panel make genex sequence panel split pane set one touch expandable true get content pane add split pane border layout center create a workspace on disk create workspace
to initialize and set up the various components of the
protected boolean get focus on one return focus flag on one
flag to check if the focus is on panel one
protected void set focus on one boolean focus flag focus flag on one focus flag
setting focus flag for the panel one
private void components string dnastr1 string dnastr2 dialog panel new jpanel dialog panel set background color jscroll pane diff pane new jscroll pane dialog panel diff pane set preferred size new dimension 850 400 string diff string generate diff seq dnastr1 dnastr2 to string jlabel lbl1 new jlabel diff string dialog panel add lbl1 this get content pane add diff pane
this method sets up the gui and other characteristics of the internals of
private int get insertions return insert count
method to get the number of insertions
private void status panel jpanel s panel new jpanel s panel set layout new border layout m status label new jlabel m status label set foreground color black m status label set border new soft bevel border 1 m status label set text s panel add m status label border layout center get content pane add s panel border layout south
create and load status panel
private int get deletions return delete count
method to get the number of deletions
public void delete base previous protein string current protein string string buffer working dnabuffer new string buffer dna system out println n caret position is caret position if caret position 0 working dnabuffer delete char at caret position 1 dna working dnabuffer to string caret position visible gene vg express gene dna caret position refresh display vg caret position current protein string vg get gene get protein string dnasequence length vg get gene get dnasequence length header length vg get gene get header length
method to delete a base
private void debug string message if debug flag true system out println message
set the debug flag to true to see the debug messages
private void show array string str arr int size str arr length system out println n array is for int j 0 j size j system out println str arr j
method to display the array that has been formed
private void setup dialog box frame import frame int width 200 int height 250 int dt height int get graphics configuration get device get default configuration get bounds get height int dt width int get graphics configuration get device get default configuration get bounds get width int location x int dt width 2 width 2 int location y int dt height 2 height 2 set size width height set location new point location x location y set resizable false
this method sets up the gui for the dialog box in the middle
private void get dnadifference diff gui diff dialog box new diff gui this gen seq panel one get dnasequence gen seq panel two get dnasequence
method for getting the dna differences
protected void refresh display visible gene vg int selected base if selected base 1 selected base label set text selected base selected base else selected base label set text selected base text pane set text vg get color html font color blue previous protein string font pre br br br font size 1 caption font body html
method to refresh the display
private void about vgl joption pane show message dialog this m program id n release version 1 4 n copyright 2004 n vgl team http mgx sourceforge net n all rights reserved n gnu general public license n http www gnu org copyleft gpl html about virtual genetics lab joption pane information message new image icon m image
display about dialog
public void window closing window event e uncomment later if required int ans joption pane show confirm dialog this you are about to close the difference dialog box n do you wish to continue closing cage joption pane yes no option joption pane warning message if ans joption pane yes option this set visible false
implementation for the windowlistener class method
public boolean has color color c return a equals c b equals c true false
check if his two colors object has specific color
public string to string return a to string t b to string
string representation of two colors object
public boolean equals object other if other this return true if other null return false if get class other get class return false two colors other color two colors other return a other color a a null a equals other color a b other color b b null b equals other color b
overriding default equals method
public int hash code int result 0 result hash prime result a hash code result hash prime result b hash code return result
overrides default hash code method
protected int get num directions return get direction ring3 length 3
how many directions on this grid
public color get protein color return drawing pane grid get protein color
get the color of protein on this canvas
public void set title polypeptide pp i op get polypeptide if pp null pp get id null title default title else title default title pp get id set border border factory create titled border title
set the title and border
public void mouse dragged mouse event event jcomponent c jcomponent event get source amino acid palette panel amino acid palette c point p event get point try selected amino acid panel amino acid at p if selected amino acid null return jpanel input panel null if admin input panel protex admin gui input panel else input panel protex main app active iopanel get input panel input palette input panel set amino acid selected amino acid transfer handler handler c get transfer handler handler export as drag c event transfer handler copy catch exception e e print stack trace
starts the drag of a amino acid
protected int get string indentation constant string name int r the values returned are hardcoded with values that look best when the canvas is drawn their value was establish through trials and best was picked int length name trim length if length 1 1 return 0 else if length 2 1 return 0 else if length 3 0 x return int 1 8f r else if length 4 0 x return int 1 2f r else if length 5 0 xx return int 2 3f r else length 6 can t be longer 0 xxx return int 3 4f r
returns constants used for center the name of the polypeptide
public void set iopanel iopanel i this i op i
set the iopanel associated with this input palette
public void remove all if drawing pane get grid null this drawing pane get grid unset all
clear graphic from this output palette
public amino acid amino acid at point p int x 0 for int i 0 i row i for int j 0 j column j amino acid a list x int d p x j column width cell radius p x j column width cell radius p y i row height cell radius p y i row height cell radius if d cell radius cell radius return a x return null
return the first amino acod in which point p is contained if none
public void mouse clicked mouse event event protex main app active iopanel i op protex main app set active iopanel border
if mouse is clicked make current iopanel the active panel
protected int get string indentation constant string name int r the values returned are hardcoded with values that look best when the canvas is drawn their value was establish through trials and best was picked int length name trim length if length 1 1 return 0 else if length 2 1 return 0 else if length 3 0 x return int 1 5f r else if length 4 0 x return int 1 2f r else if length 5 0 xx return int 2 3f r else length 6 can t be longer 0 xxx return int 3 4f r
returns constants used for center the name of the polypeptide
public float get contrast scaler return float 0 5
a constant between 0 and 1 that leads to good contrast when normalized
public iterator get iterator throws folding exception throw new folding exception no iterator available
enable iteration over the keys in the table
private void new session gene xevent handler new session this
open a new session
public void add amino acid a double probability throws folding exception throw new folding exception can t add to virtual table
add an amino acid to the table with its frequency
public void add amino acid a throws folding exception throw new folding exception can t add to virtual table
add an amino acid to the table
public string get name return amino acid table virtual
returns the name of this table
public amino acid get string name throws folding exception try double hydrophobic index new double name double value added on 10 17 2004 by namita and ruchi double hydrogenbond index new double name double value double ionic index new double name double value update max hydrophobic index return new amino acid hydrophobic index hydrogenbond index ionic index catch number format exception e throw new folding exception hydrophobic index name not a number
retrieve an acid from the table
public void add two colors a color b table put a b
add two colors object and result of mixing them to the table
public polypeptide add polypeptide panel ppp polypeptide pp ppp get polypeptide if pp null pp is in history return null hist list model add element ppp hist list scroll pane revalidate hist list scroll pane repaint pp set in history to true return pp
add a polypeptide panel
public color mix two colors color a color b two colors c new two colors a b color result color table get c if result null result color table get c toggle colors return result
mix two colors and return the result
public color mix two colors two colors a color result color table get a if result null result color table get a toggle colors return result
mix two colors in two colors object