diff --git a/pegr/.gitignore b/pegr/.gitignore index bb73e874..395c3d0a 100644 --- a/pegr/.gitignore +++ b/pegr/.gitignore @@ -1,6 +1,7 @@ Thumbs.db .DS_Store .gradle +bin/ build/ out/ .idea diff --git a/pegr/grails-app/controllers/pegr/ApiController.groovy b/pegr/grails-app/controllers/pegr/ApiController.groovy index 8f4d13b0..0fbf44eb 100644 --- a/pegr/grails-app/controllers/pegr/ApiController.groovy +++ b/pegr/grails-app/controllers/pegr/ApiController.groovy @@ -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}. ") } } diff --git a/pegr/grails-app/domain/pegr/Sample.groovy b/pegr/grails-app/domain/pegr/Sample.groovy index 8e631b18..f37d64c3 100644 --- a/pegr/grails-app/domain/pegr/Sample.groovy +++ b/pegr/grails-app/domain/pegr/Sample.groovy @@ -27,6 +27,7 @@ class Sample { String recommend GrowthMedia growthMedia String naturalId + String geoAccession List getRuns() { return SequencingExperiment.where{sample == this}.collect{it.sequenceRun} @@ -87,6 +88,7 @@ class Sample { recommend nullable: true growthMedia nullable: true naturalId nullable: true + geoAccession nullable: true, blank: true,unique: true } static mapping = { diff --git a/pegr/grails-app/migrations/add_geo.groovy b/pegr/grails-app/migrations/add_geo.groovy new file mode 100644 index 00000000..a6acd91b --- /dev/null +++ b/pegr/grails-app/migrations/add_geo.groovy @@ -0,0 +1,9 @@ +databaseChangeLog = { + + changeSet(author: "danyingshao (generated)", id: "1620671544575-3") { + addColumn(tableName: "sample") { + column(name: "geo_accession", type: "varchar(255)") + } + } + +} diff --git a/pegr/grails-app/migrations/changelog.groovy b/pegr/grails-app/migrations/changelog.groovy index bd00a2d9..093f2768 100644 --- a/pegr/grails-app/migrations/changelog.groovy +++ b/pegr/grails-app/migrations/changelog.groovy @@ -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' } diff --git a/pegr/grails-app/services/pegr/AlignmentStatsService.groovy b/pegr/grails-app/services/pegr/AlignmentStatsService.groovy index 4d77c099..adaacb9d 100644 --- a/pegr/grails-app/services/pegr/AlignmentStatsService.groovy +++ b/pegr/grails-app/services/pegr/AlignmentStatsService.groovy @@ -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 */ diff --git a/pegr/grails-app/services/pegr/SampleService.groovy b/pegr/grails-app/services/pegr/SampleService.groovy index a48e1fc9..cca349f5 100644 --- a/pegr/grails-app/services/pegr/SampleService.groovy +++ b/pegr/grails-app/services/pegr/SampleService.groovy @@ -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!") } @@ -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) diff --git a/pegr/grails-app/views/help/bioinformaticsApiHelp.gsp b/pegr/grails-app/views/help/bioinformaticsApiHelp.gsp index 0c1b70a3..1e19a12f 100644 --- a/pegr/grails-app/views/help/bioinformaticsApiHelp.gsp +++ b/pegr/grails-app/views/help/bioinformaticsApiHelp.gsp @@ -437,6 +437,7 @@ https://vesta.vmhost.psu.edu/pegr/api/updateSampleData?apiKey=
  • requestedGenomes (if multiple genomes are requested, use comma "," to deliminate the strings, e.g. "hg19,hg38")
  • requestedPipelines (if multiple pipelines are requested, use comma "," to deliminate the strings, e.g. "paired-004,fastq-001")
  • status
  • +
  • geoAccession
  • After a request is posted, PEGR will return the status code and a message as below

    diff --git a/pegr/grails-app/views/report/_moduleFiles.gsp b/pegr/grails-app/views/report/_moduleFiles.gsp index 9e5f9a51..9031c036 100644 --- a/pegr/grails-app/views/report/_moduleFiles.gsp +++ b/pegr/grails-app/views/report/_moduleFiles.gsp @@ -1,6 +1,7 @@

    Files

    + @@ -12,6 +13,7 @@ +
    Sample ID Sequence Run Fastq Files Fastqc Reports
    ${sample.id} ${sample.naturalId} Run${experiment.runId} diff --git a/pegr/grails-app/views/sample/_details.gsp b/pegr/grails-app/views/sample/_details.gsp index 1633b7f5..cb900257 100644 --- a/pegr/grails-app/views/sample/_details.gsp +++ b/pegr/grails-app/views/sample/_details.gsp @@ -238,27 +238,28 @@ - + - + - + - + +
    Sample Natural ID ${sample.naturalId}
    Sample natural ID ${sample.naturalId}
    Index ${sample.sequenceIndicesString} (${sample.sequenceIndicesIdString})
    Chromatin (ug) ${sample.chromosomeAmount}
    Avail. Cell# per aliquot (M) ${sample.cellNumber}
    Avail. cell# per aliquot (M) ${sample.cellNumber}
    Volume per aliquot (ul) ${sample.volume}
    Requested Tags (M) ${sample.requestedTagNumber}
    Requested tags (M) ${sample.requestedTagNumber}
    Requested genomes ${sample?.requestedGenomes}
    Send data to ${sample?.sendDataTo}
    Publication Reference ${sample.publicationReference}
    Publication reference ${sample?.publicationReference}
    Notes ${sample.note}
    GEO accession ${sample?.geoAccession}
    diff --git a/pegr/grails-app/views/sample/editOther.gsp b/pegr/grails-app/views/sample/editOther.gsp index f20a7b3a..964ce7dd 100644 --- a/pegr/grails-app/views/sample/editOther.gsp +++ b/pegr/grails-app/views/sample/editOther.gsp @@ -12,7 +12,7 @@
    - +
    @@ -33,7 +33,7 @@
    - +
    @@ -46,13 +46,17 @@
    - +
    +
    + + +
    Cancel