Skip to content

Commit

Permalink
GC content calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasalmeida committed Nov 14, 2023
1 parent 13e0d59 commit 830fa2f
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
5 changes: 4 additions & 1 deletion export.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async function chatUI(div){ // cerate a simple chat div
let selectRole=document.createElement('select')
selectRole.id = "selectRole"
div.appendChild(selectRole);
['system','user','assistant'].forEach(r=>{
['system','user','assistant','function'].forEach(r=>{
let opt = document.createElement('option')
selectRole.appendChild(opt)
opt.value=r
Expand Down Expand Up @@ -329,6 +329,9 @@ async function chatUI(div){ // cerate a simple chat div
if(x.choices[0].finish_reason=="function_call"){
console.log(`function_call:`,x)
let msg=x.choices[0].message
msg.role="function"
msg.name=msg.function_call.name
delete msg.function_call
msgs.push(msg)
// show result in the UI
// continue back to the loop
Expand Down
28 changes: 27 additions & 1 deletion functions/testFunctions.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,30 @@ const fetchUCSC = { // at NCI Shady Grove
}
};

function funGCcontent(parms){
parms = parms||{
sequence:'AGAAGGAAAACGGGAAACTTCACAATTAGTGAATATTTAAAAACAGACTCTTAAGAAACCAAAGGATCAAGGAAGATACCACAGGGAAAAATAGAGAATA'
}
// calculate GC funGCcontent
let GClength = parms.sequence.toUpperCase().split('').filter(x=>(x=='G'|x=='C')).length
let seqLength = parms.sequence.length
return `GC content is ${GClength}/${seqLength} = ${GClength/seqLength}`
}

const defGCcontent={
"name": "funGCcontent",
"description": "calculate the GC content of a DNA sequence",
"parameters": {
"type":"object",
"properties":{
"sequence":{
"type":"string",
"description":"a DNA or genomic sequence, composed with four letters: A, C, G, and T"
}
}
}
}

async function rankSumTest(parms){
// lets do t-test to warm things up
parms=parms||{
Expand Down Expand Up @@ -124,5 +148,7 @@ export{
fetchUCSC,
funFetchUCSC,
rankSumTest,
rankSumTestDescription
rankSumTestDescription,
funGCcontent,
defGCcontent
}

0 comments on commit 830fa2f

Please sign in to comment.