package util;

import org.junit.Ignore;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Random;

/**
 * Generates alignment files (.aligned format) for testing
 *
 * @author Jim Robinson
 * @date 3/2/12
 */
@Ignore
public class AlignmentFileGenerator {
    
    static Random RAND = new Random();

    public static void main(String[] args) throws IOException {

        String outputFile = "wide_spread.aligned";
        String chr = "chr1";
        int averageDepth = 2000;
        int avgReadSize = 100;
        int readSigma = 20;
        int interval = 1000;

        PrintWriter pw = null;

        try {
            pw = new PrintWriter(new FileWriter(outputFile));

            int averageReadsPerPosition = averageDepth / avgReadSize;

            int startPosition = 100; // arbitrary
            for (int pos = startPosition; pos < startPosition + interval; pos++) {
                
                int readSize = avgReadSize + (int) (readSigma * RAND.nextGaussian());
                int readCount = RAND.nextInt(2*averageReadsPerPosition);
                while (readCount-- > 0) {
                    pw.println(chr + "\t" + pos + "\t" + (pos + readSize) + "\t+");
                }

            }

        } finally {
            if (pw != null) pw.close();
        }

    }
}

@@ -299,20 +299,16 @@
 rator %7B%0A
-    
 %0A    sta
@@ -438,19 +438,12 @@
  = %22
-wide_spread
+test
 .ali
@@ -505,17 +505,17 @@
 Depth = 
-2
+1
 000;%0A   
@@ -537,18 +537,17 @@
 dSize = 
-10
+5
 0;%0A     
@@ -569,10 +569,9 @@
 a = 
-20
+5
 ;%0A  
@@ -591,21 +591,99 @@
 erval = 
-1000;
+200;%0A        boolean append = false;%0A%0A        int startPosition = 800; // arbitrary
 %0A%0A      
@@ -780,16 +780,24 @@
 tputFile
+, append
 ));%0A%0A   
@@ -797,34 +797,36 @@
 );%0A%0A            
-in
+floa
 t averageReadsPe
@@ -836,16 +836,24 @@
 sition =
+ (float)
  average
@@ -878,58 +878,8 @@
 e;%0A%0A
-            int startPosition = 100; // arbitrary%0A
     
@@ -957,32 +957,16 @@
 os++) %7B%0A
-                
 %0A       
@@ -1060,21 +1060,26 @@
         
-int r
+float avgR
 eadCount
@@ -1085,47 +1085,188 @@
 t = 
-RAND.nextInt(2*averageReadsPerPosition)
+2 * averageReadsPerPosition * RAND.nextFloat();%0A                int readCount = (int) avgReadCount;%0A                readCount += avgReadCount - readCount %3C RAND.nextFloat() ? 1 : 0
 ;%0A  

Add some more options and play with AlignmentFileGenerator