-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
82 changed files
with
1,515 additions
and
14 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
773 changes: 773 additions & 0 deletions
773
scripts_build/dbSnp/GCF_000001405.40_GRCh38.p14_assembly_report.txt
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,33 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Convert chromosome IDs in a VCF file from NCBI to human-readable format | ||
# | ||
# Mapping file: | ||
# Download the mapping file from: | ||
# wget "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/001/405/GCF_000001405.40_GRCh38.p14/GCF_000001405.40_GRCh38.p14_assembly_report.txt" | ||
# | ||
# Then cut the relevant columns: | ||
# cut -f 1,7 GCF_000001405.40_GRCh38.p14_assembly_report.txt | grep -v "^#" | tee chr2id.txt | ||
|
||
|
||
# Load the mapping file (assuming it's a TSV or space-separated file) | ||
mapping_file = "chr2id.txt" | ||
chrid2name = {} | ||
with open(mapping_file) as f: | ||
for l in f.readlines(): | ||
chr_name, chr_id = l.strip().split("\t") | ||
chrid2name[chr_id] = chr_name | ||
|
||
|
||
# Example: Translating IDs in a VCF file | ||
vcf_file = "GCF_000001405.38.vcf" | ||
with open(vcf_file, 'r') as file: | ||
for line in file: | ||
if not line.startswith("#"): # Skip header lines | ||
columns = line.strip().split('\t') | ||
if columns[0] in chrid2name: | ||
columns[0] = chrid2name[columns[0]] # Replace chromosome ID | ||
print('\t'.join(columns)) # Print or write to a new file | ||
else: | ||
print(line.strip()) # Print header lines as is |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.