-
Notifications
You must be signed in to change notification settings - Fork 9
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
Implement download tracker and pipeline execution change #24
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
ae80866
Added batch monitor patch and updated interface
danich1 e924e0c
Update README.md to reflect new changes
danich1 1278a27
Created README.md for configuration files
danich1 781a4a4
Updated files for ease of readability
danich1 1d4857a
Merge branch 'download_tracker' of github.com:danich1/pubtator into d…
danich1 ff61ed3
fixed execute.py
danich1 2746b8d
file name change
danich1 7842f2e
Applying Jake's suggestions from code review
danich1 c46d6a3
Added documentation and made changes per jjc2718 suggestions
danich1 d87c64f
Fixed anchors for read me
danich1 304eec3
Finalized config readme
danich1 0c5575d
No really this config.md is finalized now.
danich1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Configuration Files Explained | ||
|
||
This file explains the pipeline steps and parameters needed for each step. | ||
**Note: any added parameter or step will be ignored unless `execute.py` is manually changed.** | ||
|
||
## Repository Download | ||
|
||
This is the first step of the Pubtator pipeline. | ||
Basically this step downloads Pubtator Central's annotation file from their ftp server. | ||
|
||
Following Parameters for this section: | ||
| Param | Description | Accepted Values | | ||
| --- | --- | --- | | ||
| url | the url to download the file from | a string with a url path | | ||
| download_folder | the folder to hold the downloaded file | a string name for the folder | | ||
| skip | tell execute.py to ignore this step and contine | true or false | | ||
|
||
## Pubtator to XML | ||
|
||
This is the second step of the Pubtator pipeline. | ||
This step converts Pubtator/Pubtator Central's annotation file into xml format. | ||
**Note: This step may take awhile to complete** | ||
|
||
Following Parameters for this section: | ||
| Param | Description | Accepted Values | | ||
| --- | --- | --- | | ||
| documents | The file path pointing to the downloaded file from the previous step. | a string for the file path | | ||
| output | The file path to save the xml file. Make sure to keep the xz extension. | a string for the file path | | ||
| skip | Tell execute.py to ignore this step and contine | true or false | | ||
|
||
## Extract Tags | ||
|
||
This is the second step of the Pubtator pipeline. | ||
This step extracts Pubtator/Pubtator Central's annotations from the xml file. | ||
It outputs a tsv file that contains all extracted annotation. | ||
**Note: This step may take awhile to complete** | ||
|
||
Following Parameters for this section: | ||
| Param | Description | Accepted Values | | ||
| --- | --- | --- | | ||
| input | The file path pointing to the xml file in previouss step. Make sure to keep the xz extension. | a string for the file path | | ||
| output | The file path to save the tsv file. Make sure to keep the xz extension. | a string for the file path | | ||
| skip | Tell execute.py to ignore this step and contine | true or false | | ||
|
||
## Hetnet ID Extractor | ||
|
||
This is the third step of the Pubtator pipeline. | ||
This step filters out extracted annotations to only include tags within [Hetionet's Database](https://het.io/). | ||
|
||
Following Parameters for this section: | ||
| Param | Description | Accepted Values | | ||
| --- | --- | --- | | ||
| input | The file path pointing to the tsv file in previous step. Make sure to keep the xz extension. | a string for the file path | | ||
| output | The file path to save the tsv file. Make sure to keep the xz extension. | a string for the file path | | ||
| skip | Tell execute.py to ignore this step and contine | true or false | | ||
|
||
## Map PMIDS to PMCIDS | ||
|
||
This is the forth step of the Pubtator pipeline. | ||
This step querys NCBI's pmid to pmcid mapper in order to grab PMCIDS. | ||
**Note: To download full text you will need to have PMCIDS. PMIDS will not work.** | ||
|
||
Following Parameters for this section: | ||
| Param | Description | Accepted Values | | ||
| --- | --- | --- | | ||
| input | The file path pointing to the tsv file in extract tags step. Make sure to keep the xz extension. | a string for the file path | | ||
| output | The file path to save the tsv file. | a string for the file path | | ||
| debug | This is a flag for debugging purposes. Feel free to ignore and leave as false. | true or false | | ||
| skip | Tell execute.py to ignore this step and contine | true or false | | ||
|
||
## Download Full Text | ||
|
||
This is the fifth step of the Pubtator pipeline. | ||
This step queries Pubtator Central's api and downloads annotated full text if text is present. | ||
|
||
Following Parameters for this section: | ||
| Param | Description | Accepted Values | | ||
| --- | --- | --- | | ||
| input | The file path pointing to the tsv file in previous step. | a string for the file path | | ||
| output | The file path to save the xml file. | a string for the file path | | ||
| temp_dir | The folder to hold temporary batch files for this step of the pipeline | a string for the folder path | | ||
| log_file | A log file that keeps track of the IDs that have already been queried. It is used to monitor progress in case the process is interrupted. Make sure it has the tsv extension. | a file path for the file | | ||
| skip | Tell execute.py to ignore this step and contine | true or false | | ||
|
||
## Extract Full Text Tags | ||
|
||
This is the sixth step of the Pubtator pipeline. | ||
This step extracts tags from full text documents. | ||
Please refer to [Extract Tags Section](#extract-tags) for parameter details. | ||
|
||
## Hetnet ID Extractor Full Text | ||
|
||
This is the last step of the Pubtator pipeline. | ||
This step filters tags to only have Hetionet tags. | ||
Please refer to [Hetnet ID Extractor Section](#hetnet-id-extractor) for parameter details. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Configuration Files | ||
|
||
## File Description | ||
|
||
| File | Description | | ||
| --- | --- | | ||
| [pubtator central config](pubtator_central_config.json) | This is a configuration file for parsing Pubtator Central. | | ||
| [pubtator config](pubtator_config.json) | This is a configuration file for parsing Pubtator (older version of Pubtator Central). | | ||
| [tests config](tests_config.json) | This is a configuration file for testing the pubtator system. Feel free to ignore this file. | | ||
|
||
## Usage | ||
|
||
Each configuration file is in json format and contains parameters for each step within the pubtator pipeline. | ||
All files are organized by order of operation, which means the very first step occurs at the top and the subsequent step comes right afterwards. | ||
Every step can be skipped, which allows one to continue the pipeline at any step one chooses. | ||
Please refer to [CONFIG.md](CONFIG.md) for more details on each pipeline step and their respective parameters. | ||
|
||
Example config file: | ||
```json | ||
{ | ||
"pipeline step 1":{ | ||
"param1":"param1_value", | ||
"param2":"param2_value", | ||
"skip":false | ||
}, | ||
"pipeline step 2":{ | ||
"param1":"param1_value", | ||
"param2":"param2_value", | ||
"skip":false | ||
}, | ||
"pipeline step 3":{ | ||
"param1":"param1_value", | ||
"param2":"param2_value", | ||
"skip":false | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"repository_download":{ | ||
"url":"ftp://ftp.ncbi.nlm.nih.gov/pub/lu/PubTatorCentral/bioconcepts2pubtatorcentral.offset.gz", | ||
"download_folder":"download", | ||
"skip":false | ||
}, | ||
|
||
"pubtator_to_xml": { | ||
"documents":"download/bioconcepts2pubtatorcentral.offset.gz", | ||
"output":"data/pubtator-central-docs.xml.xz", | ||
"skip":false | ||
}, | ||
|
||
"extract_tags":{ | ||
"input":"data/pubtator-central-docs.xml.xz", | ||
"output":"data/pubtator-central-tags.tsv.xz", | ||
"skip":false | ||
}, | ||
|
||
"hetnet_id_extractor":{ | ||
"input":"data/pubtator-central-tags.tsv.xz", | ||
"output":"data/pubtator-central-hetnet-tags.tsv.xz", | ||
"skip":false | ||
}, | ||
|
||
"map_pmids_to_pmcids":{ | ||
"input":"data/pubtator-central-tags.tsv.xz", | ||
"output":"data/pubtator-pmids-to-pmcids.tsv", | ||
"debug":false, | ||
"skip":false | ||
}, | ||
|
||
"download_full_text":{ | ||
"input":"data/pubtator-pmids-to-pmcids.tsv", | ||
"document_batch":100, | ||
"output":" data/pubtator-central-full-text.xml", | ||
"temp_dir":"data/temp", | ||
"log_file":"batch_log.tsv", | ||
"skip":false | ||
}, | ||
|
||
"extract_full_text_tags":{ | ||
"input":"data/pubtator-central-full-text.xml", | ||
"output":"data/pubtator-central-full-text-tags.tsv.xz", | ||
"skip":false | ||
}, | ||
|
||
"hetnet_id_extractor_full_text":{ | ||
"input":"data/pubtator-central-full-text-tags.tsv.xz", | ||
"output":"data/pubtator-central-full-hetnet-tags.tsv.xz", | ||
"skip":false | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"repository_download":{ | ||
"url":"ftp://ftp.ncbi.nlm.nih.gov/pub/lu/PubTator/bioconcepts2pubtator_offsets.gz", | ||
"download_folder":"download", | ||
"skip":false | ||
}, | ||
|
||
"pubtator_to_xml": { | ||
"documents":"download/bioconcepts2pubtator_offsets.gz", | ||
"output":"data/pubtator-docs.xml.xz", | ||
"skip":false | ||
}, | ||
|
||
"extract_tags":{ | ||
"input":"data/pubtator-docs.xml.xz", | ||
"output":"data/pubtator-tags.tsv.xz", | ||
"skip":false | ||
}, | ||
|
||
"hetnet_id_extractor":{ | ||
"input":"data/pubtator-tags.tsv.xz", | ||
"output":"data/pubtator-hetnet-tags.tsv.xz", | ||
"skip":false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"repository_download":{ | ||
"url":"ftp://ftp.ncbi.nlm.nih.gov/pub/lu/PubTatorCentral/bioconcepts2pubtatorcentral.offset.gz", | ||
"download_folder":"download", | ||
"skip":true | ||
}, | ||
|
||
"pubtator_to_xml": { | ||
"documents":"data/example/1-sample-annotations.txt", | ||
"output":"data/example/2-sample-docs.xml", | ||
"skip":false | ||
}, | ||
|
||
"extract_tags":{ | ||
"input":"data/example/2-sample-docs.xml", | ||
"output":"data/example/3-sample-tags.tsv", | ||
"skip":false | ||
}, | ||
|
||
"hetnet_id_extractor":{ | ||
"input":"data/example/3-sample-tags.tsv", | ||
"output":"data/example/4-hetnet-tags.tsv", | ||
"skip":false | ||
}, | ||
|
||
"map_pmids_to_pmcids":{ | ||
"input":"data/example/3-sample-tags.tsv", | ||
"output":"data/example/5-sample-pmids-to-pmcids.tsv", | ||
"debug":true, | ||
"skip":false | ||
}, | ||
|
||
"download_full_text":{ | ||
"input":"data/example/5-sample-pmids-to-pmcids.tsv", | ||
"document_batch":100, | ||
"output":"data/example/6-sample-full-text.xml", | ||
"temp_dir":"data/temp", | ||
"log_file":"batch_log.tsv", | ||
"skip":false | ||
}, | ||
|
||
"extract_full_text_tags":{ | ||
"input":"data/example/6-sample-full-text.xml", | ||
"output":"data/example/7-sample-full-text-tags.tsv", | ||
"skip":false | ||
}, | ||
|
||
"hetnet_id_extractor_full_text":{ | ||
"input":"data/example/7-sample-full-text-tags.tsv", | ||
"output":"data/example/8-hetnet-full-text-tags.tsv", | ||
"skip":false | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just so I understand the purpose of these config files - you don't expect users to add or remove fields, correct? They would just change the fields if necessary (for example setting
skip:true
or changing the output filenames)?Just wondering if you need to document what each of the fields mean somewhere. Most of them are fairly obvious from the name, so I think it's probably not necessary but if you expect users to be changing things by hand a lot I might feel differently.
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.
Correct. The idea is to provide the fields already, so a user can change directories as needed.
Good idea. I'll add documentation to this PR.