utils.bib
Utils - bib¤
get_dois_from_bib(bib_file)
¤
[Deprecated] use get_unique_ids_from_bib instead.
get_dois_from_bib returns a list of DOIs from a bib file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bib_file |
Union[str, Path]
|
path to bib file |
required |
Returns:
Type | Description |
---|---|
list
|
list of DOIs |
Source code in kirsche/utils/bib.py
111 112 113 114 115 116 117 118 119 120 121 |
|
get_dois_from_bib_re(bib_file)
¤
Retrieve DOIs by parsing bib file line by line.
Source code in kirsche/utils/bib.py
28 29 30 31 32 33 34 35 36 37 38 39 |
|
get_unique_ids_from_bib(bib_file, keys=None, unique_id_prefix=None)
¤
get_unique_ids_from_bib returns a list of unique IDs from a bib file for a given key or list of keys.
By default, the key is "doi". It can also be - arxivid, which can return values like arXiv:0804.4726 - pmid, which can return values like PMID:26017442.
keys can also be a list of keys to check in order of priority, e.g., ["doi", "arxivid", "pmid"]
.
For each record, we will look up the paper based on the order of the list. If doi exists, the functioin will use doi and start the next record. If doi is not found, the function will use arxivid for the same record.
If only one value in keys is specified, we will the same key specified for all records.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bib_file |
Union[str, Path]
|
path to bib file |
required |
keys |
Optional[Union[str, list]]
|
key to use to find unique ids in the bib data, default is doi. |
None
|
unique_id_prefix |
dict
|
prefix to use for unique ids |
None
|
Returns:
Type | Description |
---|---|
list
|
list of DOIs |
Source code in kirsche/utils/bib.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
load_bib(bib_file)
¤
Load bib content from bib files
Source code in kirsche/utils/bib.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
|
parse_unique_ids_by_keys(bib_data, keys, unique_id_prefix)
¤
parse_unique_ids_by_keys parses bib data based on keys.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bib_data |
list
|
list of bib records loaded from a bib file |
required |
keys |
Union[str, list]
|
list of keys as the lookup order, e.g., ["doi", "arxivid", "pmid"] |
required |
unique_id_prefix |
dict
|
a dictionary to specify what prefix to use for each key |
required |
Source code in kirsche/utils/bib.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|