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
#This is probably not the best way to go about this, but it basically works. | |
#Keep in mind that PERL's "rand()" function isn't really random, but for this purpose it doesn't really matter. | |
#Suggested usage: samtools view -h <in.bam> | perl random_line_extraction.using_ratio.pl <ratio in decimal form> | samtools view -bS - > <out.bam> | |
$num=shift; | |
while($line=<STDIN>) { | |
chomp($line); | |
if($line =~ m/^@/) { | |
print "$line\n"; | |
} |
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
#Command: cat in.bed | perl windowize-bed.pl <windowsize> > out.bed | |
$windowsize=shift; | |
$ctr=0; | |
print STDERR "$ctr"; | |
while($line=<STDIN>) { | |
$ctr++; | |
print STDERR "\r$ctr"; | |
chomp($line); | |
@line=split(/\t/, $line); | |
for($i=$line[1]; $i<$line[2]-$windowsize+1; $i+=$windowsize) { |
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
#Automatically calculates mean heterozygous allele balance for heterozygous alleles in VCF4 files | |
#Allele balance must be pre-caluclated and defined for each variant in advance and given the INFO ID flag "AB" (default for GATK, etc.) | |
usage="usage: sh mean_allele_balance.sh <input.vcf>"; | |
if (( $# != 1 )); then echo $usage; exit; fi | |
#input | |
VCF=$1; | |
#calculations |