Skip to content

Commit

Permalink
Create ALLHiC2ALLMAPS.pl
Browse files Browse the repository at this point in the history
  • Loading branch information
tangerzhang authored Jun 28, 2019
1 parent 26a0395 commit 3d49400
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions scripts/ALLHiC2ALLMAPS.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/perl -w
### Convert ALLHiC output AGP file to ALLMAPS input csv file
print "Convert ALLHiC output AGP file to ALLMAPS input csv file\n";
die "Usage: perl $0 groups.agp\n" if(!defined $ARGV[0]);

my $agp = $ARGV[0];
open(OUT, "> hic.csv") or die"";
print OUT "Scafffold ID,scaffold position,LG,genetic position\n";
open(IN, "grep -v 'contig' $agp|") or die"";
while(<IN>){
chomp;
my @data = split(/\s+/,$_);
if($data[8] eq "+"){
$a = $data[6]; $b = $data[7];
}elsif($data[8] eq "-"){
$a = $data[7]; $b = $data[6];
}
print OUT "$data[5],$a,$data[0],$data[1]\n";
print OUT "$data[5],$b,$data[0],$data[2]\n";
}
close IN;
close OUT;

0 comments on commit 3d49400

Please sign in to comment.