Esempio n. 1
0
File: lav.c Progetto: gtsong/CHAP2
void print_lav_align_list
   (FILE*			f,
	alignel*		alignList,
	seq*			seq1,
	seq*			seq2)
	{
	seqpartition*	sp1 = &seq1->partition;
	seqpartition*	sp2 = &seq2->partition;
	alignel*		a;

	if ((sp1->p != NULL) || (sp2->p != NULL))
		suicide ("lav format can't handle multi-sequences");
		// the issue is that we'd have to check if the partition changed
		// since the previous alignment, and generate an s/h-stanza pair

	for (a=alignList ; a!=NULL ; a=a->next)
		print_lav_align (f,
		                 a->seq1, a->beg1-1, a->end1,
		                 a->seq2, a->beg2-1, a->end2,
		                 a->script, a->s);
	}
Esempio n. 2
0
void print_align_list (alignel* alignList)
	{
	int outputFormat = currParams->outputFormat;
	alignel* a;

	if ((currParams->searchLimit > 0)
	 && (printedForQuery >= currParams->searchLimit))
		return;
	printedForQuery++;

	if (!strandHeaderPrinted)
		{ print_header ();  strandHeaderPrinted = true; }

	if (infer_scores_dbgShowIdentity)
		{
		unspos numer, denom;
		u32    bin;

		for (a=alignList ; a!=NULL ; a=a->next)
			{
			alignment_identity (currParams->seq1, currParams->seq2, a,
			                    &numer, &denom);
			bin = identity_bin (numer, denom);
			// nota bene: positions written as 1-based
			print_generic (currParams->outputFile,
			               unsposSlashFmt
			               " pct_identity=" unsposSlashFmt
			               " (bin as " identityBinFormat ")",
			               a->beg1, a->beg2,
			               numer, denom,
			               bin_to_identity (bin));
			}
		}

	switch (outputFormat)
		{
		case fmtGfa:
		case fmtGfaNoScore:
			print_gfa_align_list (currParams->outputFile,
			                      (outputFormat == fmtGfa)? currParams->scoring
			                                              : NULL,
			                      alignList,
								  currParams->seq1, currParams->seq2);
			break;
		case fmtLav:
		case fmtLavComment:
		case fmtLavScore:
		case fmtLavInfScores:
			print_lav_align_list (currParams->outputFile,
			                      alignList,
			                      currParams->seq1, currParams->seq2);
			if (outputFormat == fmtLavInfScores)
				goto inf_scores_format;
			break;
		case fmtLavText:
			for (a=alignList ; a!=NULL ; a=a->next)
				{
				print_lav_align        (currParams->outputFile,
										a->seq1, a->beg1-1, a->end1,
										a->seq2, a->beg2-1, a->end2,
										a->script, a->s);
				print_text_align_align (currParams->outputFile,
										currParams->seq1, a->beg1-1, a->end1,
										currParams->seq2, a->beg2-1, a->end2,
										a->script, a->s,
										false, currParams->textContext);
				}
			break;
		case fmtAxt:
		case fmtAxtComment:
			print_axt_align_list (currParams->outputFile, alignList,
			                      currParams->seq1, currParams->seq2,
			                      /* comments */ outputFormat==fmtAxtComment,
			                      /* extras   */ NULL);
			break;
		case fmtAxtGeneral:
			print_axt_align_list (currParams->outputFile, alignList,
			                      currParams->seq1, currParams->seq2,
			                      /* comments */ false,
			                      /* extras   */ currParams->outputInfo);
			break;
		case fmtMaf:
		case fmtMafNoComment:
			print_maf_align_list (currParams->outputFile,
			                      alignList, currParams->seq1, currParams->seq2,
			                      /* comments */ false);
			break;
		case fmtMafComment:
			print_maf_align_list (currParams->outputFile,
			                      alignList, currParams->seq1, currParams->seq2,
			                      /* comments */ true);
			break;
		case fmtSoftSam:
		case fmtSoftSamNoHeader:
			print_sam_align_list (currParams->outputFile,
			                      alignList, currParams->seq1, currParams->seq2,
			                      /* softMasking */ true,
			                      currParams->samRGTags);
			break;
		case fmtHardSam:
		case fmtHardSamNoHeader:
			print_sam_align_list (currParams->outputFile,
			                      alignList, currParams->seq1, currParams->seq2,
			                      /* softMasking */ false,
			                      currParams->samRGTags);
			break;
		case fmtCigar:
			print_cigar_align_list (currParams->outputFile,
			                        alignList, currParams->seq1, currParams->seq2,
			                        /* withInfo       */ true,
			                        /* markMismatches */ false,
			                        /* letterAfter    */ false,
			                        /* hideSingles    */ false,
			                        /* lowerCase      */ false,
			                        /* withNewLine    */ true);
			break;
		case fmtGenpaf:
		case fmtGenpafNoHeader:
		case fmtGenpafNameHeader:
		case fmtGenpafBlast:
		case fmtGenpafBlastNoHeader:
			print_genpaf_align_list (currParams->outputFile,
			                         alignList, currParams->seq1, currParams->seq2,
			                         currParams->outputInfo);
			break;
		case fmtText:
		case fmtZeroText:
			print_text_align_align_list (currParams->outputFile,
			                             alignList, currParams->seq1, currParams->seq2,
			                             (outputFormat!=fmtZeroText),
			                             currParams->textContext);
			break;
		case fmtDiffs:
		case fmtDiffsNoBlocks:
			print_align_diffs_align_list (currParams->outputFile,
			                              alignList, currParams->seq1, currParams->seq2,
			                              (outputFormat == fmtDiffs),
			                              currParams->nIsAmbiguous);
			break;
		case fmtInfStats:
			infer_stats_from_align_list (alignList, currParams->seq1, currParams->seq2);
			break;
		case fmtInfScores:
		inf_scores_format:
			gather_stats_from_align_list (alignList, currParams->seq1, currParams->seq2);
			break;
		case fmtIdDist:
			identity_dist_from_align_list (alignList, currParams->seq1, currParams->seq2);
			break;
		case fmtHspComp:
		case fmtDeseed:
		case fmtNone:
			; // (do nothing)
			break;
		default:
			suicidef ("internal error, in print_align_list, outputFormat=%d", outputFormat);
		}

	if (currParams->dotplotFile != NULL)
		print_genpaf_align_list_segments (currParams->dotplotFile,
		                                  alignList, currParams->seq1, currParams->seq2,
		                                  currParams->dotplotKeys,
		                                  currParams->scoring);
	}