This week's book giveaway is in the NodeJS forum.
We're giving away four copies of Serverless Applications with Node.js and have Slobodan Stojanovic & Aleksandar Simovic on-line!
See this thread for details.
Win a copy of Serverless Applications with Node.js this week in the NodeJS forum!

Dean Boardman

Greenhorn
+ Follow
since Mar 16, 2018
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
4
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Dean Boardman

I am working on a project and as part of it I am working with a large data set.  
the part that I am having problems with is I have defined ten groups and I want to read through the entire data set and assign each value to on of the ten groups.

The code below is a section that I am having the difficulty with, the firast part is setting the values to zero, the second part is trying to assign the values to a group.
I cannot get it to run correcrly, any pointers would be welcome


3 weeks ago
Just a quick question,
what is the best way to display output on excel rather than the terminal window?
11 months ago
I am a mature student and the course that I am doing requires three modules in mathematics and programming.
when I was first at school the language that was taught was BBC basic (you may need to look it up), so I have had to hit the ground running to keep up with my class.
As a result of this, I do not have a foundation to build on, and this is why I am using the beginning java page.
So in answer to Piet Souris, I have not been taught about collections yet,  
1 year ago
Thank you all for your advice so far, I have been working on my code on and off for the last week.
I have added another class for getting the mean and standard deviation.
The code so far calculates the mean, it does work more or less. I just want to tidy up how it looks on the output screen,  
as for the standard deviation I am planning on working on that in the coming week.
I have adjusted some of the first code.




any further pointers are appreciated.
1 year ago
The first line is the patient identifiers, and the columns refer to the gene expression for each of the patients,


ProbeSetID    GSM119944    GSM119945   GSM119946   GSM119947
1007_s_at        11.37652        11.82674       11.12302        11.74344
1053_at        7.270398        7.53445       7.169297        7.730833
117_at        8.172823        8.350568       8.216073        8.052177
121_at         10.0642        11.19369       9.846189        10.54999

1 year ago
My class has been given a practice assignment in relation to our final assessment.
the brief is this
(1) Read the input data from the file “Exprs-Data.txt”.

This is a small dataset containing data relating to 17 patients.  
Of these 17 patients, the first 5 patients were subtype 1 (group1), the middle 6 patients were subtype 2 (group2) and the last 6 patients subtype 3 (group3).

(2) For each gene, calculate the means and standard deviations for the 3 groups.

(3) Output the results to a tab-delimited text file with the following format:


ProbeID     N   K   Grp1Size Grp1Mean   Grp1SD   Grp2Size   Grp2Mean   Grp2SD   Grp3Size   Grp3Mean   Grp3SD

N is the total number of patients

K is the number of groups

my code so far is as follows


I am hoping to get pointers on how to continue the code and the best way to work out the mean and the standard deviation.
it is also a way for me to keep track of how I am progressing.

1 year ago
Thank you all for your advice, I am going to start again and compile as I go and that should hopefully give me the results I need.
1 year ago
The full class is as follows,
import java.io.*;
import java.nio.file.*;
public class SeqReader
{
   public static void outputHeader(){
       System.out.print("seqName");
       System.out.print("\t "+"seqLength");
       System.out.print("\t "+"count A");
       System.out.print("\t "+"count C");
       System.out.print("\t "+"count G");
       System.out.print("\t "+"count T");
       System.out.print("\t "+"count Others ");
       System.out.print("\t "+"frac A");
       System.out.print("\t "+"frac C");
       System.out.print("\t "+"fracs G");
       System.out.print("\t "+"fracs T");
       System.out.println("\t "+"fracs Others ");
   }
   public static String  getHeader(){
       StringBuffer buffer;
       buffer = new StringBuffer();
       buffer.append("seqName");
       buffer.append("\t "+"seqLength");
       buffer.append("\t "+"count A");
       buffer.append("\t "+"count C");
       buffer.append("\t "+"count G");
       buffer.append("\t "+"count T");
       buffer.append("\t "+"frac A");
       buffer.append("\t "+"frac C");
       buffer.append("\t "+"fracs G");
       buffer.append("\t "+"fracs T");
       buffer.append("\t "+"fracs O");        
       return buffer.toString();        
   }
   public static void ProcessOneLine2(String line){
       String[] strs = line.split ("\t");
       DNASequence a_DNA_seq =new DNASequence(strs[0],strs[1]);
       a_DNA_seq.output();  
   }
   public static void processOneLine (String line){
       String[] strs = line.split("\t");
       char[] seqs = strs[1].toCharArray();
       System.out.print(strs[0]);
       System.out.print("\t"+ seqs.length);
   
   }
   {
       for(int i=0;i<seqs.length;i++){
           if(seqs[i]=='A')counts[0]++;
           else if(seqs[i]=='C')counts[1]++;
           else if(seqs[i]=='G')counts[2]++;
           else if(seqs[i]=='T')counts[3]++;
           else counts [4]++;
   }
   System.out.print("\t"+counts[0]);
   System.out.print("\t"+counts[1]);
   System.out.print("\t"+counts[2]);
   System.out.print("\t"+counts[3]);
   System.out.print("\t"+counts[4]);
       
   double[] fracs=new double[5];
   fracs[0] =counts[0]*1.0/seqs.length;
   fracs[1] =counts[1]*1.0/seqs.length;
   fracs[2] =counts[2]*1.0/seqs.length;  
   fracs[3] =counts[3]*1.0/seqs.length;
   fracs[4] =counts[4]*1.0/seqs.length;
       
   System.out.print("\t "+fracs[0]);
   System.out.print("\t "+fracs[1]);
   System.out.print("\t "+fracs[2]);
   System.out.print("\t "+fracs[3]);
   System.out.println("\t "+fracs[4]);        
}
public static void main (String[]args){
   String fileName="DNA-Seqs.fasta.txt";
   try (BufferedReader br = Files.newBufferedReader(Paths.get (fileName)))
       String line;
       outputHeader();
       PrintWriter pw=
   
   while((line = br.readLine) !=null);

   {
           processOneLine(line);
           pw.close();
   }
   
}
catch (IOExcetion e){
   e.printStackTrance ();
   

}
}  
}


As it is written I am getting a total of three error messages, but when I try to fix them I get more errors.  
This is most likely due to me not having much experience coding.
1 year ago
This is the full section of the code, I think all the brackets are in place. adding another set brings up more errors.

public static void main (String[]args){
   String fileName="DNA-Seqs.fasta.txt";
   try (BufferedReader br = Files.newBufferedReader(Paths.get (fileName)))
       String line;
       outputHeader();
       PrintWriter pw=
   
   while((line = br.readLine) !=null);
   {
           processOneLine(line);
           pw.close();
   }
   
}
1 year ago
I am very new to java and debugging is a problem so my question is how do I fix the following error,

while((line = br.readLine) !=null);

I am being told that is an illegal start of an expression and that it is not a statment.
Any help to fix this would be greatly apreciated.
1 year ago