-
Notifications
You must be signed in to change notification settings - Fork 8
Support comma-separated list of files as input #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -84,11 +84,6 @@ addBasicArgs(allParser); | |||||
|
|
||||||
| const args = parser.parse_args(); | ||||||
|
|
||||||
| if (!fs.existsSync(args.in)) { | ||||||
| console.error(`Input path "${args.in}" does not exist`); | ||||||
| process.exit(1); | ||||||
| } | ||||||
|
|
||||||
| if (!fs.existsSync(args.out)) { | ||||||
| fs.mkdirSync(args.out, { recursive: true }); | ||||||
| } | ||||||
|
|
@@ -103,10 +98,28 @@ export function getFileName(inPath: string) { | |||||
| } | ||||||
|
|
||||||
| async function main() { | ||||||
| const renderer = new ImageRenderer(args.width, args.height, args.format, args.plddt, new FocusFirstResidue()); | ||||||
| // Support multiple, comma-separated files | ||||||
| var files:string[] = args.in.split(','); | ||||||
|
|
||||||
| // Confirm all files exist | ||||||
| files.forEach(file => { | ||||||
| if (!fs.existsSync(file)) { | ||||||
| console.error(`Input path "${file}" does not exist`); | ||||||
| process.exit(1); | ||||||
| } | ||||||
| }); | ||||||
|
|
||||||
| const fileName = getFileName(args.in); | ||||||
| const cif = await readCifFile(args.in); | ||||||
| // Run the rendering process | ||||||
| files.forEach(async file => { | ||||||
| await renderFile(file); | ||||||
| }); | ||||||
| } | ||||||
|
|
||||||
| async function renderFile(filePath: string) { | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
and declare |
||||||
| var fileName = getFileName(filePath); | ||||||
|
|
||||||
| const renderer = new ImageRenderer(args.width, args.height, args.format, args.plddt, new FocusFirstResidue()); | ||||||
| const cif = await readCifFile(filePath); | ||||||
| const trajectory = await getTrajectory(cif as CifFrame); | ||||||
|
|
||||||
| switch (args.render) { | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a normal loop here so the
awaitdoes what it's supposed to. What you did would execute all the renders in parallel which you don't really want as this is a single threaded environment and you would also likely run out of memory if the input list was really long.