User Tools

Site Tools


genetica:bonngwas_all

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
genetica:bonngwas_all [2013/01/31 13:10]
tgif created
genetica:bonngwas_all [2020/08/04 10:58] (current)
Line 48: Line 48:
  
 my $ifile = shift; my $ifile = shift;
- 
 die "Must supply input filename!\n" unless ($ifile); die "Must supply input filename!\n" unless ($ifile);
- 
 (my $bn) = $ifile =~ /^(.*)\..*$/; (my $bn) = $ifile =~ /^(.*)\..*$/;
 my $pfile = $bn.'.proxies'; my $pfile = $bn.'.proxies';
 my $ofile = $bn.'.pairs'; my $ofile = $bn.'.pairs';
- 
 my $tl = int qx/wc -l $ifile | awk {'print \$1'}/; my $tl = int qx/wc -l $ifile | awk {'print \$1'}/;
- 
- 
 open(IPF, "<$ifile") or die "Cant open input file\n"; open(IPF, "<$ifile") or die "Cant open input file\n";
- 
- 
 my @pairs; my @pairs;
- 
 print "looking for pairs in $tl inputs...\n"; print "looking for pairs in $tl inputs...\n";
- 
 my $l = 0; my $l = 0;
- 
 while(<IPF>){ while(<IPF>){
  (my $a, my $b) = /(rs\d{1,18})\s+(rs\d{1,18})/;  (my $a, my $b) = /(rs\d{1,18})\s+(rs\d{1,18})/;
Line 76: Line 66:
  my @aps = uniq get_proxies($a, $pfile);  my @aps = uniq get_proxies($a, $pfile);
  my @bps = uniq get_proxies($b, $pfile);  my @bps = uniq get_proxies($b, $pfile);
- 
  foreach my $ap (sort @aps){  foreach my $ap (sort @aps){
  foreach my $bp (sort @bps){  foreach my $bp (sort @bps){
Line 119: Line 108:
 } }
 </code> </code>
 +
 +5.- Tras esto ya se puede correr intersnp deuna manera racional.
 +
 +Para los dos ultimos pasos hemos hecho un script que engloba el procesamiento de un test en todas las DBs.
 +
 +<code perl isnp4all.pl>
 +use strict; use warnings;
 +use File::Basename qw(basename);
 +use File::Find::Rule;
 +
 +my $origpairs = shift;
 +my @dbs = qw(ADMURimpQC2 ADNIimpQC2 GenADA_impQC2 NIA_AD_impQC2 TGEN_impQC2);
 +my $sel_template = '/home/data/Bonn_GWAS/selection_file_template.txt';
 +(my $test) = $origpairs =~ /listTEST(\d*)\.pairs/;
 +my $w_dir = 'intersnp_TEST'.$test;
 +mkdir $w_dir;
 +chdir $w_dir;
 +my $odir = 'outputs';
 +mkdir $odir;
 +my $tmpsel = 'selection_file_TEST'.$test.'.txt';
 +foreach my $dbname (@dbs){
 + my $targetdb = '/home/data/Variomics/'.$dbname;
 + my $grpfile = 'listTEST'.$test.'_'.$dbname.'.grp';
 + my $order ='grppairs.pl '.$origpairs.' '.$targetdb.'.bim > '.$grpfile;
 + print "Grep $origpairs into $dbname...\n";
 + system($order); 
 + print "Done\n";
 + open TEMPLATE, "<$sel_template" or die "Could not find template\n";
 + open TMPS, ">$tmpsel";
 + my $ofile = $odir.'/'.$dbname.'_TEST'.$test.'_';
 + while (<TEMPLATE>){
 + s/<Database>/$targetdb/;
 + s/<Test>/$test/;
 + s/<Pairs>/$grpfile/;
 + s/<Output>/$ofile/;
 + print TMPS "$_";
 + }
 + close TMPS;
 + close TEMPLATE;
 +# my $order = 'intersnpPN '.$tmpsel;
 +# system($order);
 + $order = 'intersnp '.$tmpsel;
 + print "$order\n";
 + system($order);
 +}
 +</code>
 +
 +Para ello utilizamos la plantilla,
 +
 +<code>
 +$ cat selection_file_template.txt
 +BFILE   <Database>  // put path and name of plink bfile there
 +TWO_MARKER 1
 +PRINTTOP 50000
 +TEST <Test>
 +COMBIFILE <Pairs>  // if file is in working dir, else put path
 +COMBILIST 1
 +OUTPUTNAME <Output>
 +END
 +</code>
 +
genetica/bonngwas_all.1359637801.txt.gz ยท Last modified: 2020/08/04 10:48 (external edit)