Commit 9f044abf8140238f65fa8520ce9a3f39ddd7543e
1 parent
8774b988e4
Exists in
master
Removed filter ids that is now available in volia.data module
Showing 1 changed file with 0 additions and 24 deletions Inline Diff
volia/filter_ids.py
1 | import argparse | File was deleted | |
2 | from os.path import isfile | ||
3 | #from volia.data_io import read_lst | ||
4 | |||
5 | import volia | ||
6 | if __name__ == "__main__": | ||
7 | parser = argparse.ArgumentParser(description="Filter ids of the given file to only keep a subset") | ||
8 | parser.add_argument("file", type=str, help="") | ||
9 | parser.add_argument("--filter", default=None, type=str, help="") | ||
10 | parser.add_argument("--outfile", default="out.txt", type=str, help="") | ||
11 | |||
12 | args = parser.parse_args() | ||
13 | |||
14 | assert args.filter is not None | ||
15 | assert isfile(args.file) | ||
16 | |||
17 | list_ = read_lst(args.file) | ||
18 | filter_ = read_lst(args.filter) | ||
19 | |||
20 | with open(args.outfile, "w") as of: | ||
21 | for key in filter_.keys(): | ||
22 | of.write(key + " " + " ".join(list_[key]) + "\n") | ||
23 | |||
24 | print("File filtered and written in: ", args.outfile) |