Skip to content
This repository has been archived by the owner on Mar 14, 2024. It is now read-only.

Commit

Permalink
add alert after submit bedset
Browse files Browse the repository at this point in the history
  • Loading branch information
xuebingjie1990 committed Jun 23, 2022
1 parent 900392a commit 61b57f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 50 deletions.
45 changes: 4 additions & 41 deletions src/createBedSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,10 @@ export default class CreateBedSet extends React.Component {
}

async componentDidMount() {
console.log("my bed set:", this.state.myBedSet)
this.getBedIdx()
}

async createBedSet() {
this.getBedIdx()
// let idx_list = []

// idx_list.push(
// this.state.myBedSet.map((bed) => {
// return bed.id;
// })
// )

// idx_list = encodeURIComponent(
// idx_list.toString()
// )

// this.setState({
// myBedSetIdx: idx_list
// })

let md = await api.post(
"/api/bedset/create/" +
Expand All @@ -55,6 +39,8 @@ export default class CreateBedSet extends React.Component {
this.state.myBedSetIdx
).then(({ data }) => data)

alert("Your BED set has been submitted for processing!")

localStorage.clear();

}
Expand Down Expand Up @@ -88,24 +74,9 @@ export default class CreateBedSet extends React.Component {
<Header />
<div
className="conten-body"
// style={{ display: "flex", justifyContent: "center" }}
>
<Container style={{ width: "75%" }} fluid className="p-4">
<h1>Download My BED Set</h1>
<span style={{ fontSize: "12pt" }}>
<p>
{"Download from http with command "}
<span style={{ fontWeight: 'bold' }}>
{"wget -i my_bedset_http.txt"}
</span>
</p>
<p>
{"Download from s3 with command "}
<span style={{ fontWeight: 'bold' }}>
{"cat my_bedset_s3.txt | parallel aws s3 cp {} <output_dir>"}
</span>
</p>
</span>
<h1>My BED Set</h1>
</Container>

{this.state.myBedSet ? (
Expand Down Expand Up @@ -162,17 +133,9 @@ export default class CreateBedSet extends React.Component {
}}
/>
<ResponsiveDialog
onClick={this.getBedIdx.bind(this)}
bedfiles={this.state.myBedSetIdx}
btn={'Download My BED Set'}
/>
{/* <button
style={{ height: "33px" }}
className="float-left btn btn-sm my-btn"
onClick={this.downloadBedSet.bind(this)}
>
Download My BED Set
</button> */}

<button
style={{ height: "33px" }}
Expand Down
14 changes: 5 additions & 9 deletions src/searchResult.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default class ResultsBed extends React.Component {

async componentDidMount() {
await this.getBedBySearchTerms();
console.log("bed info:", this.state.bedData)
}

async componentDidUpdate(prevProps, prevState) {
Expand Down Expand Up @@ -88,7 +87,6 @@ export default class ResultsBed extends React.Component {
});
}
this.setState({ terms: this.props.terms });
// console.log("BED files retrieved from the server: ", res);
this.getColumns();
this.getData();
}
Expand Down Expand Up @@ -125,14 +123,13 @@ export default class ResultsBed extends React.Component {
var bed_new = new_res.map((bed, index) => {
return bed.node.bedId;
});
const bedunique = this.getUnique(bed_old, bed_new)[0]
const bedunique = this.getUnique(bed_old, bed_new)

avg_res = oldres.map((bed, index) => {
if (bedunique.includes(bed.node.bedId)) {
if (JSON.parse(bed.node.bedfile.genome).alias === this.props.genome) {
bed.node.score =
(bed.node.score + thresh) / 2;
console.log("bed:", bed)
return bed;
}
} else {
Expand All @@ -144,7 +141,7 @@ export default class ResultsBed extends React.Component {

bed.node.score =
(bed.node.score + new_res[new_res_idx].node.score) / 2;
console.log("bed:", bed)

return bed;

}
Expand All @@ -157,15 +154,14 @@ export default class ResultsBed extends React.Component {
if (JSON.parse(bed.node.bedfile.genome).alias === this.props.genome) {
bed.node.score =
(bed.node.score + thresh) / 2;
console.log("bed:", bed)
avg_res.push(bed);
}
}
}
)

avg_res = avg_res.filter(value => Object.keys(value).length !== 0);
console.log("avg_res:", avg_res)

return avg_res;
}

Expand Down Expand Up @@ -313,11 +309,11 @@ export default class ResultsBed extends React.Component {
addtoBedSet(data) {
alert("You added " + data.name + " to your BED set.")
this.setState({
myBedSet: [...this.state.myBedSet, { "id": data.id, "name": data.name }]
myBedSet: [...this.state.myBedSet, { "id": data.id, "name": data.name, "md5sum": data.md5sum }]
}, () => {
localStorage.setItem('myBedSet', JSON.stringify(this.state.myBedSet))
})
console.log("my bed set:", this.state.myBedSet)


}

Expand Down

0 comments on commit 61b57f1

Please sign in to comment.