Skip to content
Snippets Groups Projects
Commit f8b26651 authored by tjc's avatar tjc
Browse files

wrap sequence string

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@15584 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent e5408ada
No related branches found
No related tags found
No related merge requests found
......@@ -196,7 +196,6 @@ class IOUtils
StringBuffer buffSeq = null;
try
{
if(!view)
{
File newfile = new File(
......@@ -222,10 +221,8 @@ class IOUtils
if(view) // sequence viewer
{
buffSeq.append(">");
buffSeq.append(header.toString());
buffSeq.append("\n");
buffSeq.append(basesStr);
buffSeq.append(">").append(header.toString()).append("\n");
wrapString(basesStr, buffSeq);
buffSeq.append("\n");
}
else // write to file
......@@ -397,6 +394,19 @@ class IOUtils
return basesStr;
}
private static void wrapString(String bases, StringBuffer buff)
{
final int SEQUENCE_LINE_BASE_COUNT = 60;
for(int k=0; k<bases.length(); k+=SEQUENCE_LINE_BASE_COUNT)
{
int end = k + SEQUENCE_LINE_BASE_COUNT;
if(end > bases.length())
end = bases.length();
buff.append ( bases.substring(k,end) ).append("\n");
}
}
private static void writeSequence(FileWriter writer, String header, String bases) throws IOException
{
writer.write (">" + header + "\n");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment