public static void convert(ResourceLocator resourceLocator, File outputFile, String probeResource,
int maxRecords, File tmpDir, Genome genome) throws IOException {
ExpressionFileParser.FileType type = ExpressionFileParser.determineType(resourceLocator);
GeneToLocusHelper locusHelper = new GeneToLocusHelper(probeResource);
BufferedReader reader = null;
PrintWriter writer = null;
SortingCollection cltn = getSortingCollection(maxRecords, tmpDir);
try {
reader = new BufferedReader(new InputStreamReader(ParsingUtils.openInputStream(resourceLocator.getPath())));
writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
ExpressionFileParser.FormatDescriptor formatDescriptor = ExpressionFileParser.parseHeader (reader, type, null);
String [] dataHeadings = formatDescriptor.getDataHeaders();
// Need a better way to determine type!
String dataType = resourceLocator.getPath().contains("methylation") ? TrackType.DNA_METHYLATION.toString()
: TrackType.GENE_EXPRESSION.toString();
writer.println("#type=" + dataType);
writer.print("Chr\tStart\tEnd\tProbe");
for (String s : dataHeadings) {
writer.print("\t" + s);
}
writer.println();
String nextLine = null;
while ((nextLine = reader.readLine()) != null) {
// A gct row can map to multiple loci, normally this indicates a problem with the probe
DataRow row = new DataRow(nextLine, formatDescriptor);
String probe = row.getProbe();
List<Locus> loci = locusHelper.getLoci(probe, row.getDescription(), genome.getId());
if (loci == null || loci.isEmpty()) {
log.warn("No locus found for: " + probe + " " + row.getDescription());
} else {
for (Locus locus : loci) {
String igvLine = locus.getChr() + "\t" + locus.getStart() + "\t" + locus.getEnd() + "\t" + probe +