Skip to content

Commit

Permalink
Merge pull request #24 from lifematics/dev
Browse files Browse the repository at this point in the history
1.7.0b
  • Loading branch information
Toda authored Jun 1, 2021
2 parents 7d6f3ec + 28f0cd6 commit 97c5e8b
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 24 deletions.
4 changes: 2 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ app.on('ready', () => {
//compare one からの呼び出しであることを示すフラグを filter settings に入れているがよくないかも
//次に何か加えることがあれば変更
if(args["cluster_id"]){
//Families パネルからの呼び出し
//Clusters パネルからの呼び出し
analysis.getSequences(dataSetId, clusterId, key, listSize, page, threshold, (result) => {
let filterSettings = {'conditions':{'key':result['sequences'][0]['sequence'][1], primary_only:compareTarget == "cluster_representative"}
,'threshold':{ratio: 0, A: 100, C: 100, G: 100, T: 100, lb_A: 0, lb_C: 0, lb_G: 0, lb_T: 0}
Expand Down Expand Up @@ -337,7 +337,7 @@ app.on('ready', () => {

window.webContents.send("set-etf",d+" days, "+h+" hours, "+m+" mins, "+s+" secs");
}else{
window.webContents.send("set-etf","Estimated Finish Time: N/A");
window.webContents.send("set-etf","N/A");
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "aptamCORE",
"productName": "aptamCORE",
"version": "1.6.0",
"version": "1.7.0b",
"main": "app.js",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<button id="button_information" v-on:click="information" value="Information" v-bind:disabled="mode == 'config' || mode == 'home'">Information</button>
</div>
<div class="button-container">
<button id="button_families" v-on:click="cluster" value="View" v-bind:disabled="mode == 'config' || mode == 'home'">Families</button>
<button id="button_clusters" v-on:click="cluster" value="View" v-bind:disabled="mode == 'config' || mode == 'home'">Clusters</button>
</div>
<div class="button-container">
<button id="button_sequences" v-on:click="sequence" value="Sequence" v-bind:disabled="mode == 'config' || mode == 'home'">Sequences</button>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ClusterList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<div class="row header-control">
<div class="col-sm-4">
<div class="row" id="subframediv">
<h2>Families</h2>
<h2>Clusters</h2>
<span style="margin-top:10px">
<input type="radio" id="radio_clusterlist_subframe_member" name="cluster_subframe" style="margin-left:10px;margin-right:10px;" v-model="clusterSubFrame_This" v-on:change="changeSubFrame" value="member"> <label for="radio_clusterlist_subframe_member">Member</label>
<input type="radio" id="radio_clusterlist_subframe_compare" name="cluster_subframe" style="margin-left:10px;margin-right:10px;" v-model="clusterSubFrame_This" v-on:change="changeSubFrame" value="compare"> <label for="radio_clusterlist_subframe_compare">Compare</label>
Expand Down Expand Up @@ -54,7 +54,7 @@
<th class="index" v-if="preferences.view.items.includes('copy_button')">Copy</th>
<th class="index" v-if="preferences.view.items.includes('copy_and_go_button')">Copy and Go</th>
<th class="index">Index</th>
<th class="idCol" v-if="preferences.view.items.includes('id')">Family ID</th>
<th class="idCol" v-if="preferences.view.items.includes('id')">Cluster ID</th>
<th class="ngsIdCol" v-if="preferences.view.items.includes('ngs_id')">Representative NGS ID</th>
<th class="headCol" v-if="preferences.view.items.includes('head')">Head</th>
<th class="variableCol" v-if="preferences.view.items.includes('variable')">Variable</th>
Expand Down
73 changes: 55 additions & 18 deletions src/libs/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -1599,11 +1599,11 @@ class Analysis {
this.getClusterSequenceCountImpl(dataSetId, clusterId, { key: null }, null,'SUM(count)', callback);
}

//sequence として返るのは文字列の配列であり、0 が 5' primer, 1 が variables, 2 が 3' primer

processSequenceData(sequences, representative, callback) {
const self = this;
let seqList = sequences.map(function(seq) {
let sequence = seq.sequence.split('-');
let sequence = seq.sequence.split('-');//sequence として返るのは文字列の配列であり、0 が 5' primer, 1 が variables, 2 が 3' primer
let distance = '-';
if (representative) {
distance = self.levenshteinDistance(sequence[1], representative[1]);
Expand Down Expand Up @@ -1631,6 +1631,7 @@ class Analysis {
let clusterId = (cluster ? cluster.id : null);
self.getClusterSequenceVariants(dataSetId, clusterId, { key: key, primary_only: true }, threshold, function(numVariants) {
self.getClusterSequenceCount(dataSetId, clusterId, function (count) {
//クラスタに含まれる配列のカウントを取るために一度通している?冗長かもしれない。
let baseQuery = 'SELECT * FROM sequences ';

let baseParams = [];
Expand Down Expand Up @@ -1990,7 +1991,7 @@ class Analysis {
let dataList=null;
if(datatype == "cluster") {
dataList = sqlresult.clusters;
}else if(datatype == "family_sequence"){
}else if(datatype == "cluster_sequence"){
dataList = sqlresult.sequences;
}else if (datatype== "sequence"){
dataList = sqlresult.sequences;
Expand Down Expand Up @@ -2025,7 +2026,7 @@ class Analysis {
'c_ratio',
'g_ratio',
't_ratio'];
}else if(datatype == "family_sequence"){
}else if(datatype == "cluster_sequence"){
tags = [
'id',
'ngs_id',
Expand Down Expand Up @@ -2100,7 +2101,7 @@ class Analysis {
dats["ngs_id"] = ddat.name;
}

if(datatype == "family_sequence"){
if(datatype == "cluster_sequence"){
dats["variable_distance"] = ddat.distance;
}

Expand Down Expand Up @@ -2130,7 +2131,6 @@ class Analysis {
if (error) {
throw error;
}

dataList.forEach((dataItem) => {
for (let i = 0; i < dataItem.count; ++i) {
fs.writeSync(fd, ">" + dataItem.id + "-" + dataItem.name.replace(' ', '_') + "-" + (i + 1) + "\r\n");
Expand All @@ -2149,18 +2149,55 @@ class Analysis {

exportClusters(dataSetId, filename, conditions ,clusterThresholdNumber, callback) {
const self = this;
self.getClusters(dataSetId, conditions, null, null, clusterThresholdNumber, function (result) {
let ext = path.extname(filename);
if (ext == '.csv') {
self.exportAsCsv(filename, result, "cluster",callback);
} else if (ext == '.fasta') {
let ext = path.extname(filename);
if (ext == '.csv') {
self.getClusters(dataSetId, conditions, null, null, clusterThresholdNumber, function (result) {
self.exportAsCsv(filename, result, "cluster",callback);
});
} else if (ext == '.fasta') {
self.getClusters(dataSetId, conditions, null, null, clusterThresholdNumber, function (result) {
let clusters = result.clusters;
self.exportAsFasta(filename, clusters, callback);
} else{
callback();
throw new Exception(ext+" is not supported format.");
}
});
clusters.reverse();
//古いコード。Cluster Representative のコピーを出力する。
//self.exportAsFasta(filename, clusters, callback);

let threshold={ratio: 0, A: 100,C: 100,G: 100,T: 100,lb_A: 0,lb_C: 0,lb_G: 0,lb_T: 0};
let allseqs = [];
let flist2 = [];
let exporter = function(seqs){
self.exportAsFasta(filename, seqs, callback);
};
for(let cc = 0;cc < clusters.length;cc++){
flist2.push(
function(){
self.getSequences(dataSetId,clusters[cc].id , "", null, null, threshold, function (result) {
for(let sii = 0;sii < result.sequences.length;sii++){
result.sequences[sii].name = "Cluster_"+clusters[cc].id+"-"+result.sequences[sii].name;
}
Array.prototype.push.apply(allseqs, result.sequences);
if(flist2.length == 0){
let prev_func = exporter;
prev_func(allseqs);
}else{
let prev_func = flist2.pop();
prev_func();
}
});
}
);
}
if (flist2.length == 0){
self.exportAsFasta(filename, [], callback);
}else{
let prev_func = flist2.pop();
prev_func();
}
});

} else{
callback();
throw new Exception(ext+" is not supported format.");
}
}

exportSequences(dataSetId, clusterId, filename, key, threshold, callback) {
Expand All @@ -2169,7 +2206,7 @@ class Analysis {
let ext = path.extname(filename);
if (ext == '.csv') {
if(clusterId !== null){
self.exportAsCsv(filename, result, "family_sequence", callback);
self.exportAsCsv(filename, result, "cluster_sequence", callback);
}else{
self.exportAsCsv(filename, result, "sequence", callback);
}
Expand Down

0 comments on commit 97c5e8b

Please sign in to comment.