use of org.jbei.ice.lib.entry.sequence.analysis.TraceSequences in project ice by JBEI.
the class PartResource method deleteTrace.
@DELETE
@Path("/{id}/traces/{traceId}")
public Response deleteTrace(@Context final UriInfo info, @PathParam("id") final long partId, @PathParam("traceId") final long traceId) {
final String userId = getUserId();
TraceSequences traceSequences = new TraceSequences();
if (!traceSequences.deleteTraceSequence(userId, partId, traceId)) {
return super.respond(Response.Status.UNAUTHORIZED);
}
return super.respond(Response.Status.OK);
}
use of org.jbei.ice.lib.entry.sequence.analysis.TraceSequences in project ice by JBEI.
the class PartSequence method update.
/**
* Updates the sequence information associated with this part with the referenced one.
* <br>
* Write privileges on the entry are required
*
* @param updatedSequence new sequence to associate with this part
*/
public void update(FeaturedDNASequence updatedSequence, boolean parseSequence) {
entryAuthorization.expectWrite(userId, entry);
Sequence existing = sequenceDAO.getByEntry(this.entry);
// update with raw sequence if no sequence object is passed
if (parseSequence) {
// sometimes the whole sequence is sent in the string portion (when there are no features)
// no features to add
updatedSequence = GeneralParser.parse(updatedSequence.getSequence());
} else if (updatedSequence.getSequence().isEmpty() && StringUtils.isNotBlank(existing.getSequence())) {
updatedSequence.setSequence(existing.getSequence());
}
// convert sequence wrapper to sequence storage model
Sequence sequence = SequenceUtil.dnaSequenceToSequence(updatedSequence);
if (sequence == null)
return;
// todo : commenting out for now
if (existing != null) {
SequenceVersionHistory history = new SequenceVersionHistory(userId, existing.getId());
// get features for existing entry
existing.setSequenceFeatures(new HashSet<>(sequenceFeatureDAO.getEntrySequenceFeatures(this.entry)));
// 1. check sequence string to see if it has changed
checkSequenceString(history, existing, sequence);
// 2. check features
checkForNewFeatures(existing, sequence);
// 3. check for removed features
checkRemovedFeatures(existing, sequence);
// 4. check if any existing features are updated
checkForUpdatedFeatures(existing, sequence);
// rebuild the trace sequence alignments // todo : this might not be needed for all updates
new TraceSequences().rebuildAllAlignments(entry);
// rebuild blast
scheduleBlastIndexRebuildTask(Action.UPDATE, this.entry.getPartNumber());
} else {
save(updatedSequence);
}
}
use of org.jbei.ice.lib.entry.sequence.analysis.TraceSequences in project ice by JBEI.
the class FileResource method getTraceSequenceFile.
@GET
@Path("trace/{fileId}")
public Response getTraceSequenceFile(@PathParam("fileId") String fileId, @QueryParam("sid") String sid) {
TraceSequences traceSequences = new TraceSequences();
final TraceSequence traceSequence = traceSequences.getTraceSequenceByFileId(fileId);
if (traceSequence != null) {
final File file = traceSequences.getFile(traceSequence);
return addHeaders(Response.ok(file), traceSequence.getFilename());
}
return Response.serverError().build();
}
use of org.jbei.ice.lib.entry.sequence.analysis.TraceSequences in project ice by JBEI.
the class SequenceTraceResource method updateSequences.
@PUT
@Consumes(MediaType.MULTIPART_FORM_DATA)
@Produces(MediaType.APPLICATION_JSON)
public Response updateSequences(@FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition contentDisposition) {
String userId = requireUserId();
TraceSequences sequences = new TraceSequences();
List<String> errors = sequences.bulkUpdate(userId, fileInputStream);
return super.respond(errors);
}
Aggregations