Results 1 to 4 of 4
  1. #1
    BHCluster is offline Member
    Join Date
    Mar 2008
    Posts
    32
    Rep Power
    0

    Smile I am Doing Something Wrong But Don't Know What?

    What I am trying to do is to implement the Hierarchical Clustering algorithm with UPGMA (Average distance between clusters) and various distance metrics (Pearson, Manhattan).
    The results required: plot of data in experiment space showing the clustering according to the various distance metrics and a text file with gene clustering using the notation: (A, ((B,C),D)) meaning B & C are closest and then D etc...
    The code that I have compiles but I can't run it if you know what I am doing wrong please help. The code is below:

    Java Code:
    import java.io.*;
    
    class Numbers
    	{
    public static void Manhattan(double[][] a,double[][] b,int n,int n2)
      {
        int q=n2;
        int c=n;
        for(int m=0;m<q;m++)
        {
          for(int h=0;h<q;h++)
          {
            double d=0;
            double d2=0;
            for(int j=0;j<c;j++)
            {
              d2=a[m][j]-a[h][j];
              if(d2<0)
              d2=d2*-1;
              d=d+d2;
              }
            b[m][h]=d;
    
          }
        }
    
      }
    
    
    public static void main(String[] args)
    	{
    double x1=0;
    double x2;
    double x3;
    double y;
    double y1=0;
    double y2=0;
    double y3=0;
    double z=0;
    double z1=0;
    double z2=0;
    double z3=0;
    double total=0;
    /*x=x1;
    y=x2;*/
    
    z=3-2;
    z1=0;
    if(z1<0)
    {
    	z1=z1*-1;
    }
    
    else
    {
    total=z1+z2+z3;
    }
    String[] s2=new String [9];
    BufferedReader inFile;
    try{
     inFile=new BufferedReader(new FileReader("Data_Set_1.txt"));
    String s=inFile.readLine();
    for (int i=1;i<61;i++)
    {
    
    s2=s.split(" ");
    }
    }
    catch(Exception e){}
    		System.out.println();
    	}
    	}
    Below is the Data_Set_1.txt
    Java Code:
    Gene Number	Gene Name	Experiment 1	Experiment 2	Experiment 3
    1	Y1	-9.30	5.65	-5.02
    2	Y2	-4.10	5.68	0.56
    3	Y3	4.75	0.11	2.86
    4	Y4	-1.54	-10.01	-1.99
    5	Y5	-6.29	5.62	-2.78
    6	Y6	-13.02	1.31	1.61
    7	Y7	-5.85	3.79	-6.56
    8	Y8	-12.71	-0.45	0.62
    9	Y9	-3.05	-12.65	-5.07
    10	Y10	2.18	-5.82	-9.73
    11	Y11	1.74	-0.99	-3.66
    12	Y12	-7.88	0.93	-8.33
    13	Y13	-6.34	-1.85	-4.00
    14	Y14	-0.71	-2.64	-5.64
    15	Y15	2.77	-4.16	-3.83
    16	Y16	-0.25	0.58	0.77
    17	Y17	2.52	-5.80	-8.80
    18	Y18	5.53	-9.11	-1.92
    19	Y19	6.63	2.53	7.94
    20	Y20	-7.11	8.09	-6.47
    21	Y21	-0.30	-6.18	-6.25
    22	Y22	-0.33	4.58	-8.32
    23	Y23	-2.39	1.44	3.94
    24	Y24	7.70	9.39	4.73
    25	Y25	4.89	-6.17	6.98
    26	Y26	6.05	-6.54	-1.94
    27	Y27	6.78	7.83	-7.72
    28	Y28	4.86	2.31	2.33
    29	Y29	6.93	3.95	10.61
    30	Y30	0.04	-7.31	-1.49
    31	Y31	-4.78	3.41	10.69
    32	Y32	5.55	-6.48	-0.56
    33	Y33	-3.18	-4.32	-3.32
    34	Y34	3.67	-9.79	-13.03
    35	Y35	-11.01	-3.69	-5.13
    36	Y36	-2.24	-2.19	-12.74
    37	Y37	8.84	2.10	1.28
    38	Y38	0.69	7.11	-5.35
    39	Y39	-9.19	-6.10	-11.01
    40	Y40	2.37	6.58	2.67
    41	Y41	6.40	6.03	3.58
    42	Y42	-0.54	-1.32	-0.69
    43	Y43	-0.45	0.01	-0.25
    44	Y44	0.52	0.96	0.28
    45	Y45	0.86	1.07	0.96
    46	Y46	-0.47	-1.36	-0.81
    47	Y47	-0.64	-1.47	-0.32
    48	Y48	0.34	-0.47	0.46
    49	Y49	-0.27	-0.62	-0.43
    50	Y50	-0.49	-0.22	-0.01
    51	Y51	-9.80	2.34	-5.95
    52	Y52	6.74	-8.43	4.21
    53	Y53	-7.60	-6.57	-5.13
    54	Y54	-6.53	-2.55	-13.86
    55	Y55	-3.82	7.12	-11.45
    56	Y56	5.49	-7.60	0.40
    57	Y57	6.95	-2.61	-5.14
    58	Y58	0.21	-6.98	0.84
    59	Y59	1.65	3.77	3.33
    60	Y60	6.16	3.25	-14.31
    I would appreciate greatly any help I get.
    Last edited by BHCluster; 04-14-2008 at 06:03 PM. Reason: Forgot the Text File

  2. #2
    Java Tip's Avatar
    Java Tip is offline Moderator
    Join Date
    Nov 2007
    Posts
    1,694
    Blog Entries
    430
    Rep Power
    9

    Default

    The code that I have compiles but I can't run it if you know what I am doing wrong please help.
    What is the result? What do you mean with "i cant run it"?
    "The sole cause of manís unhappiness is that he does not know how to stay quietly in his room." - Blaise Pascal

  3. #3
    BHCluster is offline Member
    Join Date
    Mar 2008
    Posts
    32
    Rep Power
    0

    Default

    When I go jav numbers it doesn't run!

  4. #4
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    7

    Default

    take a look at your class that holds the main method, is it a public?

    regards,
    sukatoa

Similar Threads

  1. what is wrong with this code
    By masaka in forum New To Java
    Replies: 5
    Last Post: 04-16-2008, 08:27 AM
  2. What's wrong with this code?
    By Wizard wusa in forum New To Java
    Replies: 14
    Last Post: 01-22-2008, 11:55 PM
  3. Is there somethign wrong with this code?
    By Soda in forum New To Java
    Replies: 1
    Last Post: 12-08-2007, 04:46 PM
  4. Whats wrong with my code???
    By Soda in forum New To Java
    Replies: 2
    Last Post: 12-06-2007, 12:54 PM
  5. Replies: 15
    Last Post: 11-30-2007, 05:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •