From 4be4bda2052e155efc60544c9308f4b47638f648 Mon Sep 17 00:00:00 2001 From: nmcb Date: Sat, 4 Jul 2026 06:44:37 +0200 Subject: [PATCH 1/2] add osv scan --- .github/workflows/scala-build.yml | 2 +- project/plugins.sbt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 project/plugins.sbt diff --git a/.github/workflows/scala-build.yml b/.github/workflows/scala-build.yml index 28c13f3..23f2be6 100644 --- a/.github/workflows/scala-build.yml +++ b/.github/workflows/scala-build.yml @@ -22,4 +22,4 @@ jobs: - uses: sbt/setup-sbt@v1 - name: sbt-test shell: bash - run: sbt -v +test + run: sbt -v +test osvScan diff --git a/project/plugins.sbt b/project/plugins.sbt new file mode 100644 index 0000000..d4d451d --- /dev/null +++ b/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("net.nmoncho" % "sbt-osv" % "0.2.0") From 92d8efebbbc17bac32c9cf41bf4664a4beba3b3a Mon Sep 17 00:00:00 2001 From: nmcb Date: Thu, 23 Jul 2026 09:21:14 +0200 Subject: [PATCH 2/2] refactor stop codons --- src/main/scala/emc/rna/Codon.scala | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/main/scala/emc/rna/Codon.scala b/src/main/scala/emc/rna/Codon.scala index fb406f7..656c1e8 100644 --- a/src/main/scala/emc/rna/Codon.scala +++ b/src/main/scala/emc/rna/Codon.scala @@ -4,7 +4,7 @@ package rna case class Codon(_1: Nucleotide, _2: Nucleotide, _3: Nucleotide) derives CanEqual: lazy val asRNA : RNA = RNA(_1, _2, _3) lazy val isStart: Boolean = Codon.Start.equals(this) - lazy val isStop: Boolean = Codon.StopCodons.contains(this) + lazy val isStop: Boolean = Codon.Stop.Codons.contains(this) def aminoAcid: AminoAcid = AminoAcid.fromCodon(this).getOrElse(sys.error("dirty rna")) @@ -34,25 +34,24 @@ object Codon: val Occur = Codon(U,G,A) val Opal = Codon(U,A,A) + /** + * Convenience definition for the set of stop codons. + */ + val Codons: Set[Codon] = + Set(Amber, Occur, Opal) + + /** + * Convenience definition of the set of stop codon names. + */ + val CodonNames: Codon => String = + Map(Amber -> "Amber", Occur -> "Occur", Opal -> "Opal") + def apply(n1: Nucleotide, n2: Nucleotide, n3: Nucleotide): Codon = Codon(n1, n2, n3) def unapply(codon: Codon): Option[(Nucleotide,Nucleotide,Nucleotide)] = if codon.isStop then Some((codon._1, codon._2, codon._3)) else None - import Stop.* - - /** - * Convenience definition for the set of stop codons. - */ - val StopCodons: Set[Codon] = - Set(Amber, Occur, Opal) - - /** - * Convenience definition of the set of stop codon names. - */ - val StopCodonNames: Codon => String = - Map(Amber -> "Amber", Occur -> "Occur", Opal -> "Opal") /** * Constructs a codon from the first three nucleotides of given sequence.