oas_paired_human_sars_cov_2 / download_oas_data.py
EC2 Default User
add cdr metadata
50b2c7c
raw
history blame contribute delete
851 Bytes
import pandas as pd
# Download data from OAS
list_of_df = []
with open("oas_uri_list.txt", "r") as f:
for url in f:
print(url)
df = pd.read_csv(url, skiprows=1, compression="gzip")
df = df[df["complete_vdj_heavy"] == "T"]
df = df[df["complete_vdj_light"] == "T"]
df = df[["sequence_alignment_aa_heavy", "cdr1_start_heavy", "cdr1_end_heavy", "cdr2_start_heavy", "cdr2_end_heavy", "cdr3_start_heavy", "cdr3_end_heavy", "sequence_alignment_aa_light", "cdr1_start_light", "cdr1_end_light", "cdr2_start_light", "cdr2_end_light", "cdr3_start_light", "cdr3_end_light"]]
list_of_df.append(df)
df = pd.concat(list_of_df, ignore_index=True)
train=df.sample(frac=0.8, ignore_index=True)
test = df.drop(train.index)
train.to_parquet("train.parquet", index=False)
test.to_parquet("test.parquet", index=False)