Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BiSePS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRHS-Bioinfo
BiSePS
Commits
b90dbc20
Commit
b90dbc20
authored
3 years ago
by
Skander Hatira
Browse files
Options
Downloads
Patches
Plain Diff
made jbrowse cli work on vanilla
parent
33fdc84e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
hooks.js
+19
-19
19 additions, 19 deletions
hooks.js
src/backend/helpers/spawnJbrowse.js
+47
-36
47 additions, 36 deletions
src/backend/helpers/spawnJbrowse.js
with
66 additions
and
55 deletions
hooks.js
+
19
−
19
View file @
b90dbc20
...
...
@@ -6,7 +6,7 @@ const path = require("path");
module
.
exports
=
{
postStart
:
async
(
forgeConfig
,
options
)
=>
{
const
resources
=
path
.
join
(
__dirname
,
"
.webpack/main/resources
"
);
//
const jbrowse = path.join(__dirname, ".webpack/main/backend/node_modules/");
const
jbrowse
=
path
.
join
(
__dirname
,
"
.webpack/main/backend/node_modules/
"
);
chmodr
(
resources
,
0o777
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -15,13 +15,13 @@ module.exports = {
console
.
log
(
"
Successful
"
);
}
});
//
chmodr(jbrowse, 0o777, (err) => {
//
if (err) {
//
console.log("Failed to execute chmod", err);
//
} else {
//
console.log("Successful");
//
}
//
});
chmodr
(
jbrowse
,
0o777
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
"
Failed to execute chmod
"
,
err
);
}
else
{
console
.
log
(
"
Successful
"
);
}
});
},
postPackage
:
async
(
forgeConfig
,
options
)
=>
{
...
...
@@ -29,10 +29,10 @@ module.exports = {
options
.
outputPaths
[
0
],
"
resources/app/.webpack/main/resources
"
);
//
const jbrowse = path.join(
//
options.outputPaths[0],
//
"resources/app/.webpack/main/backend/node_modules/"
//
);
const
jbrowse
=
path
.
join
(
options
.
outputPaths
[
0
],
"
resources/app/.webpack/main/backend/node_modules/
"
);
chmodr
(
resources
,
0o777
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -41,12 +41,12 @@ module.exports = {
console
.
log
(
"
Successful
"
);
}
});
//
chmodr(jbrowse, 0o777, (err) => {
//
if (err) {
//
console.log("Failed to execute chmod", err);
//
} else {
//
console.log("Successful");
//
}
//
});
chmodr
(
jbrowse
,
0o777
,
(
err
)
=>
{
if
(
err
)
{
console
.
log
(
"
Failed to execute chmod
"
,
err
);
}
else
{
console
.
log
(
"
Successful
"
);
}
});
},
};
This diff is collapsed.
Click to expand it.
src/backend/helpers/spawnJbrowse.js
+
47
−
36
View file @
b90dbc20
...
...
@@ -4,13 +4,14 @@ const spawnChild = (body) => {
const
http
=
require
(
"
http
"
);
const
path
=
require
(
"
path
"
);
console
.
log
(
"
hereeeeee
"
);
const
jbrowse
=
require
(
"
@
jbrowse
/cli
"
)
;
const
jbrowse
=
"
../node_modules/.bin/
jbrowse
"
;
const
script
=
path
.
join
(
__dirname
,
"
../../resources/jbrowse.sh
"
);
const
workflow
=
path
.
join
(
__dirname
,
"
../../resources/jbrowse2
"
);
const
bams
=
""
;
const
bams
=
path
.
join
(
__dirname
,
"
../node_modules/.bin/jbrowse
"
)
;
const
options
=
{
slient
:
false
,
detached
:
false
,
cwd
:
__dirname
,
};
// const child = execFileSync(
...
...
@@ -20,25 +21,35 @@ const spawnChild = (body) => {
// );
body
.
genomes
.
map
(
async
(
genome
)
=>
{
console
.
log
(
path
.
extname
(
genome
));
// const child = fork(
// jbrowse,
// ["add-assembly", genome, "--load", "copy", "--out", body.jbPath],
// options
// );
exec
(
`jbrowse add-assembly
${
genome
}
--load copy --out
${
body
.
jbPath
}
`
,
(
error
,
stdout
,
stderr
)
=>
{
if
(
error
)
{
console
.
log
(
"
bigerror
"
);
console
.
log
(
`Current directory:
${
process
.
cwd
()}
|
${
__dirname
}
`
);
console
.
error
(
`exec error:
${
error
}
`
);
return
;
}
console
.
log
(
`stdout:
${
stdout
}
`
);
console
.
error
(
`stderr:
${
stderr
}
`
);
console
.
log
(
"
success
"
);
}
const
child
=
spawn
(
path
.
join
(
__dirname
,
"
../node_modules/@jbrowse/cli/bin/run
"
),
[
"
add-assembly
"
,
genome
,
"
--load
"
,
"
copy
"
,
"
--out
"
,
body
.
jbPath
],
options
);
// child = fork(path.join(__dirname, "./node_modules/.bin/jbrowse"), [
// "add-assembly",
// genome,
// "--load",
// "copy",
// "--out",
// body.jbPath,
// ]);
// exec(
// `jbrowse add-assembly ${genome} --load copy --out ${body.jbPath}`,
// (error, stdout, stderr) => {
// if (error) {
// console.log("bigerror");
// console.error(`exec error: ${error}`);
// return;
// }
// console.log(`stdout: ${stdout}`);
// console.error(`stderr: ${stderr}`);
// console.log("success");
// }
// );
// const arrAss = [];
// console.log("before", arrAss);
...
...
@@ -49,25 +60,25 @@ const spawnChild = (body) => {
// console.log(assemblies);
// --assemblyNames \'${assemblies}\' in exec command
// no need for npx , node modules available in exec commands directly
//
let data = "";
//
for await (const chunk of child.stdout) {
//
console.log("stdout chunk: " + chunk);
//
data += chunk;
//
}
let
data
=
""
;
for
await
(
const
chunk
of
child
.
stdout
)
{
console
.
log
(
"
stdout chunk:
"
+
chunk
);
data
+=
chunk
;
}
//
let error = "";
//
for await (const chunk of child.stderr) {
//
console.error("stderr chunk: " + chunk);
//
error += chunk;
//
}
//
const exitCode = await new Promise((resolve, reject) => {
//
child.on("close", resolve);
//
});
let
error
=
""
;
for
await
(
const
chunk
of
child
.
stderr
)
{
console
.
error
(
"
stderr chunk:
"
+
chunk
);
error
+=
chunk
;
}
const
exitCode
=
await
new
Promise
((
resolve
,
reject
)
=>
{
child
.
on
(
"
close
"
,
resolve
);
});
//
if (exitCode) {
//
throw new Error(`subprocess error exit ${exitCode}, ${error}`);
//
}
//
return data;
if
(
exitCode
)
{
throw
new
Error
(
`subprocess error exit
${
exitCode
}
,
${
error
}
`
);
}
return
data
;
});
body
.
tracks
.
map
((
track
)
=>
{
exec
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment