<commit_before>package ubic.gemma.analysis.coexpression;

import ubic.basecode.io.ByteArrayConverter;
import ubic.gemma.model.expression.bioAssayData.DesignElementDataVector;

/**
 * Stores the expression profile data.
 * 
 * @author xwan
 * @author Raymond
 */
public class ExpressionProfile {
	private static ByteArrayConverter bac = new ByteArrayConverter();

	private double[] val;

	private Double rank;

	private long id;

	/**
	 * Construct an ExpressionProfile from the specified DesignElementDataVector
	 * 
	 * @param dedv -
	 *            vector to convert
	 */
	public ExpressionProfile(DesignElementDataVector dedv) {
		this.id = dedv.getId();
		byte[] bytes = dedv.getData();
		val = bac.byteArrayToDoubles(bytes);
		rank = dedv.getRank();
	}

	/**
	 * Get the ID of the vector
	 * 
	 * @return the vector ID
	 */
	public long getId() {
		return this.id;
	}

	public int getNumSamples() {
		int num = 0;
		for (double d : val) {
			if (!Double.isNaN(d))
				num++;
		}
		return num;
	}

	/**
	 * Get the relative expression level of the expression profile: k/n where k
	 * is the rank of the expression level and n is the number of expression
	 * profiles for that quantitation type
	 * 
	 * @return relative expression level
	 */
	public Double getRank() {
		return rank;
	}

}<commit_msg>Added getter for val vector<commit_after>package ubic.gemma.analysis.coexpression;

import ubic.basecode.io.ByteArrayConverter;
import ubic.gemma.model.expression.bioAssayData.DesignElementDataVector;

/**
 * Stores the expression profile data.
 * 
 * @author xwan
 * @author Raymond
 */
public class ExpressionProfile {
	private static ByteArrayConverter bac = new ByteArrayConverter();

	private double[] val;

	private Double rank;

	private long id;

	/**
	 * Construct an ExpressionProfile from the specified DesignElementDataVector
	 * 
	 * @param dedv -
	 *            vector to convert
	 */
	public ExpressionProfile(DesignElementDataVector dedv) {
		this.id = dedv.getId();
		byte[] bytes = dedv.getData();
		val = bac.byteArrayToDoubles(bytes);
		rank = dedv.getRank();
	}

	/**
	 * Get the ID of the vector
	 * 
	 * @return the vector ID
	 */
	public long getId() {
		return this.id;
	}

	public int getNumSamples() {
		int num = 0;
		for (double d : val) {
			if (!Double.isNaN(d))
				num++;
		}
		return num;
	}

	/**
	 * Get the relative expression level of the expression profile: k/n where k
	 * is the rank of the expression level and n is the number of expression
	 * profiles for that quantitation type
	 * 
	 * @return relative expression level
	 */
	public Double getRank() {
		return rank;
	}
	
	public double[] getExpressionLevels() {
		return val;
	}
}
{'fraction_non_alphanumeric': 0.10108168593808281, 'fraction_numerical': 0.0007459903021260724, 'mean_word_length': 3.332794830371567, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2564919', 'n_tokens_mistral': 884, 'n_tokens_neox': 796, 'n_words': 263}