Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include locus name and snp position in snp_table.txt #34

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[![Master branch build status](https://travis-ci.org/chadlaing/Panseq.svg?branch=master "Master Build Status")](https://travis-ci.org/chadlaing/Panseq)
# Panseq-LC: fork of Panseq, with output modified to include LocusName in SNP table

## OVERVIEW

Expand Down
19 changes: 15 additions & 4 deletions lib/Modules/PanGenome/PanGenome.pm
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ sub _printResults{

foreach my $snpId(sort keys %{$finalResult->{genomeResults}->{$genome}->{snp}}){
$snpStringHash{$snpId}->{$genomeCounter} = $finalResult->{genomeResults}->{$genome}->{snp}->{$snpId}->{value};

$snpStringHash{$snpId}->{'loci'} = $finalResult->{locusInformation}->{name};
$self->_printCoreSnpData(
snpId=>$snpId
,locusName=>$finalResult->{locusInformation}->{name}
Expand All @@ -723,6 +723,10 @@ sub _printResults{
,startBp=>$finalResult->{genomeResults}->{$genome}->{snp}->{$snpId}->{start_bp}
,contigId=>$finalResult->{genomeResults}->{$genome}->{binary}->[0]->{contig_id}
);
my $lname = "" . $snpStringHash{$snpId}->{'loci'};
my @refgenome = (split(/[|]/, $lname));
my $refgenome_ = $refgenome[1];
$snpStringHash{$snpId}->{'snp_position'} = $finalResult->{genomeResults}->{$refgenome_}->{snp}->{$snpId}->{start_bp}; #if $refgenome==$genome;
}

#if there are SNPs in a region, add dashes to the snp string
Expand Down Expand Up @@ -841,14 +845,20 @@ sub _printCoreSnpData{
sub _printSnpTable{
my $self=shift;
my $snpStringHash = shift;

#my $finalResult = shift;
my @output;
foreach my $id(sort keys %{$snpStringHash}){
my $printLine = "\n";
my $startbp = ''; #get ref start ID

foreach my $genome(1..scalar(@{$self->settings->orderedGenomeNames})){
$printLine .= ("\t" . $snpStringHash->{$id}->{$genome})
$printLine .= ("\t" . $snpStringHash->{$id}->{$genome});
my $lociname = $snpStringHash->{$id}->{'loci'};
my $refgenome = (split /|/, $lociname)[1];
$startbp = $snpStringHash->{$id}->{'snp_position'};
}
push @output, $printLine;
my $snploci = $printLine . "\t" . $snpStringHash->{$id}->{'loci'} . "\t" . $startbp;
push @output, $snploci;
}
$self->_printFH->{snpTableFH}->print(@output);
}
Expand Down Expand Up @@ -1158,6 +1168,7 @@ sub _getCoreResult {
return $snpDataArrayRef;
}


1;


Expand Down
10 changes: 10 additions & 0 deletions t/genomes.batch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
queryDirectory t/data/genomes/
percentIdentityCutoff 90
coreGenomeThreshold 3
minimumNovelRegionSize 1000
fragmentationSize 1000
overwrite 1
nameOrId name
baseDirectory t/genomes/
numberOfCores 1
runMode pan
14 changes: 14 additions & 0 deletions t/plasmids.batch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
percentIdentityCutoff 90
queryDirectory t/data/plasmids/
coreGenomeThreshold 2
cdhitDirectory /mnt/gvl/apps/linuxbrew/bin/
minimumNovelRegionSize 500
fragmentationSize 500
allelesToKeep 2
nameOrId name
overwrite 1
runMode pan
storeAlleles 1
numberOfCores 1
cdhit 1
baseDirectory t/plasmids/
12 changes: 12 additions & 0 deletions t/query.batch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
storeAlleles 1
runMode pan
queryFile t/data/testfragments.fasta
baseDirectory t/query/
numberOfCores 1
overwrite 1
nameOrId name
minimumNovelRegionSize 1
fragmentationSize 0
coreGenomeThreshold 2
percentIdentityCutoff 90
queryDirectory t/data/genomes/