<commit_before>package gcm2sbml.parser;

import gcm2sbml.util.GlobalConstants;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * This class describes a GCM file
 * 
 * @author <NAME>
 * @organization University of Utah
 * @email <EMAIL>
 */
public class GCMFile {

	public GCMFile() {
		species = new HashMap<String, Properties>();
		influences = new HashMap<String, Properties>();
		promoters = new HashMap<String, Properties>();
		globalParameters = new HashMap<String, String>();
		parameters = new HashMap<String, String>();
		loadDefaultParameters();
	}
	
	public String getSBMLFile() {
		return sbmlFile;
	}

	public void setSBMLFile(String file) {
		sbmlFile = file;
	}
	
	public boolean getDimAbs() {
		return dimAbs;
	}

	public void setDimAbs(boolean dimAbs) {
		this.dimAbs = dimAbs;
	}
	
	public boolean getBioAbs() {
		return bioAbs;
	}

	public void setBioAbs(boolean bioAbs) {
		this.bioAbs = bioAbs;
	}

	public void save(String filename) {
		try {
			PrintStream p = new PrintStream(new FileOutputStream(filename));
			StringBuffer buffer = new StringBuffer("digraph G {\n");
			for (String s : species.keySet()) {
				buffer.append(s + " [");
				Properties prop = species.get(s);
				for (Object propName : prop.keySet()) {
					if (propName.toString().equals(GlobalConstants.NAME)) {
						buffer.append(checkCompabilitySave(propName.toString()) + "="
								+ "\"" + prop.getProperty(propName.toString()).toString()
								+ "\"" + ",");
					} else {
						buffer.append(checkCompabilitySave(propName.toString()) + "="
								+ prop.getProperty(propName.toString()).toString()
								+ ",");
					}
				}
				if (!prop.containsKey("shape")) {
					buffer.append("shape=ellipse,");
				}
				if (!prop.containsKey("label")) {
					buffer.append("label=\"" + s + "\"");
				} else {
					buffer.deleteCharAt(buffer.lastIndexOf(","));
				}
				// buffer.deleteCharAt(buffer.length() - 1);
				buffer.append("]\n");
			}
			for (String s : influences.keySet()) {
				buffer.append(getInput(s) + " -> "// + getArrow(s) + " "
						+ getOutput(s) + " [");				
				Properties prop = influences.get(s);<commit_msg>Added quotes to labels.<commit_after>package gcm2sbml.parser;

import gcm2sbml.util.GlobalConstants;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * This class describes a GCM file
 * 
 * @author <NAME>
 * @organization University of Utah
 * @email <EMAIL>
 */
public class GCMFile {

	public GCMFile() {
		species = new HashMap<String, Properties>();
		influences = new HashMap<String, Properties>();
		promoters = new HashMap<String, Properties>();
		globalParameters = new HashMap<String, String>();
		parameters = new HashMap<String, String>();
		loadDefaultParameters();
	}
	
	public String getSBMLFile() {
		return sbmlFile;
	}

	public void setSBMLFile(String file) {
		sbmlFile = file;
	}
	
	public boolean getDimAbs() {
		return dimAbs;
	}

	public void setDimAbs(boolean dimAbs) {
		this.dimAbs = dimAbs;
	}
	
	public boolean getBioAbs() {
		return bioAbs;
	}

	public void setBioAbs(boolean bioAbs) {
		this.bioAbs = bioAbs;
	}

	public void save(String filename) {
		try {
			PrintStream p = new PrintStream(new FileOutputStream(filename));
			StringBuffer buffer = new StringBuffer("digraph G {\n");
			for (String s : species.keySet()) {
				buffer.append(s + " [");
				Properties prop = species.get(s);
				for (Object propName : prop.keySet()) {
					if ((propName.toString().equals(GlobalConstants.NAME)) ||
						(propName.toString().equals("label"))) {
						buffer.append(checkCompabilitySave(propName.toString()) + "="
								+ "\"" + prop.getProperty(propName.toString()).toString()
								+ "\"" + ",");
					} else {
						buffer.append(checkCompabilitySave(propName.toString()) + "="
								+ prop.getProperty(propName.toString()).toString()
								+ ",");
					}
				}
				if (!prop.containsKey("shape")) {
					buffer.append("shape=ellipse,");
				}
				if (!prop.containsKey("label")) {
					buffer.append("label=\"" + s + "\"");
				} else {
					buffer.deleteCharAt(buffer.lastIndexOf(","));
				}
				// buffer.deleteCharAt(buffer.length() - 1);
				buffer.append("]\n");
			}
			for (String s : influences.keySet()) {
				buffer.append(getInput(s) + " -> "// + getArrow(s) + " "
						+ getOutput(s) + " [");				
				Properties prop = influences.get(s);
{'fraction_non_alphanumeric': 0.15527443378902264, 'fraction_numerical': 0.001224239951030402, 'mean_word_length': 3.57703081232493, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '349102', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1545, 'n_words': 315}