« first day  last day (15 days later) » 

01:42
@terdon
Thank you that worked! Sorry for being an idiot and copying it wrong.
Here's the output on a test script:

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --cpus-per-task=40
#SBATCH --time=24:00:00
#SBATCH --job-name=1000Gchr1.8
#SBATCH --output=1000Gchr1.8.txt
#SBATCH --mail-type=ALL
#
#
#This script extracts 1000G samples using bcftools view for Sprime analysis
/scratch/t/tbviola/ckendall/Niagara_to_Keep/bcftools-1.10.2/./bcftools view --threads 40 --force-samples -S "/scratch/t/tbviola/ckendall/Niagara_to_Keep/Archaic_VCFs/ModernSamples/VCF/gNomad/gnomad.genomes.v3.1.2.hgdp_tgp.12.vcf.gz" -Oz -o "/scratch/t/tbviola/ckendall/Niagara_to_Keep/Archaic_VCFs/ModernSamples
I was just wondering what I would need to do to get the sample names next to --force-samples -S instead of the chromosome. So the script output should look this:

#!/bin/bash
#SBATCH --nodes=1
#SBATCH --cpus-per-task=40
#SBATCH --time=24:00:00
#SBATCH --job-name=1000Gchr1.8
#SBATCH --output=1000Gchr1.8.txt
#SBATCH --mail-type=ALL
#
#
#This script extracts 1000G samples using bcftools view for Sprime analysis
/scratch/t/tbviola/ckendall/Niagara_to_Keep/bcftools-1.10.2/./bcftools view --threads 40 "/scratch/t/tbviola/ckendall/Niagara_to_Keep/Archaic_VCFs/ModernSamples/VCF/gNomad/gnomad.genom
I am thinking it probably needs these edits, but I want to make sure:

BCFToolsPath="$SCRATCH/Niagara_to_Keep/bcftools-1.10.2"
VCFPath="$SCRATCH/Niagara_to_Keep/Archaic_VCFs/ModernSamples/VCF/gNomad"
SamplesPath="$SCRATCH/Niagara_to_Keep/Archaic_VCFs/ModernSamples/VCF/1000GFiles/SprimeReady/Group1"
outputPath="$SCRATCH/Niagara_to_Keep/Archaic_VCFs/ModernSamples/VCF"


while read i; do
for ((chr=1; chr<=22; chr++)); do
command="$BCFToolsPath/./bcftools view"
chrVcf="$VCFPath/gnomad.genomes.v3.1.2.hgdp_tgp.$chr.vcf.gz"
02:19
I fixed it. Thank you sooooo much for your amazing help! You seriously saved me like a week's worth of work!

Here is the final:


while read i; do
for ((chr=1; chr<=22; chr++)); do
command="$BCFToolsPath/./bcftools view"
chrVcf="$VCFPath/gnomad.genomes.v3.1.2.hgdp_tgp.$chr.vcf.gz"
thisSamplePath="$SamplesPath/${i}_SprimeSamples.txt"
thisOutputPath="$outputPath/${i}.${chr}.vcf.gz"

printf '%s\n%s --threads 40 %s --force-samples -S %s -Oz -o %s\n' "$scriptHeader" \
"$command" \
"$chrVcf" \
"$thisSamplePath" \
 
5 hours later…
07:30
Yay! Glad I could help, @CKendall1988!
Please remember to accept the answer (or post your own and accept that one if you did something different) to your question. That way, the question can be marked as answered.

« first day  last day (15 days later) »