1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
//Parse MEME output
File file=new File("C:\\Data\\WorkDir\\memeOutputFor12CTgenes.txt");
File file2=new File("C:\\Data\\WorkDir\\memeInputFor12CTgenes.txt");
Object table[][]=new Object[40][2000];
Object table2[][]=new Object[40][2000];
Object table3[][]=new Object[40][2000];
table=Parse_MEME_Output.extractMotifs(file);
table2=Parse_MEME_Output.extractGeneSequence(file2);
table3=Parse_MEME_Output.parameterMotif(table,table2);
int styleNumber=9;
//create style and font
JTextPane jtp = new JTextPane();
//JEditorPane jep=new JEditorPane();
DefaultStyledDocument doc = new DefaultStyledDocument();
jtp.setEditable(false);
jtp.setAutoscrolls(true);
jtp.setDocument(doc);
JScrollPane scroll = new JScrollPane(jtp,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(scroll);
//frame.getContentPane().add(jtp,"South"); //add SAVE button
frame.setSize(PIXEL_WIDTH/2,PIXEL_HT);
frame.setLocation(200,200);
frame.setVisible(true);
Style def = StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
StyleConstants.setFontFamily(def, "Courier");
StyleConstants.setFontSize(def,12);
Style regular = jtp.addStyle("regular", def);
Style s =jtp.addStyle("black", regular);
StyleConstants.setForeground(s, Color.BLACK);
Style s2 =jtp.addStyle("red", regular);
StyleConstants.setForeground(s2, Color.RED);
Color[] patternColors={Color.BLUE,Color.GRAY,Color.GREEN,Color.MAGENTA,
Color.ORANGE,Color.PINK,Color.YELLOW,Color.RED,Color.CYAN};
boolean[] patternBold={false,true,true,true,false,false,false,false,false};
boolean[] patternItalics={false,false,false,false,true,true,true,false,true};
Style[] patternStyle=new Style[styleNumber];
for (int j=0;j<styleNumber;j++)
{
Style style=StyleContext.getDefaultStyleContext().getStyle(StyleContext.DEFAULT_STYLE);
StyleConstants.setFontFamily(style, "Courier");
StyleConstants.setFontSize(style,12);
Style reg = jtp.addStyle("reg", def);
Style s3 =jtp.addStyle("pattern", reg);
StyleConstants.setForeground(s3, patternColors[j]);
patternStyle[j]=style;
}
for (int i=0;i<table3.length;i++)
{
try{
String numeroMotif=(String)table3[0][i];
String sequenceMotif=(String)table3[1][i]+"\n";
String sequenceGene=(String)table3[3][i]+"\t";
String geneName=(String)table3[2][i]+"\n";
String start1=((String)table3[4][i]+"\n");
//int start=Integer.parseInt(start1);
//String score=(String)table3[4][i]+"\n";
String length1=(String)table3[5][i]+"\n";
//int length=Integer.parseInt(length1);
doc.insertString(doc.getLength(),sequenceGene, jtp.getStyle("black"));
// doc.setCharacterAttributes(start,length,jtp.getStyle("red"),true);
doc.insertString(doc.getLength(),geneName, jtp.getStyle("black"));
}
catch(BadLocationException ble)
{
System.err.println("Could not insert text ..... "+ble);
}
} |