use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ArrayDesignMergeServiceImpl method createMerged.
/**
* @param mergeWithExisting i.e., "add", assuming arrayDesign is already a merged design.
*/
private ArrayDesign createMerged(ArrayDesign arrayDesign, Collection<ArrayDesign> otherArrayDesigns, Map<BioSequence, Collection<CompositeSequence>> globalBsMap, String newName, String newShortName, boolean mergeWithExisting) {
ArrayDesign result = this.formMergedDesign(arrayDesign, otherArrayDesigns, newName, newShortName, mergeWithExisting);
Collection<CompositeSequence> newProbes = this.makeNewProbes(result, globalBsMap, mergeWithExisting);
result = mergeServiceHelper.persistMerging(result, arrayDesign, otherArrayDesigns, mergeWithExisting, newProbes);
arrayDesignReportService.generateArrayDesignReport(result.getId());
return result;
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class CompositeSequenceParser method parseOneLine.
@Override
public CompositeSequence parseOneLine(String line) {
String[] tokens = StringUtils.splitPreserveAllTokens(line, '\t');
if (tokens.length != 3) {
return null;
}
String probeid = tokens[0];
String genbankAcc = tokens[1];
String description = tokens[2];
CompositeSequence result = CompositeSequence.Factory.newInstance();
result.setName(probeid);
result.setDescription(description);
DatabaseEntry dbEntry = ExternalDatabaseUtils.getGenbankAccession(genbankAcc);
BioSequence biologicalCharacteristic = BioSequence.Factory.newInstance();
// this will be changed later, typically.
biologicalCharacteristic.setName(genbankAcc);
// this will be changed later, typically.
biologicalCharacteristic.setDescription(description + " (From platform source)");
biologicalCharacteristic.setSequenceDatabaseEntry(dbEntry);
result.setBiologicalCharacteristic(biologicalCharacteristic);
return result;
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class BaseExpressionDataMatrix method selectVectors.
Collection<DesignElementDataVector> selectVectors(Collection<? extends DesignElementDataVector> vectors, QuantitationType quantitationType) {
this.quantitationTypes.add(quantitationType);
Collection<DesignElementDataVector> vectorsOfInterest = new LinkedHashSet<>();
int i = 0;
for (DesignElementDataVector vector : vectors) {
QuantitationType vectorQuantitationType = vector.getQuantitationType();
if (vectorQuantitationType.equals(quantitationType)) {
if (this.expressionExperiment == null)
this.expressionExperiment = vector.getExpressionExperiment();
vectorsOfInterest.add(vector);
this.getQuantitationTypes().add(vectorQuantitationType);
CompositeSequence designElement = vector.getDesignElement();
bioAssayDimensions.put(designElement, vector.getBioAssayDimension());
this.addToRowMaps(i, designElement);
i++;
}
}
return vectorsOfInterest;
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ExpressionDataDoubleMatrix method getRows.
@Override
public Double[][] getRows(List<CompositeSequence> designElements) {
if (designElements == null) {
return null;
}
Double[][] result = new Double[designElements.size()][];
int i = 0;
for (CompositeSequence element : designElements) {
Double[] rowResult = this.getRow(element);
result[i] = rowResult;
i++;
}
return result;
}
use of ubic.gemma.model.expression.designElement.CompositeSequence in project Gemma by PavlidisLab.
the class ExpressionDataIntegerMatrix method createMatrix.
/**
* Fill in the data
*
* @return DoubleMatrixNamed
*/
private IntegerMatrix<CompositeSequence, Integer> createMatrix(Collection<? extends DesignElementDataVector> vectors, int maxSize) {
int numRows = this.rowDesignElementMapByInteger.keySet().size();
IntegerMatrix<CompositeSequence, Integer> mat = new IntegerMatrix<>(numRows, maxSize);
for (int j = 0; j < mat.columns(); j++) {
mat.addColumnName(j);
}
// initialize the matrix to 0
for (int i = 0; i < mat.rows(); i++) {
for (int j = 0; j < mat.columns(); j++) {
mat.set(i, j, 0);
}
}
ByteArrayConverter bac = new ByteArrayConverter();
Map<Integer, CompositeSequence> rowNames = new TreeMap<>();
for (DesignElementDataVector vector : vectors) {
CompositeSequence designElement = vector.getDesignElement();
assert designElement != null : "No design element for " + vector;
Integer rowIndex = this.rowElementMap.get(designElement);
assert rowIndex != null;
rowNames.put(rowIndex, designElement);
byte[] bytes = vector.getData();
int[] vals = bac.byteArrayToInts(bytes);
BioAssayDimension dimension = vector.getBioAssayDimension();
Collection<BioAssay> bioAssays = dimension.getBioAssays();
assert bioAssays.size() == vals.length : "Expected " + vals.length + " got " + bioAssays.size();
Iterator<BioAssay> it = bioAssays.iterator();
this.setMatBioAssayValues(mat, rowIndex, ArrayUtils.toObject(vals), bioAssays, it);
}
for (int i = 0; i < mat.rows(); i++) {
mat.addRowName(rowNames.get(i));
}
ExpressionDataIntegerMatrix.log.debug("Created a " + mat.rows() + " x " + mat.columns() + " matrix");
return mat;
}
Aggregations