本文整理汇总了C++中Genome::PrintContig方法的典型用法代码示例。如果您正苦于以下问题:C++ Genome::PrintContig方法的具体用法?C++ Genome::PrintContig怎么用?C++ Genome::PrintContig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Genome
的用法示例。
在下文中一共展示了Genome::PrintContig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
//if ( chosen[k] == 10246 )
// printf( "hi %d %d %d %d\n", j, queue[j].a, k, chosen[k] ) ;
}
}
}
//return 0 ;
// Output the scaffold
int id = 0 ;
char infoFileName[512] ;
char outputFileName[512] ;
sprintf( infoFileName, "%s.info", prefix ) ;
sprintf( outputFileName, "%s.fa", prefix ) ;
outputFile = fopen( outputFileName, "w" ) ;
infoFile = fopen( infoFileName, "w") ;
memset( used, false, sizeof( bool ) * contigCnt ) ;
for ( i = 0 ; i < contigCnt ; ++i )
{
//printf( "%d (%s)\n", i, alignments.GetChromName( genome.GetChrIdFromContigId( i ) ) ) ; fflush( stdout ) ;
/*if ( i == 10246 )
{
std::vector<struct _pair> neighbors ;
scaffold.GetNeighbors( i, 0, neighbors ) ;
printf( "%u\n", neighbors.size() ) ;
}*/
if ( used[i] )
continue ;
int ncnt1 = scaffold.GetNeighbors( i, 0, neighbors, MAX_NEIGHBOR ) ;
int ncnt2 = scaffold.GetNeighbors( i, 1, neighbors, MAX_NEIGHBOR ) ;
if ( ncnt1 == 0 || ncnt2 == 0 ) // The end of a scaffold
{
fprintf( outputFile, ">scaffold_%d\n", id) ;
fprintf( infoFile, ">scaffold_%d", id ) ;
++id ;
int p = i ;
int dummyP = 1 ;
if ( ncnt1 == 0 )
dummyP = 0 ;
used[i] = true ;
genome.PrintContig( outputFile, i, dummyP ) ;
fprintf( infoFile, " (%s %d %c)", alignments.GetChromName( genome.GetChrIdFromContigId( p ) ), p, dummyP == 0 ? '+' : '-' ) ;
while ( 1 )
{
ncnt = scaffold.GetNeighbors( p, 1 - dummyP, neighbors, MAX_NEIGHBOR ) ;
if ( ncnt == 0 )
break ;
// ncnt must be 1
int insertN = 17 ;
if ( genome.GetChrIdFromContigId( p ) == genome.GetChrIdFromContigId( neighbors[0].a ) )
{
struct _contig cp, cna ;
cp = genome.GetContigInfo( p ) ;
cna = genome.GetContigInfo( neighbors[0].a ) ;
if ( p < neighbors[0].a )
insertN = cna.start - cp.end - 1 ;
else if ( p > neighbors[0].a )
insertN = cp.start - cna.end - 1 ;
}
p = neighbors[0].a ;
dummyP = neighbors[0].b ;
for ( int j = 0 ; j < insertN ; ++j )
fprintf( outputFile, "N" ) ;
used[p] = true ;
genome.PrintContig( outputFile, p, dummyP ) ;
fprintf( infoFile, " (%s %d %c)", alignments.GetChromName( genome.GetChrIdFromContigId( p ) ), p, dummyP == 0 ? '+' : '-' ) ;
}
fprintf( outputFile, "\n" ) ;
fprintf( infoFile, "\n" ) ;
}
}
for ( i = 0 ; i < contigCnt ; ++i )
if ( !used[i] )
{
fprintf( stderr, "Unreported contig %d.\n", i ) ;
}
fclose( outputFile ) ;
fclose( infoFile ) ;
delete[] buffer ;
delete[] buffer2 ;
delete[] chosen ;
delete[] queue ;
delete[] counter ;
delete[] visitTime ;
delete[] used ;
delete[] scafInfo ;
delete[] isInQueue ;
delete[] gapSize ;
//fclose( rascafFile ) ;
return 0 ;
}