Skip to content

Commit

Permalink
Removed the set_seed option (when a seed is set, which is the default…
Browse files Browse the repository at this point in the history
…, it is always 1).

Updated README.md and manual.
  • Loading branch information
inbalpaz authored and ipaz committed Feb 20, 2024
1 parent b30215e commit 1935cc7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 32 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,40 +77,52 @@ python syntracker.py -out SynTracker_output/ -mode continue
### A description of all SynTracker's possible command line arguments:

```
python syntracker.py [-h] [-target target_directory_path] [-ref ref_directory_path] [-out output_directory_path]
[-metadata metadata_file] [-mode 'new'/'continue'] [-cores number_of_cores]
[-length region_length][--identity blast_identity] [--coverage blast_coverage]
[--save_intermediate] [--set_seed integer_for_seed]
python syntracker.py [-h] [-target target_directory_path] [-ref ref_directory_path]
[-out output_directory_path] [-metadata metadata_file]
[-mode 'new'/'continue'] [-cores number_of_cores] [-length region_length]
[--identity blast_identity] [--coverage blast_coverage]
[--save_intermediate] [--no_seed]
options:
-h, --help show this help message and exit
-target [target_directory_path]
Path of the target directory which contains metagenome assemblies or genomes
-ref [ref_directory_path]
Path of the references folder containing the reference genomes
-out [output_directory_path]
The path to the output directory . When running in 'new' mode (the default), this argument is optional. By
default a folder named 'Syntracker_output/' will be created under the current directory (if the given path
already exists, it will be written over). When running in 'continue' mode, it is mandatory to provide the
path to the output directory of the run that is requested to be continued.
-metadata [metadata_file]
Path to a metadata file (optional). The file should be in CSV format and must include the sample ID.
-mode ['new'/'continue']
The running mode: 'new' or 'continue' (default='new') (Start a new run or continue a previous run that has been terminated).
-cores [number_of_cores]
The number of cores to use for the multi-processed stages of the calculation.
(Optional, by default SynTracker uses the maximal number of available cores).
-length [region_length]
The length of the compared region. (Optional, default=5000)
--identity [blast_identity]
Minimal blast identity (optional, default=97)
--coverage [blast_coverage]
Minimal blast coverage (optional, default=70)
--save_intermediate
Saves R intermediate data structures for debugging purposes (by default, they are not saved).
--set_seed [integer_for_seed]
An integer number to set the seed for subsampling of n regions per pairwise (by default, the seed is 1).
--no_seed Set no seed for the subsampling of n regions per pairwise (by default, seed=1 is set).
--no_seed Set no seed for the subsampling of n regions per pairwise (optional).
This means that the average synteny scores may change between SynTracker runs due to the subsampling.
By default, a seed=1 is set to enable reproducibility between different runs.
```

## Output
Expand Down
Binary file modified SynTracker_Manual.docx
Binary file not shown.
Binary file modified SynTracker_Manual.pdf
Binary file not shown.
4 changes: 1 addition & 3 deletions syntracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ def main():
out_param.write("Minimal identity: " + str(config.minimal_identity) + "\n")
if config.save_intermediate:
out_param.write("\nSave intermediate: " + str(config.save_intermediate) + "\n")
if config.is_set_seed:
out_param.write("Seed: " + str(config.seed_num) + "\n")
else:
if config.is_set_seed is False:
out_param.write("No seed\n")

############################################
Expand Down
26 changes: 4 additions & 22 deletions syntracker_first_stage/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,9 @@ def parse_arguments():
type=int, default=config.minimal_coverage)
parser.add_argument("--save_intermediate", help="Saves R intermediate data structures for debugging purposes",
action='store_true', default=False)
parser.add_argument("--set_seed", metavar="integer_for_seed",
help="An integer number to set the seed for subsampling of n regions per pairwise "
"(by default, the seed is 1).", type=int)
parser.add_argument("--no_seed", help="Set no seed for the subsampling of n regions per pairwise "
"(by default, seed=1 is set).",
parser.add_argument("--no_seed", help="Set no seed for the subsampling of n regions per pairwise. This means that "
"the average synteny scores may change between SynTracker runs. This is an optional parameter. "
"By default, a seed=1 is set to enable reproducibility between different runs.",
action='store_true', default=False)

# Parse the given arguments
Expand Down Expand Up @@ -162,14 +160,6 @@ def parse_arguments():
config.is_set_seed = False
config.seed_num = 0

elif args.set_seed is not None:
if args.set_seed > 0:
config.seed_num = args.set_seed
else:
error = "Error: if you use the '--set_seed' option, it must be followed by an integer to set the seed " \
"with.\n"
return error

return error


Expand Down Expand Up @@ -229,14 +219,9 @@ def read_conf_file():
elif re.search("^Save intermediate", line):
config.save_intermediate = True

elif re.search("^Seed", line):
m = re.search("^Seed:\s(\d+)\n", line)
if m:
config.is_set_seed = True
seed = m.group(1)

elif re.search("^No seed", line):
config.is_set_seed = False
config.seed_num = 0

elif re.search("^Reference genomes:", line):
in_ref_genomes_list = 1
Expand Down Expand Up @@ -309,9 +294,6 @@ def read_conf_file():
error = "The minimal identity is not written in the config file."
return error

if config.is_set_seed:
config.seed_num = int(seed)

# Verify that there is at least one reference genome and that input files exist
genomes_counter = 0
for genome in config.genomes_dict:
Expand Down

0 comments on commit 1935cc7

Please sign in to comment.