Skip to content

Commit

Permalink
Replaced all references of #ID with sample_id
Browse files Browse the repository at this point in the history
  • Loading branch information
kjaisingh committed Oct 2, 2024
1 parent 6743cd5 commit a7a0855
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/WGD/bin/estimatePloidy.R
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ if(kmeans==T){
#Write out list of cluster assignments per sample
clusterAssignments.out <- data.frame("ID"=names(clust.PCs$batch),
"batch"=as.vector(as.integer(clust.PCs$batch)))
colnames(clusterAssignments.out)[1] <- "#ID"
colnames(clusterAssignments.out)[1] <- "sample_id"
write.table(clusterAssignments.out,
paste(OUTDIR, "/sample_batch_assignments.txt", sep=""),
col.names=T, row.names=F, sep="\t", quote=F)
Expand All @@ -1052,7 +1052,7 @@ if(kmeans==T){

#Write out list of PCs per sample
samplePCs.out <- PCs$top
colnames(samplePCs.out)[1] <- "#ID"
colnames(samplePCs.out)[1] <- "sample_id"
write.table(samplePCs.out, paste(OUTDIR, "/sample_PCs.txt", sep=""),
col.names=T, row.names=F, sep="\t", quote=F)
if(gzip==T){
Expand Down Expand Up @@ -1138,7 +1138,7 @@ dev.off()

#Write table of sexes
sexes <- sexes[match(colnames(dat)[-c(1:3)], sexes$ID), ]
colnames(sexes)[1] <- "#ID"
colnames(sexes)[1] <- "sample_id"
write.table(sexes, paste(OUTDIR, "/sample_sex_assignments.txt", sep=""),
col.names=T, row.names=F, sep="\t", quote=F)
if(gzip==T){
Expand All @@ -1158,13 +1158,13 @@ females.CN[, -1] <- apply(females.CN[, -1], 2, round, digits=2)
#Merge male/female p-values and rounded CNs
merged.p <- rbind(males.p, females.p)
merged.p <- merged.p[match(colnames(dat)[-c(1:3)], merged.p$ID), ]
colnames(merged.p) <- c("#ID", paste("chr", c(1:22, "X", "Y"), "_pValue", sep=""))
colnames(merged.p) <- c("sample_id", paste("chr", c(1:22, "X", "Y"), "_pValue", sep=""))
merged.q <- rbind(males.q, females.q)
merged.q <- merged.q[match(colnames(dat)[-c(1:3)], merged.q$ID), ]
colnames(merged.q) <- c("#ID", paste("chr", c(1:22, "X", "Y"), "_qValue", sep=""))
colnames(merged.q) <- c("sample_id", paste("chr", c(1:22, "X", "Y"), "_qValue", sep=""))
merged.CN <- rbind(males.CN, females.CN)
merged.CN <- merged.CN[match(colnames(dat)[-c(1:3)], merged.CN$ID), ]
colnames(merged.CN) <- c("#ID", paste("chr", c(1:22, "X", "Y"), "_CopyNumber", sep=""))
colnames(merged.CN) <- c("sample_id", paste("chr", c(1:22, "X", "Y"), "_CopyNumber", sep=""))

#Write merged p-values
write.table(merged.p, paste(OUTDIR, "/CNA_pValues.txt", sep=""),
Expand Down
2 changes: 1 addition & 1 deletion src/WGD/bin/medianCoverage.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ if(opts$binwise==TRUE){
write.table(res,args$args[2], sep="\t", col.names=T, row.names=F, quote=F)
}else{
res <- covPerSample(cov,mad=opts$mad)
names(res)[1] <- "#ID"
names(res)[1] <- "sample_id"
write.table(res,args$args[2], sep="\t", col.names=T, row.names=F, quote=F)
}
2 changes: 1 addition & 1 deletion src/WGD/bin/scoreDosageBiases.R
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ WGD.bins <- merge(WGD.bins,cov[,1:3],by=1:3)
scores <- scoreSamples(cov,WGD.bins)

#Write scores to file
colnames(scores)[1] <- "#ID"
colnames(scores)[1] <- "sample_id"
write.table(scores,
paste(OUTDIR,"/WGD_scores.txt",sep=""),
col.names=T,row.names=F,sep="\t",quote=F)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if [ ${DISTANCE} -lt 1 ]; then
fi

#Write header for outfile
echo -e "#ID\tchromosome\tnonzero_bins_in_tail" > ${OUTFILE}
echo -e "sample_id\tchromosome\tnonzero_bins_in_tail" > ${OUTFILE}

#Iterate over contigs & write results to outfile
while read contig end; do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if [ ${DISTANCE} -lt 1 ]; then
fi

#Write header for outfile
echo -e "#ID\tchromosome\tlines_in_tail" > ${OUTFILE}
echo -e "sample_id\tchromosome\tlines_in_tail" > ${OUTFILE}

#Iterate over contigs & write results to outfile
while read contig end; do
Expand Down
4 changes: 1 addition & 3 deletions src/sv-pipeline/scripts/make_evidence_qc_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from pathlib import Path
import numpy as np

ID_COL = "#ID"
NEW_ID_COL = "sample_id"
ID_COL = "sample_id"
EMPTY_OUTLIERS = "EMPTY_ROWS_DROP"


Expand Down Expand Up @@ -217,7 +216,6 @@ def merge_evidence_qc_table(
output_df = reduce(lambda left, right: pd.merge(left, right, on=ID_COL, how="outer"), dfs)
output_df = output_df[output_df[ID_COL] != EMPTY_OUTLIERS]
output_df[outlier_cols] = output_df[outlier_cols].replace([None, np.nan], 0.0)
output_df.rename(columns={ID_COL: NEW_ID_COL}, inplace=True)

# save the file
output_df.to_csv(f"{output_prefix}.evidence_qc_table.tsv", sep="\t", header=True, index=False, na_rep=np.nan)
Expand Down

0 comments on commit a7a0855

Please sign in to comment.