package versusSNP.gui.dialogs;
import java.io.StringReader;
import java.util.Locale;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.JTextPane;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import versusSNP.Size;
import versusSNP.gui.UICaption;
public class HelpDialog extends JOptionPane {
private static final long serialVersionUID = -7354415112549360597L;
private String helpDoc;
public HelpDialog() {
super();
if (UICaption.locale.equals(Locale.SIMPLIFIED_CHINESE)) {
initSimpChineseDoc();
} else {
initEnglishDoc();
}
}
public void initEnglishDoc() {
helpDoc = "<html><head><meta http-equiv=\"Content-Language\" content=\"en-us\"><meta http-equiv=\"Content-Type\" content=\"text/html\"><title>Introduction</title></head><body><p><b><font face=\"Times New Roman\" size=\"5\">Introduction</font></b></p><p><font face=\"Times New Roman\">Thank you for choosing VersusSNP, which provides single nucleotide mutation mining between orthologous CDSs or ORFs. </font></p><p><font face=\"Times New Roman\" size=\"5\"><b><span lang=\"zh-cn\">Feature</span>s</b></font></p><p><font face=\"Times New Roman\">- Align and filter orthologous sequences between two genomes. </font></p><p><font face=\"Times New Roman\">- Filter single nucleotide mutations between orthologous pairs. </font></p><p><font face=\"Times New Roman\">- Classify mutations by their types, i.e synonymous, non-synonymous, insertions, deletions. </font></p><p><font face=\"Times New Roman\">- Calculate mutation sites on the genomes.</font></p><p><font face=\"Times New Roman\">- Plot mutations by their position and types.</font></p><p><font face=\"Times New Roman\">- Show sequences or alignments of an ORF. </font></p><p><font face=\"Times New Roman\">- Show the summaries of sequences or alignments.</font></p><p><font face=\"Times New Roman\" size=\"5\"><b>Menus</b></font></p><p><font face=\"Times New Roman\" size=\"4\"><b>1. File</b></font></p><p><font face=\"Times New Roman\">1.1 <b>Open</b>: Use this command to import a list containing all of the ORFs' position and their sequences. The positions should be listed in a tab-delimited text file or comma separated values (CSV) file. Each record is separated into four columns, i.e <name><begin><end><strand> (use '+' for plus strand, '-' for minus strand). The sequences should be in FASTA format. Also it is mandatory that you should provide the name of the genome. </font></p><p><font face=\"Times New Roman\">1.2 <b>Open Alignment</b>: Once you have imported two genomes, the alignment between the ORFs in these genomes becomes available. Use this command to import a BLAST output you've done previously. The wizard will prompt you to select a query genome and subject genome, which are the ones you specified with "-i" and "-d" when you execute BLAST program. Once BLAST parsing and filtering process is done, the program prompts you to choose a query and subject which are used when you select ORF from the navigation panel.</font></p><p><font face=\"Times New Roman\">1.3 <b>Save Alignment</b>: Use this command if you've execute BLAST program invoked by VersusSNP, the alignment result can be saved to a file. </font></p><p><font face=\"Times New Roman\">1.4 <b>Save SNP lisit</b>: Use this command to export SNP list. Choose a category and a path to export. </font></p><p><font face=\"Times New Roman\" size=\"4\"><b>2. Edit</b></font></p><p><font face=\"Times New Roman\">2.1 <b>Trim Sequence</b>: Use this command to bring out a dialog guiding you to substring sequences. The genome and ORF comboboxes are for you to locate ORF. Once you have chosen an ORF, you can input the begin position and end position you want to substring with. The sequence between the range will be shown in the box below. Check the <b>Substring complement strand</b> if you wish to get the sequence on complement strand.</font></p><p><font face=\"Times New Roman\">2.2 <b>Change query and subject genome</b>: Use this command to alter query genome and subject genome. </font></p><p><font face=\"Times New Roman\" size=\"4\"><b>3. Tools</b></font></p><p><font face=\"Times New Roman\">3.1 <b>Language</b>: Use this command to choose a language of the GUI. The default language is English. </font></p><p><font face=\"Times New Roman\">3.2 <b>Options</b>: Use this command to set the preferences of the program. There are two tabs in the preferences setting.</font></p><p><font face=\"Times New Roman\">3.2.1 <b>Alignment</b>: In this tab, there are parameters concerning the BLAST program executing and filtering. The <b>Matrix</b> and <b>Expect threshold</b> are to set in BLAST command of "-M" and "-e" parameter. The filters for BLAST output are the minimum value for a comparison which should be used. <b>Overlap percentage</b> means the minimum percentage which calculated by dividing the matching length by the whole length of the longer sequence in this match. The <b>Match score</b> is set to ensure the match should at least have a greater score than that. </font></p><p><font face=\"Times New Roman\">3.2.2 <b>Path</b>: In this tab, you should locate the <b>blastall</b> and <b>formatdb</b> program which are used to run BLAST between sequences. Also make sure to specify a temporary file which is used to save the temporary alignment result. </font></p><p><font face=\"Times New Roman\" size=\"4\"><b>4. Run</b></font></p><p><font face=\"Times New Roman\">4.1 <b>Run BLAST</b>: Use this command to perform a BLAST alignment between two set of ORF sequences. The query genome and subject genome are the ones you specified with "-i" and "-d" when you execute BLAST program. The <b>Matrix</b>,<b>Program</b>, <b>Expect threshold</b> and <b>Mask low complexity regions</b> are used to specify the BLAST command parameter "-M", "-p", "-e" and "- F", respectively. </font></p><p><font face=\"Times New Roman\" size=\"4\"><b>5. Help</b></font></p><p><font face=\"Times New Roman\">5.1 <b>Help</b>: Use this command to show help topics. </font></p><p><font face=\"Times New Roman\">5.2 <b>About</b>: Use this command to display the copyright notice and version of your copy of VersusSNP. </font></p><p><b><font face=\"Times New Roman\" size=\"5\">Interface</font></b></p><p><font face=\"Times New Roman\">The graphic interface are divided into three panels. The navigator panel on the left is for you to choose and operate with ORF's sequence and alignments. The main panel in the center is used to display mutation types and their locations. The sequence and note panel at the bottom is used to show sequence, alignment as well as their summaries. </font></p><p><b><font face=\"Times New Roman\" size=\"5\">Examples</font></b></p><p><b><font face=\"Times New Roman\" size=\"4\">1. Import ORFs and sequences</font></b></p><p><font face=\"Times New Roman\">Use the data sets you downloaded from the website. Use <b>File</b> > <b>Open</b> command and type in a genome name. Then browse to NC*.txt to load the list of ORFs' position and to NC*.fas to load the sequences of these ORFs. </font></p><p><b><font face=\"Times New Roman\" size=\"4\">2. Import sequence alignment</font></b></p><p><font face=\"Times New Roman\">Use the data sets you downloaded from the website. Use <b>File</b> > <b>Open Alignment </b>command to perform a alignment parsing and filtering between the genomes. Browse to alignments.txt and leave the query genome and subject genome what they are. Click OK and wait for the process to finish. </font></p><p><b><font face=\"Times New Roman\" size=\"4\">3. Perform a BLAST alignment between the genomes </font></b></p><p><font face=\"Times New Roman\">Use the data sets you downloaded from the website. Import two sets of genome sequences. Set the path for <b>blastall </b>and <b>formatdb</b> in<b> Option > Path</b>, also don't forget to set the path for temporary files<b>. Use</b> <b>Run</b> > <b>Run BLAST</b> command to bring out the settings of the BLAST command. Leave the default setting and wait for the process to finish. </font></p><p><b><font face=\"Times New Roman\" size=\"5\">Copyright</font></b></p><p><font face=\"Times New Roman\">THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL THE AUTHOR or AUTHORS BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING INCIDENTAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF THE USE OF THE PROGRAM, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.<br><br>YOU ACKNOWLEDGE THAT YOU HAVE READ THIS LICENSE, UNDERSTAND IT AND AGREE TO BE BOUND BY ITS TERMS AS THE COMPLETE AND EXCLUSIVE STATEMENT OF THE AGREEMENT BETWEEN US, SUPERSEDING ANY PROPOSAL OR PRIOR AGREEMENT, ORAL OR WRITTEN, AND ANY OTHER COMMUNICATIONS BETWEEN US RELATING TO THE SUBJECT MATTER OF THIS LICENSE.</font></p><p><font face=\"Times New Roman\">VersusSNP is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.. You should have received a copy of the GNU Lesser General Public License, </font></p><p>The program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.<br><br>You should have received a copy of the GNU Lesser General Public License along with this library; if not, you can get a copy from<a href=\"http://www.gnu.org/licenses/lgpl.html\">http://www.gnu.org/licenses/lgpl.html</a> or write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA</p><p><b><font face=\"Times New Roman\" size=\"5\">Contact</font></b></p><p>For more questions or bug report, please e-mail to <a href=\"mailto:dna_china@hotmail.com\">dna_china@hotmail.com</a>. </p></body></html>";
}
public void initSimpChineseDoc() {
helpDoc = "<html><head><meta http-equiv=\"Content-Language\" content=\"zh-cn\"><meta http-equiv=\"Content-Type\" content=\"text/html\"><title>���</title></head><body><p><b><font size=\"5\">���</font></b></p><p>��л��ʹ��VersusSNP��VersusSNP��һ����ͬԴ����Ŷ������ɸѡͻ��λ��Ĺ��ߡ�</p><p><b><font size=\"5\">����</font></b></p><p>- �����������������ɸѡͬԴ���бȶ�</p><p>- ��ͬԴ���м�ɸѡͻ��λ��</p><p>- ��ͻ��λ�㰴ͻ�����ͷֳ�ͬ��ͻ�䡢��ͬ��ͻ�䡢�����ɾ��</p><p>- �г�ͻ��λ���ڻ������ϵ�λ��</p><p>- ��ͻ��λ���λ�ú����ͻ����ֲ�ͼ</p><p>- �鿴����ORF�ıȶԻ�����</p><p>- �鿴�ȶԻ����е�ͳ����Ϣ</p><p><b><font size=\"5\">�˵�</font></b></p><p><b><font size=\"4\">1. �ļ�</font></b></p><p>1.1 <b>��</b>��ʹ����������һ����������ORFλ�ú����е��б�λ����Ϣ�ļ��ĸ�ʽ��<����><���><�յ�><����>�������á�+����-������ʾ���ֶμ����Ʊ�����ո�Ÿ������ɡ������ļ���FASTA��ʽ��ͬʱ����Ҫ������������ơ�</p><p>1.2 <b>�ȶԽ����</b>ʹ�������������������������бȶԽ����ע�⣬�ڵ������бȶ�֮ǰ��Ҫ�ȵ�������������������ļ�����������ʾ��ѡ��һ��Ŀ���һ�����ջ����飬����������ִ��BLAST����ʱ��"-i"��"-d"�����ֲ�ָ���������ļ�����BLAST�������̽���������ʾ��ѡ��һ��Ŀ���һ�����ջ����飬��ѡ���Ŀ������齫�ᱻ���ڵ������з�����ORF���С�</p><p>1.3 <b>����ȶԽ����</b>ʹ��������������VersusSNP����BLAST��������Ľ����</p><p>1.4 <b>����SNP�б�</b>ʹ������������ǩҳ����ʾSNP�б�����Ҫѡ��һ��ͻ�����ָ��һ������ļ��������һ������</p><p><b><font size=\"4\">2. �༭</font></b></p><p>2.1 <b>��ȡ���У�</b>ʹ����������ȡ����Ҫ��ORF���С�����ѡ��һ�������鲢ѡ����������ORF��Ȼ����<b>���</b>��<b>�յ�</b>�������������ϣ����ȡ���е���ʼ����ֹλ�á�����<b>��ʼ��ȡ</b>����һ�������о������������ı����С������ѡ��<b>��ȡ��������</b>���ı����оͻ������һ����ķ������С�</p><p>2.2 <b>����Ŀ��Ͳ��ջ�����</b>��ʹ������������Ŀ��Ͳ��ջ����顣</p><p><b><font size=\"4\">3. ����</font></b></p><p>3.1 <b>����</b>��ʹ����������趨��ϣ���ڽ�������ʾ�����ԡ�Ĭ�ϵ�������Ӣ�</p><p>3.2 <b>����</b>��ʹ����������趨����ִ�еIJ������������������ǩҳ��</p><p>3.2.1 <b>�ȶ�</b>�������������ǩҳ���趨BLAST����ִ�в�������������<b>��־���</b>��<b>����ֵ��ֵ</b>����BLAST��������"-M"��"-e"ָ���IJ�����BLAST�������Ĺ�����ȥ��С����Сֵ��ƥ�䡣<b>���Ƕ�(��)</b>��������ָƥ���ϵ����г���ռ�������������һ�����г��ȵİٷֱȡ�<b>�ȶԵ÷�</b>��������ָƥ��Ӧ��֤����С�÷֡�</p><p>3.2.2 <b>·��</b>�������������ǩҳ���趨BLAST������е�<b>blastall</b>��<b>formatdb</b>�����λ�ã�����������������BLAST�ȶ�������ġ���������ҪΪBLAST�����趨һ����ʱĿ¼����ȷ��������BLASTʱ��ʱ�ļ����Ա�д�����Ŀ¼��</p><p><b><font size=\"4\">4. </font></b><font size=\"4\"><b>����</b></font></p><p>4.1 <b>����BLAST��</b>ʹ�������������������������������н��бȶԡ�Ŀ�������Ͳ��ջ�������BLAST��������"-i"��"-d"ָ�������С�<b>����</b>��<b>��־���</b>��<b>����ֵ��ֵ</b>��<b>���ε��Ӷ�����</b>�ֱ���BLAST��������"-p"��"-M"��"-e"��"-F"ָ���IJ�����</p><p><b><font size=\"4\">5. ����</font></b></p><p>5.1 <b>������</b>��ʾ�������⡣</p><p>5.2 <b>���ڣ�</b>��ʾ�汾�Ͱ�Ȩ��Ϣ��</p><p><b><font size=\"5\">�˵�</font></b></p><p>VersusSNP�Ľ���ֳ��������������ĵ�������������ѡ��Ҫ�����ORF�����ڵ����˵���ѡ����������л��߱ȶԽ�������������ĸ���ǩҳ����չʾͻ�����ͺ�λ����Ϣ������������ı���ֱ�������ʾ���С��ȶԽ����ͳ����Ϣ��</p><p><font size=\"5\"><b>ʵ��</b></font></p><p><b><font size=\"4\">1. </font></b><font size=\"4\"><b>����ORF��Ϣ������</b></font></p><p>��ʹ��������ҳ�����ص����ݼ���������һ������ʹ��<b>�ļ�</b>><b>��</b>�������һ������������Ȼ����<b>���ṩ��������ORF��λ����Ϣ</b>��ѡ��<b>���</b>��ѡ��NC*.txt�ļ�������<b>���ṩ��������ORF������</b>��ѡ��<b>���</b>��ѡ��NC*.fas�ļ���</p><p><b><font size=\"4\">2. </font></b><font size=\"4\"><b>�������бȶ�</b></font></p><p>��ʹ��������ҳ�����ص����ݼ���������һ������ʹ��<b>�ļ�</b>><b>�ȶԽ��</b>���ѡ��һ��Ŀ���һ�����ջ����顣Ȼ����<b>�ȶ��ļ�</b>��ѡ��<b>���</b>��ѡ��alignment.txt�ļ�������ȷ�����ȴ��������̽�����</p><p><b><font size=\"4\">3. ��BLAST����������бȶ�</font></b></p><p>��ʹ��������ҳ�����ص����ݼ���������һ���������ȵ����������������У�Ȼ����<b>����</b>><b>·��</b>������<b>blastall</b>��<b>formatdb</b>�����λ�ã�ͬʱ��Ҫָ��һ����ʱ�ļ��洢Ŀ¼����Ҳ������<b>����</b>><b>���бȶ�</b>���趨BLAST�����в����������������ý�������ʹ��<b>����</b>><b>����BLAST</b>���ѡ����ȶԵĻ����飬����ȷ�����ȴ��ȶԹ��̽�����</p><p><font size=\"5\"><b>��Ȩ</b></font></p><p>�����Ȩ�����ʹ���߷��������������������£�����ʹ����ʹ�ü���ɢ���������װԭʼ�뼰����λ��ִ����ʽ��Ȩ�������۴˰�װ�Ƿ�����Ȼ��<br><br>- ���ڱ����Դ�������ɢ�������뱣�������İ�Ȩ���桢�����������У��� ������������������<br>- ���ڱ��������λ��ִ����ʽ����ɢ���������������ļ��Լ���������������ɢ����װ�е�ý�鷽ʽ����������֮��Ȩ���桢�����������У��Լ�����������������<br>- δ����ǰȡ��������ɣ�����ʹ���й���ѧԺ�����������о��������������֮���ƣ���Ϊ�����֮���������κα�ʾ֧�֡��Ͽɻ��ƹ㡢����֮��Ϊ��<br><br>��������������������й���ѧԺ�����������о����������֮����������״��"as is"���ṩ���������װ�����κ���ʾ��Ĭʾ֮�������Σ������������ھ��������Լ��ض�Ŀ�ĵ�������ΪĬʾ�Ե������й���ѧԺ�����������о����������֮�����ߣ������κ����������۳�����κ��������塢���۴�����Ϊ���Լ��ϵ����ʧ������������ΥԼ֮��Ȩ��������ʧ������ԭ��ȣ����𣬶����κ���ʹ�ñ������װ���������κ�ֱ���ԡ�����ԡ�ż���ԡ������ԡ��ͷ��Ի��κν�����������������������Ʒ������֮���á�ʹ����ʧ��������ʧ��������ʧ��ҵ���жϵȵȣ��������κ����Σ����ڸ���ʹ���ѻ���ǰ��֪���ܻ���ɴ�������������Ȼ��</p><p>VersusSNP��������������������GNU�Ͽ��ɹ������֤(LGPL)2.1���ϰ汾��������ġ�����LGPL���������½<a href=\"http://www.gnu.org/licenses/lgpl.html\">http://www.gnu.org/licenses/lgpl.html</a>��ȡ��</p><p><font size=\"5\"><b>����</b></font></p><p>����ʹ�ð���������ύ���뷢�͵����ʼ���<a href=\"mailto:dna_china@hotmail.com\">dna_china@hotmail.com</a>��</p></body></html>";
}
public void showDialog() {
JTextPane helpPane = new JTextPane();
helpPane.setContentType("text/html");
helpPane.setEditable(false);
helpPane.setPreferredSize(Size.dialog_panel_help);
try {
HTMLEditorKit editorKit = new HTMLEditorKit();
HTMLDocument doc = (HTMLDocument) editorKit.createDefaultDocument();
editorKit.read(new StringReader(helpDoc), doc, 0);
helpPane.setDocument(doc);
} catch (Exception e) {
e.printStackTrace();
} finally {
JOptionPane.showMessageDialog(null, new JScrollPane(helpPane, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED),
UICaption.dialog_caption_help, JOptionPane.PLAIN_MESSAGE);
}
}
}