Compare commits

..

2 Commits

Author SHA1 Message Date
fd34c4ea44 Bumped version number
Some checks failed
ydeng/modvcfsamples/pipeline/head There was a failure building this commit
2023-06-28 14:20:15 +00:00
58ea9ed2d0 Added untested '-p' option.
Some checks failed
ydeng/modvcfsamples/pipeline/head There was a failure building this commit
2023-06-28 14:19:53 +00:00
2 changed files with 30 additions and 2 deletions

View File

@ -13,6 +13,7 @@
"bioconda", "bioconda",
"CHROM", "CHROM",
"modvcfsamples", "modvcfsamples",
"ploidy",
"pytest", "pytest",
"pyvcf", "pyvcf",
"vcfpy", "vcfpy",

View File

@ -8,6 +8,7 @@ def run(
vcfs: list[str], vcfs: list[str],
only: list[str], only: list[str],
gt: Union[int, None], gt: Union[int, None],
rename_samples: Union[list[str], None],
filename_replace: Union[str, None], filename_replace: Union[str, None],
output_dir: str, output_dir: str,
): ):
@ -22,6 +23,14 @@ def run(
if gt is not None: if gt is not None:
modified_vcfs = sample.normalize_gt_to_length(modified_vcfs, gt) modified_vcfs = sample.normalize_gt_to_length(modified_vcfs, gt)
if rename_samples is not None:
modified_vcfs, modified_header = sample.replace_sample_names(
modified_vcfs,
modified_header,
rename_samples[0],
rename_samples[1],
)
if filename_replace is not None: if filename_replace is not None:
modified_vcfs, modified_header = sample.replace_sample_names( modified_vcfs, modified_header = sample.replace_sample_names(
modified_vcfs, modified_vcfs,
@ -48,7 +57,7 @@ def main():
parser.add_argument( parser.add_argument(
"--gt-norm", "--gt-norm",
"-g", "-g",
help="Resizes haploid genotypes to n-ploid by repeating it.", help="Resizes haploid genotypes to n-ploidy by repeating it.",
type=int, type=int,
required=False, required=False,
) )
@ -60,6 +69,17 @@ def main():
type=str, type=str,
required=False, required=False,
) )
parser.add_argument(
"--replace-name",
"p",
help="Similar to '--filename-replace', you may choose what to replace with what. "
"Ex. '-p a b' will replace all 'a' characters in a sample name with 'b'.",
nargs=2,
type=str,
required=False,
)
parser.add_argument( parser.add_argument(
"--filename-replace", "--filename-replace",
"-e", "-e",
@ -71,7 +91,14 @@ def main():
) )
args = parser.parse_args() args = parser.parse_args()
run(args.vcfs, args.only, args.gt_norm, args.filename_replace, args.output_dir) run(
args.vcfs,
args.only,
args.gt_norm,
args.replace_name,
args.filename_replace,
args.output_dir,
)
if __name__ == "__main__": if __name__ == "__main__":