Skip to content

Instantly share code, notes, and snippets.

@radaniba
Created November 29, 2012 17:02
Show Gist options
  • Select an option

  • Save radaniba/4170406 to your computer and use it in GitHub Desktop.

Select an option

Save radaniba/4170406 to your computer and use it in GitHub Desktop.
Detect HugeNET-specific RS IDs in comparison with NHGRI GWAS data
#! usr/bin/perl
use warnings;
use strict;
my $gwas_file=$ARGV[0];
my $hugenet_file=$ARGV[1];
my $num_args = $#ARGV + 1;
if ($num_args != 2) {
print "\nUsage: get-unique-hugenet_snps.pl <gwas_file> <hugenet_file> \n";
exit;
}
open HUGE , $hugenet_file or die $!;
while(my $hugeline = <HUGE>){
(my $rsNumber,my $Gene,my $Region,my $Trait,my $PubMedID,my $SampleSizeInitialReplicate,my $RiskAllele,my $pValueH) = split(/\t/,$hugeline);
#formatting the rs number since it comes with additional useles information between brackets in HugeNet file we need only the rs number
#print "rsNumber\n";
(my $hugeRS,my $useless) = split(/\(/,$rsNumber);
#print "$hugeRS\n";
open NHGRI, $gwas_file or die $!;
# UNIQ HugeNet specific SNP till proven the opposite :)
my $UNIQ = 1;
while (my $line = <NHGRI>) {
(my $PUBMEDID,my $Study,my $DiseaseTrait,my $InitialSampleSize,my $ReplicationSampleSize,my $Region,my $ReportedGene,my $Mapped_gene,my $Snp_gene_ids,my $Upstream_gene_distance,my $Downstream_gene_distance,my $StrongestSNPRiskAllele,my $SNPs,my $Snp_id_current,my $Context,my $Intergenic,my $RiskAlleleFrequency,my $pValue,my $Pvalue_mlog) = split(/\t/,$line);
if ($SNPs eq $hugeRS){
$UNIQ = 0;
print ("NHGRI ID : $SNPs\n");
last;
}
}
close (NHGRI) ;
print "HUGENET ID : $hugeRS \t $UNIQ \n";
}
close HUGE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment