Skip to content

Commit

Permalink
Merge pull request #1 from PerkinElmer/CLN-54033
Browse files Browse the repository at this point in the history
CLN-54033: support RNA sequence
  • Loading branch information
sunm19810-pki authored Jul 24, 2023
2 parents 9078f64 + 62dd54e commit 42aaa83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion packages/bio-parsers/src/genbankToJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ function genbankToJson(string, options = {}) {

if (
j === 4 &&
(item.match(/ds-dna/i) || item.match(/ss-dna/i) || item.match(/dna/i))
(item.match(/ds-dna/i) || item.match(/ss-dna/i) || item.match(/dna/i) || item.match(/rna/i))
) {
if (options.isProtein === undefined) {
options.isProtein = false;
Expand All @@ -347,6 +347,9 @@ function genbankToJson(string, options = {}) {
if (item.match(/ss-dna/i)) {
options.isSingleStrandedDNA = true;
}
if (item.match(/rna/i) && !item.match(/ss-rna/i)) {
options.isDoubleStrandedRNA = true;
}
}

// Division
Expand All @@ -368,6 +371,7 @@ function genbankToJson(string, options = {}) {
result.parsedSequence.gbDivision = gbDivision;
result.parsedSequence.sequenceTypeFromLocus = options.sequenceTypeFromLocus;
result.parsedSequence.isSingleStrandedDNA = options.isSingleStrandedDNA;
result.parsedSequence.isDoubleStrandedRNA = options.isDoubleStrandedRNA;
result.parsedSequence.date = date;
result.parsedSequence.circular = circular;
}
Expand Down
6 changes: 4 additions & 2 deletions packages/sequence-utils/src/getComplementSequenceString.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import DNAComplementMap from "./DNAComplementMap";
import { merge } from "lodash";


// ac.throw([ac.string,ac.bool],arguments);
export default function getComplementSequenceString(sequence) {
export default function getComplementSequenceString(sequence, isRna) {
// ac.throw([ac.string],arguments);
let complementSeqString = "";
const complementMap = isRna ? merge(DNAComplementMap, { a: 'u', A: 'U'}) : DNAComplementMap;
for (let i = 0; i < sequence.length; i++) {
let complementChar = DNAComplementMap[sequence[i]];
let complementChar = complementMap[sequence[i]];
if (!complementChar) {
complementChar = sequence[i];
// throw new Error('trying to get the reverse compelement of an invalid base');
Expand Down

0 comments on commit 42aaa83

Please sign in to comment.