<commit_before>package edu.psu.compbio.seqcode.projects.akshay.Utils;

import java.io.File;
import java.util.List;

import edu.psu.compbio.seqcode.gse.datasets.general.Point;
import edu.psu.compbio.seqcode.gse.datasets.general.Region;
import edu.psu.compbio.seqcode.gse.datasets.species.Genome;
import edu.psu.compbio.seqcode.gse.datasets.species.Organism;
import edu.psu.compbio.seqcode.gse.tools.utils.Args;
import edu.psu.compbio.seqcode.gse.utils.ArgParser;
import edu.psu.compbio.seqcode.gse.utils.NotFoundException;
import edu.psu.compbio.seqcode.gse.utils.Pair;
import edu.psu.compbio.seqcode.projects.shaun.Utilities;

public class DnaMethOverlapStat {
	
	private List<Point> pts;
	private int winSize;
	private List<Region> regs;
	private Genome gen;
	private RRbsBEDLoader loader;
	
	
	
	public DnaMethOverlapStat(Genome g, String peaks_file, int win, String MethBED_File) {
		this.gen = g;
		this.winSize = win;
		this.pts = Utilities.loadPeaksFromPeakFile(g, peaks_file, this.winSize);
		this.regs = Utilities.loadRegionsFromPeakFile(gen, peaks_file, winSize);
		
		File Bed_file = new File(MethBED_File);
		this.loader = new RRbsBEDLoader(this.gen,Bed_file);
		loader.sourceReads();
	}
	
	
	public void printMethPercs(){
		for(Region r : this.regs){
			double perc = loader.getMethPerc(r).car();
			int num_sites = loader.getMethPerc(r).cdr();
			if(Double.isNaN(perc)){
				System.out.println(r.getLocationString()+"\t"+"0"+"\t"+num_sites);
			}else{
				System.out.println(r.getLocationString()+"\t"+Double.toString(perc)+"\t"+num_sites);
			}
		}
	}
	
	
	public static void main(String[] args) throws NotFoundException{
		ArgParser ap = new ArgParser(args);
		
		String locations_file = ap.getKeyValue("points");
		String MethBed_file = ap.getKeyValue("methBed");
		
		Genome gen = null;
		if(ap.hasKey("species")){
			Pair<Organism, Genome> pair = Args.parseGenome(args);
			if(pair != null){
				
				gen = pair.cdr();
			}
		}else{
			if(ap.hasKey("geninfo") || ap.hasKey("g")){
				//Make fake genome... chr lengths provided
				String fName = ap.hasKey("geninfo") ? ap.getKeyValue("geninfo") : ap.getKeyValue("g");
				gen = new Genome("Genome", new File(fName), true);
			}else{
				gen = null;
			}
		}
		<commit_msg>further modifying the output format<commit_after>package edu.psu.compbio.seqcode.projects.akshay.Utils;

import java.io.File;
import java.util.List;

import edu.psu.compbio.seqcode.gse.datasets.general.Point;
import edu.psu.compbio.seqcode.gse.datasets.general.Region;
import edu.psu.compbio.seqcode.gse.datasets.species.Genome;
import edu.psu.compbio.seqcode.gse.datasets.species.Organism;
import edu.psu.compbio.seqcode.gse.tools.utils.Args;
import edu.psu.compbio.seqcode.gse.utils.ArgParser;
import edu.psu.compbio.seqcode.gse.utils.NotFoundException;
import edu.psu.compbio.seqcode.gse.utils.Pair;
import edu.psu.compbio.seqcode.projects.shaun.Utilities;

public class DnaMethOverlapStat {
	
	private List<Point> pts;
	private int winSize;
	private List<Region> regs;
	private Genome gen;
	private RRbsBEDLoader loader;
	
	
	
	public DnaMethOverlapStat(Genome g, String peaks_file, int win, String MethBED_File) {
		this.gen = g;
		this.winSize = win;
		this.pts = Utilities.loadPeaksFromPeakFile(g, peaks_file, this.winSize);
		this.regs = Utilities.loadRegionsFromPeakFile(gen, peaks_file, winSize);
		
		File Bed_file = new File(MethBED_File);
		this.loader = new RRbsBEDLoader(this.gen,Bed_file);
		loader.sourceReads();
	}
	
	
	public void printMethPercs(){
		for(Region r : this.regs){
			double perc = loader.getMethPerc(r).car();
			int num_sites = loader.getMethPerc(r).cdr();
			if(num_sites > 0){
				System.out.println(r.getLocationString()+"\t"+Double.toString(perc)+"\t"+num_sites);
			}
		}
	}
	
	
	public static void main(String[] args) throws NotFoundException{
		ArgParser ap = new ArgParser(args);
		
		String locations_file = ap.getKeyValue("points");
		String MethBed_file = ap.getKeyValue("methBed");
		
		Genome gen = null;
		if(ap.hasKey("species")){
			Pair<Organism, Genome> pair = Args.parseGenome(args);
			if(pair != null){
				
				gen = pair.cdr();
			}
		}else{
			if(ap.hasKey("geninfo") || ap.hasKey("g")){
				//Make fake genome... chr lengths provided
				String fName = ap.hasKey("geninfo") ? ap.getKeyValue("geninfo") : ap.getKeyValue("g");
				gen = new Genome("Genome", new File(fName), true);
			}else{
				gen = null;
			}
		}
		
{'fraction_non_alphanumeric': 0.14130434782608695, 'fraction_numerical': 0.0004528985507246377, 'mean_word_length': 4.321686746987952, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6891291', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1643, 'n_words': 281}