Skip to content

Instantly share code, notes, and snippets.

@mutterer
Last active December 7, 2020 14:28
Show Gist options
  • Save mutterer/a7f2da3f3a4937cbd86279259e698cdb to your computer and use it in GitHub Desktop.
Save mutterer/a7f2da3f3a4937cbd86279259e698cdb to your computer and use it in GitHub Desktop.
import_ab1_sequence_csv_from_cutepeaks.ijm
// cutepeaks exports ab1 files as tab delimited csv
// this macro replaces tabs with commas
// reopens peaks file
// and builds a nucleotide plot
// v 1.0 : 20201109
// 1.1 : 20201207 handles csv files with different columns ordering
s=File.openAsString("");
name = File.name;
s=s.replace('\t',',');
f=File.open(getDirectory('imagej')+"fixed.csv");
print(f,s);
File.close(f);
open(getDirectory('imagej')+"fixed.csv");
Table.rename("fixed.csv", name);
h=split(Table.headings,"\t");
for (i=0;i<4;i++) {
if (h[i].startsWith("#"))
Table.renameColumn(h[i], h[i].substring(1));
}
Plot.create("Plot Peaks", "distance", "value");
Plot.add("Line", Table.getColumn("G", name));
Plot.setStyle(0, "black,#a0a0ff,1.0,Line");
Plot.add("Line", Table.getColumn("A", name));
Plot.setStyle(1, "green,#a0a0ff,1.0,Line");
Plot.add("Line", Table.getColumn("T", name));
Plot.setStyle(2, "red,#a0a0ff,1.0,Line");
Plot.add("Line", Table.getColumn("C", name));
Plot.setStyle(3, "blue,#a0a0ff,1.0,Line");
Plot.setLimits(-20, 500, -100, 4000);
@mutterer
Copy link
Author

mutterer commented Nov 9, 2020

See tutorial here
example output
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment