Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pegr/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Thumbs.db
.DS_Store
.gradle
bin/
build/
out/
.idea
Expand Down
5 changes: 4 additions & 1 deletion pegr/grails-app/controllers/pegr/ApiController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -794,12 +794,15 @@ class ApiController {
case "status":
sampleService.updateSampleStatus(sample.id, sampleDict.newValue)
break
case "geoAccession":
sampleService.update(sample.id, "geoAccession", sampleDict.newValue)
break
default:
messages.push("Error: Sample ${sample.id}. Field ${sampleDict.field} cannot be edited.")
break
}
} catch(Exception e) {
messages.push("Error: sample=${sampleDict.sampleID} and field=${sampleDict.field}. ${e.message}")
messages.push("Error: sample=${sampleDict.sampleID} and field=${sampleDict.field}. ")
}
}

Expand Down
2 changes: 2 additions & 0 deletions pegr/grails-app/domain/pegr/Sample.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class Sample {
String recommend
GrowthMedia growthMedia
String naturalId
String geoAccession

List getRuns() {
return SequencingExperiment.where{sample == this}.collect{it.sequenceRun}
Expand Down Expand Up @@ -87,6 +88,7 @@ class Sample {
recommend nullable: true
growthMedia nullable: true
naturalId nullable: true
geoAccession nullable: true, blank: true,unique: true
}

static mapping = {
Expand Down
9 changes: 9 additions & 0 deletions pegr/grails-app/migrations/add_geo.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
databaseChangeLog = {

changeSet(author: "danyingshao (generated)", id: "1620671544575-3") {
addColumn(tableName: "sample") {
column(name: "geo_accession", type: "varchar(255)")
}
}

}
1 change: 1 addition & 0 deletions pegr/grails-app/migrations/changelog.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2506,4 +2506,5 @@ databaseChangeLog = {
include file: 'add_default_pipeline.groovy'
include file: 'add_quality_control_file.groovy'
include file: 'remove_index_version.groovy'
include file: 'add_geo.groovy'
}
2 changes: 1 addition & 1 deletion pegr/grails-app/services/pegr/AlignmentStatsService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class AlignmentStatsService {
}

/**
* Get the motif count from meme file
* Get the motif count from meme file. Obsolete.
* @param datasets a list of maps
* @return motifCount
*/
Expand Down
14 changes: 12 additions & 2 deletions pegr/grails-app/services/pegr/SampleService.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,14 @@ class SampleService {

@Transactional
def updateOther(Sample sample, String indexType, String indices) {
try {
sample.save()
try {
sample.save(flush: true, failOnError: true)
} catch (grails.validation.ValidationException e) {
def errorMsg = sample.errors.fieldErrors
.collect { it.field }
.join("; ")

throw new SampleException(message: "Error in " + errorMsg)
} catch (Exception e) {
throw new SampleException(message: "Error saving the sample!")
}
Expand Down Expand Up @@ -509,6 +515,10 @@ class SampleService {
sample.assay = getAssay(value)
sample.save(faileOnError: true)
break
case "geoAccession" :
sample.geoAccession = value
sample.save(failOnError: true)
break
default:
sample[field] = utilityService.getFloat(value)
sample.save(failOnError: true)
Expand Down
1 change: 1 addition & 0 deletions pegr/grails-app/views/help/bioinformaticsApiHelp.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ https://vesta.vmhost.psu.edu/pegr/api/updateSampleData?apiKey=
<li>requestedGenomes (if multiple genomes are requested, use comma "," to deliminate the strings, e.g. "hg19,hg38")</li>
<li>requestedPipelines (if multiple pipelines are requested, use comma "," to deliminate the strings, e.g. "paired-004,fastq-001")</li>
<li>status</li>
<li>geoAccession</li>
</ol>

<p>After a request is posted, PEGR will return the status code and a message as below</p>
Expand Down
2 changes: 2 additions & 0 deletions pegr/grails-app/views/report/_moduleFiles.gsp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<h3>Files</h3>
<table class="table table-bordered">
<thead>
<th>Sample ID</th>
<th>Sequence Run</th>
<th>Fastq Files</th>
<th>Fastqc Reports</th>
Expand All @@ -12,6 +13,7 @@
<g:each in="${sampleDTOs}" var="sample">
<g:each in="${sample.experiments}" var="experiment">
<tr>
<td rowspan="${Math.max(1,experiment.alignments.size())}"><g:link controller="sample" action="show" id="${sample.id}">${sample.id}</g:link> ${sample.naturalId}</td>
<td rowspan="${Math.max(1,experiment.alignments.size())}">Run${experiment.runId}</td>
<td rowspan="${Math.max(1,experiment.alignments.size())}">
<g:if test="${experiment.fastq?.read1}">
Expand Down
9 changes: 5 additions & 4 deletions pegr/grails-app/views/sample/_details.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -238,27 +238,28 @@
</h4>
<table class="table table-bordered">
<tbody>
<tr><td>Sample Natural ID</td><td> ${sample.naturalId}</td></tr>
<tr><td>Sample natural ID</td><td> ${sample.naturalId}</td></tr>
<tr><td>Index</td><td> ${sample.sequenceIndicesString} (${sample.sequenceIndicesIdString})</td></tr>

<tr><td>Chromatin (ug)</td><td> <g:if test="${sample?.chromosomeAmount}">${sample.chromosomeAmount}</g:if></td></tr>

<tr><td>Avail. Cell# per aliquot (M)</td><td> <g:if test="${sample?.cellNumber}">${sample.cellNumber}</g:if></td></tr>
<tr><td>Avail. cell# per aliquot (M)</td><td> <g:if test="${sample?.cellNumber}">${sample.cellNumber}</g:if></td></tr>

<tr><td>Volume per aliquot (ul)</td><td> <g:if test="${sample?.volume}">${sample.volume}</g:if></td></tr>

<tr><td>Requested Tags (M)</td><td> <g:if test="${sample?.requestedTagNumber}">${sample.requestedTagNumber}</g:if></td></tr>
<tr><td>Requested tags (M)</td><td> <g:if test="${sample?.requestedTagNumber}">${sample.requestedTagNumber}</g:if></td></tr>

<tr><td>Requested genomes</td><td> ${sample?.requestedGenomes}</td></tr>

<tr><td>Send data to</td><td> ${sample?.sendDataTo}</td></tr>

<g:if test="${sample?.publicationReference}">
<tr><td>Publication Reference</td><td> ${sample.publicationReference}</td></tr>
<tr><td>Publication reference</td><td> ${sample?.publicationReference}</td></tr>
</g:if>

<g:if test="${sample.note}">
<tr><td>Notes</td><td> ${sample.note}</td></tr>
<tr><td>GEO accession</td><td> ${sample?.geoAccession}</td></tr>
</g:if>
</tbody>
</table>
Expand Down
10 changes: 7 additions & 3 deletions pegr/grails-app/views/sample/editOther.gsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<g:form action="updateOther" class="fields">
<g:hiddenField name="sampleId" value="${sample.id}"></g:hiddenField>
<div>
<label>Sample Natural ID</label>
<label>Sample natural ID</label>
<input name="naturalId" size="40" value="${sample.naturalId}">
</div>
<div>
Expand All @@ -33,7 +33,7 @@
<input name="volume" class="isnumber" value="${sample.volume}">
</div>
<div>
<label>Requested Tags (M)</label>
<label>Requested tags (M)</label>
<input name="requestedTagNumber" class="isnumber" value="${sample.requestedTagNumber}">
</div>
<div>
Expand All @@ -46,13 +46,17 @@
<g:select class="sendTo no-tag-select2" name="sendToId" from="${pegr.User.list()}" optionKey="id" style="width: 150px" value="${sample.sendDataTo}"></g:select>
</div>
<div>
<label>Publication Reference</label>
<label>Publication reference</label>
<input name="publicationReference" value="${sample.publicationReference}">
</div>
<div>
<label>Notes</label>
<textarea name="note" cols="60" rows="4">${sample.note}</textarea>
</div>
<div>
<label>GEO Accession</label>
<input name="geoAccession" value="${sample.geoAccession}">
</div>
<div>
<g:submitButton name="save" value="Save" class="btn btn-primary"></g:submitButton>
<g:link action="edit" params="[sampleId: sample.id]" class="btn btn-default">Cancel</g:link>
Expand Down