generated from ydeng/python-program
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
fd34c4ea44 | |||
58ea9ed2d0 |
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -13,6 +13,7 @@
|
|||||||
"bioconda",
|
"bioconda",
|
||||||
"CHROM",
|
"CHROM",
|
||||||
"modvcfsamples",
|
"modvcfsamples",
|
||||||
|
"ploidy",
|
||||||
"pytest",
|
"pytest",
|
||||||
"pyvcf",
|
"pyvcf",
|
||||||
"vcfpy",
|
"vcfpy",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = modvcfsamples
|
name = modvcfsamples
|
||||||
version = 0.0.2
|
version = 0.0.3
|
||||||
|
|
||||||
[options]
|
[options]
|
||||||
package_dir =
|
package_dir =
|
||||||
|
@ -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__":
|
||||||
|
Loading…
Reference in New Issue
Block a user