-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NN-425 Add function to export edges in gene graph
- Loading branch information
Showing
4 changed files
with
56 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<template> | ||
<div class="tool-item"> | ||
<span v-on:click="export_edges">Export edges as .csv</span> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'ExportEdges', | ||
props:['gephi_data','ensembl_name_index'], | ||
data() { | ||
return { | ||
} | ||
}, | ||
methods: { | ||
export_edges() { | ||
var com = this; | ||
// export proteins as csv | ||
var csvTermsData = com.gephi_data.edges; | ||
var terms_csv = 'source\tsrc_ensembl\ttarget\ttrg_ensembl\tscore\n'; | ||
csvTermsData.forEach(function(row) { | ||
terms_csv += com.ensembl_name_index[row.source] + '\t' + row.source + '\t"' + com.ensembl_name_index[row.target] + '"\t"' + row.target + '"\t"' + row.attributes["score"] + '"'; | ||
terms_csv += '\n'; | ||
}); | ||
//Create html element to hidden download csv file | ||
var hiddenElement = document.createElement('a'); | ||
hiddenElement.target = '_blank'; | ||
hiddenElement.href = 'data:text/csv;charset=utf-8,' + encodeURI(terms_csv); | ||
hiddenElement.download = 'Proteins.csv'; | ||
hiddenElement.click(); | ||
}, | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters