Skip to content

Commit

Permalink
Merge pull request #11 from edilytics/pooled_mixed_changes
Browse files Browse the repository at this point in the history
Pooled mixed changes
  • Loading branch information
kclem authored Jan 31, 2023
2 parents 6218233 + 5819f68 commit e5e45ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
24 changes: 16 additions & 8 deletions CRISPResso2/CRISPRessoPooledCORE.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def main():
\nquantification_window_coordinates (OPTIONAL): Bp positions in the amplicon sequence specifying the quantification window. This parameter overrides values of the "--quantification_window_center", "-- cleavage_offset", "--window_around_sgrna" or "-- window_around_sgrna" values. Any indels/substitutions outside this window are excluded. Indexes are 0-based, meaning that the first nucleotide is position 0. Ranges are separated by the dash sign like "start-stop", and multiple ranges can be separated by the underscore (\_). A value of 0 disables this filter. (can be comma-separated list of values, corresponding to amplicon sequences given in --amplicon_seq e.g. 5-10,5-10_20-30 would specify the 5th-10th bp in the first reference and the 5th-10th and 20th-30th bp in the second reference) (default: None)\
\nquantification_window_size (OPTIONAL): Defines the size (in bp) of the quantification window extending from the position specified by the "--cleavage_offset" or "--quantification_window_center" parameter in relation to the provided guide RNA sequence(s) (--sgRNA). Mutations within this number of bp from the quantification window center are used in classifying reads as modified or unmodified. A value of 0 disables this window and indels in the entire amplicon are considered. Default is 1, 1bp on each side of the cleavage position for a total length of 2bp.\
\nquantification_window_center (OPTIONAL): Center of quantification window to use within respect to the 3\' end of the provided sgRNA sequence. Remember that the sgRNA sequence must be entered without the PAM. For cleaving nucleases, this is the predicted cleavage position. The default is -3 and is suitable for the Cas9 system. For alternate nucleases, other cleavage offsets may be appropriate, for example, if using Cpf1 this parameter would be set to 1. For base editors, this could be set to -17.', default='')

#tool specific optional
parser.add_argument('--gene_annotations', type=str, help='Gene Annotation Table from UCSC Genome Browser Tables (http://genome.ucsc.edu/cgi-bin/hgTables?command=start), \
please select as table "knownGene", as output format "all fields from selected table" and as file returned "gzip compressed"', default='')
Expand Down Expand Up @@ -664,7 +664,7 @@ def main():
headers.append(match[0])
if args.debug and match:
info(f'Matching header {head} with {match[0]}.')

if not has_header or has_unmatched_header_el:
# Default header
headers = []
Expand Down Expand Up @@ -842,12 +842,16 @@ def main():
crispresso_cmd= args.crispresso_command + ' -r1 %s -a %s %s -o %s --name %s' % (row['Demultiplexed_fastq.gz_filename'], this_amp_seq, this_amp_name_string, OUTPUT_DIRECTORY, idx)

if n_reads_aligned_amplicons[-1] > args.min_reads_to_use_region:
this_run_args = deepcopy(args)
this_run_args_from_amplicons_file = {}
for column_name in default_input_amplicon_headers:
if column_name in df_template.columns and row[column_name] and not pd.isnull(row[column_name]):
setattr(this_run_args, column_name, row[column_name])
this_run_args_from_amplicons_file[column_name] = row[column_name]

crispresso_cmd = CRISPRessoShared.propagate_crispresso_options(crispresso_cmd, crispresso_options_for_pooled, this_run_args)
#first, set the general CRISPResso options for this sub-run (e.g. plotting options, etc)
#note that the crispresso_options_for_pooled doesn't include e.g. amplicon_seq so when someone calls CRISPRessoPooled with -a that won't get passed on here
crispresso_cmd = CRISPRessoShared.propagate_crispresso_options(crispresso_cmd, crispresso_options_for_pooled, args)
#next set the per-amplicon options we read from the Amplicons file (and are stored in this_run_args_from_amplicons_file)
crispresso_cmd = CRISPRessoShared.propagate_crispresso_options(crispresso_cmd, default_input_amplicon_headers, this_run_args_from_amplicons_file)

crispresso_cmds.append(crispresso_cmd)

Expand Down Expand Up @@ -1211,12 +1215,16 @@ def rreplace(s, old, new):

crispresso_cmd = args.crispresso_command + ' -r1 %s -o %s --name %s' % (fastq_filename_region, OUTPUT_DIRECTORY, idx)

this_run_args = deepcopy(args)
this_run_args_from_amplicons_file = {}
for column_name in default_input_amplicon_headers:
if column_name in df_template.columns and row[column_name] and not pd.isnull(row[column_name]):
setattr(this_run_args, column_name, row[column_name])
this_run_args_from_amplicons_file[column_name] = row[column_name]

crispresso_cmd = CRISPRessoShared.propagate_crispresso_options(crispresso_cmd, crispresso_options_for_pooled, this_run_args)
#first, set the general CRISPResso options for this sub-run (e.g. plotting options, etc)
#note that the crispresso_options_for_pooled doesn't include e.g. amplicon_seq so when someone calls CRISPRessoPooled with -a that won't get passed on here
crispresso_cmd = CRISPRessoShared.propagate_crispresso_options(crispresso_cmd, crispresso_options_for_pooled, args)
#next set the per-amplicon options we read from the Amplicons file (and are stored in this_run_args_from_amplicons_file)
crispresso_cmd = CRISPRessoShared.propagate_crispresso_options(crispresso_cmd, default_input_amplicon_headers, this_run_args_from_amplicons_file)
info('Running CRISPResso:%s' % crispresso_cmd)
crispresso_cmds.append(crispresso_cmd)

Expand Down
7 changes: 5 additions & 2 deletions CRISPResso2/CRISPRessoShared.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,10 @@ def propagate_crispresso_options(cmd, options, params, paramInd=None):
if option:
if option in params:
if paramInd is None:
val = getattr(params, option)
if type(params) == dict:
val = params[option]
else:
val = getattr(params, option)
else:
val = params.loc[paramInd, option]
if val is None:
Expand Down Expand Up @@ -1672,7 +1675,7 @@ def get_crispresso_header(description, header_str):
term_width) + "\n" + output_line

output_line += '\n' + ('[CRISPResso version ' + __version__ + ']').center(term_width) + '\n' + (
'[Note that starting in version 2.3.0 FLASh and Trimmomatic will be replaced by fastp for read merging and trimming. Accordingly, the --flash_command and --trimmomatic_command parameters will be replaced with --fastp_command. Also, --trimmomatic_options_string will be replaced with --fastp_options_string.]').center(
'[Note that starting in version 2.3.0 FLASh and Trimmomatic will be replaced by fastp for read merging and trimming. Accordingly, the --flash_command and --trimmomatic_command parameters will be replaced with --fastp_command. Also, --trimmomatic_options_string will be replaced with --fastp_options_string.\n\nAlso in version 2.3.0, when running CRISPRessoPooled in mixed-mode (amplicon file and genome are provided) the default behavior will be as if the --demultiplex_only_at_amplicons parameter is provided. This change means that reads and amplicons do not need to align to the exact locations.]').center(
term_width) + "\n" + ('[For support contact [email protected] or [email protected]]').center(term_width) + "\n"

description_str = ""
Expand Down

0 comments on commit e5e45ad

Please sign in to comment.